diff options
author | Alexander Smirnov <alex@ydb.tech> | 2024-11-22 09:21:01 +0000 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2024-11-22 09:21:01 +0000 |
commit | a7cac42c868ca5722777ccee944217410812e72c (patch) | |
tree | 7bff7ce2a3ade72f6f15dfc634490d13628066ee | |
parent | a18f18d81996ca8e681bb6cabd441b52833d99bf (diff) | |
parent | 9478cfdab4217d3710b96329466825bf47111d7d (diff) | |
download | ydb-a7cac42c868ca5722777ccee944217410812e72c.tar.gz |
Merge branch 'rightlib' into mergelibs-241122-0919
1328 files changed, 11265 insertions, 4751 deletions
diff --git a/build/config/tests/flake8/flake8.conf b/build/config/tests/flake8/flake8.conf index fda445a3f0..a4a60be743 100644 --- a/build/config/tests/flake8/flake8.conf +++ b/build/config/tests/flake8/flake8.conf @@ -285,6 +285,8 @@ ignore = PLR915, # too-many-boolean-expressions PLR916, + # too-many-positional-arguments + PLR917, # consider-merging-isinstance PLR701, # too-many-nested-blocks diff --git a/build/export_generators/ide-gradle/build.gradle.kts.jinja b/build/export_generators/ide-gradle/build.gradle.kts.jinja index 46bcd4cefd..798922b5b7 100644 --- a/build/export_generators/ide-gradle/build.gradle.kts.jinja +++ b/build/export_generators/ide-gradle/build.gradle.kts.jinja @@ -38,21 +38,6 @@ subprojects { {%- endif %} plugins { -{#- some plugins configuration -#} -{%- for library in target.consumer if library.classpath -%} -{#- error prone plugin configuration -#} -{%- if library.prebuilt and library.jar and (library.type != "contrib" or build_contribs) and "contrib/java/com/google/errorprone/error_prone_annotations/" in library.jar -%} - - id("net.ltgt.errorprone") version "{{ errorprone_plugin_version }}" - -{%- endif -%} -{%- endfor -%} - -{#- lombok configuration -#} -{#- TODO remove usings annotation_processors semantic -#} -{%- if ("lombok.launch.AnnotationProcessorHider$AnnotationProcessor" in target.annotation_processors) or (target.use_annotation_processor|length and target.use_annotation_processor|select('startsWith', 'contrib/java/org/projectlombok/lombok')|length) %} - id("io.freefair.lombok") version "8.6" -{%- endif -%} {%- if mainClass %} `application` {%- else %} @@ -76,6 +61,17 @@ plugins { {%- if target.with_kotlinc_plugin_serialization|length %} kotlin("plugin.serialization") version "{{ kotlin_version }}" {% endif -%} +{%- endif -%} + +{#- errorprone plugin configuration -#} +{%- if target.consumer|selectattr('jar', 'startsWith', 'contrib/java/com/google/errorprone/error_prone_annotations')|length %} + id("net.ltgt.errorprone") version "{{ errorprone_plugin_version }}" +{%- endif -%} + +{#- lombok plugin configuration -#} +{#- TODO remove usings annotation_processors semantic -#} +{%- if ("lombok.launch.AnnotationProcessorHider$AnnotationProcessor" in target.annotation_processors) or (target.use_annotation_processor|length and target.use_annotation_processor|select('startsWith', 'contrib/java/org/projectlombok/lombok')|length) %} + id("io.freefair.lombok") version "8.6" {%- endif %} } @@ -272,6 +268,7 @@ sourceSets.main.java.srcDirs += "{{ srcdir_glob[0] }}" {%- endfor -%} sourceSets { +{%- if target.runs|length %} main { {#- Default by Gradle: @@ -280,13 +277,11 @@ sourceSets { resources.srcDir("src/main/resources") #} -{%- if target.runs|length -%} {%- for run in target.runs -%} {{ OutDirs(run, ' java.srcDir("', '")') }} -{%- endfor -%} -{%- endif %} +{%- endfor %} } - +{%- endif %} test { {#- Default by Gradle: @@ -315,11 +310,9 @@ sourceSets { dependencies { {%- for library in target.consumer if library.classpath -%} -{# error prone plugin configuration #} -{%- if library.prebuilt and library.jar and (library.type != "contrib" or build_contribs) and "contrib/java/com/google/errorprone/error_prone_annotations" in library.jar -%} -{% set errorprone_version = library.jar -%} -{% set errorprone_parts = errorprone_version|replace("contrib/java/com/google/errorprone/error_prone_annotations/") -%} -{% set errorprone_parts = split(errorprone_parts, '/') %} +{%- if library.prebuilt and (library.type != "contrib" or build_contribs) and ("contrib/java/com/google/errorprone/error_prone_annotations" in library.jar) -%} +{%- set errorprone_version = library.jar|replace("contrib/java/com/google/errorprone/error_prone_annotations/", "") -%} +{%- set errorprone_parts = split(errorprone_version, '/', 2) %} errorprone("com.google.errorprone:error_prone_core:{{ errorprone_parts[0] }}") {%- endif -%} diff --git a/build/export_generators/ide-gradle/build.gradle.kts.proto.jinja b/build/export_generators/ide-gradle/build.gradle.kts.proto.jinja index 9b7b71f743..fe989ed989 100644 --- a/build/export_generators/ide-gradle/build.gradle.kts.proto.jinja +++ b/build/export_generators/ide-gradle/build.gradle.kts.proto.jinja @@ -1,4 +1,6 @@ {%- set publish = target.publish -%} +{%- set libraries = target.consumer|selectattr('type', 'eq', 'library') -%} + import com.google.protobuf.gradle.* val baseBuildDir = "{{ export_root }}/gradle.build/" @@ -7,7 +9,10 @@ subprojects { buildDir = file(baseBuildDir + project.path.replaceFirst(":", "/").replace(":", ".")) } -val buildProtoDir = File("${buildDir}", "__proto__") +val mainProtosDir = File(buildDir, "main_protos") +{%- if libraries|length %} +val mainExtractedIncludeProtosDir = File(buildDir, "extracted-include-protos/main") +{%- endif %} plugins { id("java-library") @@ -37,14 +42,23 @@ repositories { } } +val project_root = "{{ arcadia_root }}" + sourceSets { main { - java.srcDir("build/generated/source/proto") + java.srcDir("$buildDir/generated/sources/proto/main/java") +{%- if target.proto_grpc %} + java.srcDir("$buildDir/generated/sources/proto/main/grpc") +{%- endif %} + } + test { + java.srcDir("$buildDir/generated/sources/proto/test/java") +{%- if target.proto_grpc %} + java.srcDir("$buildDir/generated/sources/proto/test/grpc") +{%- endif %} } } -val project_root = "{{ arcadia_root }}" - java { withSourcesJar() withJavadocJar() @@ -92,21 +106,24 @@ dependencies { } {%- endif -%} {%- endif -%} -{%- endfor %} +{%- endfor -%} {%- if target.proto_namespace %} - protobuf(files(File(buildProtoDir, "{{ target.proto_namespace }}"))) + protobuf(files(File(mainProtosDir, "{{ target.proto_namespace }}"))) {%- else %} - protobuf(files(buildProtoDir)) + protobuf(files(mainProtosDir)) {%- endif %} } protobuf { + generatedFilesBaseDir = "$buildDir/generated/sources/proto" + protoc { // Download from repositories artifact = "com.google.protobuf:protoc:{%- if target.proto_compiler_version -%}{{ target.proto_compiler_version }}{%- else -%}3.22.5{%- endif -%}" } -{% if target.proto_grpc -%} +{%- if target.proto_grpc %} + plugins { id("grpc") { artifact = "io.grpc:protoc-gen-grpc-java:{%- if target.proto_grpc_version -%}{{ target.proto_grpc_version }}{%- else -%}1.45.0{%- endif -%}" @@ -115,48 +132,57 @@ protobuf { id("grpckt") { artifact = "io.grpc:protoc-gen-grpc-kotlin:{%- if target.proto_kotlin_grpc_version -%}{{ target.proto_kotlin_grpc_version }}{%- else -%}1.3.1{%- endif -%}:jdk8@jar" } -{% endif -%} +{%- endif %} } + generateProtoTasks { all().forEach { it.plugins { id("grpc") {%- if target.proto_kotlin_grpc %} id("grpckt") -{% endif -%} +{%- endif %} } {%- if target.proto_kotlin_grpc %} it.builtins { create("kotlin") } -{% endif -%} +{%- endif %} } } {%- endif %} } -val prepareProto = tasks.register<Copy>("prepareProto") { - from(rootDir) { -{%- for proto in target.proto_files %} - include("{{ proto }}") -{%- endfor %} -{# Mining proto-deps sources directories #} -{%- for library in target.consumer if library.prebuilt -%} -{%- if library.type == "library" %} -{%- set proto_rep = library.classpath|replace('project(":','') %} -{%- set proto_rep = proto_rep|replace('")','') %} -{%- set proto_rep = proto_rep|replace(':','/') %} -{%- set proto = proto_rep + '/**' %} +val prepareMainProtos = tasks.register<Copy>("prepareMainProtos") { + from("$project_root") { +{#- list of all current project proto files -#} +{%- for proto in target.proto_files %} include("{{ proto }}") -{%- endif -%} -{%- endfor %} +{%- endfor %} } - into(buildProtoDir) + into(mainProtosDir) } +{% if libraries|length -%} +val extractMainLibrariesProtos = tasks.register<Copy>("extractMainLibrariesProtos") { + from("$project_root") { +{#- list of all library directories -#} +{%- for library in libraries -%} +{%- set path_and_jar = rsplit(library.jar, '/', 2) %} + include("{{ path_and_jar[0] }}/**/*.proto") +{%- endfor %} + } + into(mainExtractedIncludeProtosDir) +} + +{% endif -%} afterEvaluate { - tasks.getByName("extractProto").dependsOn(prepareProto) + tasks.getByName("extractProto").dependsOn(prepareMainProtos) +{%- if libraries|length %} + tasks.getByName("extractProto").dependsOn(extractMainLibrariesProtos) +{%- endif %} } + {# To avoid problems when build project with proto #} tasks.getByName("sourcesJar").dependsOn("generateProto") diff --git a/build/external_resources/flake8_py3/ya.make b/build/external_resources/flake8_py3/ya.make index 3b66251bae..3d89508e8e 100644 --- a/build/external_resources/flake8_py3/ya.make +++ b/build/external_resources/flake8_py3/ya.make @@ -12,12 +12,12 @@ ENDIF() DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE( FLAKE8_PY3 - sbr:6822862832 FOR DARWIN-ARM64 - sbr:6822863322 FOR DARWIN + sbr:7501315930 FOR DARWIN-ARM64 + sbr:7501316202 FOR DARWIN sbr:6726869647 FOR LINUX-PPC64LE - sbr:6822864509 FOR LINUX - sbr:6822862341 FOR LINUX-AARCH64 - sbr:6822864007 FOR WIN32 + sbr:7501316756 FOR LINUX + sbr:7501315620 FOR LINUX-AARCH64 + sbr:7501316414 FOR WIN32 ) END() diff --git a/build/mapping.conf.json b/build/mapping.conf.json index 7c3df72802..473f306a32 100644 --- a/build/mapping.conf.json +++ b/build/mapping.conf.json @@ -293,24 +293,28 @@ "6726871384": "https://devtools-registry.s3.yandex.net/6726871384", "6760720465": "https://devtools-registry.s3.yandex.net/6760720465", "6822863322": "https://devtools-registry.s3.yandex.net/6822863322", + "7501316202": "https://devtools-registry.s3.yandex.net/7501316202", "6603781997": "https://devtools-registry.s3.yandex.net/6603781997", "6652223452": "https://devtools-registry.s3.yandex.net/6652223452", "6674733966": "https://devtools-registry.s3.yandex.net/6674733966", "6726867988": "https://devtools-registry.s3.yandex.net/6726867988", "6760720256": "https://devtools-registry.s3.yandex.net/6760720256", "6822862832": "https://devtools-registry.s3.yandex.net/6822862832", + "7501315930": "https://devtools-registry.s3.yandex.net/7501315930", "6603787904": "https://devtools-registry.s3.yandex.net/6603787904", "6652225714": "https://devtools-registry.s3.yandex.net/6652225714", "6674734993": "https://devtools-registry.s3.yandex.net/6674734993", "6726875537": "https://devtools-registry.s3.yandex.net/6726875537", "6760721014": "https://devtools-registry.s3.yandex.net/6760721014", "6822864509": "https://devtools-registry.s3.yandex.net/6822864509", + "7501316756": "https://devtools-registry.s3.yandex.net/7501316756", "6603780916": "https://devtools-registry.s3.yandex.net/6603780916", "6652222817": "https://devtools-registry.s3.yandex.net/6652222817", "6674733653": "https://devtools-registry.s3.yandex.net/6674733653", "6726866588": "https://devtools-registry.s3.yandex.net/6726866588", "6760720046": "https://devtools-registry.s3.yandex.net/6760720046", "6822862341": "https://devtools-registry.s3.yandex.net/6822862341", + "7501315620": "https://devtools-registry.s3.yandex.net/7501315620", "6603783079": "https://devtools-registry.s3.yandex.net/6603783079", "6652224021": "https://devtools-registry.s3.yandex.net/6652224021", "6674734285": "https://devtools-registry.s3.yandex.net/6674734285", @@ -321,6 +325,7 @@ "6726873745": "https://devtools-registry.s3.yandex.net/6726873745", "6760720811": "https://devtools-registry.s3.yandex.net/6760720811", "6822864007": "https://devtools-registry.s3.yandex.net/6822864007", + "7501316414": "https://devtools-registry.s3.yandex.net/7501316414", "3961412335": "https://devtools-registry.s3.yandex.net/3961412335", "3961411314": "https://devtools-registry.s3.yandex.net/3961411314", "3961413236": "https://devtools-registry.s3.yandex.net/3961413236", @@ -906,7 +911,10 @@ "6990860705": "https://devtools-registry.s3.yandex.net/6990860705", "6990881789": "https://devtools-registry.s3.yandex.net/6990881789", "7324461836": "https://devtools-registry.s3.yandex.net/7324461836", + "7512107516": "https://devtools-registry.s3.yandex.net/7512107516", "7193803465": "https://devtools-registry.s3.yandex.net/7193803465", + "7512042091": "https://devtools-registry.s3.yandex.net/7512042091", + "7512103615": "https://devtools-registry.s3.yandex.net/7512103615", "7324464594": "https://devtools-registry.s3.yandex.net/7324464594", "7487656957": "https://devtools-registry.s3.yandex.net/7487656957", "7458707245": "https://devtools-registry.s3.yandex.net/7458707245", @@ -1037,6 +1045,11 @@ "7451466407": "https://devtools-registry.s3.yandex.net/7451466407", "7407150115": "https://devtools-registry.s3.yandex.net/7407150115", "7451406900": "https://devtools-registry.s3.yandex.net/7451406900", + "7494722271": "https://devtools-registry.s3.yandex.net/7494722271", + "7494597813": "https://devtools-registry.s3.yandex.net/7494597813", + "7495431598": "https://devtools-registry.s3.yandex.net/7495431598", + "7495332394": "https://devtools-registry.s3.yandex.net/7495332394", + "7495957585": "https://devtools-registry.s3.yandex.net/7495957585", "6048579718": "https://devtools-registry.s3.yandex.net/6048579718", "2980468199": "https://devtools-registry.s3.yandex.net/2980468199", "5562224408": "https://devtools-registry.s3.yandex.net/5562224408" @@ -1334,24 +1347,28 @@ "6726871384": "devtools/ya/test/programs/flake8/flake8 for darwin", "6760720465": "devtools/ya/test/programs/flake8/flake8 for darwin", "6822863322": "devtools/ya/test/programs/flake8/flake8 for darwin", + "7501316202": "devtools/ya/test/programs/flake8/flake8 for darwin", "6603781997": "devtools/ya/test/programs/flake8/flake8 for darwin-arm64", "6652223452": "devtools/ya/test/programs/flake8/flake8 for darwin-arm64", "6674733966": "devtools/ya/test/programs/flake8/flake8 for darwin-arm64", "6726867988": "devtools/ya/test/programs/flake8/flake8 for darwin-arm64", "6760720256": "devtools/ya/test/programs/flake8/flake8 for darwin-arm64", "6822862832": "devtools/ya/test/programs/flake8/flake8 for darwin-arm64", + "7501315930": "devtools/ya/test/programs/flake8/flake8 for darwin-arm64", "6603787904": "devtools/ya/test/programs/flake8/flake8 for linux", "6652225714": "devtools/ya/test/programs/flake8/flake8 for linux", "6674734993": "devtools/ya/test/programs/flake8/flake8 for linux", "6726875537": "devtools/ya/test/programs/flake8/flake8 for linux", "6760721014": "devtools/ya/test/programs/flake8/flake8 for linux", "6822864509": "devtools/ya/test/programs/flake8/flake8 for linux", + "7501316756": "devtools/ya/test/programs/flake8/flake8 for linux", "6603780916": "devtools/ya/test/programs/flake8/flake8 for linux-aarch64", "6652222817": "devtools/ya/test/programs/flake8/flake8 for linux-aarch64", "6674733653": "devtools/ya/test/programs/flake8/flake8 for linux-aarch64", "6726866588": "devtools/ya/test/programs/flake8/flake8 for linux-aarch64", "6760720046": "devtools/ya/test/programs/flake8/flake8 for linux-aarch64", "6822862341": "devtools/ya/test/programs/flake8/flake8 for linux-aarch64", + "7501315620": "devtools/ya/test/programs/flake8/flake8 for linux-aarch64", "6603783079": "devtools/ya/test/programs/flake8/flake8 for linux-ppc64le", "6652224021": "devtools/ya/test/programs/flake8/flake8 for linux-ppc64le", "6674734285": "devtools/ya/test/programs/flake8/flake8 for linux-ppc64le", @@ -1362,6 +1379,7 @@ "6726873745": "devtools/ya/test/programs/flake8/flake8 for win32", "6760720811": "devtools/ya/test/programs/flake8/flake8 for win32", "6822864007": "devtools/ya/test/programs/flake8/flake8 for win32", + "7501316414": "devtools/ya/test/programs/flake8/flake8 for win32", "3961412335": "devtools/ya/test/programs/flake8/py2/flake8 for darwin", "3961411314": "devtools/ya/test/programs/flake8/py2/flake8 for darwin-arm64", "3961413236": "devtools/ya/test/programs/flake8/py2/flake8 for linux", @@ -1947,7 +1965,10 @@ "6990860705": "none-none-none-sandbox/backup/d386643e-58f8-43e1-8760-341d73801df8/yfm-docs.tar", "6990881789": "none-none-none-sandbox/backup/efc428e5-52a5-4a6f-8f0c-53f1d255efea/yfm-docs.tar", "7324461836": "none-none-none-service_resources/TASKLET_EXECUTABLE/backup/0541e185-8261-4b07-9149-257f03a9c8ae/yfm-docs.tar", + "7512107516": "none-none-none-service_resources/TASKLET_EXECUTABLE/backup/0ae16953-fe8d-4f1b-9a76-137110f40faf/yfm-docs.tar", "7193803465": "none-none-none-service_resources/TASKLET_EXECUTABLE/backup/17df2ad2-24bc-49e8-8909-b58685dac393/yfm-docs.tar", + "7512042091": "none-none-none-service_resources/TASKLET_EXECUTABLE/backup/203a60f0-6d4d-46bf-93eb-a2a5f998b768/yfm-docs.tar", + "7512103615": "none-none-none-service_resources/TASKLET_EXECUTABLE/backup/29fcd2aa-e0b5-481e-83c8-b7ff5e0157c9/yfm-docs.tar", "7324464594": "none-none-none-service_resources/TASKLET_EXECUTABLE/backup/32cc8c74-decd-44a8-bc8c-f8f0d7edfffe/yfm-docs.tar", "7487656957": "none-none-none-service_resources/TASKLET_EXECUTABLE/backup/4b747fb6-2d4e-4a7b-bbed-abb9a1e21761/yfm-docs.tar", "7458707245": "none-none-none-service_resources/TASKLET_EXECUTABLE/backup/4e7df89f-3762-4eba-ba73-562ccaeae548/yfm-docs.tar", @@ -2078,6 +2099,11 @@ "7451466407": "ynd-clang-18-optimized-linux-x86_64-c66062833fd14752a7ad8fbfb8f25f370b097278", "7407150115": "ynd-clang-18-optimized-mingw-w64-x86_64-56872a411472c7ec2b09f2c8372ea4c67d069a5b", "7451406900": "ynd-clang-18-optimized-mingw-w64-x86_64-c66062833fd14752a7ad8fbfb8f25f370b097278", + "7494722271": "ynd-clang-format-18-darwin-arm64-d0b9255e235e80974f9dfd0ebff3850929bed981", + "7494597813": "ynd-clang-format-18-darwin-x86_64-d0b9255e235e80974f9dfd0ebff3850929bed981", + "7495431598": "ynd-clang-format-18-linux-aarch64-d0b9255e235e80974f9dfd0ebff3850929bed981", + "7495332394": "ynd-clang-format-18-linux-x86_64-d0b9255e235e80974f9dfd0ebff3850929bed981", + "7495957585": "ynd-clang-format-18-mingw-w64-x86_64-d0b9255e235e80974f9dfd0ebff3850929bed981", "6048579718": "yt/go/ytrecipe/cmd/ytexec for linux", "2980468199": "ytexec for linux", "5562224408": "ytexec for linux" diff --git a/build/platform/yfm/ya.make b/build/platform/yfm/ya.make index 5935d3b7f3..2da4c854c2 100644 --- a/build/platform/yfm/ya.make +++ b/build/platform/yfm/ya.make @@ -6,10 +6,10 @@ ENDIF() DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE( YFM_TOOL - sbr:7487672728 FOR DARWIN-ARM64 - sbr:7487672728 FOR DARWIN - sbr:7487632536 FOR LINUX - sbr:7487656957 FOR WIN32 + sbr:7512103615 FOR DARWIN-ARM64 + sbr:7512103615 FOR DARWIN + sbr:7512042091 FOR LINUX + sbr:7512107516 FOR WIN32 ) END() diff --git a/build/plugins/lib/nots/package_manager/base/package_json.py b/build/plugins/lib/nots/package_manager/base/package_json.py index 449b386556..4fcb22e3ca 100644 --- a/build/plugins/lib/nots/package_manager/base/package_json.py +++ b/build/plugins/lib/nots/package_manager/base/package_json.py @@ -1,11 +1,12 @@ import json -import logging import os from six import iteritems +import logging from .utils import build_pj_path + logger = logging.getLogger(__name__) @@ -247,3 +248,6 @@ class PackageJson(object): messages.extend([f" - {key}" for key in missing_overrides]) return (not messages, messages) + + def get_pnpm_patched_dependencies(self) -> dict[str, str]: + return self.data.get("pnpm", {}).get("patchedDependencies", {}) diff --git a/build/plugins/lib/nots/package_manager/base/package_manager.py b/build/plugins/lib/nots/package_manager/base/package_manager.py index fbe4a16436..b780ae8edc 100644 --- a/build/plugins/lib/nots/package_manager/base/package_manager.py +++ b/build/plugins/lib/nots/package_manager/base/package_manager.py @@ -1,13 +1,13 @@ import os -import sys import subprocess - +import sys from abc import ABCMeta, abstractmethod from six import add_metaclass from .constants import NPM_REGISTRY_URL from .package_json import PackageJson from .utils import build_nm_path, build_pj_path +from .timeit import timeit class PackageManagerError(RuntimeError): @@ -126,7 +126,8 @@ class BasePackageManager(object): return [p[prefix_len:] for p in pj.get_workspace_map(ignore_self=True).keys()] - def _exec_command(self, args, include_defaults=True, script_path=None, env=None): + @timeit + def _exec_command(self, args, cwd: str, include_defaults=True, script_path=None, env=None): if not self.nodejs_bin_path: raise PackageManagerError("Unable to execute command: nodejs_bin_path is not configured") @@ -135,9 +136,7 @@ class BasePackageManager(object): + args + (self._get_default_options() if include_defaults else []) ) - p = subprocess.Popen( - cmd, cwd=self.build_path, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env - ) + p = subprocess.Popen(cmd, cwd=cwd, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) stdout, stderr = p.communicate() if p.returncode != 0: diff --git a/build/plugins/lib/nots/package_manager/npm/npm_package_manager.py b/build/plugins/lib/nots/package_manager/npm/npm_package_manager.py index 1d251ee1c8..faacb19f49 100644 --- a/build/plugins/lib/nots/package_manager/npm/npm_package_manager.py +++ b/build/plugins/lib/nots/package_manager/npm/npm_package_manager.py @@ -1,6 +1,5 @@ import os - from ..base import BasePackageManager, PackageManagerError from ..base.constants import NODE_MODULES_WORKSPACE_BUNDLE_FILENAME from ..base.node_modules_bundler import bundle_node_modules @@ -157,7 +156,7 @@ class NpmPackageManager(BasePackageManager): env = os.environ.copy() env.update({"NPM_CONFIG_CACHE": os.path.join(self.build_path, ".npm-cache")}) - self._exec_command(install_cmd, env=env) + self._exec_command(install_cmd, cwd=self.build_path, env=env) def _prepare_workspace(self): lf = self.load_lockfile(build_pre_lockfile_path(self.build_path)) diff --git a/build/plugins/lib/nots/package_manager/pnpm/package_manager.py b/build/plugins/lib/nots/package_manager/pnpm/package_manager.py index b40cafeb34..891bd96f6e 100644 --- a/build/plugins/lib/nots/package_manager/pnpm/package_manager.py +++ b/build/plugins/lib/nots/package_manager/pnpm/package_manager.py @@ -5,8 +5,9 @@ from .lockfile import PnpmLockfile from .utils import build_lockfile_path, build_pre_lockfile_path, build_ws_config_path from .workspace import PnpmWorkspace from ..base import BasePackageManager, PackageManagerError -from ..base.constants import NODE_MODULES_WORKSPACE_BUNDLE_FILENAME +from ..base.constants import NODE_MODULES_WORKSPACE_BUNDLE_FILENAME, PACKAGE_JSON_FILENAME, PNPM_LOCKFILE_FILENAME from ..base.node_modules_bundler import bundle_node_modules +from ..base.package_json import PackageJson from ..base.timeit import timeit from ..base.utils import ( b_rooted, @@ -47,6 +48,40 @@ class PnpmPackageManager(BasePackageManager): return os.path.join(home_dir(), ".cache", "pnpm-store") @timeit + def _create_local_node_modules(self, nm_store_path: str, store_dir: str, virtual_store_dir: str): + """ + Creates ~/.nots/nm_store/$MODDIR/node_modules folder (with installed packages and .pnpm/virtual-store) + + Should be used after build for local development ($SOURCE_DIR/node_modules should be a symlink to this folder). + + But now it is also a workaround to provide valid node_modules structure in the parent folder of virtual-store + It is needed for fixing custom module resolvers (like in tsc, webpack, etc...), which are trying to find modules in the parents directories + """ + + # provide files required for `pnpm install` + pj = PackageJson.load(os.path.join(self.build_path, PACKAGE_JSON_FILENAME)) + required_files = [ + PACKAGE_JSON_FILENAME, + PNPM_LOCKFILE_FILENAME, + *list(pj.bins_iter()), + *pj.get_pnpm_patched_dependencies().values(), + ] + + for f in required_files: + src = os.path.join(self.build_path, f) + if os.path.exists(src): + dst = os.path.join(nm_store_path, f) + try: + os.remove(dst) + except FileNotFoundError: + pass + + os.makedirs(os.path.dirname(dst), exist_ok=True) + shutil.copy(src, dst) + + self._run_pnpm_install(store_dir, virtual_store_dir, nm_store_path) + + @timeit def create_node_modules(self, yatool_prebuilder_path=None, local_cli=False, bundle=True): """ Creates node_modules directory according to the lockfile. @@ -68,7 +103,10 @@ class PnpmPackageManager(BasePackageManager): # Use single virtual-store location in ~/.nots/nm_store/$MODDIR/node_modules/.pnpm/virtual-store virtual_store_dir = os.path.join(build_nm_path(nm_store_path), self._VSTORE_NM_PATH) - self._run_pnpm_install(store_dir, virtual_store_dir) + self._create_local_node_modules(nm_store_path, store_dir, virtual_store_dir) + + self._run_pnpm_install(store_dir, virtual_store_dir, self.build_path) + self._run_apply_addons_if_need(yatool_prebuilder_path, virtual_store_dir) self._replace_internal_lockfile_with_original(virtual_store_dir) @@ -81,7 +119,7 @@ class PnpmPackageManager(BasePackageManager): ) @timeit - def _run_pnpm_install(self, store_dir: str, virtual_store_dir: str): + def _run_pnpm_install(self, store_dir: str, virtual_store_dir: str, cwd: str): install_cmd = [ "install", "--frozen-lockfile", @@ -100,8 +138,9 @@ class PnpmPackageManager(BasePackageManager): virtual_store_dir, ] - self._exec_command(install_cmd) + self._exec_command(install_cmd, cwd=cwd) + @timeit def calc_prepare_deps_inouts_and_resources( self, store_path: str, has_deps: bool ) -> tuple[list[str], list[str], list[str]]: @@ -122,6 +161,7 @@ class PnpmPackageManager(BasePackageManager): return ins, outs, resources + @timeit def calc_node_modules_inouts(self, local_cli: bool, has_deps: bool) -> tuple[list[str], list[str]]: """ Returns input and output paths for command that creates `node_modules` bundle. @@ -139,6 +179,7 @@ class PnpmPackageManager(BasePackageManager): return ins, outs + @timeit def extract_packages_meta_from_lockfiles(self, lf_paths): """ :type lf_paths: iterable of BaseLockfile @@ -167,6 +208,7 @@ class PnpmPackageManager(BasePackageManager): return PnpmWorkspace.load(build_ws_config_path(self.build_path)) + @timeit def build_workspace(self, tarballs_store: str): """ :rtype: PnpmWorkspace @@ -182,6 +224,7 @@ class PnpmPackageManager(BasePackageManager): return ws + @timeit def _build_merged_pre_lockfile(self, tarballs_store, dep_paths): """ :type dep_paths: list of str @@ -199,6 +242,7 @@ class PnpmPackageManager(BasePackageManager): lf.write() + @timeit def _build_merged_workspace_config(self, ws, dep_paths): """ NOTE: This method mutates `ws`. @@ -223,10 +267,12 @@ class PnpmPackageManager(BasePackageManager): "--virtual-store", virtual_store_dir, ], + cwd=self.build_path, include_defaults=False, script_path=os.path.join(yatool_prebuilder_path, "build", "bin", "prebuilder.js"), ) + @timeit def _replace_internal_lockfile_with_original(self, virtual_store_dir): original_lf_path = build_lockfile_path(self.sources_path) vs_lf_path = os.path.join(virtual_store_dir, "lock.yaml") @@ -236,14 +282,15 @@ class PnpmPackageManager(BasePackageManager): @timeit def _copy_pnpm_patches(self): pj = self.load_package_json_from_dir(self.sources_path) - patchedDependencies: dict[str, str] = pj.data.get("pnpm", {}).get("patchedDependencies", {}) + patched_dependencies: dict[str, str] = pj.data.get("pnpm", {}).get("patchedDependencies", {}) - for p in patchedDependencies.values(): + for p in patched_dependencies.values(): patch_source_path = os.path.join(self.sources_path, p) patch_build_path = os.path.join(self.build_path, p) os.makedirs(os.path.dirname(patch_build_path), exist_ok=True) shutil.copyfile(patch_source_path, patch_build_path) + @timeit def _get_default_options(self): return super(PnpmPackageManager, self)._get_default_options() + [ "--stream", @@ -252,5 +299,6 @@ class PnpmPackageManager(BasePackageManager): "--no-color", ] + @timeit def _get_debug_log_path(self): return self._nm_path(".pnpm-debug.log") diff --git a/build/plugins/lib/nots/package_manager/ya.make b/build/plugins/lib/nots/package_manager/ya.make index 08a791eb7e..6853c7b50a 100644 --- a/build/plugins/lib/nots/package_manager/ya.make +++ b/build/plugins/lib/nots/package_manager/ya.make @@ -4,7 +4,6 @@ PY3_LIBRARY() STYLE_PYTHON() - PY_SRCS( __init__.py ) diff --git a/build/ya.conf.json b/build/ya.conf.json index 995c61a0fc..35dfed0031 100644 --- a/build/ya.conf.json +++ b/build/ya.conf.json @@ -86,6 +86,14 @@ }, "formula": "build/platform/clang/clang-format/clang-format16.json" }, + "clang-format-18": { + "executable": { + "clang-format": [ + "clang-format" + ] + }, + "formula": "build/platform/clang/clang-format/clang-format18.json" + }, "clang16": { "executable": { "c++": [ @@ -484,6 +492,49 @@ } } }, + "clang-format-18": { + "platforms": [ + { + "default": true, + "host": { + "arch": "x86_64", + "os": "LINUX" + } + }, + { + "default": true, + "host": { + "arch": "aarch64", + "os": "LINUX" + } + }, + { + "default": true, + "host": { + "os": "WIN" + } + }, + { + "default": true, + "host": { + "os": "DARWIN" + } + }, + { + "default": true, + "host": { + "arch": "arm64", + "os": "DARWIN" + } + } + ], + "tools": { + "clang-format-18": { + "bottle": "clang-format-18", + "executable": "clang-format" + } + } + }, "clang16": { "env": { "CPATH": [ @@ -2302,6 +2353,9 @@ "clang-format": { "description": "Run Clang-Format source code formatter" }, + "clang-format-18": { + "description": "Run Clang-Format source code formatter (18 version)" + }, "clang-rename": { "description": "Run Clang-Rename refactoring tool" }, diff --git a/build/ymake_conf.py b/build/ymake_conf.py index 771c2b2902..77bf04e0a9 100755 --- a/build/ymake_conf.py +++ b/build/ymake_conf.py @@ -1551,7 +1551,6 @@ class GnuCompiler(Compiler): '-Wno-deprecated-enum-float-conversion', '-Wno-deprecated-volatile', '-Wno-pessimizing-move', - '-Wno-return-std-move', '-Wno-undefined-var-template', ] diff --git a/contrib/libs/expat/.yandex_meta/devtools.copyrights.report b/contrib/libs/expat/.yandex_meta/devtools.copyrights.report index c3106544c7..b67c3a92e5 100644 --- a/contrib/libs/expat/.yandex_meta/devtools.copyrights.report +++ b/contrib/libs/expat/.yandex_meta/devtools.copyrights.report @@ -85,7 +85,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] lib/xmltok_impl.c [9:20] KEEP COPYRIGHT_SERVICE_LABEL 17566be0ee85deadbd5b2fcedc8b66a9 @@ -96,7 +96,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL 1916cbefc2e0a780a3d503ba26f3780a BELONGS ya.make @@ -129,7 +129,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] lib/xmltok.c [9:27] KEEP COPYRIGHT_SERVICE_LABEL 262c58e3a627f5cee77a882379e1364f @@ -151,7 +151,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL 338b8ad8ee9b8449a90a88a0559aefd9 BELONGS ya.make @@ -161,7 +161,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL 347b7c5a6d0cfaa5712b5fb2bfd1a69a BELONGS ya.make @@ -182,7 +182,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL 387a03e23bfe968e0bc1919b0ef65164 BELONGS ya.make @@ -202,7 +202,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL 4010f67351b9e656cc500aa367c0c393 BELONGS ya.make @@ -212,7 +212,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] lib/xmlrole.c [9:19] lib/xmltok.c [9:27] @@ -235,7 +235,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] lib/xmltok.c [9:27] KEEP COPYRIGHT_SERVICE_LABEL 50da2a76d12ee3df6d928d81ca59a715 @@ -266,7 +266,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL 576486d7fb5eeab148dcf39027acec46 BELONGS ya.make @@ -276,7 +276,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL 581b53ae6f0fb8a0cc30c73b46bc3441 BELONGS ya.make @@ -319,7 +319,7 @@ BELONGS ya.make Match type : COPYRIGHT Files with this license: expat.h [9:22] - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL 5fe78d330bca84f8e39670e48c92ba39 BELONGS ya.make @@ -330,7 +330,7 @@ BELONGS ya.make Match type : COPYRIGHT Files with this license: lib/internal.h [28:36] - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL 60e5da68428d71447ddd4bd7750453bb BELONGS ya.make @@ -340,7 +340,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL 6451d5e490271b354ad3b567c7a03423 BELONGS ya.make @@ -350,7 +350,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL 660431f3ef648d1a8e72ca1d307af738 BELONGS ya.make @@ -360,7 +360,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL 7588a9020c401c85f6b542a5629c0c92 BELONGS ya.make @@ -380,7 +380,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL 7c09099ef5f35bf3be4611e6cbb14510 BELONGS ya.make @@ -409,7 +409,7 @@ BELONGS ya.make lib/nametab.h [9:11] lib/utf8tab.h [9:13] lib/winconfig.h [9:14] - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] lib/xmlrole.c [9:19] lib/xmlrole.h [9:14] lib/xmltok.c [9:27] @@ -460,11 +460,21 @@ BELONGS ya.make Match type : COPYRIGHT Files with this license: lib/internal.h [28:36] - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] lib/xmlrole.c [9:19] lib/xmltok.c [9:27] lib/xmltok_impl.c [9:20] +KEEP COPYRIGHT_SERVICE_LABEL 9b348497698951665d1e43c1d376a510 +BELONGS ya.make + Note: matched license text is too long. Read it in the source files. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/xmlparse.c [9:44] + KEEP COPYRIGHT_SERVICE_LABEL 9fdb85dcaaf74d518b27233b48fffa52 BELONGS ya.make Note: matched license text is too long. Read it in the source files. @@ -475,7 +485,7 @@ BELONGS ya.make Files with this license: expat.h [9:22] expat_external.h [9:18] - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL a0fdd1392c0b9b2558b9ccfe44592143 BELONGS ya.make @@ -527,7 +537,7 @@ BELONGS ya.make Match type : COPYRIGHT Files with this license: expat.h [9:22] - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] lib/xmltok.c [9:27] lib/xmltok_impl.c [9:20] @@ -539,7 +549,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL ac721fcd634b3e5674a847f5ed2f1c8e BELONGS ya.make @@ -559,7 +569,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL b646d644160a51f7f42f9fd9f89d8b3f BELONGS ya.make @@ -620,7 +630,7 @@ BELONGS ya.make lib/iasciitab.h [9:13] lib/latin1tab.h [9:13] lib/utf8tab.h [9:13] - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] lib/xmlrole.c [9:19] lib/xmlrole.h [9:14] lib/xmltok.c [9:27] @@ -637,7 +647,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL d548c6beaeae204247905b60d5feff91 BELONGS ya.make @@ -647,7 +657,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] lib/xmltok_impl.c [9:20] KEEP COPYRIGHT_SERVICE_LABEL d9ac29affff64c14b3c82b78ed157a77 @@ -658,7 +668,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] lib/xmlrole.c [9:19] lib/xmltok.c [9:27] @@ -670,7 +680,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL dd3e49797101e1ae2e966f0ebdd58da4 BELONGS ya.make @@ -700,7 +710,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL e3d6c1b6030b59aad9996cc0a9efeda5 BELONGS ya.make @@ -710,7 +720,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL e526eb605bd716769dd1ed15786af827 BELONGS ya.make @@ -730,7 +740,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL ef0dda0153a00710149f327147a79b7f BELONGS ya.make @@ -771,7 +781,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL f792720cb266393d3d3fb2199660c4ea BELONGS ya.make @@ -783,7 +793,7 @@ BELONGS ya.make Files with this license: expat.h [9:22] lib/internal.h [28:36] - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] lib/xmltok.c [9:27] lib/xmltok.h [9:15] @@ -813,7 +823,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - lib/xmlparse.c [9:43] + lib/xmlparse.c [9:44] KEEP COPYRIGHT_SERVICE_LABEL ffabe442e64111946b696c0384a52a77 BELONGS ya.make diff --git a/contrib/libs/expat/.yandex_meta/devtools.licenses.report b/contrib/libs/expat/.yandex_meta/devtools.licenses.report index e38dc31f64..f11728285f 100644 --- a/contrib/libs/expat/.yandex_meta/devtools.licenses.report +++ b/contrib/libs/expat/.yandex_meta/devtools.licenses.report @@ -42,7 +42,7 @@ BELONGS ya.make KEEP MIT 6bb6514a1d779748b76a73215a89ae66 BELONGS ya.make -FILE_INCLUDE AUTHORS found in files: expat.h at line 38, expat_external.h at line 34, lib/ascii.h at line 30, lib/asciitab.h at line 29, lib/iasciitab.h at line 29, lib/internal.h at line 52, lib/latin1tab.h at line 29, lib/utf8tab.h at line 29, lib/winconfig.h at line 30, lib/xmlparse.c at line 59, lib/xmlrole.c at line 35, lib/xmlrole.h at line 30, lib/xmltok.c at line 43, lib/xmltok.h at line 31, lib/xmltok_impl.c at line 36, lib/xmltok_impl.h at line 28, lib/xmltok_ns.c at line 31 +FILE_INCLUDE AUTHORS found in files: expat.h at line 38, expat_external.h at line 34, lib/ascii.h at line 30, lib/asciitab.h at line 29, lib/iasciitab.h at line 29, lib/internal.h at line 52, lib/latin1tab.h at line 29, lib/utf8tab.h at line 29, lib/winconfig.h at line 30, lib/xmlparse.c at line 60, lib/xmlrole.c at line 35, lib/xmlrole.h at line 30, lib/xmltok.c at line 43, lib/xmltok.h at line 31, lib/xmltok_impl.c at line 36, lib/xmltok_impl.h at line 28, lib/xmltok_ns.c at line 31 Note: matched license text is too long. Read it in the source files. Scancode info: Original SPDX id: MIT @@ -59,7 +59,7 @@ FILE_INCLUDE AUTHORS found in files: expat.h at line 38, expat_external.h at lin lib/latin1tab.h [15:32] lib/utf8tab.h [15:32] lib/winconfig.h [16:33] - lib/xmlparse.c [45:62] + lib/xmlparse.c [46:63] lib/xmlrole.c [21:38] lib/xmlrole.h [16:33] lib/xmltok.c [29:46] @@ -100,7 +100,7 @@ BELONGS ya.make lib/nametab.h [11:11] lib/utf8tab.h [13:13] lib/winconfig.h [14:14] - lib/xmlparse.c [43:43] + lib/xmlparse.c [44:44] lib/xmlrole.c [19:19] lib/xmlrole.h [14:14] lib/xmltok.c [27:27] diff --git a/contrib/libs/expat/.yandex_meta/licenses.list.txt b/contrib/libs/expat/.yandex_meta/licenses.list.txt index 10480569cc..e23955221e 100644 --- a/contrib/libs/expat/.yandex_meta/licenses.list.txt +++ b/contrib/libs/expat/.yandex_meta/licenses.list.txt @@ -67,6 +67,7 @@ Copyright (c) 2023 Owain Davies <owaind@bath.edu> Copyright (c) 2023-2024 Sony Corporation / Snild Dolkow <snild@sony.com> Copyright (c) 2024 Berkay Eren Ürün <berkay.ueruen@siemens.com> + Copyright (c) 2024 Hanno Böck <hanno@gentoo.org> Licensed under the MIT license: diff --git a/contrib/libs/expat/.yandex_meta/override.nix b/contrib/libs/expat/.yandex_meta/override.nix index 380531bb62..a7493ed82e 100644 --- a/contrib/libs/expat/.yandex_meta/override.nix +++ b/contrib/libs/expat/.yandex_meta/override.nix @@ -1,12 +1,12 @@ pkgs: attrs: with pkgs; with attrs; rec { - version = "2.6.3"; + version = "2.6.4"; versionTag = "R_${lib.replaceStrings ["."] ["_"] version}"; src = fetchFromGitHub { owner = "libexpat"; repo = "libexpat"; rev = "${versionTag}"; - hash = "sha256-xxjUNbkcJkCMzlMt5yNnnUl0pJ/pP3Z9F5qnlYQXLOQ="; + hash = "sha256-ek8/3c8bKG+z7fIM+QCNsH7eoVGAt7z3bXBHZ3QjlS8="; }; nativeBuildInputs = [ autoreconfHook ]; diff --git a/contrib/libs/expat/Changes b/contrib/libs/expat/Changes index c1d22efa5a..aa19f70ae2 100644 --- a/contrib/libs/expat/Changes +++ b/contrib/libs/expat/Changes @@ -30,6 +30,37 @@ !! THANK YOU! Sebastian Pipping -- Berlin, 2024-03-09 !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +Release 2.6.4 Wed November 6 2024 + Security fixes: + #915 CVE-2024-50602 -- Fix crash within function XML_ResumeParser + from a NULL pointer dereference by disallowing function + XML_StopParser to (stop or) suspend an unstarted parser. + A new error code XML_ERROR_NOT_STARTED was introduced to + properly communicate this situation. // CWE-476 CWE-754 + + Other changes: + #903 CMake: Add alias target "expat::expat" + #905 docs: Document use via CMake >=3.18 with FetchContent + and SOURCE_SUBDIR and its consequences + #902 tests: Reduce use of global parser instance + #904 tests: Resolve duplicate handler + #317 #918 tests: Improve tests on doctype closing (ex CVE-2019-15903) + #914 Fix signedness of format strings + #919 #920 Version info bumped from 10:3:9 (libexpat*.so.1.9.3) + to 11:0:10 (libexpat*.so.1.10.0); see https://verbump.de/ + for what these numbers do + + Infrastructure: + #907 CI: Upgrade Clang from 18 to 19 + #913 CI: Drop macos-12 and add macos-15 + #910 CI: Adapt to breaking changes in GitHub Actions + #898 Add missing entries to .gitignore + + Special thanks to: + Hanno Böck + José Eduardo Gutiérrez Conejo + José Ricardo Cardona Quesada + Release 2.6.3 Wed September 4 2024 Security fixes: #887 #890 CVE-2024-45490 -- Calling function XML_ParseBuffer with diff --git a/contrib/libs/expat/README.md b/contrib/libs/expat/README.md index 180a68e4ab..23d26dad2b 100644 --- a/contrib/libs/expat/README.md +++ b/contrib/libs/expat/README.md @@ -11,7 +11,7 @@ > at the top of the `Changes` file. -# Expat, Release 2.6.3 +# Expat, Release 2.6.4 This is Expat, a C99 library for parsing [XML 1.0 Fourth Edition](https://www.w3.org/TR/2006/REC-xml-20060816/), started by @@ -43,9 +43,9 @@ This license is the same as the MIT/X Consortium license. ## Using libexpat in your CMake-Based Project -There are two ways of using libexpat with CMake: +There are three documented ways of using libexpat with CMake: -### a) Module Mode +### a) `find_package` with Module Mode This approach leverages CMake's own [module `FindEXPAT`](https://cmake.org/cmake/help/latest/module/FindEXPAT.html). @@ -70,7 +70,7 @@ target_include_directories(hello PRIVATE ${EXPAT_INCLUDE_DIRS}) target_link_libraries(hello PUBLIC ${EXPAT_LIBRARIES}) ``` -### b) Config Mode +### b) `find_package` with Config Mode This approach requires files from… @@ -98,6 +98,45 @@ add_executable(hello target_link_libraries(hello PUBLIC expat::expat) ``` +### c) The `FetchContent` module + +This approach — as demonstrated below — requires CMake >=3.18 for both the +[`FetchContent` module](https://cmake.org/cmake/help/latest/module/FetchContent.html) +and its support for the `SOURCE_SUBDIR` option to be available. + +Please note that: +- Use of the `FetchContent` module with *non-release* SHA1s or `master` + of libexpat is neither advised nor considered officially supported. +- Pinning to a specific commit is great for robust CI. +- Pinning to a specific commit needs updating every time there is a new + release of libexpat — either manually or through automation —, + to not miss out on libexpat security updates. + +For an example that pulls in libexpat via Git: + +```cmake +cmake_minimum_required(VERSION 3.18) + +include(FetchContent) + +project(hello VERSION 1.0.0) + +FetchContent_Declare( + expat + GIT_REPOSITORY https://github.com/libexpat/libexpat/ + GIT_TAG 000000000_GIT_COMMIT_SHA1_HERE_000000000 # i.e. Git tag R_0_Y_Z + SOURCE_SUBDIR expat/ +) + +FetchContent_MakeAvailable(expat) + +add_executable(hello + hello.c +) + +target_link_libraries(hello PUBLIC expat) +``` + ## Building from a Git Clone diff --git a/contrib/libs/expat/expat.h b/contrib/libs/expat/expat.h index d0d6015a66..523b37d8d5 100644 --- a/contrib/libs/expat/expat.h +++ b/contrib/libs/expat/expat.h @@ -130,7 +130,9 @@ enum XML_Error { /* Added in 2.3.0. */ XML_ERROR_NO_BUFFER, /* Added in 2.4.0. */ - XML_ERROR_AMPLIFICATION_LIMIT_BREACH + XML_ERROR_AMPLIFICATION_LIMIT_BREACH, + /* Added in 2.6.4. */ + XML_ERROR_NOT_STARTED, }; enum XML_Content_Type { @@ -1066,7 +1068,7 @@ XML_SetReparseDeferralEnabled(XML_Parser parser, XML_Bool enabled); */ #define XML_MAJOR_VERSION 2 #define XML_MINOR_VERSION 6 -#define XML_MICRO_VERSION 3 +#define XML_MICRO_VERSION 4 #ifdef __cplusplus } diff --git a/contrib/libs/expat/expat_config.h b/contrib/libs/expat/expat_config.h index a3e5f4a3d3..48d7b064fa 100644 --- a/contrib/libs/expat/expat_config.h +++ b/contrib/libs/expat/expat_config.h @@ -83,7 +83,7 @@ #define PACKAGE_NAME "expat" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "expat 2.6.3" +#define PACKAGE_STRING "expat 2.6.4" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "expat" @@ -92,7 +92,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "2.6.3" +#define PACKAGE_VERSION "2.6.4" /* Define to 1 if all of the C90 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for @@ -100,7 +100,7 @@ #define STDC_HEADERS 1 /* Version number of package */ -#define VERSION "2.6.3" +#define VERSION "2.6.4" /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ diff --git a/contrib/libs/expat/lib/xmlparse.c b/contrib/libs/expat/lib/xmlparse.c index 949c226ce8..e3e46da03b 100644 --- a/contrib/libs/expat/lib/xmlparse.c +++ b/contrib/libs/expat/lib/xmlparse.c @@ -1,4 +1,4 @@ -/* ba4cdf9bdb534f355a9def4c9e25d20ee8e72f95b0a4d930be52e563f5080196 (2.6.3+) +/* c5625880f4bf417c1463deee4eb92d86ff413f802048621c57e25fe483eb59e4 (2.6.4+) __ __ _ ___\ \/ /_ __ __ _| |_ / _ \\ /| '_ \ / _` | __| @@ -40,6 +40,7 @@ Copyright (c) 2023 Owain Davies <owaind@bath.edu> Copyright (c) 2023-2024 Sony Corporation / Snild Dolkow <snild@sony.com> Copyright (c) 2024 Berkay Eren Ürün <berkay.ueruen@siemens.com> + Copyright (c) 2024 Hanno Böck <hanno@gentoo.org> Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining @@ -2234,6 +2235,9 @@ XML_StopParser(XML_Parser parser, XML_Bool resumable) { if (parser == NULL) return XML_STATUS_ERROR; switch (parser->m_parsingStatus.parsing) { + case XML_INITIALIZED: + parser->m_errorCode = XML_ERROR_NOT_STARTED; + return XML_STATUS_ERROR; case XML_SUSPENDED: if (resumable) { parser->m_errorCode = XML_ERROR_SUSPENDED; @@ -2244,7 +2248,7 @@ XML_StopParser(XML_Parser parser, XML_Bool resumable) { case XML_FINISHED: parser->m_errorCode = XML_ERROR_FINISHED; return XML_STATUS_ERROR; - default: + case XML_PARSING: if (resumable) { #ifdef XML_DTD if (parser->m_isParamEntity) { @@ -2255,6 +2259,9 @@ XML_StopParser(XML_Parser parser, XML_Bool resumable) { parser->m_parsingStatus.parsing = XML_SUSPENDED; } else parser->m_parsingStatus.parsing = XML_FINISHED; + break; + default: + assert(0); } return XML_STATUS_OK; } @@ -2519,6 +2526,9 @@ XML_ErrorString(enum XML_Error code) { case XML_ERROR_AMPLIFICATION_LIMIT_BREACH: return XML_L( "limit on input amplification factor (from DTD and entities) breached"); + /* Added in 2.6.4. */ + case XML_ERROR_NOT_STARTED: + return XML_L("parser not started"); } return NULL; } @@ -7856,7 +7866,7 @@ accountingReportDiff(XML_Parser rootParser, assert(! rootParser->m_parentParser); fprintf(stderr, - " (+" EXPAT_FMT_PTRDIFF_T("6") " bytes %s|%d, xmlparse.c:%d) %*s\"", + " (+" EXPAT_FMT_PTRDIFF_T("6") " bytes %s|%u, xmlparse.c:%d) %*s\"", bytesMore, (account == XML_ACCOUNT_DIRECT) ? "DIR" : "EXP", levelsAwayFromRootParser, source_line, 10, ""); @@ -7969,7 +7979,7 @@ entityTrackingReportStats(XML_Parser rootParser, ENTITY *entity, fprintf( stderr, - "expat: Entities(%p): Count %9d, depth %2d/%2d %*s%s%s; %s length %d (xmlparse.c:%d)\n", + "expat: Entities(%p): Count %9u, depth %2u/%2u %*s%s%s; %s length %d (xmlparse.c:%d)\n", (void *)rootParser, rootParser->m_entity_stats.countEverOpened, rootParser->m_entity_stats.currentDepth, rootParser->m_entity_stats.maximumDepthSeen, diff --git a/contrib/libs/expat/ya.make b/contrib/libs/expat/ya.make index 45fbab7888..489ae45db1 100644 --- a/contrib/libs/expat/ya.make +++ b/contrib/libs/expat/ya.make @@ -10,9 +10,9 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -VERSION(2.6.3) +VERSION(2.6.4) -ORIGINAL_SOURCE(https://github.com/libexpat/libexpat/archive/R_2_6_3.tar.gz) +ORIGINAL_SOURCE(https://github.com/libexpat/libexpat/archive/R_2_6_4.tar.gz) ADDINCL( contrib/libs/expat diff --git a/contrib/libs/poco/Foundation/include/Poco/Dynamic/VarHolder.h b/contrib/libs/poco/Foundation/include/Poco/Dynamic/VarHolder.h index 85af40f449..9a85a24aee 100644 --- a/contrib/libs/poco/Foundation/include/Poco/Dynamic/VarHolder.h +++ b/contrib/libs/poco/Foundation/include/Poco/Dynamic/VarHolder.h @@ -452,15 +452,33 @@ private: template <typename F, typename T> void checkUpperLimitFloat(const F& from) const { - if (from > std::numeric_limits<T>::max()) - throw RangeException("Value too large."); + if (std::is_floating_point<T>::value) + { + if (from > std::numeric_limits<T>::max()) + throw RangeException("Value too large."); + } + else + { + // Avoid clang -Wimplicit-int-float-conversion warning with an explicit cast. + if (from > static_cast<F>(std::numeric_limits<T>::max())) + throw RangeException("Value too large."); + } } template <typename F, typename T> void checkLowerLimitFloat(const F& from) const { - if (from < -std::numeric_limits<T>::max()) - throw RangeException("Value too small."); + if (std::is_floating_point<T>::value) + { + if (from < -std::numeric_limits<T>::max()) + throw RangeException("Value too small."); + } + else + { + // Avoid clang -Wimplicit-int-float-conversion warning with an explicit cast. + if (from < static_cast<F>(std::numeric_limits<T>::min())) + throw RangeException("Value too small."); + } } template <typename F, typename T> diff --git a/contrib/python/google-auth/py3/.dist-info/METADATA b/contrib/python/google-auth/py3/.dist-info/METADATA index 261e2a0276..500fd7bdbc 100644 --- a/contrib/python/google-auth/py3/.dist-info/METADATA +++ b/contrib/python/google-auth/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: google-auth -Version: 2.35.0 +Version: 2.36.0 Summary: Google Authentication Library Home-page: https://github.com/googleapis/google-auth-library-python Author: Google Cloud Platform @@ -24,22 +24,22 @@ Classifier: Operating System :: OS Independent Classifier: Topic :: Internet :: WWW/HTTP Requires-Python: >=3.7 License-File: LICENSE -Requires-Dist: cachetools <6.0,>=2.0.0 -Requires-Dist: pyasn1-modules >=0.2.1 -Requires-Dist: rsa <5,>=3.1.4 +Requires-Dist: cachetools<6.0,>=2.0.0 +Requires-Dist: pyasn1-modules>=0.2.1 +Requires-Dist: rsa<5,>=3.1.4 Provides-Extra: aiohttp -Requires-Dist: aiohttp <4.0.0.dev0,>=3.6.2 ; extra == 'aiohttp' -Requires-Dist: requests <3.0.0.dev0,>=2.20.0 ; extra == 'aiohttp' +Requires-Dist: aiohttp<4.0.0.dev0,>=3.6.2; extra == "aiohttp" +Requires-Dist: requests<3.0.0.dev0,>=2.20.0; extra == "aiohttp" Provides-Extra: enterprise_cert -Requires-Dist: cryptography ; extra == 'enterprise_cert' -Requires-Dist: pyopenssl ; extra == 'enterprise_cert' +Requires-Dist: cryptography; extra == "enterprise-cert" +Requires-Dist: pyopenssl; extra == "enterprise-cert" Provides-Extra: pyopenssl -Requires-Dist: pyopenssl >=20.0.0 ; extra == 'pyopenssl' -Requires-Dist: cryptography >=38.0.3 ; extra == 'pyopenssl' +Requires-Dist: pyopenssl>=20.0.0; extra == "pyopenssl" +Requires-Dist: cryptography>=38.0.3; extra == "pyopenssl" Provides-Extra: reauth -Requires-Dist: pyu2f >=0.1.5 ; extra == 'reauth' +Requires-Dist: pyu2f>=0.1.5; extra == "reauth" Provides-Extra: requests -Requires-Dist: requests <3.0.0.dev0,>=2.20.0 ; extra == 'requests' +Requires-Dist: requests<3.0.0.dev0,>=2.20.0; extra == "requests" Google Auth Python Library ========================== diff --git a/contrib/python/google-auth/py3/google/auth/_default.py b/contrib/python/google-auth/py3/google/auth/_default.py index 7bbcf85914..cdc8b7a646 100644 --- a/contrib/python/google-auth/py3/google/auth/_default.py +++ b/contrib/python/google-auth/py3/google/auth/_default.py @@ -472,6 +472,10 @@ def _get_impersonated_service_account_credentials(filename, info, scopes): source_credentials, _ = _get_service_account_credentials( filename, source_credentials_info ) + elif source_credentials_type == _EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE: + source_credentials, _ = _get_external_account_authorized_user_credentials( + filename, source_credentials_info + ) else: raise exceptions.InvalidType( "source credential of type {} is not supported.".format( diff --git a/contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py b/contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py index b66d9f9b37..8d692972fd 100644 --- a/contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py +++ b/contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py @@ -294,7 +294,7 @@ def get_universe_domain(request): 404 occurs while retrieving metadata. """ universe_domain = get( - request, "universe/universe_domain", return_none_for_not_found_error=True + request, "universe/universe-domain", return_none_for_not_found_error=True ) if not universe_domain: return "googleapis.com" diff --git a/contrib/python/google-auth/py3/google/auth/iam.py b/contrib/python/google-auth/py3/google/auth/iam.py index bba1624c16..dcf0dbf9d5 100644 --- a/contrib/python/google-auth/py3/google/auth/iam.py +++ b/contrib/python/google-auth/py3/google/auth/iam.py @@ -23,10 +23,18 @@ import base64 import http.client as http_client import json +from google.auth import _exponential_backoff from google.auth import _helpers +from google.auth import credentials from google.auth import crypt from google.auth import exceptions +IAM_RETRY_CODES = { + http_client.INTERNAL_SERVER_ERROR, + http_client.BAD_GATEWAY, + http_client.SERVICE_UNAVAILABLE, + http_client.GATEWAY_TIMEOUT, +} _IAM_SCOPE = ["https://www.googleapis.com/auth/iam"] @@ -82,21 +90,30 @@ class Signer(crypt.Signer): message = _helpers.to_bytes(message) method = "POST" - url = _IAM_SIGN_ENDPOINT.format(self._service_account_email) + url = _IAM_SIGN_ENDPOINT.replace( + credentials.DEFAULT_UNIVERSE_DOMAIN, self._credentials.universe_domain + ).format(self._service_account_email) headers = {"Content-Type": "application/json"} body = json.dumps( {"payload": base64.b64encode(message).decode("utf-8")} ).encode("utf-8") - self._credentials.before_request(self._request, method, url, headers) - response = self._request(url=url, method=method, body=body, headers=headers) + retries = _exponential_backoff.ExponentialBackoff() + for _ in retries: + self._credentials.before_request(self._request, method, url, headers) - if response.status != http_client.OK: - raise exceptions.TransportError( - "Error calling the IAM signBlob API: {}".format(response.data) - ) + response = self._request(url=url, method=method, body=body, headers=headers) - return json.loads(response.data.decode("utf-8")) + if response.status in IAM_RETRY_CODES: + continue + + if response.status != http_client.OK: + raise exceptions.TransportError( + "Error calling the IAM signBlob API: {}".format(response.data) + ) + + return json.loads(response.data.decode("utf-8")) + raise exceptions.TransportError("exhausted signBlob endpoint retries") @property def key_id(self): diff --git a/contrib/python/google-auth/py3/google/auth/impersonated_credentials.py b/contrib/python/google-auth/py3/google/auth/impersonated_credentials.py index c42a936433..d51c8ef1e8 100644 --- a/contrib/python/google-auth/py3/google/auth/impersonated_credentials.py +++ b/contrib/python/google-auth/py3/google/auth/impersonated_credentials.py @@ -31,6 +31,7 @@ from datetime import datetime import http.client as http_client import json +from google.auth import _exponential_backoff from google.auth import _helpers from google.auth import credentials from google.auth import exceptions @@ -45,7 +46,12 @@ _DEFAULT_TOKEN_LIFETIME_SECS = 3600 # 1 hour in seconds def _make_iam_token_request( - request, principal, headers, body, iam_endpoint_override=None + request, + principal, + headers, + body, + universe_domain=credentials.DEFAULT_UNIVERSE_DOMAIN, + iam_endpoint_override=None, ): """Makes a request to the Google Cloud IAM service for an access token. Args: @@ -66,7 +72,9 @@ def _make_iam_token_request( `iamcredentials.googleapis.com` is not enabled or the `Service Account Token Creator` is not assigned """ - iam_endpoint = iam_endpoint_override or iam._IAM_ENDPOINT.format(principal) + iam_endpoint = iam_endpoint_override or iam._IAM_ENDPOINT.replace( + credentials.DEFAULT_UNIVERSE_DOMAIN, universe_domain + ).format(principal) body = json.dumps(body).encode("utf-8") @@ -218,6 +226,8 @@ class Credentials( and self._source_credentials._always_use_jwt_access ): self._source_credentials._create_self_signed_jwt(None) + + self._universe_domain = source_credentials.universe_domain self._target_principal = target_principal self._target_scopes = target_scopes self._delegates = delegates @@ -270,13 +280,16 @@ class Credentials( principal=self._target_principal, headers=headers, body=body, + universe_domain=self.universe_domain, iam_endpoint_override=self._iam_endpoint_override, ) def sign_bytes(self, message): from google.auth.transport.requests import AuthorizedSession - iam_sign_endpoint = iam._IAM_SIGN_ENDPOINT.format(self._target_principal) + iam_sign_endpoint = iam._IAM_SIGN_ENDPOINT.replace( + credentials.DEFAULT_UNIVERSE_DOMAIN, self.universe_domain + ).format(self._target_principal) body = { "payload": base64.b64encode(message).decode("utf-8"), @@ -288,18 +301,22 @@ class Credentials( authed_session = AuthorizedSession(self._source_credentials) try: - response = authed_session.post( - url=iam_sign_endpoint, headers=headers, json=body - ) + retries = _exponential_backoff.ExponentialBackoff() + for _ in retries: + response = authed_session.post( + url=iam_sign_endpoint, headers=headers, json=body + ) + if response.status_code in iam.IAM_RETRY_CODES: + continue + if response.status_code != http_client.OK: + raise exceptions.TransportError( + "Error calling sign_bytes: {}".format(response.json()) + ) + + return base64.b64decode(response.json()["signedBlob"]) finally: authed_session.close() - - if response.status_code != http_client.OK: - raise exceptions.TransportError( - "Error calling sign_bytes: {}".format(response.json()) - ) - - return base64.b64decode(response.json()["signedBlob"]) + raise exceptions.TransportError("exhausted signBlob endpoint retries") @property def signer_email(self): @@ -422,9 +439,10 @@ class IDTokenCredentials(credentials.CredentialsWithQuotaProject): def refresh(self, request): from google.auth.transport.requests import AuthorizedSession - iam_sign_endpoint = iam._IAM_IDTOKEN_ENDPOINT.format( - self._target_credentials.signer_email - ) + iam_sign_endpoint = iam._IAM_IDTOKEN_ENDPOINT.replace( + credentials.DEFAULT_UNIVERSE_DOMAIN, + self._target_credentials.universe_domain, + ).format(self._target_credentials.signer_email) body = { "audience": self._target_audience, diff --git a/contrib/python/google-auth/py3/google/auth/transport/_requests_base.py b/contrib/python/google-auth/py3/google/auth/transport/_requests_base.py index ec718d909a..0608223d8c 100644 --- a/contrib/python/google-auth/py3/google/auth/transport/_requests_base.py +++ b/contrib/python/google-auth/py3/google/auth/transport/_requests_base.py @@ -13,7 +13,8 @@ # limitations under the License. """Transport adapter for Base Requests.""" - +# NOTE: The coverage for this file is temporarily disabled in `.coveragerc` +# since it is currently unused. import abc diff --git a/contrib/python/google-auth/py3/google/auth/transport/requests.py b/contrib/python/google-auth/py3/google/auth/transport/requests.py index 68f67c59bd..23a69783dc 100644 --- a/contrib/python/google-auth/py3/google/auth/transport/requests.py +++ b/contrib/python/google-auth/py3/google/auth/transport/requests.py @@ -38,7 +38,6 @@ from google.auth import environment_vars from google.auth import exceptions from google.auth import transport import google.auth.transport._mtls_helper -from google.auth.transport._requests_base import _BaseAuthorizedSession from google.oauth2 import service_account _LOGGER = logging.getLogger(__name__) @@ -293,7 +292,7 @@ class _MutualTlsOffloadAdapter(requests.adapters.HTTPAdapter): return super(_MutualTlsOffloadAdapter, self).proxy_manager_for(*args, **kwargs) -class AuthorizedSession(requests.Session, _BaseAuthorizedSession): +class AuthorizedSession(requests.Session): """A Requests Session class with credentials. This class is used to perform requests to API endpoints that require @@ -390,7 +389,7 @@ class AuthorizedSession(requests.Session, _BaseAuthorizedSession): default_host=None, ): super(AuthorizedSession, self).__init__() - _BaseAuthorizedSession.__init__(self, credentials) + self.credentials = credentials self._refresh_status_codes = refresh_status_codes self._max_refresh_attempts = max_refresh_attempts self._refresh_timeout = refresh_timeout diff --git a/contrib/python/google-auth/py3/google/auth/version.py b/contrib/python/google-auth/py3/google/auth/version.py index 6610120c69..15dc374707 100644 --- a/contrib/python/google-auth/py3/google/auth/version.py +++ b/contrib/python/google-auth/py3/google/auth/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "2.35.0" +__version__ = "2.36.0" diff --git a/contrib/python/google-auth/py3/google/oauth2/_client.py b/contrib/python/google-auth/py3/google/oauth2/_client.py index 68e13ddc73..5a9fc3503c 100644 --- a/contrib/python/google-auth/py3/google/oauth2/_client.py +++ b/contrib/python/google-auth/py3/google/oauth2/_client.py @@ -30,6 +30,7 @@ import urllib from google.auth import _exponential_backoff from google.auth import _helpers +from google.auth import credentials from google.auth import exceptions from google.auth import jwt from google.auth import metrics @@ -319,7 +320,12 @@ def jwt_grant(request, token_uri, assertion, can_retry=True): def call_iam_generate_id_token_endpoint( - request, iam_id_token_endpoint, signer_email, audience, access_token + request, + iam_id_token_endpoint, + signer_email, + audience, + access_token, + universe_domain=credentials.DEFAULT_UNIVERSE_DOMAIN, ): """Call iam.generateIdToken endpoint to get ID token. @@ -339,7 +345,9 @@ def call_iam_generate_id_token_endpoint( response_data = _token_endpoint_request( request, - iam_id_token_endpoint.format(signer_email), + iam_id_token_endpoint.replace( + credentials.DEFAULT_UNIVERSE_DOMAIN, universe_domain + ).format(signer_email), body, access_token=access_token, use_json=True, diff --git a/contrib/python/google-auth/py3/google/oauth2/service_account.py b/contrib/python/google-auth/py3/google/oauth2/service_account.py index 98dafa3e38..3e84194ac7 100644 --- a/contrib/python/google-auth/py3/google/oauth2/service_account.py +++ b/contrib/python/google-auth/py3/google/oauth2/service_account.py @@ -812,6 +812,7 @@ class IDTokenCredentials( self.signer_email, self._target_audience, jwt_credentials.token.decode(), + self._universe_domain, ) @_helpers.copy_docstring(credentials.Credentials) diff --git a/contrib/python/google-auth/py3/tests/compute_engine/test__metadata.py b/contrib/python/google-auth/py3/tests/compute_engine/test__metadata.py index a06dc4fa19..03ba8de497 100644 --- a/contrib/python/google-auth/py3/tests/compute_engine/test__metadata.py +++ b/contrib/python/google-auth/py3/tests/compute_engine/test__metadata.py @@ -399,7 +399,7 @@ def test_get_universe_domain_success(): request.assert_called_once_with( method="GET", - url=_metadata._METADATA_ROOT + "universe/universe_domain", + url=_metadata._METADATA_ROOT + "universe/universe-domain", headers=_metadata._METADATA_HEADERS, ) assert universe_domain == "fake_universe_domain" @@ -412,7 +412,7 @@ def test_get_universe_domain_success_empty_response(): request.assert_called_once_with( method="GET", - url=_metadata._METADATA_ROOT + "universe/universe_domain", + url=_metadata._METADATA_ROOT + "universe/universe-domain", headers=_metadata._METADATA_HEADERS, ) assert universe_domain == "googleapis.com" @@ -427,7 +427,7 @@ def test_get_universe_domain_not_found(): request.assert_called_once_with( method="GET", - url=_metadata._METADATA_ROOT + "universe/universe_domain", + url=_metadata._METADATA_ROOT + "universe/universe-domain", headers=_metadata._METADATA_HEADERS, ) assert universe_domain == "googleapis.com" @@ -447,7 +447,7 @@ def test_get_universe_domain_retryable_error_failure(): request.assert_called_with( method="GET", - url=_metadata._METADATA_ROOT + "universe/universe_domain", + url=_metadata._METADATA_ROOT + "universe/universe-domain", headers=_metadata._METADATA_HEADERS, ) assert request.call_count == 5 @@ -489,12 +489,12 @@ def test_get_universe_domain_retryable_error_success(): request_error.assert_called_once_with( method="GET", - url=_metadata._METADATA_ROOT + "universe/universe_domain", + url=_metadata._METADATA_ROOT + "universe/universe-domain", headers=_metadata._METADATA_HEADERS, ) request_ok.assert_called_once_with( method="GET", - url=_metadata._METADATA_ROOT + "universe/universe_domain", + url=_metadata._METADATA_ROOT + "universe/universe-domain", headers=_metadata._METADATA_HEADERS, ) @@ -513,7 +513,7 @@ def test_get_universe_domain_other_error(): request.assert_called_once_with( method="GET", - url=_metadata._METADATA_ROOT + "universe/universe_domain", + url=_metadata._METADATA_ROOT + "universe/universe-domain", headers=_metadata._METADATA_HEADERS, ) diff --git a/contrib/python/google-auth/py3/tests/compute_engine/test_credentials.py b/contrib/python/google-auth/py3/tests/compute_engine/test_credentials.py index 662210fa41..fddfb7f64d 100644 --- a/contrib/python/google-auth/py3/tests/compute_engine/test_credentials.py +++ b/contrib/python/google-auth/py3/tests/compute_engine/test_credentials.py @@ -487,6 +487,16 @@ class TestIDTokenCredentials(object): }, ) + # mock information about universe_domain + responses.add( + responses.GET, + "http://metadata.google.internal/computeMetadata/v1/universe/" + "universe-domain", + status=200, + content_type="application/json", + json={}, + ) + # mock token for credentials responses.add( responses.GET, @@ -659,6 +669,16 @@ class TestIDTokenCredentials(object): }, ) + # stubby response about universe_domain + responses.add( + responses.GET, + "http://metadata.google.internal/computeMetadata/v1/universe/" + "universe-domain", + status=200, + content_type="application/json", + json={}, + ) + # mock sign blob endpoint signature = base64.b64encode(b"some-signature").decode("utf-8") responses.add( diff --git a/contrib/python/google-auth/py3/tests/data/impersonated_service_account_external_account_authorized_user_source.json b/contrib/python/google-auth/py3/tests/data/impersonated_service_account_external_account_authorized_user_source.json new file mode 100644 index 0000000000..0bc44c13a2 --- /dev/null +++ b/contrib/python/google-auth/py3/tests/data/impersonated_service_account_external_account_authorized_user_source.json @@ -0,0 +1,16 @@ +{ + "delegates": [ + "service-account-delegate@example.com" + ], + "service_account_impersonation_url": "https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/service-account-target@example.com:generateAccessToken", + "source_credentials": { + "type": "external_account_authorized_user", + "audience": "//iam.googleapis.com/locations/global/workforcePools/$WORKFORCE_POOL_ID/providers/$PROVIDER_ID", + "refresh_token": "refreshToken", + "token_url": "https://sts.googleapis.com/v1/oauth/token", + "token_info_url": "https://sts.googleapis.com/v1/instrospect", + "client_id": "clientId", + "client_secret": "clientSecret" + }, + "type": "impersonated_service_account" +}
\ No newline at end of file diff --git a/contrib/python/google-auth/py3/tests/oauth2/test__client.py b/contrib/python/google-auth/py3/tests/oauth2/test__client.py index 8736a4e27b..df77bbcd2f 100644 --- a/contrib/python/google-auth/py3/tests/oauth2/test__client.py +++ b/contrib/python/google-auth/py3/tests/oauth2/test__client.py @@ -325,6 +325,7 @@ def test_call_iam_generate_id_token_endpoint(): "fake_email", "fake_audience", "fake_access_token", + "googleapis.com", ) assert ( @@ -362,6 +363,7 @@ def test_call_iam_generate_id_token_endpoint_no_id_token(): "fake_email", "fake_audience", "fake_access_token", + "googleapis.com", ) assert excinfo.match("No ID token in response") diff --git a/contrib/python/google-auth/py3/tests/oauth2/test_service_account.py b/contrib/python/google-auth/py3/tests/oauth2/test_service_account.py index fe02e828e7..e60c8200f4 100644 --- a/contrib/python/google-auth/py3/tests/oauth2/test_service_account.py +++ b/contrib/python/google-auth/py3/tests/oauth2/test_service_account.py @@ -790,7 +790,7 @@ class TestIDTokenCredentials(object): ) request = mock.Mock() credentials.refresh(request) - req, iam_endpoint, signer_email, target_audience, access_token = call_iam_generate_id_token_endpoint.call_args[ + req, iam_endpoint, signer_email, target_audience, access_token, universe_domain = call_iam_generate_id_token_endpoint.call_args[ 0 ] assert req == request @@ -812,7 +812,7 @@ class TestIDTokenCredentials(object): ) request = mock.Mock() credentials.refresh(request) - req, iam_endpoint, signer_email, target_audience, access_token = call_iam_generate_id_token_endpoint.call_args[ + req, iam_endpoint, signer_email, target_audience, access_token, universe_domain = call_iam_generate_id_token_endpoint.call_args[ 0 ] assert req == request diff --git a/contrib/python/google-auth/py3/tests/test__default.py b/contrib/python/google-auth/py3/tests/test__default.py index 3147d505da..f71594fcc5 100644 --- a/contrib/python/google-auth/py3/tests/test__default.py +++ b/contrib/python/google-auth/py3/tests/test__default.py @@ -154,6 +154,11 @@ IMPERSONATED_SERVICE_ACCOUNT_SERVICE_ACCOUNT_SOURCE_FILE = os.path.join( DATA_DIR, "impersonated_service_account_service_account_source.json" ) +IMPERSONATED_SERVICE_ACCOUNT_EXTERNAL_ACCOUNT_AUTHORIZED_USER_SOURCE_FILE = os.path.join( + DATA_DIR, + "impersonated_service_account_external_account_authorized_user_source.json", +) + EXTERNAL_ACCOUNT_AUTHORIZED_USER_FILE = os.path.join( DATA_DIR, "external_account_authorized_user.json" ) @@ -366,6 +371,17 @@ def test_load_credentials_from_file_impersonated_with_service_account_source(): assert not credentials._quota_project_id +def test_load_credentials_from_file_impersonated_with_external_account_authorized_user_source(): + credentials, _ = _default.load_credentials_from_file( + IMPERSONATED_SERVICE_ACCOUNT_EXTERNAL_ACCOUNT_AUTHORIZED_USER_SOURCE_FILE + ) + assert isinstance(credentials, impersonated_credentials.Credentials) + assert isinstance( + credentials._source_credentials, external_account_authorized_user.Credentials + ) + assert not credentials._quota_project_id + + def test_load_credentials_from_file_impersonated_passing_quota_project(): credentials, _ = _default.load_credentials_from_file( IMPERSONATED_SERVICE_ACCOUNT_SERVICE_ACCOUNT_SOURCE_FILE, diff --git a/contrib/python/google-auth/py3/tests/test_iam.py b/contrib/python/google-auth/py3/tests/test_iam.py index 6706afb4b5..01c2fa085a 100644 --- a/contrib/python/google-auth/py3/tests/test_iam.py +++ b/contrib/python/google-auth/py3/tests/test_iam.py @@ -91,6 +91,7 @@ class TestSigner(object): assert returned_signature == signature kwargs = request.call_args[1] assert kwargs["headers"]["Content-Type"] == "application/json" + request.call_count == 1 def test_sign_bytes_failure(self): request = make_request(http_client.UNAUTHORIZED) @@ -100,3 +101,15 @@ class TestSigner(object): with pytest.raises(exceptions.TransportError): signer.sign("123") + request.call_count == 1 + + @mock.patch("time.sleep", return_value=None) + def test_sign_bytes_retryable_failure(self, mock_time): + request = make_request(http_client.INTERNAL_SERVER_ERROR) + credentials = make_credentials() + + signer = iam.Signer(request, credentials, mock.sentinel.service_account_email) + + with pytest.raises(exceptions.TransportError): + signer.sign("123") + request.call_count == 3 diff --git a/contrib/python/google-auth/py3/tests/test_impersonated_credentials.py b/contrib/python/google-auth/py3/tests/test_impersonated_credentials.py index 4fb68103a8..371477b8a9 100644 --- a/contrib/python/google-auth/py3/tests/test_impersonated_credentials.py +++ b/contrib/python/google-auth/py3/tests/test_impersonated_credentials.py @@ -147,6 +147,13 @@ class TestImpersonatedCredentials(object): "principal": "impersonated@project.iam.gserviceaccount.com", } + def test_universe_domain_matching_source(self): + source_credentials = service_account.Credentials( + SIGNER, "some@email.com", TOKEN_URI, universe_domain="foo.bar" + ) + credentials = self.make_credentials(source_credentials=source_credentials) + assert credentials.universe_domain == "foo.bar" + def test__make_copy_get_cred_info(self): credentials = self.make_credentials() credentials._cred_file_path = "/path/to/file" @@ -233,6 +240,38 @@ class TestImpersonatedCredentials(object): ) @pytest.mark.parametrize("use_data_bytes", [True, False]) + def test_refresh_success_nonGdu(self, use_data_bytes, mock_donor_credentials): + source_credentials = service_account.Credentials( + SIGNER, "some@email.com", TOKEN_URI, universe_domain="foo.bar" + ) + credentials = self.make_credentials( + lifetime=None, source_credentials=source_credentials + ) + token = "token" + + expire_time = ( + _helpers.utcnow().replace(microsecond=0) + datetime.timedelta(seconds=500) + ).isoformat("T") + "Z" + response_body = {"accessToken": token, "expireTime": expire_time} + + request = self.make_request( + data=json.dumps(response_body), + status=http_client.OK, + use_data_bytes=use_data_bytes, + ) + + credentials.refresh(request) + + assert credentials.valid + assert not credentials.expired + # Confirm override endpoint used. + request_kwargs = request.call_args[1] + assert ( + request_kwargs["url"] + == "https://iamcredentials.foo.bar/v1/projects/-/serviceAccounts/impersonated@project.iam.gserviceaccount.com:generateAccessToken" + ) + + @pytest.mark.parametrize("use_data_bytes", [True, False]) def test_refresh_success_iam_endpoint_override( self, use_data_bytes, mock_donor_credentials ): @@ -398,6 +437,38 @@ class TestImpersonatedCredentials(object): def test_sign_bytes(self, mock_donor_credentials, mock_authorizedsession_sign): credentials = self.make_credentials(lifetime=None) + expected_url = "https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/impersonated@project.iam.gserviceaccount.com:signBlob" + self._sign_bytes_helper( + credentials, + mock_donor_credentials, + mock_authorizedsession_sign, + expected_url, + ) + + def test_sign_bytes_nonGdu( + self, mock_donor_credentials, mock_authorizedsession_sign + ): + source_credentials = service_account.Credentials( + SIGNER, "some@email.com", TOKEN_URI, universe_domain="foo.bar" + ) + credentials = self.make_credentials( + lifetime=None, source_credentials=source_credentials + ) + expected_url = "https://iamcredentials.foo.bar/v1/projects/-/serviceAccounts/impersonated@project.iam.gserviceaccount.com:signBlob" + self._sign_bytes_helper( + credentials, + mock_donor_credentials, + mock_authorizedsession_sign, + expected_url, + ) + + def _sign_bytes_helper( + self, + credentials, + mock_donor_credentials, + mock_authorizedsession_sign, + expected_url, + ): token = "token" expire_time = ( @@ -413,11 +484,19 @@ class TestImpersonatedCredentials(object): request.return_value = response credentials.refresh(request) - assert credentials.valid assert not credentials.expired signature = credentials.sign_bytes(b"signed bytes") + mock_authorizedsession_sign.assert_called_with( + mock.ANY, + "POST", + expected_url, + None, + json={"payload": "c2lnbmVkIGJ5dGVz", "delegates": []}, + headers={"Content-Type": "application/json"}, + ) + assert signature == b"signature" def test_sign_bytes_failure(self): @@ -427,12 +506,28 @@ class TestImpersonatedCredentials(object): "google.auth.transport.requests.AuthorizedSession.request", autospec=True ) as auth_session: data = {"error": {"code": 403, "message": "unauthorized"}} - auth_session.return_value = MockResponse(data, http_client.FORBIDDEN) + mock_response = MockResponse(data, http_client.UNAUTHORIZED) + auth_session.return_value = mock_response with pytest.raises(exceptions.TransportError) as excinfo: credentials.sign_bytes(b"foo") assert excinfo.match("'code': 403") + @mock.patch("time.sleep", return_value=None) + def test_sign_bytes_retryable_failure(self, mock_time): + credentials = self.make_credentials(lifetime=None) + + with mock.patch( + "google.auth.transport.requests.AuthorizedSession.request", autospec=True + ) as auth_session: + data = {"error": {"code": 500, "message": "internal_failure"}} + mock_response = MockResponse(data, http_client.INTERNAL_SERVER_ERROR) + auth_session.return_value = mock_response + + with pytest.raises(exceptions.TransportError) as excinfo: + credentials.sign_bytes(b"foo") + assert excinfo.match("exhausted signBlob endpoint retries") + def test_with_quota_project(self): credentials = self.make_credentials() @@ -548,6 +643,45 @@ class TestImpersonatedCredentials(object): self, mock_donor_credentials, mock_authorizedsession_idtoken ): credentials = self.make_credentials(lifetime=None) + target_credentials = self.make_credentials(lifetime=None) + expected_url = "https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/impersonated@project.iam.gserviceaccount.com:generateIdToken" + self._test_id_token_helper( + credentials, + target_credentials, + mock_donor_credentials, + mock_authorizedsession_idtoken, + expected_url, + ) + + def test_id_token_from_credential_nonGdu( + self, mock_donor_credentials, mock_authorizedsession_idtoken + ): + source_credentials = service_account.Credentials( + SIGNER, "some@email.com", TOKEN_URI, universe_domain="foo.bar" + ) + credentials = self.make_credentials( + lifetime=None, source_credentials=source_credentials + ) + target_credentials = self.make_credentials( + lifetime=None, source_credentials=source_credentials + ) + expected_url = "https://iamcredentials.foo.bar/v1/projects/-/serviceAccounts/impersonated@project.iam.gserviceaccount.com:generateIdToken" + self._test_id_token_helper( + credentials, + target_credentials, + mock_donor_credentials, + mock_authorizedsession_idtoken, + expected_url, + ) + + def _test_id_token_helper( + self, + credentials, + target_credentials, + mock_donor_credentials, + mock_authorizedsession_idtoken, + expected_url, + ): token = "token" target_audience = "https://foo.bar" @@ -565,17 +699,19 @@ class TestImpersonatedCredentials(object): assert credentials.valid assert not credentials.expired - new_credentials = self.make_credentials(lifetime=None) - id_creds = impersonated_credentials.IDTokenCredentials( credentials, target_audience=target_audience, include_email=True ) - id_creds = id_creds.from_credentials(target_credentials=new_credentials) + id_creds = id_creds.from_credentials(target_credentials=target_credentials) id_creds.refresh(request) + args = mock_authorizedsession_idtoken.call_args.args + + assert args[2] == expected_url + assert id_creds.token == ID_TOKEN_DATA assert id_creds._include_email is True - assert id_creds._target_credentials is new_credentials + assert id_creds._target_credentials is target_credentials def test_id_token_with_target_audience( self, mock_donor_credentials, mock_authorizedsession_idtoken diff --git a/contrib/python/google-auth/py3/ya.make b/contrib/python/google-auth/py3/ya.make index 60146f91a4..a518b37365 100644 --- a/contrib/python/google-auth/py3/ya.make +++ b/contrib/python/google-auth/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(2.35.0) +VERSION(2.36.0) LICENSE(Apache-2.0) diff --git a/contrib/python/pythran/.dist-info/METADATA b/contrib/python/pythran/.dist-info/METADATA index 66c4bc9778..f68434e090 100644 --- a/contrib/python/pythran/.dist-info/METADATA +++ b/contrib/python/pythran/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pythran -Version: 0.16.1 +Version: 0.17.0 Summary: Ahead of Time compiler for numeric kernels Author-email: Serge Guelton <serge.guelton@telecom-bretagne.eu> License: Copyright (c) 2012, HPC Project and Serge Guelton @@ -52,22 +52,24 @@ Requires-Python: >=3.7 Description-Content-Type: text/x-rst License-File: LICENSE License-File: AUTHORS -Requires-Dist: ply>=3.4 +Requires-Dist: ply >=3.4 Requires-Dist: setuptools -Requires-Dist: gast~=0.5.0 +Requires-Dist: gast ~=0.6.0 Requires-Dist: numpy -Requires-Dist: beniget~=0.4.0 +Requires-Dist: beniget ~=0.4.0 Provides-Extra: doc -Requires-Dist: numpy; extra == "doc" -Requires-Dist: nbsphinx; extra == "doc" -Requires-Dist: scipy; extra == "doc" -Requires-Dist: guzzle-sphinx-theme; extra == "doc" +Requires-Dist: numpy ; extra == 'doc' +Requires-Dist: nbsphinx ; extra == 'doc' +Requires-Dist: scipy ; extra == 'doc' +Requires-Dist: guzzle-sphinx-theme ; extra == 'doc' Provides-Extra: test -Requires-Dist: ipython; extra == "test" -Requires-Dist: nbval; extra == "test" -Requires-Dist: cython; extra == "test" -Requires-Dist: wheel; extra == "test" -Requires-Dist: packaging; extra == "test" +Requires-Dist: ipython ; extra == 'test' +Requires-Dist: nbval ; extra == 'test' +Requires-Dist: cython ; extra == 'test' +Requires-Dist: wheel ; extra == 'test' +Requires-Dist: packaging ; extra == 'test' +Requires-Dist: ninja ; extra == 'test' +Requires-Dist: meson ; extra == 'test' Pythran ####### diff --git a/contrib/python/pythran/pythran/analyses/__init__.py b/contrib/python/pythran/pythran/analyses/__init__.py index 8560129b07..3c149f9b0b 100644 --- a/contrib/python/pythran/pythran/analyses/__init__.py +++ b/contrib/python/pythran/pythran/analyses/__init__.py @@ -9,7 +9,7 @@ into import analyses.Foo """ -from .aliases import Aliases, StrictAliases +from .aliases import Aliases, StrictAliases, InterproceduralAliases from .ancestors import Ancestors, AncestorsWithBody from .argument_effects import ArgumentEffects from .argument_read_once import ArgumentReadOnce diff --git a/contrib/python/pythran/pythran/analyses/aliases.py b/contrib/python/pythran/pythran/analyses/aliases.py index 1266b7cfd0..79f050e711 100644 --- a/contrib/python/pythran/pythran/analyses/aliases.py +++ b/contrib/python/pythran/pythran/analyses/aliases.py @@ -544,6 +544,11 @@ class Aliases(ModuleAnalysis): # aliasing created by statements + def init_function_alias(self, node): + "each argument is bound to a different identifier" + self.aliases.update((arg.id, {arg}) + for arg in node.args.args) + def visit_FunctionDef(self, node): ''' Initialise aliasing default value before visiting. @@ -558,8 +563,7 @@ class Aliases(ModuleAnalysis): self.aliases.update((k, {v}) for k, v in self.global_declarations.items()) - self.aliases.update((arg.id, {arg}) - for arg in node.args.args) + self.init_function_alias(node) self.generic_visit(node) if Aliases.RetId in self.aliases: @@ -612,6 +616,27 @@ class Aliases(ModuleAnalysis): node.return_alias = merge_return_aliases + def visit_Assert(self, node): + self.generic_visit(node) + + if not isinstance(node.test, ast.Compare): + return + if len(node.test.ops) != 1: + return + op = node.test.ops[0] + comparator = node.test.comparators[0] + + if not isinstance(node.test.left, ast.Name): + return + if not isinstance(comparator, ast.Name): + return + + if isinstance(op, ast.IsNot): + left_aliases = self.aliases[node.test.left.id] + right_aliases = self.aliases[comparator.id] + self.aliases[node.test.left.id] = self.aliases[node.test.left.id].difference(right_aliases) + right_aliases.difference_update(left_aliases) + def visit_Assign(self, node): r''' Assignment creates aliasing between lhs and rhs @@ -626,8 +651,9 @@ class Aliases(ModuleAnalysis): Everyone points to the formal parameter 'a' \o/ ''' md.visit(self, node) - value_aliases = self.visit(node.value) - for t in node.targets: + value_aliases = self.visit(node.value) if node.value else {} + targets = node.targets if isinstance(node, ast.Assign) else (node.target,) + for t in targets: if isinstance(t, ast.Name): self.aliases[t.id] = set(value_aliases) or {t} for alias in list(value_aliases): @@ -638,6 +664,8 @@ class Aliases(ModuleAnalysis): else: self.visit(t) + visit_AnnAssign = visit_Assign + def visit_For(self, node): ''' For loop creates aliasing between the target @@ -786,3 +814,14 @@ class StrictAliases(Aliases): def get_unbound_value_set(self): return set() + + +class InterproceduralAliases(Aliases): + """ + Gather aliases while assuming two different parameters can point to the same + value + """ + + def init_function_alias(self, node): + self.aliases.update((arg.id, set(node.args.args)) + for arg in node.args.args) diff --git a/contrib/python/pythran/pythran/analyses/argument_effects.py b/contrib/python/pythran/pythran/analyses/argument_effects.py index f89f4f6883..808b86349c 100644 --- a/contrib/python/pythran/pythran/analyses/argument_effects.py +++ b/contrib/python/pythran/pythran/analyses/argument_effects.py @@ -135,13 +135,16 @@ class ArgumentEffects(ModuleAnalysis): self.generic_visit(node) def visit_Assign(self, node): - for t in node.targets: + targets = node.targets if isinstance(node, ast.Assign) else (node.target,) + for t in targets: if isinstance(t, ast.Subscript): n = self.argument_index(t) if n >= 0: self.current_function.update_effects[n] = True self.generic_visit(node) + visit_AnnAssign = visit_Assign + def visit_Call(self, node): for i, arg in enumerate(node.args): n = self.argument_index(arg) diff --git a/contrib/python/pythran/pythran/analyses/argument_read_once.py b/contrib/python/pythran/pythran/analyses/argument_read_once.py index a30fa5a098..8210fc70d7 100644 --- a/contrib/python/pythran/pythran/analyses/argument_read_once.py +++ b/contrib/python/pythran/pythran/analyses/argument_read_once.py @@ -147,10 +147,13 @@ class ArgumentReadOnce(ModuleAnalysis): def visit_Assign(self, node): dep = self.generic_visit(node) - local = [self.local_effect(t, 2) for t in node.targets + targets = node.targets if isinstance(node, ast.Assign) else (node.target,) + local = [self.local_effect(t, 2) for t in targets if isinstance(t, ast.Subscript)] return lambda ctx: dep(ctx) + sum(l(ctx) for l in local) + visit_AnnAssign = visit_Assign + def visit_AugAssign(self, node): dep = self.generic_visit(node) local = self.local_effect(node.target, 2) diff --git a/contrib/python/pythran/pythran/analyses/cfg.py b/contrib/python/pythran/pythran/analyses/cfg.py index 7006b3eb2e..b2e9de78f4 100644 --- a/contrib/python/pythran/pythran/analyses/cfg.py +++ b/contrib/python/pythran/pythran/analyses/cfg.py @@ -61,7 +61,7 @@ class CFG(FunctionAnalysis): return (node,), () # All these nodes have the same behavior as pass - visit_Assign = visit_AugAssign = visit_Import = visit_Pass + visit_Assign = visit_AnnAssign = visit_AugAssign = visit_Import = visit_Pass visit_Expr = visit_Print = visit_ImportFrom = visit_Pass visit_Yield = visit_Delete = visit_Pass diff --git a/contrib/python/pythran/pythran/analyses/constant_expressions.py b/contrib/python/pythran/pythran/analyses/constant_expressions.py index ce90617a78..7c6e3938f7 100644 --- a/contrib/python/pythran/pythran/analyses/constant_expressions.py +++ b/contrib/python/pythran/pythran/analyses/constant_expressions.py @@ -99,3 +99,9 @@ class ConstantExpressions(NodeAnalysis): def visit_Index(self, node): return self.visit(node.value) and self.add(node) + + def visit_AnnAssign(self, node): + self.visit(node.target) + # skip annotation + if node.value: + self.visit(node.value) diff --git a/contrib/python/pythran/pythran/analyses/fixed_size_list.py b/contrib/python/pythran/pythran/analyses/fixed_size_list.py index 956473226d..1d05d2dc42 100644 --- a/contrib/python/pythran/pythran/analyses/fixed_size_list.py +++ b/contrib/python/pythran/pythran/analyses/fixed_size_list.py @@ -57,10 +57,13 @@ class FixedSizeList(FunctionAnalysis): def visit_Assign(self, node): self.generic_visit(node) + if not node.value: + return if not self.is_fixed_size_list_def(node.value): return - for target in node.targets: + targets = node.targets if isinstance(node, ast.Assign) else (node.target,) + for target in targets: def_ = self.def_use_chains.chains[target] if any(not self.is_safe_use(u) for u in def_.users()): break @@ -72,6 +75,8 @@ class FixedSizeList(FunctionAnalysis): else: self.result.add(node.value) + visit_AnnAssign = visit_Assign + def visit_Call(self, node): self.generic_visit(node) for i, arg in enumerate(node.args): diff --git a/contrib/python/pythran/pythran/analyses/imported_ids.py b/contrib/python/pythran/pythran/analyses/imported_ids.py index 2abafcdef5..4df642bcee 100644 --- a/contrib/python/pythran/pythran/analyses/imported_ids.py +++ b/contrib/python/pythran/pythran/analyses/imported_ids.py @@ -50,10 +50,14 @@ class ImportedIds(NodeAnalysis): # order matter as an assignation # is evaluated before being assigned md.visit(self, node) - self.visit(node.value) - for target in node.targets: + if node.value: + self.visit(node.value) + targets = node.targets if isinstance(node, ast.Assign) else (node.target,) + for target in targets: self.visit(target) + visit_AnnAssign = visit_Assign + def visit_AugAssign(self, node): self.in_augassign = True self.generic_visit(node) diff --git a/contrib/python/pythran/pythran/analyses/lazyness_analysis.py b/contrib/python/pythran/pythran/analyses/lazyness_analysis.py index 0efdaef374..5589231080 100644 --- a/contrib/python/pythran/pythran/analyses/lazyness_analysis.py +++ b/contrib/python/pythran/pythran/analyses/lazyness_analysis.py @@ -159,9 +159,13 @@ class LazynessAnalysis(FunctionAnalysis): def visit_Assign(self, node): md.visit(self, node) - self.visit(node.value) - ids = self.gather(Identifiers, node.value) - for target in node.targets: + if node.value: + self.visit(node.value) + ids = self.gather(Identifiers, node.value) + else: + ids = set() + targets = node.targets if isinstance(node, ast.Assign) else (node.target,) + for target in targets: if isinstance(target, ast.Name): self.assign_to(target, ids) if node.value not in self.pure_expressions: @@ -177,6 +181,8 @@ class LazynessAnalysis(FunctionAnalysis): else: raise PythranSyntaxError("Assign to unknown node", node) + visit_AnnAssign = visit_Assign + def visit_AugAssign(self, node): md.visit(self, node) # augassigned variable can't be lazy diff --git a/contrib/python/pythran/pythran/analyses/literals.py b/contrib/python/pythran/pythran/analyses/literals.py index 47c71950ef..929e8c4e6a 100644 --- a/contrib/python/pythran/pythran/analyses/literals.py +++ b/contrib/python/pythran/pythran/analyses/literals.py @@ -20,6 +20,8 @@ class Literals(FunctionAnalysis): # a constructor which may be costly and they can be updated using # function call if isinstance(node.value, (ast.Constant, ast.Lambda)): - targets = [target for target in node.targets + targets = node.targets if isinstance(node, ast.Assign) else (node.target,) + targets = [target for target in targets if isinstance(target, ast.Name)] self.result.update(targets) + visit_AnnAssign = visit_Assign diff --git a/contrib/python/pythran/pythran/analyses/locals_analysis.py b/contrib/python/pythran/pythran/analyses/locals_analysis.py index 91ebb56e7f..0d76584521 100644 --- a/contrib/python/pythran/pythran/analyses/locals_analysis.py +++ b/contrib/python/pythran/pythran/analyses/locals_analysis.py @@ -82,12 +82,18 @@ class Locals(ModuleAnalysis): self.expr_parent = node self.result[node] = self.locals.copy() md.visit(self, node) - self.visit(node.value) - self.locals.update(t.id for t in node.targets + if node.value: + self.visit(node.value) + targets = node.targets if isinstance(node, ast.Assign) else (node.target,) + self.locals.update(t.id for t in targets if isinstance(t, ast.Name)) - for target in node.targets: + for target in targets: self.visit(target) + def visit_AnnAssign(self, node): + self.visit_Assign(node) + self.visit(node.annotation) + def visit_For(self, node): self.expr_parent = node self.result[node] = self.locals.copy() diff --git a/contrib/python/pythran/pythran/analyses/range_values.py b/contrib/python/pythran/pythran/analyses/range_values.py index 2b9a8cf001..bc11d37b47 100644 --- a/contrib/python/pythran/pythran/analyses/range_values.py +++ b/contrib/python/pythran/pythran/analyses/range_values.py @@ -579,14 +579,19 @@ class RangeValuesSimple(RangeValuesBase): >>> res['b'] Interval(low=2, high=2) """ + if not node.value: + return assigned_range = self.visit(node.value) - for target in node.targets: + targets = node.targets if isinstance(node, ast.Assign) else (node.target,) + for target in targets: if isinstance(target, ast.Name): # Make sure all Interval doesn't alias for multiple variables. self.add(target.id, assigned_range) else: self.visit(target) + visit_AnnAssign = visit_Assign + def visit_AugAssign(self, node): """ Update range value for augassigned variables. diff --git a/contrib/python/pythran/pythran/backend.py b/contrib/python/pythran/pythran/backend.py index c5de8d6461..cb0f77c1cc 100644 --- a/contrib/python/pythran/pythran/backend.py +++ b/contrib/python/pythran/pythran/backend.py @@ -408,26 +408,29 @@ class CxxFunction(ast.NodeVisitor): Finally, process OpenMP clause like #pragma omp atomic """ + targets = node.targets if isinstance(node, ast.Assign) else (node.target,) if not all(isinstance(n, (ast.Name, ast.Subscript)) - for n in node.targets): + for n in targets): raise PythranSyntaxError( "Must assign to an identifier or a subscript", node) + if not node.value: + return self.visit_Pass(node) value = self.visit(node.value) - targets = [self.visit(t) for t in node.targets] - alltargets = "= ".join(targets) - islocal = (len(targets) == 1 and - isinstance(node.targets[0], ast.Name) and - node.targets[0].id in self.scope[node] and - node.targets[0].id not in self.openmp_deps) + stargets = [self.visit(t) for t in targets] + alltargets = "= ".join(stargets) + islocal = (len(stargets) == 1 and + isinstance(targets[0], ast.Name) and + targets[0].id in self.scope[node] and + targets[0].id not in self.openmp_deps) if islocal: # remove this decls from local decls - self.ldecls.difference_update(t.id for t in node.targets) + self.ldecls.difference_update(t.id for t in targets) # add a local declaration - if self.types[node.targets[0]].iscombined(): - alltargets = '{} {}'.format(self.typeof(node.targets[0]), + if self.types[targets[0]].iscombined(): + alltargets = '{} {}'.format(self.typeof(targets[0]), alltargets) - elif isinstance(self.types[node.targets[0]], + elif isinstance(self.types[targets[0]], self.types.builder.Assignable): alltargets = '{} {}'.format( self.types.builder.AssignableNoEscape( @@ -435,7 +438,7 @@ class CxxFunction(ast.NodeVisitor): 'decltype({})'.format(value))).sgenerate(), alltargets) else: - assert isinstance(self.types[node.targets[0]], + assert isinstance(self.types[targets[0]], self.types.builder.Lazy) alltargets = '{} {}'.format( self.types.builder.Lazy( @@ -445,6 +448,8 @@ class CxxFunction(ast.NodeVisitor): stmt = Assign(alltargets, value) return self.process_omp_attachements(node, stmt) + visit_AnnAssign = visit_Assign + def visit_AugAssign(self, node): value = self.visit(node.value) target = self.visit(node.target) @@ -907,7 +912,7 @@ class CxxFunction(ast.NodeVisitor): body = self.visit(node.body) orelse = self.visit(node.orelse) return ( - "(((bool){0}) " + "(pythonic::builtins::functor::bool_{{}}({0}) " "? typename __combined<decltype({1}), decltype({2})>::type({1}) " ": typename __combined<decltype({1}), decltype({2})>::type({2}))" ).format(test, body, orelse) @@ -1026,9 +1031,13 @@ class CxxFunction(ast.NodeVisitor): else: ret = repr(node.value) + TYPE_TO_SUFFIX.get(type(node.value), "") if node in self.immediates: - assert isinstance(node.value, int) - return "std::integral_constant<%s, %s>{}" % ( - PYTYPE_TO_CTYPE_TABLE[type(node.value)], str(node.value).lower()) + if isinstance(node.value, int): + return "std::integral_constant<%s, %s>{}" % ( + PYTYPE_TO_CTYPE_TABLE[type(node.value)], str(node.value).lower()) + if isinstance(node.value, str): + assert len(node.value) == 1 + return "std::integral_constant<char, '%s'>{}" % node.value + raise PythranSyntaxError("Unsupported immediate type", node) return ret def visit_Attribute(self, node): @@ -1321,12 +1330,17 @@ class CxxGenerator(CxxFunction): ]).generate()) def visit_Assign(self, node): + if not node.value: + return self.visit_Pass(node) value = self.visit(node.value) - targets = [self.visit(t) for t in node.targets] + targets = node.targets if isinstance(node, ast.Assign) else (node.target,) + targets = [self.visit(t) for t in targets] alltargets = "= ".join(targets) stmt = Assign(alltargets, value) return self.process_omp_attachements(node, stmt) + visit_AnnAssign = visit_Assign + def can_use_autofor(self, node): """ TODO : Yield should block only if it is use in the for loop, not in the diff --git a/contrib/python/pythran/pythran/config.py b/contrib/python/pythran/pythran/config.py index c8d09640c7..053c26d3d8 100644 --- a/contrib/python/pythran/pythran/config.py +++ b/contrib/python/pythran/pythran/config.py @@ -193,6 +193,11 @@ def make_extension(python, **extra): "extra_objects": [] } + # In case the extension doesn't include any optimization level, make sure we + # have a decent default. Later options have prcedence so this is still + # customizable by users. + extension['extra_compile_args'].insert(0, "-O2") + if python: extension['define_macros'].append('ENABLE_PYTHON_MODULE') extension['define_macros'].append( @@ -234,7 +239,7 @@ def make_extension(python, **extra): extension['include_dirs'].append(numpy.get_include()) # blas dependency - reserved_blas_entries = 'pythran-openblas', 'none' + reserved_blas_entries = 'scipy-openblas', 'pythran-openblas', 'none' user_blas = cfg.get('compiler', 'blas') if user_blas == 'pythran-openblas': try: @@ -250,24 +255,28 @@ def make_extension(python, **extra): "Please install it or change the compiler.blas " "setting. Defaulting to 'none'") user_blas = 'none' + elif user_blas == 'scipy-openblas': + try: + import scipy_openblas64 as openblas + # required to cope with atlas missing extern "C" + extension['define_macros'].append('PYTHRAN_BLAS_SCIPY_OPENBLAS') + extension['include_dirs'].append(openblas.get_include_dir()) + extension['library_dirs'].append(openblas.get_lib_dir()) + extension['libraries'].append(openblas.get_library()) + extension['extra_link_args'].append("-Wl,-rpath=" + openblas.get_lib_dir()) + except ImportError: + logger.warning("Failed to find 'scipy-openblas64' package. " + "Please install it or change the compiler.blas " + "setting. Defaulting to 'none'") + user_blas = 'none' + if user_blas == 'none': extension['define_macros'].append('PYTHRAN_BLAS_NONE') if user_blas not in reserved_blas_entries: - try: - import numpy.distutils.system_info as numpy_sys - # Numpy can pollute stdout with checks - with silent(): - numpy_blas = numpy_sys.get_info(user_blas) - extension['libraries'].extend(numpy_blas.get('libraries', [])) - extension['library_dirs'].extend( - numpy_blas.get('library_dirs', [])) - # `numpy.distutils` not present for Python >= 3.12 - except ImportError: - blas = numpy.show_config('dicts')["Build Dependencies"]["blas"] - libblas = {'openblas64': 'openblas'}.get(blas['name'], blas['name']) - extension["libraries"].append(libblas) + extension["libraries"].append(user_blas) + extension['define_macros'].append('PYTHRAN_BLAS_{}'.format(user_blas.upper())) # final macro normalization @@ -327,6 +336,10 @@ def run(): parser.add_argument('--no-python', action='store_true', help='do not include Python-related flags') + parser.add_argument('-V', '--version', + action='version', + version=pythran.version.__version__) + parser.add_argument('--verbose', '-v', action='count', default=0, help=( 'verbose mode: [-v] prints warnings if pythranrc ' @@ -382,20 +395,22 @@ def run(): if args.libs or args.verbose >= 2: ldflags = [] - ldflags.extend((compiler_obj.library_dir_option(include)) + ldflags.extend(('-L' + compiler_obj.library_dir_option(include)) for include in extension['library_dirs']) ldflags.extend((compiler_obj.library_option(include)) for include in extension['libraries']) if args.python: - libpl = distutils.sysconfig.get_config_var('LIBPL') - if libpl: - ldflags.append(libpl) libs = distutils.sysconfig.get_config_var('LIBS') if libs: ldflags.extend(shsplit(libs)) - ldflags.append(compiler_obj.library_option('python') - + distutils.sysconfig.get_config_var('VERSION')) + libdir = distutils.sysconfig.get_config_var('LIBDIR') + pylib = distutils.sysconfig.get_config_var('LDLIBRARY') + if libdir and pylib: + ldflags.append(os.path.join(libdir, pylib)) + else: + ldflags.append(compiler_obj.library_option('python') + + distutils.sysconfig.get_config_var('VERSION')) logger.info('LDFLAGS = '.rjust(10) + ' '.join(ldflags)) if args.libs: diff --git a/contrib/python/pythran/pythran/graph.py b/contrib/python/pythran/pythran/graph.py index 83626eb8ba..7a29337e27 100644 --- a/contrib/python/pythran/pythran/graph.py +++ b/contrib/python/pythran/pythran/graph.py @@ -63,71 +63,3 @@ def has_path(graph, src, dest): return True worklist.extend(graph.successors(current)) return False - -# Copied verbatim from NetworkX 2.6.1 -# -# NetworkX is distributed with the 3-clause BSD license. -# -# :: -# -# Copyright (C) 2004-2021, NetworkX Developers -# Aric Hagberg <hagberg@lanl.gov> -# Dan Schult <dschult@colgate.edu> -# Pieter Swart <swart@lanl.gov> -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# -# * Neither the name of the NetworkX Developers nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -def _all_simple_paths_graph(G, source, targets, cutoff): - visited = dict.fromkeys([source]) - stack = [iter(G[source])] - while stack: - children = stack[-1] - child = next(children, None) - if child is None: - stack.pop() - visited.popitem() - elif len(visited) < cutoff: - if child in visited: - continue - if child in targets: - yield list(visited) + [child] - visited[child] = None - if targets - set(visited.keys()): # expand stack until find all targets - stack.append(iter(G[child])) - else: - visited.popitem() # maybe other ways to child - else: # len(visited) == cutoff: - for target in (targets & (set(children) | {child})) - set(visited.keys()): - yield list(visited) + [target] - stack.pop() - visited.popitem() - -def all_simple_paths(graph, src, target): - return _all_simple_paths_graph(graph, src, {target}, len(graph) - 1) diff --git a/contrib/python/pythran/pythran/interval.py b/contrib/python/pythran/pythran/interval.py index 4e5dff8fd9..b8ef42e694 100644 --- a/contrib/python/pythran/pythran/interval.py +++ b/contrib/python/pythran/pythran/interval.py @@ -196,13 +196,15 @@ class Interval(object): >>> Interval(1, 5) ** Interval(-5, -4) Interval(low=1.0, high=1.0) >>> Interval(-1, 5) ** Interval(-5, 3) - Interval(low=-1.0, high=125.0) + Interval(low=-1.0, high=125) >>> Interval(1, 5) ** Interval(3, 8) - Interval(low=1.0, high=390625.0) + Interval(low=1, high=390625) """ res = [v1 ** v2 for v1, v2 in itertools.product(range1.bounds(), range2.bounds())] - return Interval(numpy.ceil(min(res)), numpy.floor(max(res))) + minres, maxres = min(res), max(res) + return Interval(type(minres)(numpy.ceil(minres)), + type(maxres)(numpy.floor(maxres))) def __lshift__(range1, range2): """ diff --git a/contrib/python/pythran/pythran/optimizations/__init__.py b/contrib/python/pythran/pythran/optimizations/__init__.py index 899e6ce876..c42c1e08dd 100644 --- a/contrib/python/pythran/pythran/optimizations/__init__.py +++ b/contrib/python/pythran/pythran/optimizations/__init__.py @@ -13,6 +13,7 @@ import optimisations.xxxxx from .constant_folding import ConstantFolding, PartialConstantFolding from .copyto import CopyTo from .dead_code_elimination import DeadCodeElimination +from .fast_gexpr import FastGExpr from .forward_substitution import ForwardSubstitution, PreInliningForwardSubstitution from .iter_transformation import IterTransformation from .comprehension_patterns import ComprehensionPatterns diff --git a/contrib/python/pythran/pythran/optimizations/constant_folding.py b/contrib/python/pythran/pythran/optimizations/constant_folding.py index 726a217fe9..5bf1f3e023 100644 --- a/contrib/python/pythran/pythran/optimizations/constant_folding.py +++ b/contrib/python/pythran/pythran/optimizations/constant_folding.py @@ -93,8 +93,11 @@ class ConstEval(ast.NodeVisitor): self.locals.pop(node.id) def visit_Assign(self, node): + if not node.value: + return value = self.visit(node.value) - for target in node.targets: + targets = node.targets if isinstance(node, ast.Assign) else (node.target,) + for target in targets: if isinstance(target, ast.Name): self.locals[target.id] = value elif isinstance(target, ast.Subscript): @@ -102,6 +105,8 @@ class ConstEval(ast.NodeVisitor): else: raise NotImplementedError("assign") + visit_AnnAssign = visit_Assign + def visit_AugAssign(self, node): value = self.visit(node.value) ty = type(node.op) diff --git a/contrib/python/pythran/pythran/optimizations/copyto.py b/contrib/python/pythran/pythran/optimizations/copyto.py index 33aa79fcc5..e95d7194ec 100644 --- a/contrib/python/pythran/pythran/optimizations/copyto.py +++ b/contrib/python/pythran/pythran/optimizations/copyto.py @@ -68,9 +68,12 @@ class CopyTo(Transformation): return node def visit_Assign(self, node): - if len(node.targets) != 1: + if not node.value: return node - target, = node.targets + targets = node.targets if isinstance(node, ast.Assign) else (node.target,) + if len(targets) != 1: + return node + target, = targets if not self.is_fully_sliced(target): return node if self.is_fully_sliced(node.value): @@ -87,5 +90,6 @@ class CopyTo(Transformation): [target.value, value], []) ) + visit_AnnAssign = visit_Assign diff --git a/contrib/python/pythran/pythran/optimizations/dead_code_elimination.py b/contrib/python/pythran/pythran/optimizations/dead_code_elimination.py index c4077380de..fd1a6b91dc 100644 --- a/contrib/python/pythran/pythran/optimizations/dead_code_elimination.py +++ b/contrib/python/pythran/pythran/optimizations/dead_code_elimination.py @@ -91,15 +91,26 @@ class DeadCodeElimination(Transformation): if self.used_target(target)] if len(targets) == len(node.targets): return node - node.targets = targets self.update = True if targets: + node.targets = targets return node if node.value in self.pure_expressions: return ast.Pass() else: return ast.Expr(value=node.value) + def visit_AnnAssign(self, node): + if not node.value: + return node + if self.used_target(node.target): + return node + self.update = True + if node.value in self.pure_expressions: + return ast.Pass() + else: + return ast.Expr(value=node.value) + def visit_Expr(self, node): if (node.value in self.pure_expressions and not isinstance(node.value, ast.Yield)): diff --git a/contrib/python/pythran/pythran/optimizations/fast_gexpr.py b/contrib/python/pythran/pythran/optimizations/fast_gexpr.py new file mode 100644 index 0000000000..8fe23b33d0 --- /dev/null +++ b/contrib/python/pythran/pythran/optimizations/fast_gexpr.py @@ -0,0 +1,73 @@ +""" Optimize a[...] = b[...] + c when we have no conflicting aliasing """ + +from pythran.analyses import InterproceduralAliases +from pythran.passmanager import Transformation + +import gast as ast + + +class FastGExpr(Transformation): + + def __init__(self): + self.update = False + super(FastGExpr, self).__init__(InterproceduralAliases) + + def as_gexpr(self, node): + if not isinstance(node, ast.Subscript): + return None + if not isinstance(node.slice, ast.Slice): + if not isinstance(node.slice, ast.Tuple): + return None + if not any(isinstance(elt, ast.Slice) for elt in node.slice.elts): + return None + + if not isinstance(node.value, ast.Name): + return None + + return node.value, node.slice + + def may_alias(self, gexpr, value): + if isinstance(value, ast.Constant): + return False + if isinstance(value, (ast.List, ast.Tuple)): + return any(self.may_alias(gexpr, elt) for elt in value.elts) + if isinstance(value, ast.UnaryOp): + return self.may_alias(gexpr, value.operand) + if isinstance(value, ast.BinOp): + return any(self.may_alias(gexpr, elt) for elt in (value.left, + value.right)) + if isinstance(value, ast.Subscript): + if not isinstance(value.value, ast.Name): + return True + return not self.interprocedural_aliases[gexpr[0]].isdisjoint(self.interprocedural_aliases[value.value]) + + return True + + + def visit_Assign(self, node): + targets = node.targets if isinstance(node, ast.Assign) else (node.target,) + if len(targets) > 1: + return node + + if not node.value: + return node + + target, = targets + value = node.value + gexpr = self.as_gexpr(target) + if not gexpr: + return node + + if self.may_alias(gexpr, value): + return node + + self.update = True + + func = ast.Attribute( + value=ast.Attribute(value=ast.Name('builtins', ast.Load(), + None, None), + attr="pythran", ctx=ast.Load()), + attr="restrict_assign", ctx=ast.Load()) + return ast.Expr(ast.Call(func, args=[target, value], keywords=[])) + visit_AnnAssign = visit_Assign + diff --git a/contrib/python/pythran/pythran/optimizations/forward_substitution.py b/contrib/python/pythran/pythran/optimizations/forward_substitution.py index e1e325877d..4d34f8c05e 100644 --- a/contrib/python/pythran/pythran/optimizations/forward_substitution.py +++ b/contrib/python/pythran/pythran/optimizations/forward_substitution.py @@ -35,6 +35,15 @@ class Remover(ast.NodeTransformer): return ast.Pass() return node + def visit_AnnAssign(self, node): + if node in self.nodes: + to_prune = self.nodes[node] + if node.target in to_prune: + return ast.Pass() + else: + return node + return node + class ForwardSubstitution(Transformation): @@ -135,22 +144,31 @@ class ForwardSubstitution(Transformation): return value elif len(parent.targets) == 1: ids = self.gather(Identifiers, value) - node_stmt = next(reversed([s for s in self.ancestors[node] - if isinstance(s, ast.stmt)])) - all_paths = graph.all_simple_paths(self.cfg, parent, node_stmt) - for path in all_paths: - for stmt in path[1:-1]: + node_stmt = next(s for s in self.ancestors[node][::-1] + if isinstance(s, ast.stmt)) + # Check if there is a path from `parent' to `node_stmt' that + # modifies any of the identifier from `value'. If so, cancel the + # forward substitution. + worklist = [node_stmt] + visited = {parent} + while worklist: + workitem = worklist.pop() + if workitem in visited: + continue + visited.add(workitem) + for pred in self.cfg.predecessors(workitem): + if not graph.has_path(self.cfg, parent, pred): + continue + assigned_ids = {n.id - for n in self.gather(IsAssigned, stmt)} + for n in self.gather(IsAssigned, + pred)} if not ids.isdisjoint(assigned_ids): - break - else: - continue - break - else: - self.update = True - self.to_remove[parent].append(dnode) - return value + return node # cancel + worklist.append(pred) + self.update = True + self.to_remove[parent].append(dnode) + return value return node diff --git a/contrib/python/pythran/pythran/optimizations/inlining.py b/contrib/python/pythran/pythran/optimizations/inlining.py index 70ea9c9fff..dac8dc6b2f 100644 --- a/contrib/python/pythran/pythran/optimizations/inlining.py +++ b/contrib/python/pythran/pythran/optimizations/inlining.py @@ -50,6 +50,7 @@ __pythran_inlinefooa0)) * (__pythran_inlinefoob1 + \ visit_Return = visit_Stmt visit_Assign = visit_Stmt + visit_AnnAssign = visit_Stmt visit_AugAssign = visit_Stmt visit_Print = visit_Stmt visit_For = visit_Stmt diff --git a/contrib/python/pythran/pythran/optimizations/list_to_tuple.py b/contrib/python/pythran/pythran/optimizations/list_to_tuple.py index f820aa73e7..87261ab733 100644 --- a/contrib/python/pythran/pythran/optimizations/list_to_tuple.py +++ b/contrib/python/pythran/pythran/optimizations/list_to_tuple.py @@ -102,6 +102,8 @@ class ListToTuple(Transformation): node.value = self.convert(node.value) return node + visit_AnnAssign = visit_Assign + def convert(self, node): self.update = True diff --git a/contrib/python/pythran/pythran/pythonic/__dispatch__/append.hpp b/contrib/python/pythran/pythran/pythonic/__dispatch__/append.hpp new file mode 100644 index 0000000000..f558245002 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/__dispatch__/append.hpp @@ -0,0 +1,22 @@ +#ifndef PYTHONIC_DISPATCH_APPEND_HPP +#define PYTHONIC_DISPATCH_APPEND_HPP + +#include "pythonic/include/__dispatch__/append.hpp" + +#include "pythonic/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace __dispatch__ +{ + + template <class Any, class Arg> + types::none_type append(Any &&any, Arg &&arg) + { + std::forward<Any>(any).push_back(std::forward<Arg>(arg)); + return {}; + } +} // namespace __dispatch__ +PYTHONIC_NS_END + +#endif diff --git a/contrib/python/pythran/pythran/pythonic/__dispatch__/conjugate.hpp b/contrib/python/pythran/pythran/pythonic/__dispatch__/conjugate.hpp index 0a21614138..90bb8be176 100644 --- a/contrib/python/pythran/pythran/pythonic/__dispatch__/conjugate.hpp +++ b/contrib/python/pythran/pythran/pythonic/__dispatch__/conjugate.hpp @@ -15,7 +15,7 @@ namespace __dispatch__ { return numpy::functor::conjugate{}(any); } -} +} // namespace __dispatch__ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/__dispatch__/copy.hpp b/contrib/python/pythran/pythran/pythonic/__dispatch__/copy.hpp index 70e59d1f38..8eb42561fa 100644 --- a/contrib/python/pythran/pythran/pythonic/__dispatch__/copy.hpp +++ b/contrib/python/pythran/pythran/pythonic/__dispatch__/copy.hpp @@ -14,7 +14,7 @@ namespace __dispatch__ { return any.copy(); } -} +} // namespace __dispatch__ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/__dispatch__/count.hpp b/contrib/python/pythran/pythran/pythonic/__dispatch__/count.hpp index 5d350f6106..cc566bea02 100644 --- a/contrib/python/pythran/pythran/pythonic/__dispatch__/count.hpp +++ b/contrib/python/pythran/pythran/pythonic/__dispatch__/count.hpp @@ -11,12 +11,12 @@ namespace __dispatch__ { template <class Any, class Value> - auto count(Any &&any, Value &&value) - -> decltype(any.count(std::forward<Value>(value))) + auto count(Any &&any, + Value &&value) -> decltype(any.count(std::forward<Value>(value))) { return any.count(std::forward<Value>(value)); } -} +} // namespace __dispatch__ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/__dispatch__/extend.hpp b/contrib/python/pythran/pythran/pythonic/__dispatch__/extend.hpp new file mode 100644 index 0000000000..634ffb6d06 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/__dispatch__/extend.hpp @@ -0,0 +1,22 @@ +#ifndef PYTHONIC_DISPATCH_EXTEND_HPP +#define PYTHONIC_DISPATCH_EXTEND_HPP + +#include "pythonic/include/__dispatch__/extend.hpp" + +#include "pythonic/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace __dispatch__ +{ + + template <class Any, class Arg> + types::none_type extend(Any &&any, Arg &&arg) + { + std::forward<Any>(any) += std::forward<Arg>(arg); + return {}; + } +} // namespace __dispatch__ +PYTHONIC_NS_END + +#endif diff --git a/contrib/python/pythran/pythran/pythonic/__dispatch__/insert.hpp b/contrib/python/pythran/pythran/pythonic/__dispatch__/insert.hpp new file mode 100644 index 0000000000..5b90502f47 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/__dispatch__/insert.hpp @@ -0,0 +1,26 @@ +#ifndef PYTHONIC_DISPATCH_INSERT_HPP +#define PYTHONIC_DISPATCH_INSERT_HPP + +#include "pythonic/include/__dispatch__/insert.hpp" + +#include "pythonic/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace __dispatch__ +{ + + template <class Any, class Arg> + types::none_type insert(Any &&any, long index, Arg &&arg) + { + index = index % (1 + any.size()); // +1 because we want to be able to insert + // at the end of any + if (index < 0) + index += any.size(); + any.insert(index, std::forward<Arg>(arg)); + return builtins::None; + } +} // namespace __dispatch__ +PYTHONIC_NS_END + +#endif diff --git a/contrib/python/pythran/pythran/pythonic/__dispatch__/pop.hpp b/contrib/python/pythran/pythran/pythonic/__dispatch__/pop.hpp index 72c4aa474f..262c82d240 100644 --- a/contrib/python/pythran/pythran/pythonic/__dispatch__/pop.hpp +++ b/contrib/python/pythran/pythran/pythonic/__dispatch__/pop.hpp @@ -10,12 +10,12 @@ PYTHONIC_NS_BEGIN namespace __dispatch__ { template <class Any, class... Arg0> - auto pop(Any &&any, Arg0 &&... arg0) - -> decltype(any.pop(std::forward<Arg0>(arg0)...)) + auto pop(Any &&any, + Arg0 &&...arg0) -> decltype(any.pop(std::forward<Arg0>(arg0)...)) { return any.pop(std::forward<Arg0>(arg0)...); } -} +} // namespace __dispatch__ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/__dispatch__/remove.hpp b/contrib/python/pythran/pythran/pythonic/__dispatch__/remove.hpp index 60493e3038..114b02f382 100644 --- a/contrib/python/pythran/pythran/pythonic/__dispatch__/remove.hpp +++ b/contrib/python/pythran/pythran/pythonic/__dispatch__/remove.hpp @@ -14,7 +14,7 @@ namespace __dispatch__ { return any.remove(arg0); } -} +} // namespace __dispatch__ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/__dispatch__/reverse.hpp b/contrib/python/pythran/pythran/pythonic/__dispatch__/reverse.hpp new file mode 100644 index 0000000000..055d33fb68 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/__dispatch__/reverse.hpp @@ -0,0 +1,24 @@ +#ifndef PYTHONIC_DISPATCH_REVERSE_HPP +#define PYTHONIC_DISPATCH_REVERSE_HPP + +#include "pythonic/include/__dispatch__/reverse.hpp" + +#include "pythonic/utils/functor.hpp" + +#include <algorithm> + +PYTHONIC_NS_BEGIN + +namespace __dispatch__ +{ + + template <class Any> + types::none_type reverse(Any &&any) + { + std::reverse(any.begin(), any.end()); + return {}; + } +} // namespace __dispatch__ +PYTHONIC_NS_END + +#endif diff --git a/contrib/python/pythran/pythran/pythonic/__dispatch__/sort.hpp b/contrib/python/pythran/pythran/pythonic/__dispatch__/sort.hpp index a49b8f8955..3bdc0cdccb 100644 --- a/contrib/python/pythran/pythran/pythonic/__dispatch__/sort.hpp +++ b/contrib/python/pythran/pythran/pythonic/__dispatch__/sort.hpp @@ -12,14 +12,14 @@ namespace __dispatch__ { template <class T, class... Args> - auto sort(types::list<T> &l, Args &&... args) + auto sort(types::list<T> &l, Args &&...args) -> decltype(pythonic::builtins::list::sort(l, std::forward<Args>(args)...)) { return pythonic::builtins::list::sort(l, std::forward<Args>(args)...); } template <class T, class... Args> - auto sort(types::list<T> &&l, Args &&... args) + auto sort(types::list<T> &&l, Args &&...args) -> decltype(pythonic::builtins::list::sort(std::move(l), std::forward<Args>(args)...)) { @@ -27,12 +27,12 @@ namespace __dispatch__ std::forward<Args>(args)...); } template <class Any, class... Args> - types::none_type sort(Any &&any, Args &&... args) + types::none_type sort(Any &&any, Args &&...args) { return pythonic::numpy::ndarray::sort(std::forward<Any>(any), std::forward<Args>(args)...); } -} +} // namespace __dispatch__ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/__dispatch__/tolist.hpp b/contrib/python/pythran/pythran/pythonic/__dispatch__/tolist.hpp new file mode 100644 index 0000000000..a39c4394a9 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/__dispatch__/tolist.hpp @@ -0,0 +1,8 @@ +#ifndef PYTHONIC_DISPATCH_TOLIST_HPP +#define PYTHONIC_DISPATCH_TOLIST_HPP + +#include "pythonic/include/__dispatch__/tolist.hpp" +#include "pythonic/numpy/ndarray/tolist.hpp" +#include "pythonic/types/array.hpp" + +#endif diff --git a/contrib/python/pythran/pythran/pythonic/__dispatch__/update.hpp b/contrib/python/pythran/pythran/pythonic/__dispatch__/update.hpp index faae8c9a27..12f1acfbfe 100644 --- a/contrib/python/pythran/pythran/pythonic/__dispatch__/update.hpp +++ b/contrib/python/pythran/pythran/pythonic/__dispatch__/update.hpp @@ -11,12 +11,12 @@ namespace __dispatch__ { template <class Any, class... Arg0> - auto update(Any &&any, Arg0 &&... arg0) + auto update(Any &&any, Arg0 &&...arg0) -> decltype(any.update(std::forward<Arg0>(arg0)...)) { return any.update(std::forward<Arg0>(arg0)...); } -} +} // namespace __dispatch__ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/array/array.hpp b/contrib/python/pythran/pythran/pythonic/array/array.hpp new file mode 100644 index 0000000000..6edf437706 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/array/array.hpp @@ -0,0 +1,34 @@ +#ifndef PYTHONIC_ARRAY_ARRAY_HPP +#define PYTHONIC_ARRAY_ARRAY_HPP + +#include "pythonic/include/array/array.hpp" + +#include "pythonic/types/array.hpp" +#include "pythonic/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace array +{ + namespace details + { + + template <char c> + types::array<typename details::typecodes<c>::type> + array(std::integral_constant<char, c>) + { + return {0}; + } + + template <char c, class E> + types::array<typename details::typecodes<c>::type> + array(std::integral_constant<char, c>, E &&elts) + { + return {std::forward<E>(elts)}; + } + } // namespace details + +} // namespace array +PYTHONIC_NS_END + +#endif diff --git a/contrib/python/pythran/pythran/pythonic/array/array/buffer_info.hpp b/contrib/python/pythran/pythran/pythonic/array/array/buffer_info.hpp new file mode 100644 index 0000000000..3413e05442 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/array/array/buffer_info.hpp @@ -0,0 +1,25 @@ +#ifndef PYTHONIC_ARRAY_ARRAY_BUFFER_INFO_HPP +#define PYTHONIC_ARRAY_ARRAY_BUFFER_INFO_HPP + +#include "pythonic/include/types/array.hpp" +#include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace array +{ + + namespace array + { + + template <class T> + std::tuple<long, long> buffer_info(types::array<T> const &seq) + { + return std::make_tuple(seq.id(), seq.size()); + } + + } // namespace array +} // namespace array +PYTHONIC_NS_END +#endif diff --git a/contrib/python/pythran/pythran/pythonic/array/array/byteswap.hpp b/contrib/python/pythran/pythran/pythonic/array/array/byteswap.hpp new file mode 100644 index 0000000000..be93143b6f --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/array/array/byteswap.hpp @@ -0,0 +1,46 @@ +#ifndef PYTHONIC_ARRAY_ARRAY_BYTESWAP_HPP +#define PYTHONIC_ARRAY_ARRAY_BYTESWAP_HPP + +#include "pythonic/include/array/array/byteswap.hpp" +#include "pythonic/utils/functor.hpp" + +#include <byteswap.h> + +PYTHONIC_NS_BEGIN + +namespace array +{ + + namespace array + { + inline void byteswap(char *buffer, size_t n, std::integral_constant<unsigned, 2>) + { + auto *ibuffer = reinterpret_cast<uint16_t *>(buffer); + for (size_t i = 0; i < n; i++) + ibuffer[i] = bswap_16(ibuffer[i]); + } + inline void byteswap(char *buffer, size_t n, std::integral_constant<unsigned, 4>) + { + auto *ibuffer = reinterpret_cast<uint32_t *>(buffer); + for (size_t i = 0; i < n; i++) + ibuffer[i] = bswap_32(ibuffer[i]); + } + inline void byteswap(char *buffer, size_t n, std::integral_constant<unsigned, 8>) + { + auto *ibuffer = reinterpret_cast<uint64_t *>(buffer); + for (size_t i = 0; i < n; i++) + ibuffer[i] = bswap_64(ibuffer[i]); + } + + template <class T> + types::none_type byteswap(types::array<T> &seq) + { + byteswap(reinterpret_cast<char *>(seq.data()), seq.size(), + std::integral_constant<unsigned, sizeof(T)>{}); + return {}; + } + + } // namespace array +} // namespace array +PYTHONIC_NS_END +#endif diff --git a/contrib/python/pythran/pythran/pythonic/array/array/count.hpp b/contrib/python/pythran/pythran/pythonic/array/array/count.hpp new file mode 100644 index 0000000000..a787213385 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/array/array/count.hpp @@ -0,0 +1,24 @@ +#ifndef PYTHONIC_ARRAY_ARRAY_COUNT_HPP +#define PYTHONIC_ARRAY_ARRAY_COUNT_HPP + +#include "pythonic/include/types/array.hpp" +#include "pythonic/include/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace array +{ + + namespace array + { + + template <class T> + long count(types::array<T> const &seq) + { + return std::count(seq.begin(), seq.end()); + } + + } // namespace array +} // namespace array +PYTHONIC_NS_END +#endif diff --git a/contrib/python/pythran/pythran/pythonic/array/array/extend.hpp b/contrib/python/pythran/pythran/pythonic/array/array/extend.hpp new file mode 100644 index 0000000000..b27f79bbaa --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/array/array/extend.hpp @@ -0,0 +1,25 @@ +#ifndef PYTHONIC_ARRAY_ARRAY_EXTEND_HPP +#define PYTHONIC_ARRAY_ARRAY_EXTEND_HPP + +#include "pythonic/include/types/array.hpp" +#include "pythonic/include/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace array +{ + + namespace array + { + + template <class T, class S> + types::none_type extend(types::array<T> &a, S &&elts) + { + seq += std::forward<S>(elts); + return {}; + } + + } // namespace array +} // namespace array +PYTHONIC_NS_END +#endif diff --git a/contrib/python/pythran/pythran/pythonic/array/array/frombytes.hpp b/contrib/python/pythran/pythran/pythonic/array/array/frombytes.hpp new file mode 100644 index 0000000000..a42701531b --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/array/array/frombytes.hpp @@ -0,0 +1,28 @@ +#ifndef PYTHONIC_ARRAY_ARRAY_FROMBYTES_HPP +#define PYTHONIC_ARRAY_ARRAY_FROMBYTES_HPP + +#include "pythonic/include/utils/functor.hpp" +#include "pythonic/types/array.hpp" +#include "pythonic/types/str.hpp" + +PYTHONIC_NS_BEGIN + +namespace array +{ + + namespace array + { + + template <class T> + types::none_type frombytes(types::array<T> &seq, types::str const &s) + { + long size = seq.size(); + seq.resize(size + s.size() / sizeof(T)); + memcpy(seq.data() + size, s.c_str(), s.size()); + return {}; + } + + } // namespace array +} // namespace array +PYTHONIC_NS_END +#endif diff --git a/contrib/python/pythran/pythran/pythonic/array/array/fromfile.hpp b/contrib/python/pythran/pythran/pythonic/array/array/fromfile.hpp new file mode 100644 index 0000000000..1c4151d9a7 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/array/array/fromfile.hpp @@ -0,0 +1,27 @@ +#ifndef PYTHONIC_ARRAY_ARRAY_FROMFILE_HPP +#define PYTHONIC_ARRAY_ARRAY_FROMFILE_HPP + +#include "pythonic/include/types/array.hpp" +#include "pythonic/include/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace array +{ + + namespace array + { + + template <class T> + types::none_type fromfile(types::array<T> &seq, types::file &f, long n) + { + long p = seq.size(); + seq.resize(p + n); + f.read_as(n, seq.data() + p); + return {}; + } + + } // namespace array +} // namespace array +PYTHONIC_NS_END +#endif diff --git a/contrib/python/pythran/pythran/pythonic/array/array/fromlist.hpp b/contrib/python/pythran/pythran/pythonic/array/array/fromlist.hpp new file mode 100644 index 0000000000..9a4e8ca9f7 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/array/array/fromlist.hpp @@ -0,0 +1,25 @@ +#ifndef PYTHONIC_ARRAY_ARRAY_FROMLIST_HPP +#define PYTHONIC_ARRAY_ARRAY_FROMLIST_HPP + +#include "pythonic/include/types/array.hpp" +#include "pythonic/include/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace array +{ + + namespace array + { + + template <class T, class E> + types::none_type fromlist(types::array<T> &seq, E &&elts) + { + seq += std::forward<E>(elts); + return {}; + } + + } // namespace array +} // namespace array +PYTHONIC_NS_END +#endif diff --git a/contrib/python/pythran/pythran/pythonic/array/typecodes.hpp b/contrib/python/pythran/pythran/pythonic/array/typecodes.hpp new file mode 100644 index 0000000000..287bf464bf --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/array/typecodes.hpp @@ -0,0 +1,6 @@ +#ifndef PYTHONIC_ARRAY_TYPECODES_HPP +#define PYTHONIC_ARRAY_TYPECODES_HPP + +#include "pythonic/include/array/typecodes.hpp" + +#endif diff --git a/contrib/python/pythran/pythran/pythonic/bisect/bisect.hpp b/contrib/python/pythran/pythran/pythonic/bisect/bisect.hpp index 3efc50b943..84258fbe36 100644 --- a/contrib/python/pythran/pythran/pythonic/bisect/bisect.hpp +++ b/contrib/python/pythran/pythran/pythonic/bisect/bisect.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_BISECT_BISECT_HPP #define PYTHONIC_BISECT_BISECT_HPP -#include "pythonic/include/bisect/bisect.hpp" #include "pythonic/builtins/ValueError.hpp" +#include "pythonic/include/bisect/bisect.hpp" #include "pythonic/utils/functor.hpp" @@ -29,7 +29,7 @@ namespace bisect throw types::ValueError("lo must be non-negative"); return std::distance(x.begin(), fun(x.begin() + lo, x.begin() + hi, a)); } -} +} // namespace bisect PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/bisect/bisect_left.hpp b/contrib/python/pythran/pythran/pythonic/bisect/bisect_left.hpp index 964c112663..00e7cf4ea4 100644 --- a/contrib/python/pythran/pythran/pythonic/bisect/bisect_left.hpp +++ b/contrib/python/pythran/pythran/pythonic/bisect/bisect_left.hpp @@ -24,7 +24,7 @@ namespace bisect return bisect(x, a, lo, hi, std::lower_bound<typename X::const_iterator, A>); } -} +} // namespace bisect PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/bisect/bisect_right.hpp b/contrib/python/pythran/pythran/pythonic/bisect/bisect_right.hpp index f82893d2fe..ac71177bd3 100644 --- a/contrib/python/pythran/pythran/pythonic/bisect/bisect_right.hpp +++ b/contrib/python/pythran/pythran/pythonic/bisect/bisect_right.hpp @@ -22,7 +22,7 @@ namespace bisect { return bisect(x, a, lo, hi); } -} +} // namespace bisect PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/all.hpp b/contrib/python/pythran/pythran/pythonic/builtins/all.hpp index 6fb8383595..a77851e0da 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/all.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/all.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_BUILTIN_ALL_HPP #define PYTHONIC_BUILTIN_ALL_HPP -#include "pythonic/utils/functor.hpp" #include "pythonic/include/builtins/all.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -18,7 +18,7 @@ namespace builtins return false; return true; } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/any.hpp b/contrib/python/pythran/pythran/pythonic/builtins/any.hpp index d74e5c2ae2..2246fcf22c 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/any.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/any.hpp @@ -18,7 +18,7 @@ namespace builtins return true; return false; } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/bin.hpp b/contrib/python/pythran/pythran/pythonic/builtins/bin.hpp index f102c79700..f53fbc4619 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/bin.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/bin.hpp @@ -58,7 +58,7 @@ namespace builtins return res; } } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/bool_.hpp b/contrib/python/pythran/pythran/pythonic/builtins/bool_.hpp index 843b273cd6..c50889b659 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/bool_.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/bool_.hpp @@ -26,7 +26,7 @@ namespace builtins } template <class T, size_t N> - bool bool_::operator()(types::array<T, N> const &val) const + bool bool_::operator()(types::array_tuple<T, N> const &val) const { return N; } diff --git a/contrib/python/pythran/pythran/pythonic/builtins/chr.hpp b/contrib/python/pythran/pythran/pythonic/builtins/chr.hpp index 3984cb549a..0f216d2b94 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/chr.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/chr.hpp @@ -15,7 +15,7 @@ namespace builtins { return types::str((char)v); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/dict.hpp b/contrib/python/pythran/pythran/pythonic/builtins/dict.hpp index f6dc308085..6b54af3328 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/dict.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/dict.hpp @@ -28,9 +28,10 @@ namespace builtins } template <class Iterable> - auto dict(Iterable &&iterable) -> types::dict< - typename std::decay<decltype(std::get<0>(*iterable.begin()))>::type, - typename std::decay<decltype(std::get<1>(*iterable.begin()))>::type> + auto dict(Iterable &&iterable) + -> types::dict< + typename std::decay<decltype(std::get<0>(*iterable.begin()))>::type, + typename std::decay<decltype(std::get<1>(*iterable.begin()))>::type> { types::dict< typename std::decay<decltype(std::get<0>(*iterable.begin()))>::type, diff --git a/contrib/python/pythran/pythran/pythonic/builtins/dict/clear.hpp b/contrib/python/pythran/pythran/pythonic/builtins/dict/clear.hpp index 7efdba9135..cd59ba3311 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/dict/clear.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/dict/clear.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_BUILTIN_DICT_CLEAR_HPP #define PYTHONIC_BUILTIN_DICT_CLEAR_HPP -#include "pythonic/include/builtins/dict/clear.hpp" #include "pythonic/__dispatch__/clear.hpp" +#include "pythonic/include/builtins/dict/clear.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/dict/copy.hpp b/contrib/python/pythran/pythran/pythonic/builtins/dict/copy.hpp index 06fcbb767d..3cd0d80061 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/dict/copy.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/dict/copy.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_BUILTIN_DICT_COPY_HPP #define PYTHONIC_BUILTIN_DICT_COPY_HPP -#include "pythonic/include/builtins/dict/copy.hpp" #include "pythonic/__dispatch__/copy.hpp" +#include "pythonic/include/builtins/dict/copy.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/dict/fromkeys.hpp b/contrib/python/pythran/pythran/pythonic/builtins/dict/fromkeys.hpp index 2fb83b6e8e..3cfbcfb9ce 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/dict/fromkeys.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/dict/fromkeys.hpp @@ -21,14 +21,14 @@ namespace builtins fromkeys(Iterable &&iter, V const &v) { types::dict<typename std::remove_reference<Iterable>::type::value_type, - V> D = - types::empty_dict(); // Allocate default capacity to dict + V> + D = types::empty_dict(); // Allocate default capacity to dict for (auto const &i : iter) D[i] = v; return D; } - } -} + } // namespace dict +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/dict/get.hpp b/contrib/python/pythran/pythran/pythonic/builtins/dict/get.hpp index bcb0f587a0..f88f6f31cc 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/dict/get.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/dict/get.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/builtins/dict/get.hpp" -#include "pythonic/types/dict.hpp" #include "pythonic/types/NoneType.hpp" +#include "pythonic/types/dict.hpp" #include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -32,8 +32,8 @@ namespace builtins { return default_; } - } -} + } // namespace dict +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/dict/items.hpp b/contrib/python/pythran/pythran/pythonic/builtins/dict/items.hpp index 5bbd6ced2f..dc0a5537a7 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/dict/items.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/dict/items.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/builtins/dict/items.hpp" -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/dict.hpp" #include "pythonic/include/types/list.hpp" +#include "pythonic/include/utils/functor.hpp" #include <tuple> @@ -22,8 +22,8 @@ namespace builtins { return std::forward<D>(d).items(); } - } -} + } // namespace dict +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/dict/keys.hpp b/contrib/python/pythran/pythran/pythonic/builtins/dict/keys.hpp index d4dfa271d7..2f7563373f 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/dict/keys.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/dict/keys.hpp @@ -23,8 +23,8 @@ namespace builtins { return std::forward<D>(d).keys(); } - } -} + } // namespace dict +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/dict/pop.hpp b/contrib/python/pythran/pythran/pythonic/builtins/dict/pop.hpp index a22e470576..7e47d6bbae 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/dict/pop.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/dict/pop.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_BUILTIN_DICT_POP_HPP #define PYTHONIC_BUILTIN_DICT_POP_HPP -#include "pythonic/include/builtins/dict/pop.hpp" #include "pythonic/__dispatch__/pop.hpp" +#include "pythonic/include/builtins/dict/pop.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/dict/popitem.hpp b/contrib/python/pythran/pythran/pythonic/builtins/dict/popitem.hpp index e0369befca..4c3dd6e290 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/dict/popitem.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/dict/popitem.hpp @@ -21,8 +21,8 @@ namespace builtins { return std::forward<D>(d).popitem(); } - } -} + } // namespace dict +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/dict/setdefault.hpp b/contrib/python/pythran/pythran/pythonic/builtins/dict/setdefault.hpp index 3f1079897a..1fd1dbeb98 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/dict/setdefault.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/dict/setdefault.hpp @@ -37,8 +37,8 @@ namespace builtins { return d.get(k); } - } -} + } // namespace dict +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/dict/update.hpp b/contrib/python/pythran/pythran/pythonic/builtins/dict/update.hpp index ffda356efd..21d27c4e4f 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/dict/update.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/dict/update.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_BUILTIN_DICT_UPDATE_HPP #define PYTHONIC_BUILTIN_DICT_UPDATE_HPP -#include "pythonic/include/builtins/dict/update.hpp" #include "pythonic/__dispatch__/update.hpp" +#include "pythonic/include/builtins/dict/update.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/dict/values.hpp b/contrib/python/pythran/pythran/pythonic/builtins/dict/values.hpp index 69fd137d3d..cff17f8e21 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/dict/values.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/dict/values.hpp @@ -19,8 +19,8 @@ namespace builtins { return std::forward<D>(d).values(); } - } -} + } // namespace dict +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/divmod.hpp b/contrib/python/pythran/pythran/pythonic/builtins/divmod.hpp index 8227d53915..5f2a22fd1a 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/divmod.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/divmod.hpp @@ -17,7 +17,7 @@ namespace builtins { return types::make_tuple(t0 / t1, t0 % t1); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/enumerate.hpp b/contrib/python/pythran/pythran/pythonic/builtins/enumerate.hpp index 06ed891845..faab84a455 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/enumerate.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/enumerate.hpp @@ -29,8 +29,8 @@ namespace builtins } template <class Iterator> - enumerate_iterator<Iterator> &enumerate_iterator<Iterator>:: - operator+=(long n) + enumerate_iterator<Iterator> & + enumerate_iterator<Iterator>::operator+=(long n) { value += n, iter += n; return *this; @@ -42,29 +42,29 @@ namespace builtins // TODO : We could handle case with && without size if there is a // performances benefits template <class Iterator> - bool enumerate_iterator<Iterator>:: - operator!=(enumerate_iterator<Iterator> const &other) const + bool enumerate_iterator<Iterator>::operator!=( + enumerate_iterator<Iterator> const &other) const { return !(*this == other); } template <class Iterator> - bool enumerate_iterator<Iterator>:: - operator<(enumerate_iterator const &other) const + bool enumerate_iterator<Iterator>::operator<( + enumerate_iterator const &other) const { return iter < other.iter; } template <class Iterator> - bool enumerate_iterator<Iterator>:: - operator==(enumerate_iterator<Iterator> const &other) const + bool enumerate_iterator<Iterator>::operator==( + enumerate_iterator<Iterator> const &other) const { return iter == other.iter; } template <class Iterator> - long enumerate_iterator<Iterator>:: - operator-(enumerate_iterator<Iterator> const &other) const + long enumerate_iterator<Iterator>::operator-( + enumerate_iterator<Iterator> const &other) const { return iter - other.iter; } @@ -100,7 +100,7 @@ namespace builtins { return end_iter; } - } + } // namespace details /// enumerate implementation @@ -111,7 +111,7 @@ namespace builtins { return {std::forward<Iterable>(seq), first}; } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/file.hpp b/contrib/python/pythran/pythran/pythonic/builtins/file.hpp index fef17cbc15..c79388552e 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/file.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/file.hpp @@ -18,8 +18,8 @@ namespace builtins { return {filename, strmode}; } - } -} + } // namespace anonymous +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/file/fileno.hpp b/contrib/python/pythran/pythran/pythonic/builtins/file/fileno.hpp index b167d3ade2..83c7f4305b 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/file/fileno.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/file/fileno.hpp @@ -18,7 +18,7 @@ namespace builtins { return f.fileno(); } - } -} + } // namespace file +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/file/isatty.hpp b/contrib/python/pythran/pythran/pythonic/builtins/file/isatty.hpp index b8e0216003..e9245ffab8 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/file/isatty.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/file/isatty.hpp @@ -18,7 +18,7 @@ namespace builtins { return f.isatty(); } - } -} + } // namespace file +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/file/next.hpp b/contrib/python/pythran/pythran/pythonic/builtins/file/next.hpp index f1ae5fbafe..e41223e31c 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/file/next.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/file/next.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_BUILTIN_FILE_NEXT_HPP #define PYTHONIC_BUILTIN_FILE_NEXT_HPP -#include "pythonic/include/builtins/file/next.hpp" #include "pythonic/__dispatch__/next.hpp" +#include "pythonic/include/builtins/file/next.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/file/readlines.hpp b/contrib/python/pythran/pythran/pythonic/builtins/file/readlines.hpp index 5bea169b08..fa31688715 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/file/readlines.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/file/readlines.hpp @@ -27,7 +27,7 @@ namespace builtins { return f.readlines(sizehint); } - } -} + } // namespace file +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/file/tell.hpp b/contrib/python/pythran/pythran/pythonic/builtins/file/tell.hpp index dc5fbabe21..6e645839b8 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/file/tell.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/file/tell.hpp @@ -18,7 +18,7 @@ namespace builtins { return f.tell(); } - } -} + } // namespace file +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/file/writelines.hpp b/contrib/python/pythran/pythran/pythonic/builtins/file/writelines.hpp index 6859de2d44..bc6ffb2065 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/file/writelines.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/file/writelines.hpp @@ -19,7 +19,7 @@ namespace builtins { f.writelines(sequence); } - } -} + } // namespace file +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/float_/is_integer.hpp b/contrib/python/pythran/pythran/pythonic/builtins/float_/is_integer.hpp index 5ffccf8383..491acf02cf 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/float_/is_integer.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/float_/is_integer.hpp @@ -19,8 +19,8 @@ namespace builtins { return std::trunc(d) == d; } - } -} + } // namespace float_ +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/hex.hpp b/contrib/python/pythran/pythran/pythonic/builtins/hex.hpp index 3ab0221f0b..ccdbc09063 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/hex.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/hex.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/builtins/hex.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/str.hpp" +#include "pythonic/utils/functor.hpp" #include <sstream> @@ -20,7 +20,7 @@ namespace builtins oss << "0x" << std::hex << v; return oss.str(); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/in.hpp b/contrib/python/pythran/pythran/pythonic/builtins/in.hpp index 69623a8dd0..a4f57ee1fa 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/in.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/in.hpp @@ -30,7 +30,7 @@ namespace details { return t.contains(v); } -} +} // namespace details template <class T, class V> bool in(T &&t, V const &v) diff --git a/contrib/python/pythran/pythran/pythonic/builtins/iter.hpp b/contrib/python/pythran/pythran/pythonic/builtins/iter.hpp index dc54d242a5..b2c155c136 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/iter.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/iter.hpp @@ -22,8 +22,7 @@ namespace builtins // FIXME : There is a dangling reference as data.begin() is ! the one // from data "saved" in the "iter" struct template <class T> - iter<T>::iter(T data) - : iterator(data.begin()), _end(data.end()), data(data) + iter<T>::iter(T data) : iterator(data.begin()), _end(data.end()), data(data) { } @@ -44,7 +43,7 @@ namespace builtins { return _end; } - } + } // namespace details /// iter implementation @@ -55,7 +54,7 @@ namespace builtins { return {std::forward<T>(t)}; } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/len.hpp b/contrib/python/pythran/pythran/pythonic/builtins/len.hpp index 703db0dd98..2c4e4f4449 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/len.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/len.hpp @@ -6,8 +6,8 @@ #include "pythonic/types/traits.hpp" #include "pythonic/utils/functor.hpp" -#include <tuple> #include <iterator> +#include <tuple> PYTHONIC_NS_BEGIN @@ -24,6 +24,6 @@ namespace builtins { return t.size(); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/list.hpp b/contrib/python/pythran/pythran/pythonic/builtins/list.hpp index 9c793954b3..95d065d6f9 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/list.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/list.hpp @@ -38,8 +38,8 @@ namespace builtins Iterable>::type::iterator>::value_type>::type>(t.begin(), t.end()); } - } -} + } // namespace anonymous +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/list/append.hpp b/contrib/python/pythran/pythran/pythonic/builtins/list/append.hpp index a9d89b544f..804fc11f93 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/list/append.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/list/append.hpp @@ -4,8 +4,8 @@ #include "pythonic/include/builtins/list/append.hpp" #include "pythonic/builtins/None.hpp" -#include "pythonic/types/list.hpp" #include "pythonic/types/NoneType.hpp" +#include "pythonic/types/list.hpp" #include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -28,7 +28,7 @@ namespace builtins seq.push_back(std::forward<F>(value)); return builtins::None; } - } -} + } // namespace list +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/list/count.hpp b/contrib/python/pythran/pythran/pythonic/builtins/list/count.hpp index e43223ea9d..d986a9fbdc 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/list/count.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/list/count.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_BUILTIN_LIST_COUNT_HPP #define PYTHONIC_BUILTIN_LIST_COUNT_HPP -#include "pythonic/include/builtins/list/count.hpp" #include "pythonic/__dispatch__/count.hpp" +#include "pythonic/include/builtins/list/count.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/list/extend.hpp b/contrib/python/pythran/pythran/pythonic/builtins/list/extend.hpp index 273f4cf80a..e1321d79ff 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/list/extend.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/list/extend.hpp @@ -4,8 +4,8 @@ #include "pythonic/include/builtins/list/extend.hpp" #include "pythonic/builtins/None.hpp" -#include "pythonic/types/list.hpp" #include "pythonic/types/NoneType.hpp" +#include "pythonic/types/list.hpp" #include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -33,7 +33,7 @@ namespace builtins { return {}; } - } -} + } // namespace list +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/list/insert.hpp b/contrib/python/pythran/pythran/pythonic/builtins/list/insert.hpp index 123a017884..452336831d 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/list/insert.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/list/insert.hpp @@ -4,8 +4,8 @@ #include "pythonic/include/builtins/list/insert.hpp" #include "pythonic/builtins/None.hpp" -#include "pythonic/types/list.hpp" #include "pythonic/types/NoneType.hpp" +#include "pythonic/types/list.hpp" #include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -27,7 +27,7 @@ namespace builtins seq.insert(n, std::forward<F>(value)); return builtins::None; } - } -} + } // namespace list +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/list/pop.hpp b/contrib/python/pythran/pythran/pythonic/builtins/list/pop.hpp index 37cd6fecb9..efbf13994e 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/list/pop.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/list/pop.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_BUILTIN_LIST_POP_HPP #define PYTHONIC_BUILTIN_LIST_POP_HPP -#include "pythonic/include/builtins/list/pop.hpp" #include "pythonic/__dispatch__/pop.hpp" +#include "pythonic/include/builtins/list/pop.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/list/remove.hpp b/contrib/python/pythran/pythran/pythonic/builtins/list/remove.hpp index 1d65547065..b7202068bc 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/list/remove.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/list/remove.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_BUILTIN_LIST_REMOVE_HPP #define PYTHONIC_BUILTIN_LIST_REMOVE_HPP -#include "pythonic/include/builtins/list/remove.hpp" #include "pythonic/__dispatch__/remove.hpp" +#include "pythonic/include/builtins/list/remove.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/list/reverse.hpp b/contrib/python/pythran/pythran/pythonic/builtins/list/reverse.hpp index 2948d3f24b..a292d22a96 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/list/reverse.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/list/reverse.hpp @@ -4,8 +4,8 @@ #include "pythonic/include/builtins/list/reverse.hpp" #include "pythonic/builtins/None.hpp" -#include "pythonic/types/list.hpp" #include "pythonic/types/NoneType.hpp" +#include "pythonic/types/list.hpp" #include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -22,7 +22,7 @@ namespace builtins std::reverse(seq.begin(), seq.end()); return builtins::None; } - } -} + } // namespace list +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/list/sort.hpp b/contrib/python/pythran/pythran/pythonic/builtins/list/sort.hpp index 365de6505d..913b87d4f9 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/list/sort.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/list/sort.hpp @@ -4,8 +4,8 @@ #include "pythonic/include/builtins/list/sort.hpp" #include "pythonic/builtins/None.hpp" -#include "pythonic/types/list.hpp" #include "pythonic/types/NoneType.hpp" +#include "pythonic/types/list.hpp" #include "pythonic/utils/functor.hpp" #include "pythonic/utils/pdqsort.hpp" @@ -32,7 +32,7 @@ namespace builtins }); return builtins::None; } - } -} + } // namespace list +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/map.hpp b/contrib/python/pythran/pythran/pythonic/builtins/map.hpp index fde24f3d3a..ac6eb0354a 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/map.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/map.hpp @@ -5,10 +5,10 @@ #include "pythonic/itertools/common.hpp" #include "pythonic/types/tuple.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/fwd.hpp" #include "pythonic/utils/int_.hpp" #include "pythonic/utils/iterator.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/utils/seq.hpp" #include <iterator> @@ -44,8 +44,8 @@ namespace builtins template <typename Operator, typename... Iters> template <size_t... I> typename map_res<Operator, Iters...>::type - map_iterator<Operator, Iters...>::get_value(utils::index_sequence<I...>, - std::false_type) const + map_iterator<Operator, Iters...>::get_value(utils::index_sequence<I...>, + std::false_type) const { return _op(*std::get<I>(it)...); } @@ -53,16 +53,15 @@ namespace builtins template <typename Operator, typename... Iters> template <size_t... I> typename map_res<Operator, Iters...>::type - map_iterator<Operator, Iters...>::get_value(utils::index_sequence<I...>, - std::true_type) const + map_iterator<Operator, Iters...>::get_value(utils::index_sequence<I...>, + std::true_type) const { return types::make_tuple(*std::get<I>(it)...); } template <typename Operator, typename... Iters> typename map_res<Operator, Iters...>::type - map_iterator<Operator, Iters...>:: - operator*() const + map_iterator<Operator, Iters...>::operator*() const { return get_value(utils::make_index_sequence<sizeof...(Iters)>{}, std::is_same<Operator, types::none_type>()); @@ -76,8 +75,8 @@ namespace builtins } template <typename Operator, typename... Iters> - map_iterator<Operator, Iters...> &map_iterator<Operator, Iters...>:: - operator++() + map_iterator<Operator, Iters...> & + map_iterator<Operator, Iters...>::operator++() { next(utils::make_index_sequence<sizeof...(Iters)>{}); return *this; @@ -98,16 +97,16 @@ namespace builtins } template <typename Operator, typename... Iters> - map_iterator<Operator, Iters...> &map_iterator<Operator, Iters...>:: - operator+=(long i) + map_iterator<Operator, Iters...> & + map_iterator<Operator, Iters...>::operator+=(long i) { - advance(i, utils::int_<sizeof...(Iters)-1>()); + advance(i, utils::int_<sizeof...(Iters) - 1>()); return *this; } template <typename Operator, typename... Iters> - map_iterator<Operator, Iters...> map_iterator<Operator, Iters...>:: - operator+(long i) const + map_iterator<Operator, Iters...> + map_iterator<Operator, Iters...>::operator+(long i) const { map_iterator<Operator, Iters...> other(*this); other += i; @@ -131,22 +130,22 @@ namespace builtins } template <typename Operator, typename... Iters> - bool map_iterator<Operator, Iters...>:: - operator==(map_iterator<Operator, Iters...> const &other) const + bool map_iterator<Operator, Iters...>::operator==( + map_iterator<Operator, Iters...> const &other) const { - return equal(other, utils::int_<sizeof...(Iters)-1>()); + return equal(other, utils::int_<sizeof...(Iters) - 1>()); } template <typename Operator, typename... Iters> - bool map_iterator<Operator, Iters...>:: - operator!=(map_iterator<Operator, Iters...> const &other) const + bool map_iterator<Operator, Iters...>::operator!=( + map_iterator<Operator, Iters...> const &other) const { return !(*this == other); } template <typename Operator, typename... Iters> - bool map_iterator<Operator, Iters...>:: - operator<(map_iterator<Operator, Iters...> const &other) const + bool map_iterator<Operator, Iters...>::operator<( + map_iterator<Operator, Iters...> const &other) const { return !(*this == other); } @@ -168,15 +167,15 @@ namespace builtins } template <typename Operator, typename... Iters> - long map_iterator<Operator, Iters...>:: - operator-(map_iterator<Operator, Iters...> const &other) const + long map_iterator<Operator, Iters...>::operator-( + map_iterator<Operator, Iters...> const &other) const { - return min_len(other, utils::int_<sizeof...(Iters)-1>()); + return min_len(other, utils::int_<sizeof...(Iters) - 1>()); } template <typename Operator, typename... Iters> template <class... Types> - map<Operator, Iters...>::map(Operator const &_op, Types &&... _iters) + map<Operator, Iters...>::map(Operator const &_op, Types &&..._iters) : utils::iterator_reminder<true, Iters...>( std::forward<Types>(_iters)...), map_iterator<Operator, Iters...>( @@ -206,18 +205,19 @@ namespace builtins { return end_iter; } - } + } // namespace details template <typename Operator, typename... Iter> - auto map(Operator &&_op, Iter &&... iters) -> details::map< - typename std::remove_cv< - typename std::remove_reference<Operator>::type>::type, - typename types::iterator<typename std::remove_cv< - typename std::remove_reference<Iter>::type>::type>::type...> + auto map(Operator &&_op, Iter &&...iters) + -> details::map< + typename std::remove_cv< + typename std::remove_reference<Operator>::type>::type, + typename types::iterator<typename std::remove_cv< + typename std::remove_reference<Iter>::type>::type>::type...> { return {std::forward<Operator>(_op), std::forward<Iter>(iters)...}; } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/max.hpp b/contrib/python/pythran/pythran/pythonic/builtins/max.hpp index 48514877f5..aeb9eb7970 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/max.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/max.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_BUILTIN_MAX_HPP #define PYTHONIC_BUILTIN_MAX_HPP -#include "pythonic/include/builtins/max.hpp" #include "pythonic/builtins/minmax.hpp" +#include "pythonic/include/builtins/max.hpp" #include "pythonic/operator_/lt.hpp" #include "pythonic/utils/functor.hpp" @@ -13,14 +13,14 @@ namespace builtins { template <class... Types> - auto max(Types &&... values) + auto max(Types &&...values) -> decltype(details::minmax(operator_::functor::lt{}, std::forward<Types>(values)...)) { return details::minmax(operator_::functor::lt{}, std::forward<Types>(values)...); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/min.hpp b/contrib/python/pythran/pythran/pythonic/builtins/min.hpp index 1b41376489..915a711ce8 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/min.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/min.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_BUILTIN_MIN_HPP #define PYTHONIC_BUILTIN_MIN_HPP -#include "pythonic/include/builtins/min.hpp" #include "pythonic/builtins/minmax.hpp" +#include "pythonic/include/builtins/min.hpp" #include "pythonic/operator_/gt.hpp" #include "pythonic/utils/functor.hpp" @@ -13,14 +13,14 @@ namespace builtins { template <class... Types> - auto min(Types &&... values) + auto min(Types &&...values) -> decltype(details::minmax(operator_::functor::gt{}, std::forward<Types>(values)...)) { return details::minmax(operator_::functor::gt{}, std::forward<Types>(values)...); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/minmax.hpp b/contrib/python/pythran/pythran/pythonic/builtins/minmax.hpp index d580b69715..f74a25cdeb 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/minmax.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/minmax.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/builtins/minmax.hpp" -#include <utility> #include <algorithm> +#include <utility> PYTHONIC_NS_BEGIN @@ -25,16 +25,16 @@ namespace builtins { using value_type = decltype(*t.begin()); return *std::max_element( - t.begin(), t.end(), - [op, key](value_type const &self, value_type const &other) { - return op(key(self), key(other)); - }); + t.begin(), t.end(), + [op, key](value_type const &self, value_type const &other) { + return op(key(self), key(other)); + }); } template <class Op, class T0, class T1, class... Types> typename std::enable_if<!std::is_same<T1, types::kwonly>::value, typename __combined<T0, T1, Types...>::type>::type - minmax(Op const &op, T0 const &t0, T1 const &t1, Types const &... ts) + minmax(Op const &op, T0 const &t0, T1 const &t1, Types const &...ts) { using value_type = typename __combined<T0, T1, Types...>::type; std::initializer_list<value_type> values = { @@ -42,8 +42,8 @@ namespace builtins static_cast<value_type>(ts)...}; return minmax(op, values); } - } -} + } // namespace details +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/next.hpp b/contrib/python/pythran/pythran/pythonic/builtins/next.hpp index afecc8b2d5..e9ef292321 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/next.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/next.hpp @@ -23,7 +23,7 @@ namespace builtins } else throw types::StopIteration(); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/oct.hpp b/contrib/python/pythran/pythran/pythonic/builtins/oct.hpp index ec4e483429..9150c79063 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/oct.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/oct.hpp @@ -26,7 +26,7 @@ namespace builtins << std::oct << v; return oss.str(); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/open.hpp b/contrib/python/pythran/pythran/pythonic/builtins/open.hpp index 6128c3a36c..adbeaa1b45 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/open.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/open.hpp @@ -16,7 +16,7 @@ namespace builtins { return {filename, strmode}; } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/ord.hpp b/contrib/python/pythran/pythran/pythonic/builtins/ord.hpp index 07a362bf3c..07f941c7f3 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/ord.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/ord.hpp @@ -20,7 +20,7 @@ namespace builtins std::to_string(v.size()) + " found"); return (long)v.chars()[0]; } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/pythran/StaticIfBreak.hpp b/contrib/python/pythran/pythran/pythonic/builtins/pythran/StaticIfBreak.hpp index 5086bd6d10..cb0715c02d 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/pythran/StaticIfBreak.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/pythran/StaticIfBreak.hpp @@ -2,8 +2,8 @@ #define PYTHONIC_BUILTIN_PYTHRAN_STATICIFBREAK_HPP #include "pythonic/include/builtins/pythran/StaticIfBreak.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/static_if.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -17,8 +17,8 @@ namespace builtins { return {arg}; } - } -} + } // namespace pythran +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/pythran/StaticIfCont.hpp b/contrib/python/pythran/pythran/pythonic/builtins/pythran/StaticIfCont.hpp index 12b144b7c0..eb53537bd5 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/pythran/StaticIfCont.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/pythran/StaticIfCont.hpp @@ -2,8 +2,8 @@ #define PYTHONIC_BUILTIN_PYTHRAN_STATICIFCONT_HPP #include "pythonic/include/builtins/pythran/StaticIfCont.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/static_if.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -17,8 +17,8 @@ namespace builtins { return {arg}; } - } -} + } // namespace pythran +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/pythran/StaticIfNoReturn.hpp b/contrib/python/pythran/pythran/pythonic/builtins/pythran/StaticIfNoReturn.hpp index d7bb508b99..713e9d99a9 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/pythran/StaticIfNoReturn.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/pythran/StaticIfNoReturn.hpp @@ -2,8 +2,8 @@ #define PYTHONIC_BUILTIN_PYTHRAN_STATICIFNORETURN_HPP #include "pythonic/include/builtins/pythran/StaticIfNoReturn.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/static_if.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -17,8 +17,8 @@ namespace builtins { return {arg}; } - } -} + } // namespace pythran +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/pythran/StaticIfReturn.hpp b/contrib/python/pythran/pythran/pythonic/builtins/pythran/StaticIfReturn.hpp index b0dd350d0b..4a2a194bf1 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/pythran/StaticIfReturn.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/pythran/StaticIfReturn.hpp @@ -2,8 +2,8 @@ #define PYTHONIC_BUILTIN_PYTHRAN_STATICIFRETURN_HPP #include "pythonic/include/builtins/pythran/StaticIfReturn.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/static_if.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -17,8 +17,8 @@ namespace builtins { return {arg}; } - } -} + } // namespace pythran +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/pythran/abssqr.hpp b/contrib/python/pythran/pythran/pythonic/builtins/pythran/abssqr.hpp index f400910c4e..90375172fb 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/pythran/abssqr.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/pythran/abssqr.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/builtins/pythran/abssqr.hpp" +#include "pythonic/types/numpy_op_helper.hpp" #include "pythonic/utils/functor.hpp" #include "pythonic/utils/meta.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -29,13 +29,13 @@ namespace builtins { return v.real() * v.real() + v.imag() * v.imag(); } - } + } // namespace details #define NUMPY_NARY_FUNC_NAME abssqr #define NUMPY_NARY_FUNC_SYM details::abssqr #include "pythonic/types/numpy_nary_expr.hpp" - } -} + } // namespace pythran +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/pythran/and_.hpp b/contrib/python/pythran/pythran/pythonic/builtins/pythran/and_.hpp index 90375ad4e2..193c2d2a62 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/pythran/and_.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/pythran/and_.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/builtins/pythran/and_.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/combined.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -23,8 +23,8 @@ namespace builtins else return (types::lazy_combined_t<T0, T1>)val0; } - } -} + } // namespace pythran +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/pythran/is_none.hpp b/contrib/python/pythran/pythran/pythonic/builtins/pythran/is_none.hpp index 084170ff62..83a42d9c24 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/pythran/is_none.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/pythran/is_none.hpp @@ -2,8 +2,8 @@ #define PYTHONIC_BUILTIN_PYTHRAN_IS_NONE_HPP #include "pythonic/include/builtins/pythran/is_none.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/NoneType.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -13,7 +13,7 @@ namespace builtins namespace pythran { } -} +} // namespace builtins PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/builtins/pythran/len_set.hpp b/contrib/python/pythran/pythran/pythonic/builtins/pythran/len_set.hpp index 6b24e17e50..03b9f8fbd8 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/pythran/len_set.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/pythran/len_set.hpp @@ -19,10 +19,11 @@ namespace builtins long len_set(Iterable const &s) { return std::set<typename std::iterator_traits< - typename Iterable::iterator>::value_type>(s.begin(), s.end()).size(); + typename Iterable::iterator>::value_type>(s.begin(), s.end()) + .size(); } - } -} + } // namespace pythran +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/pythran/make_shape.hpp b/contrib/python/pythran/pythran/pythonic/builtins/pythran/make_shape.hpp index 13db44f138..d3cdd871e8 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/pythran/make_shape.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/pythran/make_shape.hpp @@ -12,8 +12,8 @@ namespace builtins { return {args...}; } - } // pythran -} // builtins + } // namespace pythran +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/pythran/or_.hpp b/contrib/python/pythran/pythran/pythonic/builtins/pythran/or_.hpp index 08cbeda546..8fc97fa5a9 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/pythran/or_.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/pythran/or_.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/builtins/pythran/or_.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/combined.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -23,8 +23,8 @@ namespace builtins else return (types::lazy_combined_t<T0, T1>)std::forward<T1>(v1)(); } - } -} + } // namespace pythran +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/pythran/restrict_assign.hpp b/contrib/python/pythran/pythran/pythonic/builtins/pythran/restrict_assign.hpp new file mode 100644 index 0000000000..f3f3cb0768 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/builtins/pythran/restrict_assign.hpp @@ -0,0 +1,6 @@ +#ifndef PYTHONIC_BUILTIN_RESTRICT_ASSIGN_HPP +#define PYTHONIC_BUILTIN_RESTRICT_ASSIGN_HPP + +#include "pythonic/include/builtins/pythran/restrict_assign.hpp" + +#endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/pythran/static_if.hpp b/contrib/python/pythran/pythran/pythonic/builtins/pythran/static_if.hpp index cd7e395b84..8e6c975cae 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/pythran/static_if.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/pythran/static_if.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_BUILTIN_PYTHRAN_STATIC_IF_HPP #define PYTHONIC_BUILTIN_PYTHRAN_STATIC_IF_HPP +#include "pythonic/builtins/pythran/is_none.hpp" #include "pythonic/include/builtins/pythran/static_if.hpp" #include "pythonic/utils/functor.hpp" -#include "pythonic/builtins/pythran/is_none.hpp" PYTHONIC_NS_BEGIN @@ -14,13 +14,13 @@ namespace builtins { template <class T, class F0, class F1> - auto static_if(T const &cond, F0 f0, F1 f1) - -> decltype(details::static_if<T>{cond}(f0, f1)) + auto static_if(T const &cond, F0 f0, + F1 f1) -> decltype(details::static_if<T>{cond}(f0, f1)) { return details::static_if<T>{cond}(f0, f1); } - } -} + } // namespace pythran +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/pythran/static_list.hpp b/contrib/python/pythran/pythran/pythonic/builtins/pythran/static_list.hpp index ee84ae35fc..adf15e8635 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/pythran/static_list.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/pythran/static_list.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_BUILTIN_PYTHRAN_STATIC_LIST_HPP #define PYTHONIC_BUILTIN_PYTHRAN_STATIC_LIST_HPP -#include "pythonic/include/builtins/pythran/static_list.hpp" #include "pythonic/builtins/list.hpp" +#include "pythonic/include/builtins/pythran/static_list.hpp" #include "pythonic/types/tuple.hpp" #include "pythonic/utils/functor.hpp" @@ -14,17 +14,17 @@ namespace builtins namespace pythran { template <class T, size_t N> - types::static_list<T, N> static_list(types::array<T, N> const &other) + types::static_list<T, N> static_list(types::array_tuple<T, N> const &other) { return other.template to_array<types::list_version>(); } template <class T, size_t N> - types::static_list<T, N> static_list(types::array<T, N> &other) + types::static_list<T, N> static_list(types::array_tuple<T, N> &other) { return other.template to_array<types::list_version>(); } template <class T, size_t N> - types::static_list<T, N> static_list(types::array<T, N> &&other) + types::static_list<T, N> static_list(types::array_tuple<T, N> &&other) { return other.template to_array<types::list_version>(); } @@ -35,8 +35,8 @@ namespace builtins { return pythonic::builtins::functor::list{}(std::forward<T>(other)); } - } -} + } // namespace pythran +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/reduce.hpp b/contrib/python/pythran/pythran/pythonic/builtins/reduce.hpp index e2fb2569a9..068dc42fbc 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/reduce.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/reduce.hpp @@ -40,7 +40,7 @@ namespace builtins s.begin(), s.end(), static_cast<reduce_helper_t<Iterable, Operator, T>>(init), op); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/reversed.hpp b/contrib/python/pythran/pythran/pythonic/builtins/reversed.hpp index 954dd8bb81..f765c3ac39 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/reversed.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/reversed.hpp @@ -18,8 +18,7 @@ namespace builtins } template <class Iterable> - reversed<Iterable>::reversed(Iterable const &iterable) - : iterable(iterable) + reversed<Iterable>::reversed(Iterable const &iterable) : iterable(iterable) { } @@ -47,14 +46,14 @@ namespace builtins { return iterable.rend(); } - } + } // namespace details template <class Iterable> details::reversed<Iterable> reversed(Iterable const &iterable) { return {iterable}; } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/round.hpp b/contrib/python/pythran/pythran/pythonic/builtins/round.hpp index f9618f77af..4089ca084e 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/round.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/round.hpp @@ -25,7 +25,7 @@ namespace builtins { return std::lround(v); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set.hpp index 337f4592e3..736c732aba 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/set.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/set.hpp @@ -26,7 +26,7 @@ namespace builtins { return {t.begin(), t.end()}; } - } -} + } // namespace anonymous +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set/add.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set/add.hpp index 329536687c..6ea8f0d73f 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/set/add.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/set/add.hpp @@ -29,7 +29,7 @@ namespace builtins s.add(value); return builtins::None; } - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set/clear.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set/clear.hpp index d855c9c844..cb7020ac63 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/set/clear.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/set/clear.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_BUILTIN_SET_CLEAR_HPP #define PYTHONIC_BUILTIN_SET_CLEAR_HPP -#include "pythonic/include/builtins/set/clear.hpp" #include "pythonic/__dispatch__/clear.hpp" +#include "pythonic/include/builtins/set/clear.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set/copy.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set/copy.hpp index dc309baaa7..7996dc5440 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/set/copy.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/set/copy.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_BUILTIN_SET_COPY_HPP #define PYTHONIC_BUILTIN_SET_COPY_HPP -#include "pythonic/include/builtins/set/copy.hpp" #include "pythonic/__dispatch__/copy.hpp" +#include "pythonic/include/builtins/set/copy.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set/difference_update.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set/difference_update.hpp index 29d1800082..9de4f8a14d 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/set/difference_update.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/set/difference_update.hpp @@ -16,7 +16,7 @@ namespace builtins template <typename T, typename... Types> types::none_type difference_update(types::set<T> &set, - Types const &... others) + Types const &...others) { set.difference_update(others...); return {}; @@ -24,7 +24,7 @@ namespace builtins template <typename T, typename... Types> types::none_type difference_update(types::set<T> &&set, - Types const &... others) + Types const &...others) { // nothing to be done as we work on rvalue return {}; @@ -32,12 +32,12 @@ namespace builtins template <typename... Types> types::none_type difference_update(types::empty_set const &set, - Types const &... others) + Types const &...others) { // nothing can be removed in set return {}; } - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set/discard.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set/discard.hpp index 8219da30af..82210c22f6 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/set/discard.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/set/discard.hpp @@ -30,7 +30,7 @@ namespace builtins { // nothing to remove in an empty_set } - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set/intersection.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set/intersection.hpp index 7477fdf0b5..09417a47fb 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/set/intersection.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/set/intersection.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/builtins/set/intersection.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/set.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -16,7 +16,7 @@ namespace builtins template <typename T, typename... Types> typename __combined<types::set<T>, Types...>::type - intersection(types::set<T> const &set, Types const &... others) + intersection(types::set<T> const &set, Types const &...others) { return set.intersection(others...); } @@ -29,11 +29,11 @@ namespace builtins */ template <typename... Types> types::empty_set intersection(types::empty_set const &set, - Types const &... others) + Types const &...others) { return types::empty_set(); } - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set/intersection_update.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set/intersection_update.hpp index 5bf8b65a81..847a4d4dd6 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/set/intersection_update.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/set/intersection_update.hpp @@ -16,7 +16,7 @@ namespace builtins template <typename T, typename... Types> types::none_type intersection_update(types::set<T> &set, - Types const &... others) + Types const &...others) { set.intersection_update(others...); return {}; @@ -24,7 +24,7 @@ namespace builtins template <typename T, typename... Types> types::none_type intersection_update(types::set<T> &&set, - Types const &... others) + Types const &...others) { // If it is an rvalue, we don't really want to update return {}; @@ -32,13 +32,13 @@ namespace builtins template <typename... Types> types::none_type intersection_update(types::empty_set &&set, - Types const &... others) + Types const &...others) { // If it is an empty_set, it is ! really updated otherwise we have a // typing issue return {}; } - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set/isdisjoint.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set/isdisjoint.hpp index 2f5c08794e..7613c53d7a 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/set/isdisjoint.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/set/isdisjoint.hpp @@ -25,7 +25,7 @@ namespace builtins { return true; } - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set/issubset.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set/issubset.hpp index b74680f918..0222faf745 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/set/issubset.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/set/issubset.hpp @@ -25,7 +25,7 @@ namespace builtins { return true; } - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set/issuperset.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set/issuperset.hpp index 10da3c1ad3..7f3d759798 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/set/issuperset.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/set/issuperset.hpp @@ -25,7 +25,7 @@ namespace builtins { return false; } - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set/remove.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set/remove.hpp index 1035406a69..0cbc67d76e 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/set/remove.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/set/remove.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_BUILTIN_SET_REMOVE_HPP #define PYTHONIC_BUILTIN_SET_REMOVE_HPP -#include "pythonic/include/builtins/set/remove.hpp" #include "pythonic/__dispatch__/remove.hpp" +#include "pythonic/include/builtins/set/remove.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set/symmetric_difference.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set/symmetric_difference.hpp index b8fd245193..14dd6fbbdf 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/set/symmetric_difference.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/set/symmetric_difference.hpp @@ -33,7 +33,7 @@ namespace builtins { return other; } - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set/symmetric_difference_update.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set/symmetric_difference_update.hpp index fcbac1a429..e9aa1675ce 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/set/symmetric_difference_update.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/set/symmetric_difference_update.hpp @@ -37,7 +37,7 @@ namespace builtins // nothing otherwise empty_set have ! its correct type. return {}; } - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set/update.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set/update.hpp index 673a6e192b..e2965e07b7 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/set/update.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/set/update.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_SET_UPDATE_HPP #define PYTHONIC_SET_UPDATE_HPP -#include "pythonic/include/builtins/set/update.hpp" #include "pythonic/__dispatch__/update.hpp" +#include "pythonic/include/builtins/set/update.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/sorted.hpp b/contrib/python/pythran/pythran/pythonic/builtins/sorted.hpp index 8e247435a0..c8e9e2efda 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/sorted.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/sorted.hpp @@ -64,7 +64,7 @@ namespace builtins pdqsort(out.begin(), out.end()); return out; } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str.hpp index d77176f03b..ce0cf778ac 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/str.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/str.hpp @@ -74,8 +74,8 @@ namespace builtins snprintf(buffer, sizeof(buffer), "%g", l); return buffer; } - } -} + } // namespace anonymous +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/__mod__.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/__mod__.hpp index 812f1abf23..2ea185e1f3 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/str/__mod__.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/str/__mod__.hpp @@ -29,7 +29,7 @@ namespace builtins fmt(f % std::get<std::tuple_size<Tuple>::value - I>(a), a, utils::int_<I - 1>()); } - } + } // namespace details template <class T> types::str __mod__(types::str const &s, T const &arg) @@ -46,13 +46,14 @@ namespace builtins return fmter.str(); } template <size_t N, class T> - types::str __mod__(types::str const &s, types::array<T, N> const &args) + types::str __mod__(types::str const &s, + types::array_tuple<T, N> const &args) { boost::format fmter(s.chars()); details::fmt(fmter, args, utils::int_<N>()); return fmter.str(); } - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/capitalize.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/capitalize.hpp index 5102d46dbc..743bbe8c2f 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/str/capitalize.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/str/capitalize.hpp @@ -26,7 +26,7 @@ namespace builtins return copy; } } - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/count.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/count.hpp index 2a9f6b5ec3..b7c6bbdc76 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/str/count.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/str/count.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_BUILTIN_STR_COUNT_HPP #define PYTHONIC_BUILTIN_STR_COUNT_HPP -#include "pythonic/include/builtins/str/count.hpp" #include "pythonic/__dispatch__/count.hpp" +#include "pythonic/include/builtins/str/count.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/endswith.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/endswith.hpp index b8df066ce6..70fa51f46a 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/str/endswith.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/str/endswith.hpp @@ -22,7 +22,7 @@ namespace builtins long rstart = end - suffix.size(); return rstart >= start && s.compare(rstart, suffix.size(), suffix) == 0; } - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/isalpha.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/isalpha.hpp index e7d9beaa70..4fa77567ba 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/str/isalpha.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/str/isalpha.hpp @@ -19,7 +19,7 @@ namespace builtins return !s.empty() && std::all_of(s.chars().begin(), s.chars().end(), (int (*)(int))std::isalpha); } - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/isdigit.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/isdigit.hpp index 58da6227c4..43ffe5d5a7 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/str/isdigit.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/str/isdigit.hpp @@ -21,7 +21,7 @@ namespace builtins return !s.empty() && std::all_of(s.chars().begin(), s.chars().end(), (int (*)(int))std::isdigit); } - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/join.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/join.hpp index af966c789b..38cf6fd963 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/str/join.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/str/join.hpp @@ -112,7 +112,7 @@ namespace builtins } return out; } - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/lower.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/lower.hpp index 6d2bcd6cb9..417d01df6b 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/str/lower.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/str/lower.hpp @@ -21,7 +21,7 @@ namespace builtins ::tolower); return copy; } - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/lstrip.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/lstrip.hpp index d3a031bfed..1b4a37310d 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/str/lstrip.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/str/lstrip.hpp @@ -23,7 +23,7 @@ namespace builtins else return {chars.begin() + stop, chars.end()}; } - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/rstrip.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/rstrip.hpp index a1536478bd..2dadb99bc5 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/str/rstrip.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/str/rstrip.hpp @@ -22,7 +22,7 @@ namespace builtins return {}; return {chars.begin(), chars.begin() + stop + 1}; } - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/startswith.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/startswith.hpp index 1d297f4c87..226388ca5f 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/str/startswith.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/str/startswith.hpp @@ -22,7 +22,7 @@ namespace builtins return (end - start) >= prefix.size() && s.compare(start, prefix.size(), prefix) == 0; } - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/strip.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/strip.hpp index c580a63a8a..e1cab71ee9 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/str/strip.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/str/strip.hpp @@ -25,7 +25,7 @@ namespace builtins self.chars().begin() + self.find_last_not_of(to_del) + 1); } - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/upper.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/upper.hpp index 1f8d38a884..d90d583ec2 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/str/upper.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/str/upper.hpp @@ -21,7 +21,7 @@ namespace builtins ::toupper); return copy; } - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/sum.hpp b/contrib/python/pythran/pythran/pythonic/builtins/sum.hpp index 5c35f1c4a6..f583b1ae39 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/sum.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/sum.hpp @@ -5,8 +5,8 @@ #include "pythonic/types/assignable.hpp" #include "pythonic/types/tuple.hpp" -#include "pythonic/utils/int_.hpp" #include "pythonic/utils/functor.hpp" +#include "pythonic/utils/int_.hpp" #include <algorithm> @@ -25,25 +25,26 @@ namespace builtins } template <class Tuple> - auto tuple_sum<Tuple, 0>::operator()(Tuple const &t) - -> decltype(std::get<0>(t)) + auto + tuple_sum<Tuple, 0>::operator()(Tuple const &t) -> decltype(std::get<0>(t)) { return std::get<0>(t); } - } + } // namespace details template <class Iterable, class T> - auto sum(Iterable s, T start) -> decltype(std::accumulate( - s.begin(), s.end(), - static_cast<typename assignable<decltype(start + *s.begin())>::type>( - start))) + auto sum(Iterable s, T start) + -> decltype(std::accumulate( + s.begin(), s.end(), + static_cast<typename assignable<decltype(start + *s.begin())>::type>( + start))) { return std::accumulate( s.begin(), s.end(), static_cast<typename assignable<decltype(start + *s.begin())>::type>( start)); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/tuple.hpp b/contrib/python/pythran/pythran/pythonic/builtins/tuple.hpp index 4692a1108d..7abe56ad8f 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/tuple.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/tuple.hpp @@ -38,7 +38,7 @@ namespace builtins typename std::enable_if< types::len_of<typename std::remove_cv<typename std::remove_reference< StaticIterable>::type>::type>::value >= 0, - types::array< + types::array_tuple< typename std::iterator_traits< typename std::remove_cv<typename std::remove_reference< StaticIterable>::type>::type::iterator>::value_type, @@ -46,16 +46,17 @@ namespace builtins StaticIterable>::type>::type>::value>>::type tuple(StaticIterable &&i) { - types::array< + types::array_tuple< typename std::iterator_traits< typename std::remove_cv<typename std::remove_reference< StaticIterable>::type>::type::iterator>::value_type, - types::len_of<typename std::remove_cv<typename std::remove_reference< - StaticIterable>::type>::type>::value> res; + types::len_of<typename std::remove_cv< + typename std::remove_reference<StaticIterable>::type>::type>::value> + res; std::copy(i.begin(), i.end(), res.begin()); return res; } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/type.hpp b/contrib/python/pythran/pythran/pythonic/builtins/type.hpp index 55b530a80b..401c566845 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/type.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/type.hpp @@ -6,27 +6,27 @@ #include "pythonic/utils/functor.hpp" #include "pythonic/builtins/bool_.hpp" -#include "pythonic/builtins/int_.hpp" -#include "pythonic/builtins/float_.hpp" #include "pythonic/builtins/complex.hpp" +#include "pythonic/builtins/dict.hpp" +#include "pythonic/builtins/float_.hpp" +#include "pythonic/builtins/int_.hpp" +#include "pythonic/builtins/list.hpp" #include "pythonic/builtins/set.hpp" #include "pythonic/builtins/str.hpp" -#include "pythonic/builtins/list.hpp" -#include "pythonic/builtins/dict.hpp" #include "pythonic/builtins/tuple.hpp" #include "pythonic/numpy/array.hpp" #include "pythonic/numpy/byte.hpp" -#include "pythonic/numpy/ubyte.hpp" -#include "pythonic/numpy/short_.hpp" -#include "pythonic/numpy/ushort.hpp" -#include "pythonic/numpy/intc.hpp" -#include "pythonic/numpy/uintc.hpp" +#include "pythonic/numpy/float128.hpp" +#include "pythonic/numpy/float32.hpp" #include "pythonic/numpy/int_.hpp" -#include "pythonic/numpy/uint.hpp" +#include "pythonic/numpy/intc.hpp" #include "pythonic/numpy/longlong.hpp" +#include "pythonic/numpy/short_.hpp" +#include "pythonic/numpy/ubyte.hpp" +#include "pythonic/numpy/uint.hpp" +#include "pythonic/numpy/uintc.hpp" #include "pythonic/numpy/ulonglong.hpp" -#include "pythonic/numpy/float32.hpp" -#include "pythonic/numpy/float128.hpp" +#include "pythonic/numpy/ushort.hpp" PYTHONIC_NS_BEGIN @@ -81,7 +81,7 @@ namespace builtins using type = functor::tuple; }; template <class T, size_t N> - struct type_functor<types::array<T, N>> { + struct type_functor<types::array_tuple<T, N>> { using type = functor::tuple; }; template <class T, class pS> @@ -142,7 +142,7 @@ namespace builtins { return {}; } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/xrange.hpp b/contrib/python/pythran/pythran/pythonic/builtins/xrange.hpp index 2436fa470c..696ac32089 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/xrange.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/xrange.hpp @@ -24,7 +24,7 @@ namespace builtins return _begin + std::min(0L, _step * ((_end - _begin + _step + 1) / _step)); } - } + } // namespace xrange_iterator::xrange_iterator(long v, long s) : value_(v), step_(s) { @@ -102,7 +102,7 @@ namespace builtins { return {begin_ - step_, -step_}; } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/builtins/zip.hpp b/contrib/python/pythran/pythran/pythonic/builtins/zip.hpp index 84f7bf8e55..3fb8c04521 100644 --- a/contrib/python/pythran/pythran/pythonic/builtins/zip.hpp +++ b/contrib/python/pythran/pythran/pythonic/builtins/zip.hpp @@ -12,12 +12,12 @@ namespace builtins { template <typename... Iter> - auto zip(Iter &&... iters) - -> decltype(map(builtins::None, std::forward<Iter>(iters)...)) + auto zip(Iter &&...iters) -> decltype(map(builtins::None, + std::forward<Iter>(iters)...)) { return map(builtins::None, std::forward<Iter>(iters)...); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/cmath/acos.hpp b/contrib/python/pythran/pythran/pythonic/cmath/acos.hpp index d35580c144..b3cb005142 100644 --- a/contrib/python/pythran/pythran/pythonic/cmath/acos.hpp +++ b/contrib/python/pythran/pythran/pythonic/cmath/acos.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/cmath/acos.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/complex.hpp" +#include "pythonic/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/cmath/acosh.hpp b/contrib/python/pythran/pythran/pythonic/cmath/acosh.hpp index 09193d0d3a..67b00ee66c 100644 --- a/contrib/python/pythran/pythran/pythonic/cmath/acosh.hpp +++ b/contrib/python/pythran/pythran/pythonic/cmath/acosh.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/cmath/acosh.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/complex.hpp" +#include "pythonic/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/cmath/asin.hpp b/contrib/python/pythran/pythran/pythonic/cmath/asin.hpp index a18a35b291..6c55305660 100644 --- a/contrib/python/pythran/pythran/pythonic/cmath/asin.hpp +++ b/contrib/python/pythran/pythran/pythonic/cmath/asin.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/cmath/asin.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/complex.hpp" +#include "pythonic/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/cmath/asinh.hpp b/contrib/python/pythran/pythran/pythonic/cmath/asinh.hpp index d460ba71fa..7c6949eab7 100644 --- a/contrib/python/pythran/pythran/pythonic/cmath/asinh.hpp +++ b/contrib/python/pythran/pythran/pythonic/cmath/asinh.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/cmath/asinh.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/complex.hpp" +#include "pythonic/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/cmath/atan.hpp b/contrib/python/pythran/pythran/pythonic/cmath/atan.hpp index ecc5020e8d..28d30766eb 100644 --- a/contrib/python/pythran/pythran/pythonic/cmath/atan.hpp +++ b/contrib/python/pythran/pythran/pythonic/cmath/atan.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/cmath/atan.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/complex.hpp" +#include "pythonic/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/cmath/atanh.hpp b/contrib/python/pythran/pythran/pythonic/cmath/atanh.hpp index 997c74310f..098827ce24 100644 --- a/contrib/python/pythran/pythran/pythonic/cmath/atanh.hpp +++ b/contrib/python/pythran/pythran/pythonic/cmath/atanh.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/cmath/atanh.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/complex.hpp" +#include "pythonic/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/cmath/cos.hpp b/contrib/python/pythran/pythran/pythonic/cmath/cos.hpp index fe4965949f..1d73a31ea9 100644 --- a/contrib/python/pythran/pythran/pythonic/cmath/cos.hpp +++ b/contrib/python/pythran/pythran/pythonic/cmath/cos.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/cmath/cos.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/complex.hpp" +#include "pythonic/utils/functor.hpp" #include <cmath> @@ -23,7 +23,7 @@ namespace cmath { return std::cos(v); } -} +} // namespace cmath PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/cmath/cosh.hpp b/contrib/python/pythran/pythran/pythonic/cmath/cosh.hpp index 671143a91b..f466f94c42 100644 --- a/contrib/python/pythran/pythran/pythonic/cmath/cosh.hpp +++ b/contrib/python/pythran/pythran/pythonic/cmath/cosh.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/cmath/cosh.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/complex.hpp" +#include "pythonic/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/cmath/exp.hpp b/contrib/python/pythran/pythran/pythonic/cmath/exp.hpp index aa06a419b3..8202b2e111 100644 --- a/contrib/python/pythran/pythran/pythonic/cmath/exp.hpp +++ b/contrib/python/pythran/pythran/pythonic/cmath/exp.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/cmath/exp.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/complex.hpp" +#include "pythonic/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/cmath/isinf.hpp b/contrib/python/pythran/pythran/pythonic/cmath/isinf.hpp index c2f012b8e3..98303da971 100644 --- a/contrib/python/pythran/pythran/pythonic/cmath/isinf.hpp +++ b/contrib/python/pythran/pythran/pythonic/cmath/isinf.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/cmath/isinf.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/complex.hpp" +#include "pythonic/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/cmath/isnan.hpp b/contrib/python/pythran/pythran/pythonic/cmath/isnan.hpp index 969dc7461a..96b68e65ce 100644 --- a/contrib/python/pythran/pythran/pythonic/cmath/isnan.hpp +++ b/contrib/python/pythran/pythran/pythonic/cmath/isnan.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/cmath/isnan.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/complex.hpp" +#include "pythonic/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/cmath/log.hpp b/contrib/python/pythran/pythran/pythonic/cmath/log.hpp index 8c8fe36930..b885a43023 100644 --- a/contrib/python/pythran/pythran/pythonic/cmath/log.hpp +++ b/contrib/python/pythran/pythran/pythonic/cmath/log.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/cmath/log.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/complex.hpp" +#include "pythonic/utils/functor.hpp" #include <cmath> @@ -17,7 +17,7 @@ namespace cmath { return log(x) / log(base); } -} +} // namespace cmath PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/cmath/log10.hpp b/contrib/python/pythran/pythran/pythonic/cmath/log10.hpp index 86c3c79391..55eda96e70 100644 --- a/contrib/python/pythran/pythran/pythonic/cmath/log10.hpp +++ b/contrib/python/pythran/pythran/pythonic/cmath/log10.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/cmath/log10.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/complex.hpp" +#include "pythonic/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/cmath/sin.hpp b/contrib/python/pythran/pythran/pythonic/cmath/sin.hpp index 5dcec69e74..1f57e20720 100644 --- a/contrib/python/pythran/pythran/pythonic/cmath/sin.hpp +++ b/contrib/python/pythran/pythran/pythonic/cmath/sin.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/cmath/sin.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/complex.hpp" +#include "pythonic/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/cmath/sinh.hpp b/contrib/python/pythran/pythran/pythonic/cmath/sinh.hpp index 891d543f06..e1a28836cc 100644 --- a/contrib/python/pythran/pythran/pythonic/cmath/sinh.hpp +++ b/contrib/python/pythran/pythran/pythonic/cmath/sinh.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/cmath/sinh.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/complex.hpp" +#include "pythonic/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/cmath/sqrt.hpp b/contrib/python/pythran/pythran/pythonic/cmath/sqrt.hpp index f84a6293ed..8b5582fdcd 100644 --- a/contrib/python/pythran/pythran/pythonic/cmath/sqrt.hpp +++ b/contrib/python/pythran/pythran/pythonic/cmath/sqrt.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/cmath/sqrt.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/complex.hpp" +#include "pythonic/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/cmath/tan.hpp b/contrib/python/pythran/pythran/pythonic/cmath/tan.hpp index 23052a4a6e..537042c4d9 100644 --- a/contrib/python/pythran/pythran/pythonic/cmath/tan.hpp +++ b/contrib/python/pythran/pythran/pythonic/cmath/tan.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/cmath/tan.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/complex.hpp" +#include "pythonic/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/cmath/tanh.hpp b/contrib/python/pythran/pythran/pythonic/cmath/tanh.hpp index b81d76e718..0748384156 100644 --- a/contrib/python/pythran/pythran/pythonic/cmath/tanh.hpp +++ b/contrib/python/pythran/pythran/pythonic/cmath/tanh.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/cmath/tanh.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/complex.hpp" +#include "pythonic/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/core.hpp b/contrib/python/pythran/pythran/pythonic/core.hpp index feb77722fb..844d944cb5 100644 --- a/contrib/python/pythran/pythran/pythonic/core.hpp +++ b/contrib/python/pythran/pythran/pythonic/core.hpp @@ -32,7 +32,8 @@ // Define python's visibility macros #include "pyconfig.h" -// Some version of python define that macro on Windows, and it breaks compilation of some C++ headers. +// Some version of python define that macro on Windows, and it breaks +// compilation of some C++ headers. #ifdef copysign #undef copysign #endif @@ -41,8 +42,8 @@ #include "pythonic/types/assignable.hpp" #include "pythonic/types/combined.hpp" -#include "pythonic/types/int.hpp" #include "pythonic/types/float.hpp" +#include "pythonic/types/int.hpp" #include "pythonic/types/slice.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/functools/partial.hpp b/contrib/python/pythran/pythran/pythonic/functools/partial.hpp index d6ab8bdabe..e2a2df85e7 100644 --- a/contrib/python/pythran/pythran/pythonic/functools/partial.hpp +++ b/contrib/python/pythran/pythran/pythonic/functools/partial.hpp @@ -17,37 +17,37 @@ namespace functools { template <typename... ClosureTypes> - task<ClosureTypes...>::task() - : closure() + task<ClosureTypes...>::task() : closure() { } template <typename... ClosureTypes> - task<ClosureTypes...>::task(ClosureTypes const &... types) + task<ClosureTypes...>::task(ClosureTypes const &...types) : closure(types...) { } template <typename... ClosureTypes> template <typename... Types> - auto task<ClosureTypes...>::operator()(Types &&... types) const -> decltype( - this->call(utils::make_index_sequence<sizeof...(ClosureTypes)-1>(), - std::forward<Types>(types)...)) + auto task<ClosureTypes...>::operator()(Types &&...types) const + -> decltype(this->call( + utils::make_index_sequence<sizeof...(ClosureTypes) - 1>(), + std::forward<Types>(types)...)) { - return call(utils::make_index_sequence<sizeof...(ClosureTypes)-1>(), + return call(utils::make_index_sequence<sizeof...(ClosureTypes) - 1>(), std::forward<Types>(types)...); } - } + } // namespace details template <typename... Types> // remove references as closure capture the env by copy details::task<typename std::remove_cv< typename std::remove_reference<Types>::type>::type...> - partial(Types &&... types) + partial(Types &&...types) { return {std::forward<Types>(types)...}; } -} +} // namespace functools PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/functools/reduce.hpp b/contrib/python/pythran/pythran/pythonic/functools/reduce.hpp index 3d0cdff245..452b85599c 100644 --- a/contrib/python/pythran/pythran/pythonic/functools/reduce.hpp +++ b/contrib/python/pythran/pythran/pythonic/functools/reduce.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_FUNCTOOLS_REDUCE_HPP #define PYTHONIC_FUNCTOOLS_REDUCE_HPP -#include "pythonic/include/functools/reduce.hpp" #include "pythonic/builtins/reduce.hpp" +#include "pythonic/include/functools/reduce.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/append.hpp b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/append.hpp new file mode 100644 index 0000000000..3a87a320c5 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/append.hpp @@ -0,0 +1,18 @@ +#ifndef PYTHONIC_INCLUDE_DISPATCH_APPEND_HPP +#define PYTHONIC_INCLUDE_DISPATCH_APPEND_HPP + +#include "pythonic/include/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace __dispatch__ +{ + + template <class Any, class Arg> + types::none_type append(Any &&any, Arg &&arg0); + + DEFINE_FUNCTOR(pythonic::__dispatch__, append); +} // namespace __dispatch__ +PYTHONIC_NS_END + +#endif diff --git a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/clear.hpp b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/clear.hpp index ae78da378b..e3a912e2f7 100644 --- a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/clear.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/clear.hpp @@ -14,7 +14,7 @@ namespace __dispatch__ } DEFINE_FUNCTOR(pythonic::__dispatch__, clear); -} +} // namespace __dispatch__ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/conjugate.hpp b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/conjugate.hpp index 869cb55762..0a5b94b561 100644 --- a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/conjugate.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/conjugate.hpp @@ -12,7 +12,7 @@ namespace __dispatch__ auto conjugate(Any const &any) -> decltype(numpy::functor::conjugate{}(any)); DEFINE_FUNCTOR(pythonic::__dispatch__, conjugate); -} +} // namespace __dispatch__ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/copy.hpp b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/copy.hpp index 04819e9477..265301da68 100644 --- a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/copy.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/copy.hpp @@ -11,7 +11,7 @@ namespace __dispatch__ auto copy(Any const &any) -> decltype(any.copy()); DEFINE_FUNCTOR(pythonic::__dispatch__, copy); -} +} // namespace __dispatch__ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/count.hpp b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/count.hpp index 0fe42b94e7..8dcc6fcca1 100644 --- a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/count.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/count.hpp @@ -8,11 +8,11 @@ PYTHONIC_NS_BEGIN namespace __dispatch__ { template <class Any, class Value> - auto count(Any &&any, Value &&value) - -> decltype(any.count(std::forward<Value>(value))); + auto count(Any &&any, + Value &&value) -> decltype(any.count(std::forward<Value>(value))); DEFINE_FUNCTOR(pythonic::__dispatch__, count); -} +} // namespace __dispatch__ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/extend.hpp b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/extend.hpp new file mode 100644 index 0000000000..760cebed1a --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/extend.hpp @@ -0,0 +1,18 @@ +#ifndef PYTHONIC_INCLUDE_DISPATCH_EXTEND_HPP +#define PYTHONIC_INCLUDE_DISPATCH_EXTEND_HPP + +#include "pythonic/include/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace __dispatch__ +{ + + template <class Any, class Arg> + types::none_type extend(Any &&any, Arg &&arg0); + + DEFINE_FUNCTOR(pythonic::__dispatch__, extend); +} // namespace __dispatch__ +PYTHONIC_NS_END + +#endif diff --git a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/index.hpp b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/index.hpp index c658f74941..0532e6cbce 100644 --- a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/index.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/index.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_DISPATCH_INDEX_HPP #define PYTHONIC_INCLUDE_DISPATCH_INDEX_HPP -#include "pythonic/utils/functor.hpp" #include "pythonic/include/operator_/indexOf.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN diff --git a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/insert.hpp b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/insert.hpp new file mode 100644 index 0000000000..c486b3ce66 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/insert.hpp @@ -0,0 +1,18 @@ +#ifndef PYTHONIC_INCLUDE_DISPATCH_INSERT_HPP +#define PYTHONIC_INCLUDE_DISPATCH_INSERT_HPP + +#include "pythonic/include/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace __dispatch__ +{ + + template <class Any, class Arg> + types::none_type insert(Any &&any, long index, Arg &&arg0); + + DEFINE_FUNCTOR(pythonic::__dispatch__, insert); +} // namespace __dispatch__ +PYTHONIC_NS_END + +#endif diff --git a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/pop.hpp b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/pop.hpp index 8a44bfe1a5..ac37c2e653 100644 --- a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/pop.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/pop.hpp @@ -8,11 +8,11 @@ PYTHONIC_NS_BEGIN namespace __dispatch__ { template <class Any, class... Arg0> - auto pop(Any &&any, Arg0 &&... arg0) - -> decltype(any.pop(std::forward<Arg0>(arg0)...)); + auto pop(Any &&any, + Arg0 &&...arg0) -> decltype(any.pop(std::forward<Arg0>(arg0)...)); DEFINE_FUNCTOR(pythonic::__dispatch__, pop); -} +} // namespace __dispatch__ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/remove.hpp b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/remove.hpp index 4b78c24603..7e9c34fe4d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/remove.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/remove.hpp @@ -11,7 +11,7 @@ namespace __dispatch__ auto remove(Any &any, Arg0 const &arg0) -> decltype(any.remove(arg0)); DEFINE_FUNCTOR(pythonic::__dispatch__, remove); -} +} // namespace __dispatch__ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/reverse.hpp b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/reverse.hpp new file mode 100644 index 0000000000..0734d21312 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/reverse.hpp @@ -0,0 +1,18 @@ +#ifndef PYTHONIC_INCLUDE_DISPATCH_REVERSE_HPP +#define PYTHONIC_INCLUDE_DISPATCH_REVERSE_HPP + +#include "pythonic/include/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace __dispatch__ +{ + + template <class Any> + types::none_type reverse(Any &&any); + + DEFINE_FUNCTOR(pythonic::__dispatch__, reverse); +} // namespace __dispatch__ +PYTHONIC_NS_END + +#endif diff --git a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/sort.hpp b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/sort.hpp index e2dc8fe4c0..d57b8c2f38 100644 --- a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/sort.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/sort.hpp @@ -10,18 +10,18 @@ namespace __dispatch__ { template <class T, class... Args> - auto sort(types::list<T> &l, Args &&... args) + auto sort(types::list<T> &l, Args &&...args) -> decltype(pythonic::builtins::list::sort(l, std::forward<Args>(args)...)); template <class T, class... Args> - auto sort(types::list<T> &&l, Args &&... args) + auto sort(types::list<T> &&l, Args &&...args) -> decltype(pythonic::builtins::list::sort(std::move(l), std::forward<Args>(args)...)); template <class Any, class... Args> - types::none_type sort(Any &&any, Args &&... args); + types::none_type sort(Any &&any, Args &&...args); DEFINE_FUNCTOR(pythonic::__dispatch__, sort); -} +} // namespace __dispatch__ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/tolist.hpp b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/tolist.hpp new file mode 100644 index 0000000000..199ee3fc9b --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/tolist.hpp @@ -0,0 +1,53 @@ +#ifndef PYTHONIC_INCLUDE_DISPATCH_TOLIST_HPP +#define PYTHONIC_INCLUDE_DISPATCH_TOLIST_HPP + +#include "pythonic/include/numpy/ndarray/tolist.hpp" +#include "pythonic/include/types/array.hpp" + +PYTHONIC_NS_BEGIN + +namespace __dispatch__ +{ + template <class Any> + auto tolist(Any &&any) -> decltype(numpy::ndarray::tolist(any)) + { + return numpy::ndarray::tolist(any); + } + + template <class T, class S> + types::list< + typename std::conditional<std::is_integral<T>::value, long, double>::type> + tolist(types::sliced_array<T, S> &&a) + { + return {a.begin(), a.end()}; + } + + template <class T, class S> + types::list< + typename std::conditional<std::is_integral<T>::value, long, double>::type> + tolist(types::sliced_array<T, S> const &a) + { + return {a.begin(), a.end()}; + } + + template <class T> + types::list< + typename std::conditional<std::is_integral<T>::value, long, double>::type> + tolist(types::array<T> &&a) + { + return {a.begin(), a.end()}; + } + + template <class T> + types::list< + typename std::conditional<std::is_integral<T>::value, long, double>::type> + tolist(types::array<T> const &a) + { + return {a.begin(), a.end()}; + } + + DEFINE_FUNCTOR(pythonic::__dispatch__, tolist); +} // namespace __dispatch__ +PYTHONIC_NS_END + +#endif diff --git a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/update.hpp b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/update.hpp index e7ed9dd06b..258c9f6b86 100644 --- a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/update.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/update.hpp @@ -9,11 +9,11 @@ namespace __dispatch__ { template <class Any, class... Arg0> - auto update(Any &&any, Arg0 &&... arg0) + auto update(Any &&any, Arg0 &&...arg0) -> decltype(any.update(std::forward<Arg0>(arg0)...)); DEFINE_FUNCTOR(pythonic::__dispatch__, update); -} +} // namespace __dispatch__ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/array/array.hpp b/contrib/python/pythran/pythran/pythonic/include/array/array.hpp new file mode 100644 index 0000000000..1c076e11dd --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/include/array/array.hpp @@ -0,0 +1,81 @@ +#ifndef PYTHONIC_INCLUDE_ARRAY_ARRAY_HPP +#define PYTHONIC_INCLUDE_ARRAY_ARRAY_HPP + +#include "pythonic/include/types/array.hpp" +#include "pythonic/include/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace array +{ + namespace details + { + template <char c> + struct typecodes; + template <> + struct typecodes<'b'> { + using type = signed char; + }; + template <> + struct typecodes<'B'> { + using type = unsigned char; + }; + template <> + struct typecodes<'u'> { + using type = wchar_t; + }; + template <> + struct typecodes<'h'> { + using type = signed short; + }; + template <> + struct typecodes<'H'> { + using type = unsigned short; + }; + template <> + struct typecodes<'i'> { + using type = signed int; + }; + template <> + struct typecodes<'I'> { + using type = unsigned int; + }; + template <> + struct typecodes<'l'> { + using type = signed long; + }; + template <> + struct typecodes<'L'> { + using type = unsigned long; + }; + template <> + struct typecodes<'q'> { + using type = signed long long; + }; + template <> + struct typecodes<'Q'> { + using type = unsigned long long; + }; + template <> + struct typecodes<'f'> { + using type = float; + }; + template <> + struct typecodes<'d'> { + using type = double; + }; + + template <char c> + types::array<typename details::typecodes<c>::type> + array(std::integral_constant<char, c>); + + template <char c, class E> + types::array<typename details::typecodes<c>::type> + array(std::integral_constant<char, c>, E &&elts); + } // namespace details + + DEFINE_FUNCTOR(pythonic::array::details, array); +} // namespace array +PYTHONIC_NS_END + +#endif diff --git a/contrib/python/pythran/pythran/pythonic/include/array/array/buffer_info.hpp b/contrib/python/pythran/pythran/pythonic/include/array/array/buffer_info.hpp new file mode 100644 index 0000000000..954978d3c9 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/include/array/array/buffer_info.hpp @@ -0,0 +1,23 @@ +#ifndef PYTHONIC_INCLUDE_ARRAY_ARRAY_BUFFER_INFO_HPP +#define PYTHONIC_INCLUDE_ARRAY_ARRAY_BUFFER_INFO_HPP + +#include "pythonic/include/types/array.hpp" +#include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace array +{ + + namespace array + { + + template <class T> + std::tuple<long, long> buffer_info(types::array<T> const &seq); + + DEFINE_FUNCTOR(pythonic::array::array, buffer_info); + } // namespace array +} // namespace array +PYTHONIC_NS_END +#endif diff --git a/contrib/python/pythran/pythran/pythonic/include/array/array/byteswap.hpp b/contrib/python/pythran/pythran/pythonic/include/array/array/byteswap.hpp new file mode 100644 index 0000000000..e3bcdaecf7 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/include/array/array/byteswap.hpp @@ -0,0 +1,28 @@ +#ifndef PYTHONIC_INCLUDE_ARRAY_ARRAY_BYTESWAP_HPP +#define PYTHONIC_INCLUDE_ARRAY_ARRAY_BYTESWAP_HPP + +#include "pythonic/include/types/array.hpp" +#include "pythonic/include/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace array +{ + + namespace array + { + + template <class T> + types::none_type byteswap(types::array<T> &seq); + + template <class T> + types::none_type byteswap(types::array<T> &&seq) + { + return {}; + } + + DEFINE_FUNCTOR(pythonic::array::array, byteswap); + } // namespace array +} // namespace array +PYTHONIC_NS_END +#endif diff --git a/contrib/python/pythran/pythran/pythonic/include/array/array/count.hpp b/contrib/python/pythran/pythran/pythonic/include/array/array/count.hpp new file mode 100644 index 0000000000..80ff7dc0d0 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/include/array/array/count.hpp @@ -0,0 +1,22 @@ +#ifndef PYTHONIC_INCLUDE_ARRAY_ARRAY_COUNT_HPP +#define PYTHONIC_INCLUDE_ARRAY_ARRAY_COUNT_HPP + +#include "pythonic/include/types/array.hpp" +#include "pythonic/include/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace array +{ + + namespace array + { + + template <class T> + long count(types::array<T> const &seq); + + DEFINE_FUNCTOR(pythonic::array::array, count); + } // namespace array +} // namespace array +PYTHONIC_NS_END +#endif diff --git a/contrib/python/pythran/pythran/pythonic/include/array/array/extend.hpp b/contrib/python/pythran/pythran/pythonic/include/array/array/extend.hpp new file mode 100644 index 0000000000..004a4de828 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/include/array/array/extend.hpp @@ -0,0 +1,22 @@ +#ifndef PYTHONIC_INCLUDE_ARRAY_ARRAY_EXTEND_HPP +#define PYTHONIC_INCLUDE_ARRAY_ARRAY_EXTEND_HPP + +#include "pythonic/include/types/array.hpp" +#include "pythonic/include/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace array +{ + + namespace array + { + + template <class T, class S> + types::none_type extend(types::array<T> &a, S &&elts); + + DEFINE_FUNCTOR(pythonic::array::array, extend); + } // namespace array +} // namespace array +PYTHONIC_NS_END +#endif diff --git a/contrib/python/pythran/pythran/pythonic/include/array/array/frombytes.hpp b/contrib/python/pythran/pythran/pythonic/include/array/array/frombytes.hpp new file mode 100644 index 0000000000..22f2724dfb --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/include/array/array/frombytes.hpp @@ -0,0 +1,23 @@ +#ifndef PYTHONIC_INCLUDE_ARRAY_ARRAY_FROMBYTES_HPP +#define PYTHONIC_INCLUDE_ARRAY_ARRAY_FROMBYTES_HPP + +#include "pythonic/include/types/array.hpp" +#include "pythonic/include/types/str.hpp" +#include "pythonic/include/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace array +{ + + namespace array + { + + template <class T> + types::none_type frombytes(types::array<T> &seq, types::str const &); + + DEFINE_FUNCTOR(pythonic::array::array, frombytes); + } // namespace array +} // namespace array +PYTHONIC_NS_END +#endif diff --git a/contrib/python/pythran/pythran/pythonic/include/array/array/fromfile.hpp b/contrib/python/pythran/pythran/pythonic/include/array/array/fromfile.hpp new file mode 100644 index 0000000000..2dee79fd50 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/include/array/array/fromfile.hpp @@ -0,0 +1,41 @@ +#ifndef PYTHONIC_INCLUDE_ARRAY_ARRAY_FROMFILE_HPP +#define PYTHONIC_INCLUDE_ARRAY_ARRAY_FROMFILE_HPP + +#include "pythonic/include/types/array.hpp" +#include "pythonic/include/types/file.hpp" +#include "pythonic/include/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace array +{ + + namespace array + { + + template <class T> + types::none_type fromfile(types::array<T> &seq, types::file &f, long n); + + template <class T> + types::none_type fromfile(types::array<T> &seq, types::file &&f, long n) + { + return fromfile(seq, f, n); + } + + template <class T> + types::none_type fromfile(types::array<T> &&seq, types::file &&f, long n) + { + return fromfile(seq, f, n); + } + + template <class T> + types::none_type fromfile(types::array<T> &&seq, types::file &f, long n) + { + return fromfile(seq, f, n); + } + + DEFINE_FUNCTOR(pythonic::array::array, fromfile); + } // namespace array +} // namespace array +PYTHONIC_NS_END +#endif diff --git a/contrib/python/pythran/pythran/pythonic/include/array/array/fromlist.hpp b/contrib/python/pythran/pythran/pythonic/include/array/array/fromlist.hpp new file mode 100644 index 0000000000..e164bc722b --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/include/array/array/fromlist.hpp @@ -0,0 +1,27 @@ +#ifndef PYTHONIC_INCLUDE_ARRAY_ARRAY_FROMLIST_HPP +#define PYTHONIC_INCLUDE_ARRAY_ARRAY_FROMLIST_HPP + +#include "pythonic/include/types/array.hpp" +#include "pythonic/include/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace array +{ + + namespace array + { + + template <class T, class E> + types::none_type fromlist(types::array<T> &seq, E &&elts); + template <class T, class E> + types::none_type fromlist(types::array<T> &&seq, E &&elts) + { + return fromlist(seq, elts); + } + + DEFINE_FUNCTOR(pythonic::array::array, fromlist); + } // namespace array +} // namespace array +PYTHONIC_NS_END +#endif diff --git a/contrib/python/pythran/pythran/pythonic/include/array/typecodes.hpp b/contrib/python/pythran/pythran/pythonic/include/array/typecodes.hpp new file mode 100644 index 0000000000..791f037b52 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/include/array/typecodes.hpp @@ -0,0 +1,14 @@ +#ifndef PYTHONIC_INCLUDE_ARRAY_TYPECODES_HPP +#define PYTHONIC_INCLUDE_ARRAY_TYPECODES_HPP + +#include "pythonic/types/str.hpp" + +PYTHONIC_NS_BEGIN + +namespace array +{ + static types::str const typecodes("bBuhHiIlLqQfd"); +} +PYTHONIC_NS_END + +#endif diff --git a/contrib/python/pythran/pythran/pythonic/include/bisect/bisect.hpp b/contrib/python/pythran/pythran/pythonic/include/bisect/bisect.hpp index 8eb3e9fda5..3d54ae8a09 100644 --- a/contrib/python/pythran/pythran/pythonic/include/bisect/bisect.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/bisect/bisect.hpp @@ -27,7 +27,7 @@ namespace bisect std::upper_bound<typename X::const_iterator, A>); DEFINE_FUNCTOR(pythonic::bisect, bisect); -} +} // namespace bisect PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/bisect/bisect_left.hpp b/contrib/python/pythran/pythran/pythonic/include/bisect/bisect_left.hpp index 0953aa3e4b..589eb2e43a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/bisect/bisect_left.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/bisect/bisect_left.hpp @@ -14,7 +14,7 @@ namespace bisect long bisect_left(X const &x, A const &a, long lo, long hi); DEFINE_FUNCTOR(pythonic::bisect, bisect_left); -} +} // namespace bisect PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/bisect/bisect_right.hpp b/contrib/python/pythran/pythran/pythonic/include/bisect/bisect_right.hpp index c4d0d479e4..a29a0130c3 100644 --- a/contrib/python/pythran/pythran/pythonic/include/bisect/bisect_right.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/bisect/bisect_right.hpp @@ -14,7 +14,7 @@ namespace bisect long bisect_right(X const &x, A const &a, long lo, long hi); DEFINE_FUNCTOR(pythonic::bisect, bisect_right); -} +} // namespace bisect PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/abs.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/abs.hpp index ca927fb622..cec382b713 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/abs.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/abs.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_ABS_HPP #define PYTHONIC_INCLUDE_BUILTIN_ABS_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/abs.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -11,7 +11,7 @@ namespace builtins // FIXME np.abs accept any iterator while builtins.abs only accept // numeric types && numpy.array USING_FUNCTOR(abs, numpy::functor::abs); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/all.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/all.hpp index e3b619e3af..4d9c6085e8 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/all.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/all.hpp @@ -12,7 +12,7 @@ namespace builtins bool all(Iterable &&s); DEFINE_FUNCTOR(pythonic::builtins, all); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/any.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/any.hpp index 86b3d845cd..5bb310e634 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/any.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/any.hpp @@ -11,7 +11,7 @@ namespace builtins bool any(Iterable &&s); DEFINE_FUNCTOR(pythonic::builtins, any); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/bin.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/bin.hpp index 7365388c78..f507ec4b55 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/bin.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/bin.hpp @@ -16,7 +16,7 @@ namespace builtins bin(T const &v); DEFINE_FUNCTOR(pythonic::builtins, bin); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/bool_.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/bool_.hpp index f48b174f59..f0fdd1b52e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/bool_.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/bool_.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_BOOL_HPP #define PYTHONIC_INCLUDE_BUILTIN_BOOL_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -25,15 +25,15 @@ namespace builtins bool operator()(std::tuple<Ts...> const &val) const; template <class T, size_t N> - bool operator()(types::array<T, N> const &val) const; + bool operator()(types::array_tuple<T, N> const &val) const; friend std::ostream &operator<<(std::ostream &os, bool_) { return os << "bool"; } }; - } -} + } // namespace functor +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/chr.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/chr.hpp index 6e30ee9590..0c3819bc00 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/chr.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/chr.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_CHR_HPP #define PYTHONIC_INCLUDE_BUILTIN_CHR_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/str.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -12,7 +12,7 @@ namespace builtins types::str chr(T const &v); DEFINE_FUNCTOR(pythonic::builtins, chr); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/complex.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/complex.hpp index 7057bd3791..1ad6bc6dfe 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/complex.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/complex.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_COMPLEX_HPP #define PYTHONIC_INCLUDE_BUILTIN_COMPLEX_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -21,8 +21,8 @@ namespace builtins return os << "complex"; } }; - } -} + } // namespace functor +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/complex/conjugate.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/complex/conjugate.hpp index dcb8d5ac32..0c2b460779 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/complex/conjugate.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/complex/conjugate.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_COMPLEX_CONJUGATE_HPP #define PYTHONIC_INCLUDE_BUILTIN_COMPLEX_CONJUGATE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/conjugate.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace builtins @@ -11,6 +11,6 @@ namespace builtins { USING_FUNCTOR(conjugate, numpy::functor::conjugate); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/dict.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/dict.hpp index f84a9798a1..f4fdb16983 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/dict.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/dict.hpp @@ -20,13 +20,15 @@ namespace builtins types::dict<K, V> dict(types::dict<K, V> const &); template <class Iterable> - auto dict(Iterable &&iterable) -> types::dict< - typename std::decay<decltype(std::get<0>(*iterable.begin()))>::type, - typename std::decay<decltype(std::get<1>(*iterable.begin()))>::type>; - } + auto dict(Iterable &&iterable) + -> types::dict< + typename std::decay<decltype(std::get<0>(*iterable.begin()))>::type, + typename std::decay< + decltype(std::get<1>(*iterable.begin()))>::type>; + } // namespace anonymous DEFINE_FUNCTOR(pythonic::builtins::anonymous, dict); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/clear.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/clear.hpp index d90a2f3cf2..c51f03ef47 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/clear.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/clear.hpp @@ -11,7 +11,7 @@ namespace builtins { USING_FUNCTOR(clear, pythonic::__dispatch__::functor::clear); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/copy.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/copy.hpp index e0a92e31bb..33213a8226 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/copy.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/copy.hpp @@ -11,7 +11,7 @@ namespace builtins { USING_FUNCTOR(copy, pythonic::__dispatch__::functor::copy); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/fromkeys.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/fromkeys.hpp index 0bcf1ff1e8..d06ff6ee57 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/fromkeys.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/fromkeys.hpp @@ -20,8 +20,8 @@ namespace builtins fromkeys(Iterable &&iter, V const &v = builtins::None); DEFINE_FUNCTOR(pythonic::builtins::dict, fromkeys); - } -} + } // namespace dict +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/get.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/get.hpp index 01edc4b6a5..be4e976f4a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/get.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/get.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_DICT_GET_HPP #define PYTHONIC_INCLUDE_BUILTIN_DICT_GET_HPP -#include "pythonic/include/types/dict.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/dict.hpp" #include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -28,8 +28,8 @@ namespace builtins typename __combined<T, J>::type get(::dict_container<T>, I, J); DEFINE_FUNCTOR(pythonic::builtins::dict, get); - } -} + } // namespace dict +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/items.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/items.hpp index 21e47d0e6e..13d34bc997 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/items.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/items.hpp @@ -19,8 +19,8 @@ namespace builtins auto items(D &&d) -> decltype(std::forward<D>(d).items()); DEFINE_FUNCTOR(pythonic::builtins::dict, items); - } -} + } // namespace dict +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/keys.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/keys.hpp index f0dbba5452..5f0a78dfb8 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/keys.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/keys.hpp @@ -17,8 +17,8 @@ namespace builtins auto keys(D &&d) -> decltype(std::forward<D>(d).keys()); DEFINE_FUNCTOR(pythonic::builtins::dict, keys); - } -} + } // namespace dict +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/pop.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/pop.hpp index 7d0562c789..06ae4499ce 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/pop.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/pop.hpp @@ -11,7 +11,7 @@ namespace builtins { USING_FUNCTOR(pop, pythonic::__dispatch__::functor::pop); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/popitem.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/popitem.hpp index 5f12f97b59..16d7c1136a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/popitem.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/popitem.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_DICT_POPITEM_HPP #define PYTHONIC_INCLUDE_BUILTIN_DICT_POPITEM_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/dict.hpp" +#include "pythonic/include/utils/functor.hpp" #include <tuple> @@ -18,8 +18,8 @@ namespace builtins auto popitem(D &&d) -> decltype(std::forward<D>(d).popitem()); DEFINE_FUNCTOR(pythonic::builtins::dict, popitem); - } -} + } // namespace dict +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/setdefault.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/setdefault.hpp index e14b8221c0..cd7a58b679 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/setdefault.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/setdefault.hpp @@ -25,8 +25,8 @@ namespace builtins types::none<V> setdefault(types::dict<K, V> &&d, W const &k); DEFINE_FUNCTOR(pythonic::builtins::dict, setdefault); - } -} + } // namespace dict +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/update.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/update.hpp index 8d6990a90f..6e95782e33 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/update.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/update.hpp @@ -11,7 +11,7 @@ namespace builtins { USING_FUNCTOR(update, pythonic::__dispatch__::functor::update); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/values.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/values.hpp index 26030f7f09..d47d0aa144 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/values.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/values.hpp @@ -16,8 +16,8 @@ namespace builtins auto values(D &&d) -> decltype(std::forward<D>(d).values()); DEFINE_FUNCTOR(pythonic::builtins::dict, values); - } -} + } // namespace dict +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/divmod.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/divmod.hpp index c693338267..2dc79538c7 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/divmod.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/divmod.hpp @@ -14,7 +14,7 @@ namespace builtins -> decltype(types::make_tuple(t0 / t1, t0 % t1)); DEFINE_FUNCTOR(pythonic::builtins, divmod); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/file.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/file.hpp index ac84be64d4..fbe7b70e4b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/file.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/file.hpp @@ -17,7 +17,7 @@ namespace builtins } DEFINE_FUNCTOR(pythonic::builtins::anonymous, file); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/file/close.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/file/close.hpp index 106b3d0baa..e4fbf8f509 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/file/close.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/file/close.hpp @@ -16,7 +16,7 @@ namespace builtins void close(types::file &&f); DEFINE_FUNCTOR(pythonic::builtins::file, close); - } -} + } // namespace file +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/file/fileno.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/file/fileno.hpp index db8c9c055e..9323f7b699 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/file/fileno.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/file/fileno.hpp @@ -15,7 +15,7 @@ namespace builtins long fileno(types::file const &f); DEFINE_FUNCTOR(pythonic::builtins::file, fileno); - } -} + } // namespace file +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/file/flush.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/file/flush.hpp index e0d2b3a240..e193d9f8b6 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/file/flush.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/file/flush.hpp @@ -16,7 +16,7 @@ namespace builtins void flush(types::file &&f); DEFINE_FUNCTOR(pythonic::builtins::file, flush); - } -} + } // namespace file +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/file/isatty.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/file/isatty.hpp index 87bfb13759..55bdc93335 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/file/isatty.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/file/isatty.hpp @@ -15,7 +15,7 @@ namespace builtins bool isatty(types::file const &f); DEFINE_FUNCTOR(pythonic::builtins::file, isatty); - } -} + } // namespace file +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/file/next.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/file/next.hpp index 1378f872d7..9d51b4ba7e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/file/next.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/file/next.hpp @@ -11,6 +11,6 @@ namespace builtins { USING_FUNCTOR(next, pythonic::__dispatch__::functor::next); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/file/read.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/file/read.hpp index aeaa1f3ab2..8ac0b63dbc 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/file/read.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/file/read.hpp @@ -17,7 +17,7 @@ namespace builtins types::str read(types::file &&f, long size = -1); DEFINE_FUNCTOR(pythonic::builtins::file, read); - } -} + } // namespace file +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/file/readline.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/file/readline.hpp index 31abcc98fe..00810611b1 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/file/readline.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/file/readline.hpp @@ -17,7 +17,7 @@ namespace builtins types::str readline(types::file &&f, long size = -1); DEFINE_FUNCTOR(pythonic::builtins::file, readline); - } -} + } // namespace file +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/file/readlines.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/file/readlines.hpp index 32dea082d9..a5f77ee32e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/file/readlines.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/file/readlines.hpp @@ -20,7 +20,7 @@ namespace builtins types::list<types::str> readlines(F &&f, long sizehint); DEFINE_FUNCTOR(pythonic::builtins::file, readlines); - } -} + } // namespace file +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/file/seek.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/file/seek.hpp index 40f4202a5c..93cd83c78b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/file/seek.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/file/seek.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_FILE_SEEK_HPP #define PYTHONIC_INCLUDE_BUILTIN_FILE_SEEK_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/file.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -18,7 +18,7 @@ namespace builtins void seek(types::file &&f, long offset, long whence); DEFINE_FUNCTOR(pythonic::builtins::file, seek); - } -} + } // namespace file +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/file/tell.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/file/tell.hpp index a9f623d3dc..12bbab6783 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/file/tell.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/file/tell.hpp @@ -15,7 +15,7 @@ namespace builtins long tell(types::file const &f); DEFINE_FUNCTOR(pythonic::builtins::file, tell); - } -} + } // namespace file +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/file/truncate.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/file/truncate.hpp index 7278238699..45146410c6 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/file/truncate.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/file/truncate.hpp @@ -18,7 +18,7 @@ namespace builtins void truncate(types::file &&f, long size); DEFINE_FUNCTOR(pythonic::builtins::file, truncate); - } -} + } // namespace file +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/file/write.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/file/write.hpp index 66f09cc73e..66fe5ee813 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/file/write.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/file/write.hpp @@ -17,7 +17,7 @@ namespace builtins long write(types::file &&f, types::str const &str); DEFINE_FUNCTOR(pythonic::builtins::file, write); - } -} + } // namespace file +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/file/writelines.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/file/writelines.hpp index f98dfc1482..966173a973 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/file/writelines.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/file/writelines.hpp @@ -16,7 +16,7 @@ namespace builtins void writelines(F &&f, T const &sequence); DEFINE_FUNCTOR(pythonic::builtins::file, writelines); - } -} + } // namespace file +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/float_.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/float_.hpp index b9d05a6701..15ca376ccf 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/float_.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/float_.hpp @@ -24,8 +24,8 @@ namespace builtins return os << "float"; } }; - } -} + } // namespace functor +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/float_/is_integer.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/float_/is_integer.hpp index cfc14f7e8c..ae979b9d16 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/float_/is_integer.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/float_/is_integer.hpp @@ -14,8 +14,8 @@ namespace builtins bool is_integer(double d); DEFINE_FUNCTOR(pythonic::builtins::float_, is_integer); - } -} + } // namespace float_ +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/hex.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/hex.hpp index 5d5acb13fc..a078ffc394 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/hex.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/hex.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_HEX_HPP #define PYTHONIC_INCLUDE_BUILTIN_HEX_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/str.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -13,7 +13,7 @@ namespace builtins types::str hex(T const &v); DEFINE_FUNCTOR(pythonic::builtins, hex); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/id.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/id.hpp index 40378062ea..257f36c5bc 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/id.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/id.hpp @@ -16,7 +16,7 @@ namespace builtins long id(bool const &t); DEFINE_FUNCTOR(pythonic::builtins, id); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/int_.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/int_.hpp index e7a0d94150..dcee7b1648 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/int_.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/int_.hpp @@ -26,8 +26,8 @@ namespace builtins return os << "int"; } }; - } -} + } // namespace functor +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/isinstance.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/isinstance.hpp index 8a25f0f33c..806cd0ee29 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/isinstance.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/isinstance.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_ISINSTANCE_HPP #define PYTHONIC_INCLUDE_BUILTIN_ISINSTANCE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/builtins/pythran/is_none.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" PYTHONIC_NS_BEGIN @@ -25,7 +25,7 @@ namespace types struct isinstance<str, char const *> { using type = true_type; }; -} +} // namespace types namespace builtins { @@ -41,14 +41,14 @@ namespace builtins template <class Obj, class... Clss> struct isinstance<Obj, std::tuple<Clss...>> { using type = typename std::conditional< - utils::any_of< - std::is_same<typename types::isinstance< - Obj, typename std::decay<decltype( - std::declval<Clss>()())>::type>::type, - types::true_type>::value...>::value, + utils::any_of<std::is_same< + typename types::isinstance< + Obj, typename std::decay< + decltype(std::declval<Clss>()())>::type>::type, + types::true_type>::value...>::value, types::true_type, types::false_type>::type; }; - } + } // namespace details template <class Obj, class Cls> typename details::isinstance<Obj, Cls>::type isinstance(Obj, Cls) @@ -57,7 +57,7 @@ namespace builtins } DEFINE_FUNCTOR(pythonic::builtins, isinstance); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/iter.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/iter.hpp index 1e3dc07c49..7c252347b7 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/iter.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/iter.hpp @@ -23,7 +23,7 @@ namespace builtins iterator const &begin() const; iterator const &end() const; }; - } + } // namespace details template <class T> details::iter< @@ -31,7 +31,7 @@ namespace builtins iter(T &&t); DEFINE_FUNCTOR(pythonic::builtins, iter); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/len.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/len.hpp index e0fcf0aade..d884ee5c38 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/len.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/len.hpp @@ -4,8 +4,8 @@ #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/yield.hpp" -#include <tuple> #include <iterator> +#include <tuple> PYTHONIC_NS_BEGIN @@ -20,6 +20,6 @@ namespace builtins len(T const &t); DEFINE_FUNCTOR(pythonic::builtins, len); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/list.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/list.hpp index c587b413c5..aba29bc9c1 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/list.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/list.hpp @@ -23,10 +23,10 @@ namespace builtins typename std::remove_reference<Iterable>::type::iterator>::value_type>:: type> list(Iterable &&t); - } + } // namespace anonymous DEFINE_FUNCTOR(pythonic::builtins::anonymous, list); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/list/append.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/list/append.hpp index 507606d4c3..d07b99cef1 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/list/append.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/list/append.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_LIST_APPEND_HPP #define PYTHONIC_INCLUDE_BUILTIN_LIST_APPEND_HPP -#include "pythonic/include/types/list.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/list.hpp" #include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -23,7 +23,7 @@ namespace builtins types::none_type append(types::empty_list &seq, F &&value); DEFINE_FUNCTOR(pythonic::builtins::list, append); - } -} + } // namespace list +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/list/count.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/list/count.hpp index b8e3707b90..85e4ef1698 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/list/count.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/list/count.hpp @@ -13,7 +13,7 @@ namespace builtins { USING_FUNCTOR(count, pythonic::__dispatch__::functor::count); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/list/extend.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/list/extend.hpp index 8c071ca1ae..bac4c96704 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/list/extend.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/list/extend.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_LIST_EXTEND_HPP #define PYTHONIC_INCLUDE_BUILTIN_LIST_EXTEND_HPP -#include "pythonic/include/types/list.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/list.hpp" #include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -26,7 +26,7 @@ namespace builtins extend(T0 &&seq, T1 const &add); DEFINE_FUNCTOR(pythonic::builtins::list, extend); - } -} + } // namespace list +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/list/insert.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/list/insert.hpp index 58bfb6a686..5b762f4eca 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/list/insert.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/list/insert.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_LIST_INSERT_HPP #define PYTHONIC_INCLUDE_BUILTIN_LIST_INSERT_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/list.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/list.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace builtins types::none_type insert(types::list<T> &seq, long n, F &&value); DEFINE_FUNCTOR(pythonic::builtins::list, insert); - } -} + } // namespace list +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/list/pop.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/list/pop.hpp index 9ac28a6d27..633e0f00e8 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/list/pop.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/list/pop.hpp @@ -13,6 +13,6 @@ namespace builtins { USING_FUNCTOR(pop, pythonic::__dispatch__::functor::pop); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/list/remove.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/list/remove.hpp index 8fd44c85b3..da4307b42c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/list/remove.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/list/remove.hpp @@ -13,6 +13,6 @@ namespace builtins { USING_FUNCTOR(remove, pythonic::__dispatch__::functor::remove); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/list/reverse.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/list/reverse.hpp index edc2c52370..f5fe0227c1 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/list/reverse.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/list/reverse.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_LIST_REVERSE_HPP #define PYTHONIC_INCLUDE_BUILTIN_LIST_REVERSE_HPP -#include "pythonic/include/types/list.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/list.hpp" #include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace builtins types::none_type reverse(types::list<T> &seq); DEFINE_FUNCTOR(pythonic::builtins::list, reverse); - } -} + } // namespace list +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/list/sort.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/list/sort.hpp index 4f92e8f033..1db0c70bbe 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/list/sort.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/list/sort.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_LIST_SORT_HPP #define PYTHONIC_INCLUDE_BUILTIN_LIST_SORT_HPP -#include "pythonic/include/types/list.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/list.hpp" #include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -20,7 +20,7 @@ namespace builtins types::none_type sort(types::list<T> &seq, K key); DEFINE_FUNCTOR(pythonic::builtins::list, sort); - } -} + } // namespace list +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/map.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/map.hpp index 5e0912eb59..788106712c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/map.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/map.hpp @@ -4,9 +4,9 @@ #include "pythonic/include/itertools/common.hpp" #include "pythonic/include/types/NoneType.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/int_.hpp" #include "pythonic/include/utils/iterator.hpp" -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/seq.hpp" #include <utility> @@ -21,15 +21,15 @@ namespace builtins template <class Operator, class... Iters> struct map_res { - using type = decltype( - std::declval<Operator>()(std::declval<typename std::iterator_traits< + using type = decltype(std::declval<Operator>()( + std::declval<typename std::iterator_traits< typename Iters::iterator>::value_type>()...)); }; template <class... Iters> struct map_res<types::none_type, Iters...> { - using type = - decltype(types::make_tuple(std::declval<typename std::iterator_traits< + using type = decltype(types::make_tuple( + std::declval<typename std::iterator_traits< typename Iters::iterator>::value_type>()...)); }; @@ -98,23 +98,24 @@ namespace builtins map() = default; // Use an extra template to enable forwarding template <class... Types> - map(Operator const &_op, Types &&... _iters); + map(Operator const &_op, Types &&..._iters); iterator &begin(); iterator const &begin() const; iterator const &end() const; }; - } + } // namespace details template <typename Operator, typename... Iter> - auto map(Operator &&_op, Iter &&... iters) -> details::map< - typename std::remove_cv< - typename std::remove_reference<Operator>::type>::type, - typename types::iterator<typename std::remove_cv< - typename std::remove_reference<Iter>::type>::type>::type...>; + auto map(Operator &&_op, Iter &&...iters) + -> details::map< + typename std::remove_cv< + typename std::remove_reference<Operator>::type>::type, + typename types::iterator<typename std::remove_cv< + typename std::remove_reference<Iter>::type>::type>::type...>; DEFINE_FUNCTOR(pythonic::builtins, map); -} +} // namespace builtins namespace types { @@ -135,7 +136,7 @@ namespace types // selected static constexpr long value = (_head < _tail ? _head : _tail); }; -} +} // namespace types PYTHONIC_NS_END /* type inference stuff {*/ diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/max.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/max.hpp index 6f69e58b22..6ece9c3354 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/max.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/max.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_MAX_HPP #define PYTHONIC_INCLUDE_BUILTIN_MAX_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/operator_/gt.hpp" #include "pythonic/include/builtins/minmax.hpp" +#include "pythonic/include/operator_/gt.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -11,12 +11,12 @@ namespace builtins { template <class... Types> - auto max(Types &&... values) + auto max(Types &&...values) -> decltype(details::minmax(operator_::functor::lt{}, std::forward<Types>(values)...)); DEFINE_FUNCTOR(pythonic::builtins, max); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/min.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/min.hpp index 9b2a6608c7..4aabbaed45 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/min.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/min.hpp @@ -1,21 +1,21 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_MIN_HPP #define PYTHONIC_INCLUDE_BUILTIN_MIN_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/operator_/gt.hpp" #include "pythonic/include/builtins/minmax.hpp" +#include "pythonic/include/operator_/gt.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace builtins { template <class... Types> - auto min(Types &&... values) + auto min(Types &&...values) -> decltype(details::minmax(operator_::functor::gt{}, std::forward<Types>(values)...)); DEFINE_FUNCTOR(pythonic::builtins, min); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/minmax.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/minmax.hpp index 8163964c18..68f894dc0f 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/minmax.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/minmax.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_MINMAX_HPP #define PYTHONIC_INCLUDE_BUILTIN_MINMAX_HPP -#include <utility> #include "pythonic/include/builtins/pythran/kwonly.hpp" +#include <utility> PYTHONIC_NS_BEGIN @@ -21,8 +21,8 @@ namespace builtins typename std::enable_if<!std::is_same<T1, types::kwonly>::value, typename __combined<T0, T1, Types...>::type>::type minmax(Op const &, T0 const &, T1 const &, Types const &...); - } -} + } // namespace details +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/next.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/next.hpp index abea2e5ee3..f89e332cc1 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/next.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/next.hpp @@ -14,7 +14,7 @@ namespace builtins auto next(T &&y) -> decltype(*y); DEFINE_FUNCTOR(pythonic::builtins, next); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/oct.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/oct.hpp index af52c36a3e..1b1a219b7d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/oct.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/oct.hpp @@ -12,7 +12,7 @@ namespace builtins types::str oct(T const &v); DEFINE_FUNCTOR(pythonic::builtins, oct); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/open.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/open.hpp index 126985be04..e68d4feaa2 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/open.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/open.hpp @@ -13,7 +13,7 @@ namespace builtins types::file open(types::str const &filename, types::str const &strmode = "r"); DEFINE_FUNCTOR(pythonic::builtins, open); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/ord.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/ord.hpp index d9658b94ae..32356b07d6 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/ord.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/ord.hpp @@ -11,7 +11,7 @@ namespace builtins long ord(types::str const &v); DEFINE_FUNCTOR(pythonic::builtins, ord); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/pow.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/pow.hpp index 7b07574dcb..c31526d7eb 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/pow.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/pow.hpp @@ -16,11 +16,11 @@ namespace builtins long pow(long, std::integral_constant<long, N>); template <class... Types> - auto pow(Types &&... args) + auto pow(Types &&...args) -> decltype(numpy::functor::power{}(std::forward<Types>(args)...)); DEFINE_FUNCTOR(pythonic::builtins, pow); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/print.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/print.hpp index 9e6599ffb9..fa7b86ce2d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/print.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/print.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_PRINT_HPP #define PYTHONIC_INCLUDE_BUILTIN_PRINT_HPP -#include <ostream> #include "pythonic/include/utils/functor.hpp" +#include <ostream> PYTHONIC_NS_BEGIN @@ -12,14 +12,14 @@ namespace builtins void print_nonl(); template <typename T, typename... Types> - void print_nonl(T const &value, Types const &... values); + void print_nonl(T const &value, Types const &...values); void print(); template <typename T, typename... Types> - void print(T const &value, Types const &... values); + void print(T const &value, Types const &...values); DEFINE_FUNCTOR(pythonic::builtins, print); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/StaticIfBreak.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/StaticIfBreak.hpp index b631bfff7a..6c590b067d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/StaticIfBreak.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/StaticIfBreak.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_PYTHRAN_STATICIFBREAK_HPP #define PYTHONIC_INCLUDE_BUILTIN_PYTHRAN_STATICIFBREAK_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/static_if.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -15,8 +15,8 @@ namespace builtins types::StaticIfBreak<T> StaticIfBreak(T const &arg); DEFINE_FUNCTOR(pythonic::builtins::pythran, StaticIfBreak); - } -} + } // namespace pythran +} // namespace builtins PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/StaticIfCont.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/StaticIfCont.hpp index 4fc6f53af7..918b9cedbe 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/StaticIfCont.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/StaticIfCont.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_PYTHRAN_STATICIFCONT_HPP #define PYTHONIC_INCLUDE_BUILTIN_PYTHRAN_STATICIFCONT_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/static_if.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -15,8 +15,8 @@ namespace builtins types::StaticIfCont<T> StaticIfCont(T const &arg); DEFINE_FUNCTOR(pythonic::builtins::pythran, StaticIfCont); - } -} + } // namespace pythran +} // namespace builtins PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/StaticIfNoReturn.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/StaticIfNoReturn.hpp index 4f795c261b..b19474f63d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/StaticIfNoReturn.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/StaticIfNoReturn.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_PYTHRAN_STATICIFNORETURN_HPP #define PYTHONIC_INCLUDE_BUILTIN_PYTHRAN_STATICIFNORETURN_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/static_if.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -15,8 +15,8 @@ namespace builtins types::StaticIfNoReturn<T> StaticIfNoReturn(T const &arg); DEFINE_FUNCTOR(pythonic::builtins::pythran, StaticIfNoReturn); - } -} + } // namespace pythran +} // namespace builtins PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/StaticIfReturn.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/StaticIfReturn.hpp index 766e5dc5ab..72f7b898fd 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/StaticIfReturn.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/StaticIfReturn.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_PYTHRAN_STATICIFRETURN_HPP #define PYTHONIC_INCLUDE_BUILTIN_PYTHRAN_STATICIFRETURN_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/static_if.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -15,8 +15,8 @@ namespace builtins types::StaticIfReturn<T> StaticIfReturn(T const &arg); DEFINE_FUNCTOR(pythonic::builtins::pythran, StaticIfReturn); - } -} + } // namespace pythran +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/abssqr.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/abssqr.hpp index 5f62296b09..2f7284fd19 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/abssqr.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/abssqr.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_PYTHRAN_ABSSQR_HPP #define PYTHONIC_INCLUDE_BUILTIN_PYTHRAN_ABSSQR_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -21,13 +21,13 @@ namespace builtins template <class T> T abssqr(std::complex<T> const &v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME abssqr #define NUMPY_NARY_FUNC_SYM details::abssqr #include "pythonic/include/types/numpy_nary_expr.hpp" - } -} + } // namespace pythran +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/and_.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/and_.hpp index d6b15e95bd..2ef5198b39 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/and_.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/and_.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_PYTHRAN_AND_HPP #define PYTHONIC_INCLUDE_BUILTIN_PYTHRAN_AND_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/combined.hpp" #include "pythonic/include/types/lazy.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -17,8 +17,8 @@ namespace builtins types::lazy_combined_t<T0, T1> and_(T0 &&, T1 &&); DEFINE_FUNCTOR(pythonic::builtins::pythran, and_); - } -} + } // namespace pythran +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/len_set.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/len_set.hpp index 474f991b17..146e9f8b5e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/len_set.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/len_set.hpp @@ -15,8 +15,8 @@ namespace builtins long len_set(Iterable const &s); DEFINE_FUNCTOR(pythonic::builtins::pythran, len_set); - } -} + } // namespace pythran +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/make_shape.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/make_shape.hpp index 9f97d723eb..fbe1ad1a31 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/make_shape.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/make_shape.hpp @@ -11,8 +11,8 @@ namespace builtins pythonic::types::pshape<Args...> make_shape(Args... args); DEFINE_FUNCTOR(pythonic::builtins::pythran, make_shape); - } // pythran -} // builtins + } // namespace pythran +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/or_.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/or_.hpp index e84af2fe82..1622c50b54 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/or_.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/or_.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_PYTHRAN_OR_HPP #define PYTHONIC_INCLUDE_BUILTIN_PYTHRAN_OR_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/combined.hpp" #include "pythonic/include/types/lazy.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -17,8 +17,8 @@ namespace builtins types::lazy_combined_t<T0, T1> or_(T0 &&, T1 &&); DEFINE_FUNCTOR(pythonic::builtins::pythran, or_); - } -} + } // namespace pythran +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/restrict_assign.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/restrict_assign.hpp new file mode 100644 index 0000000000..7332335e16 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/restrict_assign.hpp @@ -0,0 +1,29 @@ +#ifndef PYTHONIC_INCLUDE_BUILTIN_RESTRICT_ASSIGN_HPP +#define PYTHONIC_INCLUDE_BUILTIN_RESTRICT_ASSIGN_HPP + +#include "pythonic/include/types/numpy_gexpr.hpp" + +PYTHONIC_NS_BEGIN + +namespace builtins +{ + namespace pythran + { + template <class Arg, class... S, class E> + void restrict_assign(types::numpy_gexpr<Arg, S...> &&target, E &&value) + { + std::move(target)._copy_restrict(std::forward<E>(value)); + } + + template <class T, class E> + void restrict_assign(T &&target, E &&value) + { + target = std::forward<E>(value); + } + + DEFINE_FUNCTOR(pythonic::builtins::pythran, restrict_assign); + } // namespace pythran +} // namespace builtins +PYTHONIC_NS_END + +#endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/static_if.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/static_if.hpp index a678609de5..bafed1af01 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/static_if.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/static_if.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_PYTHRAN_STATIC_IF_HPP #define PYTHONIC_INCLUDE_BUILTIN_PYTHRAN_STATIC_IF_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/builtins/pythran/is_none.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -54,9 +54,10 @@ namespace builtins { } template <class... Args> - auto operator()(Args &&... args) const -> typename __combined< - decltype(f0(std::forward<Args>(args)...)), - decltype(f1(std::forward<Args>(args)...))>::type + auto operator()(Args &&...args) const -> + typename __combined< + decltype(f0(std::forward<Args>(args)...)), + decltype(f1(std::forward<Args>(args)...))>::type { if (state_) return f0(std::forward<Args>(args)...); @@ -71,10 +72,10 @@ namespace builtins return {state_, f0, f1}; } }; - } + } // namespace details template <class T, class F0, class F1> - auto static_if(T const &cond, F0 f0, F1 f1) - -> decltype(details::static_if<T>{cond}(f0, f1)); + auto static_if(T const &cond, F0 f0, + F1 f1) -> decltype(details::static_if<T>{cond}(f0, f1)); template <class F0, class F1> auto static_if(int const &cond, F0 f0, F1 f1) @@ -84,8 +85,8 @@ namespace builtins } DEFINE_FUNCTOR(pythonic::builtins::pythran, static_if); - } -} + } // namespace pythran +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/static_list.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/static_list.hpp index 3d6ba21c71..cc3067bc0e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/static_list.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/static_list.hpp @@ -17,15 +17,15 @@ namespace builtins return {}; } template <class T, size_t N> - types::static_list<T, N> static_list(types::array<T, N> const &other); + types::static_list<T, N> static_list(types::array_tuple<T, N> const &other); template <class T, size_t N> - types::static_list<T, N> static_list(types::array<T, N> &other); + types::static_list<T, N> static_list(types::array_tuple<T, N> &other); template <class T, size_t N> - types::static_list<T, N> static_list(types::array<T, N> &&other); + types::static_list<T, N> static_list(types::array_tuple<T, N> &&other); template <class T> - auto static_list(T &&other) -> decltype( - pythonic::builtins::functor::list{}(std::forward<T>(other))); + auto static_list(T &&other) -> decltype(pythonic::builtins::functor::list{}( + std::forward<T>(other))); template <class T0, class... Tys> types::static_list<typename __combined<T0, Tys...>::type, diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/range.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/range.hpp index d88756401b..7c40b6dcd6 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/range.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/range.hpp @@ -30,7 +30,7 @@ namespace builtins bool operator<(range_iterator const &other) const; long operator-(range_iterator const &other) const; }; - } + } // namespace struct range { using value_type = long; @@ -58,7 +58,7 @@ namespace builtins }; DEFINE_FUNCTOR(pythonic::builtins, range); -} +} // namespace builtins PYTHONIC_NS_END namespace std @@ -70,7 +70,7 @@ namespace std struct tuple_element<I, pythonic::builtins::range> { typedef long type; }; -} +} // namespace std /* type inference stuff {*/ #include "pythonic/include/types/combined.hpp" diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/reduce.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/reduce.hpp index 2084ccbf3a..75791102f4 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/reduce.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/reduce.hpp @@ -20,7 +20,7 @@ namespace builtins // this convoluted expression computes the fixed-point type of the output // it's required because, e.g. static_list<long, 1> + static_list<long, 1> - // returns array<long, 2> + // returns array_tuple<long, 2> // and this widens to list template <class Iterable, class Operator, class T> using reduce_helper_t = typename __combined< @@ -36,7 +36,7 @@ namespace builtins static_cast<reduce_helper_t<Iterable, Operator, T>>(init), op)); DEFINE_FUNCTOR(pythonic::builtins, reduce); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/reversed.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/reversed.hpp index ead9297154..805009da18 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/reversed.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/reversed.hpp @@ -26,13 +26,13 @@ namespace builtins const_iterator begin() const; const_iterator end() const; }; - } + } // namespace details template <class Iterable> details::reversed<Iterable> reversed(Iterable const &iterable); DEFINE_FUNCTOR(pythonic::builtins, reversed); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/round.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/round.hpp index 49563a81db..0e45639481 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/round.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/round.hpp @@ -14,7 +14,7 @@ namespace builtins double round(T const &v); DEFINE_FUNCTOR(pythonic::builtins, round); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set.hpp index d5cf0c3dd3..6bff4e9b7a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/set.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set.hpp @@ -17,9 +17,9 @@ namespace builtins inline types::set<typename std::iterator_traits< typename std::remove_reference<Iterable>::type::iterator>::value_type> set(Iterable &&t); - } + } // namespace anonymous DEFINE_FUNCTOR(pythonic::builtins::anonymous, set); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/add.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/add.hpp index 18794b4ba4..c9e9f2fd86 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/add.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/add.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_SET_ADD_HPP #define PYTHONIC_INCLUDE_BUILTIN_SET_ADD_HPP -#include "pythonic/include/types/set.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/set.hpp" #include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -23,7 +23,7 @@ namespace builtins types::none_type add(types::empty_set const &s, F &&value); DEFINE_FUNCTOR(pythonic::builtins::set, add); - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/clear.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/clear.hpp index 4ccfbe12bd..1011bd0973 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/clear.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/clear.hpp @@ -11,6 +11,6 @@ namespace builtins { USING_FUNCTOR(clear, pythonic::__dispatch__::functor::clear); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/copy.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/copy.hpp index f6628cd93f..b83eb45376 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/copy.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/copy.hpp @@ -11,6 +11,6 @@ namespace builtins { USING_FUNCTOR(copy, pythonic::__dispatch__::functor::copy); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/difference.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/difference.hpp index e246a88eb3..bdc34bc830 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/difference.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/difference.hpp @@ -13,14 +13,14 @@ namespace builtins { template <typename T, typename... Types> - types::set<T> difference(types::set<T> const &set, Types const &... others); + types::set<T> difference(types::set<T> const &set, Types const &...others); template <typename T, typename... Types> - types::set<T> difference(types::set<T> &&set, Types const &... others); + types::set<T> difference(types::set<T> &&set, Types const &...others); template <typename... Types> types::empty_set difference(types::empty_set const &set, - Types const &... others); + Types const &...others); template <typename T> types::set<T> difference(types::set<T> const &set); @@ -31,7 +31,7 @@ namespace builtins types::empty_set difference(types::empty_set const &set); DEFINE_FUNCTOR(pythonic::builtins::set, difference); - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/difference_update.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/difference_update.hpp index 7057bb5cf5..7514ad93b0 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/difference_update.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/difference_update.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_SET_DIFFERENCEUPDATE_HPP #define PYTHONIC_INCLUDE_BUILTIN_SET_DIFFERENCEUPDATE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/set.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -14,18 +14,18 @@ namespace builtins template <typename T, typename... Types> types::none_type difference_update(types::set<T> &set, - Types const &... others); + Types const &...others); template <typename T, typename... Types> types::none_type difference_update(types::set<T> &&set, - Types const &... others); + Types const &...others); template <typename... Types> types::none_type difference_update(types::empty_set const &set, - Types const &... others); + Types const &...others); DEFINE_FUNCTOR(pythonic::builtins::set, difference_update); - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/discard.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/discard.hpp index 1e79a83450..11820088e0 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/discard.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/discard.hpp @@ -21,7 +21,7 @@ namespace builtins void discard(types::empty_set const &set, U const &elem); DEFINE_FUNCTOR(pythonic::builtins::set, discard); - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/intersection.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/intersection.hpp index eb4e34d172..3a33b6bca5 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/intersection.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/intersection.hpp @@ -14,7 +14,7 @@ namespace builtins template <typename T, typename... Types> typename __combined<types::set<T>, Types...>::type - intersection(types::set<T> const &set, Types const &... others); + intersection(types::set<T> const &set, Types const &...others); /* No rvalue overload possible because of return type modification.: * >>> a = set([1,2,3]) @@ -24,10 +24,10 @@ namespace builtins */ template <typename... Types> types::empty_set intersection(types::empty_set const &set, - Types const &... others); + Types const &...others); DEFINE_FUNCTOR(pythonic::builtins::set, intersection); - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/intersection_update.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/intersection_update.hpp index e7d4583cf4..a9fd1bdfc5 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/intersection_update.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/intersection_update.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_SET_INTERSECTIONUPDATE_HPP #define PYTHONIC_INCLUDE_BUILTIN_SET_INTERSECTIONUPDATE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/set.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -14,18 +14,18 @@ namespace builtins template <typename T, typename... Types> types::none_type intersection_update(types::set<T> &set, - Types const &... others); + Types const &...others); template <typename T, typename... Types> types::none_type intersection_update(types::set<T> &&set, - Types const &... others); + Types const &...others); template <typename... Types> types::none_type intersection_update(types::empty_set &&set, - Types const &... others); + Types const &...others); DEFINE_FUNCTOR(pythonic::builtins::set, intersection_update); - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/isdisjoint.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/isdisjoint.hpp index 0edf1bd001..d2a0d41ece 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/isdisjoint.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/isdisjoint.hpp @@ -18,7 +18,7 @@ namespace builtins bool isdisjoint(types::empty_set const &calling_set, U const &arg_set); DEFINE_FUNCTOR(pythonic::builtins::set, isdisjoint); - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/issubset.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/issubset.hpp index 8748d64acd..fb3026ee7e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/issubset.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/issubset.hpp @@ -19,7 +19,7 @@ namespace builtins bool issubset(types::empty_set const &set, U const &other); DEFINE_FUNCTOR(pythonic::builtins::set, issubset); - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/issuperset.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/issuperset.hpp index 3b32830f28..f9f886070c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/issuperset.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/issuperset.hpp @@ -19,7 +19,7 @@ namespace builtins bool issuperset(types::empty_set const &set, U const &other); DEFINE_FUNCTOR(pythonic::builtins::set, issuperset); - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/remove.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/remove.hpp index cd1edc50e7..9821115440 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/remove.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/remove.hpp @@ -11,6 +11,6 @@ namespace builtins { USING_FUNCTOR(remove, pythonic::__dispatch__::functor::remove); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/symmetric_difference.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/symmetric_difference.hpp index 916449ae26..a58e3635cc 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/symmetric_difference.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/symmetric_difference.hpp @@ -29,7 +29,7 @@ namespace builtins symmetric_difference(types::empty_set const &set, U const &other); DEFINE_FUNCTOR(pythonic::builtins::set, symmetric_difference); - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/symmetric_difference_update.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/symmetric_difference_update.hpp index 094bc11843..71b68679fa 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/symmetric_difference_update.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/symmetric_difference_update.hpp @@ -25,7 +25,7 @@ namespace builtins U const &other); DEFINE_FUNCTOR(pythonic::builtins::set, symmetric_difference_update); - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/union_.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/union_.hpp index 92f0741359..2e561dd825 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/union_.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/union_.hpp @@ -14,11 +14,11 @@ namespace builtins template <typename T, typename... Types> typename __combined<types::set<T>, Types...>::type - union_(types::set<T> const &set, Types const &... others); + union_(types::set<T> const &set, Types const &...others); template <typename... Types> typename __combined<types::empty_set, Types...>::type - union_(types::empty_set const &init, Types const &... others); + union_(types::empty_set const &init, Types const &...others); template <typename T> types::set<T> union_(types::set<T> const &set); @@ -29,7 +29,7 @@ namespace builtins types::empty_set union_(types::empty_set const &init); DEFINE_FUNCTOR(pythonic::builtins::set, union_); - } -} + } // namespace set +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/update.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/update.hpp index 99163e3ecb..ec57cdc152 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/update.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/update.hpp @@ -11,6 +11,6 @@ namespace builtins { USING_FUNCTOR(update, pythonic::__dispatch__::functor::update); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/sorted.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/sorted.hpp index be2859f02f..61553dbdde 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/sorted.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/sorted.hpp @@ -25,7 +25,7 @@ namespace builtins sorted(Iterable &&seq, types::none_type const &key, bool reverse = false); DEFINE_FUNCTOR(pythonic::builtins, sorted); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str.hpp index ccaa8846de..4adf0379b6 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/str.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str.hpp @@ -18,10 +18,10 @@ namespace builtins inline types::str str(bool b); inline types::str str(long value); inline types::str str(double l); - } + } // namespace anonymous DEFINE_FUNCTOR(pythonic::builtins::anonymous, str); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/__mod__.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/__mod__.hpp index e598da55b5..5a687fd6f7 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/__mod__.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/__mod__.hpp @@ -16,10 +16,11 @@ namespace builtins template <class... Ts> types::str __mod__(types::str const &, std::tuple<Ts...> const &args); template <size_t N, class T> - types::str __mod__(types::str const &, types::array<T, N> const &args); + types::str __mod__(types::str const &, + types::array_tuple<T, N> const &args); DEFINE_FUNCTOR(pythonic::builtins::str, __mod__); - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/capitalize.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/capitalize.hpp index fdf4929313..9fd4ccc1d8 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/capitalize.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/capitalize.hpp @@ -15,7 +15,7 @@ namespace builtins types::str capitalize(types::str const &s); DEFINE_FUNCTOR(pythonic::builtins::str, capitalize); - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/count.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/count.hpp index 35c0a6ae88..f6f8244b9a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/count.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/count.hpp @@ -11,6 +11,6 @@ namespace builtins { USING_FUNCTOR(count, pythonic::__dispatch__::functor::count); } -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/endswith.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/endswith.hpp index 78f94b170c..4772df1d17 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/endswith.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/endswith.hpp @@ -17,7 +17,7 @@ namespace builtins long end = -1); DEFINE_FUNCTOR(pythonic::builtins::str, endswith); - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/find.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/find.hpp index b9852d98cb..f7563e670b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/find.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/find.hpp @@ -20,7 +20,7 @@ namespace builtins long find(types::str const &s, types::str const &value); DEFINE_FUNCTOR(pythonic::builtins::str, find); - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/isalpha.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/isalpha.hpp index 463f4f25a2..dec802e5a2 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/isalpha.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/isalpha.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_STR_ISALPHA_HPP #define PYTHONIC_INCLUDE_BUILTIN_STR_ISALPHA_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/str.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace builtins bool isalpha(types::str const &s); DEFINE_FUNCTOR(pythonic::builtins::str, isalpha); - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/isdigit.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/isdigit.hpp index 5771c7da4c..d58089f96f 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/isdigit.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/isdigit.hpp @@ -15,7 +15,7 @@ namespace builtins bool isdigit(types::str const &s); DEFINE_FUNCTOR(pythonic::builtins::str, isdigit); - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/join.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/join.hpp index aa566d1e4d..cac5684f61 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/join.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/join.hpp @@ -40,7 +40,7 @@ namespace builtins join(S const &s, Iterable &&iterable); DEFINE_FUNCTOR(pythonic::builtins::str, join); - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/lower.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/lower.hpp index b204a5c25b..2ba4cf0d37 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/lower.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/lower.hpp @@ -15,7 +15,7 @@ namespace builtins types::str lower(types::str const &s); DEFINE_FUNCTOR(pythonic::builtins::str, lower); - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/lstrip.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/lstrip.hpp index 23c75f0371..565590aa53 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/lstrip.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/lstrip.hpp @@ -14,7 +14,7 @@ namespace builtins types::str lstrip(types::str const &self, types::str const &to_del = " "); DEFINE_FUNCTOR(pythonic::builtins::str, lstrip); - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/replace.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/replace.hpp index 2493f64145..353d73cff8 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/replace.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/replace.hpp @@ -17,7 +17,7 @@ namespace builtins long count = std::numeric_limits<long>::max()); DEFINE_FUNCTOR(pythonic::builtins::str, replace); - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/rstrip.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/rstrip.hpp index db2d6a2717..d3beb61e5b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/rstrip.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/rstrip.hpp @@ -15,7 +15,7 @@ namespace builtins types::str rstrip(types::str const &self, types::str const &to_del = " "); DEFINE_FUNCTOR(pythonic::builtins::str, rstrip); - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/split.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/split.hpp index a2d19f60f0..43304c4b3e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/split.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/split.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_STR_SPLIT_HPP #define PYTHONIC_INCLUDE_BUILTIN_STR_SPLIT_HPP -#include "pythonic/include/types/list.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/list.hpp" #include "pythonic/include/types/str.hpp" #include "pythonic/include/utils/functor.hpp" @@ -22,7 +22,7 @@ namespace builtins long maxsplit = -1); DEFINE_FUNCTOR(pythonic::builtins::str, split); - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/startswith.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/startswith.hpp index e1931d2e78..41fe387827 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/startswith.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/startswith.hpp @@ -16,7 +16,7 @@ namespace builtins long start = 0, long end = -1); DEFINE_FUNCTOR(pythonic::builtins::str, startswith); - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/strip.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/strip.hpp index ec045f1118..1a5cfce67b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/strip.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/strip.hpp @@ -15,7 +15,7 @@ namespace builtins types::str strip(types::str const &self, types::str const &to_del = " \n"); DEFINE_FUNCTOR(pythonic::builtins::str, strip); - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/upper.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/upper.hpp index 6c1b0279f1..19b150ad1e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/upper.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/upper.hpp @@ -15,7 +15,7 @@ namespace builtins types::str upper(types::str const &s); DEFINE_FUNCTOR(pythonic::builtins::str, upper); - } -} + } // namespace str +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/sum.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/sum.hpp index d33137066a..dd5adfce71 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/sum.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/sum.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/types/assignable.hpp" #include "pythonic/include/types/tuple.hpp" -#include "pythonic/include/utils/int_.hpp" #include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/utils/int_.hpp" #include <numeric> @@ -17,21 +17,22 @@ namespace builtins { template <class Tuple, size_t N> struct tuple_sum { - auto operator()(Tuple const &t) - -> decltype(std::get<N>(t) + tuple_sum<Tuple, N - 1>()(t)); + auto operator()(Tuple const &t) -> decltype(std::get<N>(t) + + tuple_sum<Tuple, N - 1>()(t)); }; template <class Tuple> struct tuple_sum<Tuple, 0> { auto operator()(Tuple const &t) -> decltype(std::get<0>(t)); }; - } + } // namespace details template <class Iterable, class T> - auto sum(Iterable s, T start) -> decltype(std::accumulate( - s.begin(), s.end(), - static_cast<typename assignable<decltype(start + *s.begin())>::type>( - start))); + auto sum(Iterable s, T start) + -> decltype(std::accumulate( + s.begin(), s.end(), + static_cast<typename assignable<decltype(start + *s.begin())>::type>( + start))); template <class Iterable> auto sum(Iterable s) -> decltype(sum(s, 0L)) @@ -40,10 +41,11 @@ namespace builtins } template <class... Types> - auto sum(std::tuple<Types...> const &t) -> decltype( - details::tuple_sum<std::tuple<Types...>, sizeof...(Types)-1>()(t)) + auto sum(std::tuple<Types...> const &t) + -> decltype(details::tuple_sum<std::tuple<Types...>, + sizeof...(Types) - 1>()(t)) { - return details::tuple_sum<std::tuple<Types...>, sizeof...(Types)-1>()(t); + return details::tuple_sum<std::tuple<Types...>, sizeof...(Types) - 1>()(t); } template <class T, size_t N, class V> @@ -53,7 +55,7 @@ namespace builtins } DEFINE_FUNCTOR(pythonic::builtins, sum); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/tuple.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/tuple.hpp index 59e3db2793..1dcdcfa40d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/tuple.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/tuple.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_BUILTIN_TUPLE_HPP #define PYTHONIC_INCLUDE_BUILTIN_TUPLE_HPP -#include "pythonic/include/types/tuple.hpp" #include "pythonic/include/types/dynamic_tuple.hpp" +#include "pythonic/include/types/tuple.hpp" #include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -30,7 +30,7 @@ namespace builtins typename std::enable_if< types::len_of<typename std::remove_cv<typename std::remove_reference< StaticIterable>::type>::type>::value >= 0, - types::array< + types::array_tuple< typename std::iterator_traits< typename std::remove_cv<typename std::remove_reference< StaticIterable>::type>::type::iterator>::value_type, @@ -39,7 +39,7 @@ namespace builtins tuple(StaticIterable &&i); DEFINE_FUNCTOR(pythonic::builtins, tuple); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/type.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/type.hpp index d115066a79..bd50e722b8 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/type.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/type.hpp @@ -11,7 +11,7 @@ namespace builtins template <class T> typename type_functor<T>::type type(T const &t); DEFINE_FUNCTOR(pythonic::builtins, type); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/xrange.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/xrange.hpp index 340eeabd14..9b2d17d0d4 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/xrange.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/xrange.hpp @@ -28,7 +28,7 @@ namespace builtins bool operator<(xrange_iterator const &other) const; long operator-(xrange_iterator const &other) const; }; - } + } // namespace struct xrange { using value_type = long; @@ -51,7 +51,7 @@ namespace builtins }; DEFINE_FUNCTOR(pythonic::builtins, xrange); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/zip.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/zip.hpp index d37be63b66..731f91eecd 100644 --- a/contrib/python/pythran/pythran/pythonic/include/builtins/zip.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/builtins/zip.hpp @@ -10,11 +10,11 @@ namespace builtins { template <typename... Iter> - auto zip(Iter &&... iters) - -> decltype(map(builtins::None, std::forward<Iter>(iters)...)); + auto zip(Iter &&...iters) -> decltype(map(builtins::None, + std::forward<Iter>(iters)...)); DEFINE_FUNCTOR(pythonic::builtins, zip); -} +} // namespace builtins PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/cmath/acos.hpp b/contrib/python/pythran/pythran/pythonic/include/cmath/acos.hpp index 71ac51e739..92d24f89d5 100644 --- a/contrib/python/pythran/pythran/pythonic/include/cmath/acos.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/cmath/acos.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_CMATH_ACOS_HPP #define PYTHONIC_INCLUDE_CMATH_ACOS_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/include/cmath/acosh.hpp b/contrib/python/pythran/pythran/pythonic/include/cmath/acosh.hpp index 46d979f916..1140211104 100644 --- a/contrib/python/pythran/pythran/pythonic/include/cmath/acosh.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/cmath/acosh.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_CMATH_ACOSH_HPP #define PYTHONIC_INCLUDE_CMATH_ACOSH_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/include/cmath/asin.hpp b/contrib/python/pythran/pythran/pythonic/include/cmath/asin.hpp index f5e8fb2e1d..f40ef73477 100644 --- a/contrib/python/pythran/pythran/pythonic/include/cmath/asin.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/cmath/asin.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_CMATH_ASIN_HPP #define PYTHONIC_INCLUDE_CMATH_ASIN_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/include/cmath/asinh.hpp b/contrib/python/pythran/pythran/pythonic/include/cmath/asinh.hpp index ba7fa7ee2e..904e57f04b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/cmath/asinh.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/cmath/asinh.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_CMATH_ASINH_HPP #define PYTHONIC_INCLUDE_CMATH_ASINH_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/include/cmath/atan.hpp b/contrib/python/pythran/pythran/pythonic/include/cmath/atan.hpp index 9cef6406d7..47b979517c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/cmath/atan.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/cmath/atan.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_CMATH_ATAN_HPP #define PYTHONIC_INCLUDE_CMATH_ATAN_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/include/cmath/atanh.hpp b/contrib/python/pythran/pythran/pythonic/include/cmath/atanh.hpp index ede7ff35f9..9ebc806938 100644 --- a/contrib/python/pythran/pythran/pythonic/include/cmath/atanh.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/cmath/atanh.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_CMATH_ATANH_HPP #define PYTHONIC_INCLUDE_CMATH_ATANH_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/include/cmath/cos.hpp b/contrib/python/pythran/pythran/pythonic/include/cmath/cos.hpp index f5071fc02b..40a35bc7f3 100644 --- a/contrib/python/pythran/pythran/pythonic/include/cmath/cos.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/cmath/cos.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_CMATH_COS_HPP #define PYTHONIC_INCLUDE_CMATH_COS_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> @@ -16,7 +16,7 @@ namespace cmath std::complex<T> cos(T const &v); DEFINE_FUNCTOR(pythonic::cmath, cos); -} +} // namespace cmath PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/cmath/cosh.hpp b/contrib/python/pythran/pythran/pythonic/include/cmath/cosh.hpp index 905b213209..ffcc2e9574 100644 --- a/contrib/python/pythran/pythran/pythonic/include/cmath/cosh.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/cmath/cosh.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_CMATH_COSH_HPP #define PYTHONIC_INCLUDE_CMATH_COSH_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/include/cmath/e.hpp b/contrib/python/pythran/pythran/pythonic/include/cmath/e.hpp index d128c68dbe..fbf9acd5c1 100644 --- a/contrib/python/pythran/pythran/pythonic/include/cmath/e.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/cmath/e.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_CMATH_E_HPP #define PYTHONIC_INCLUDE_CMATH_E_HPP -#include "pythonic/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/include/cmath/exp.hpp b/contrib/python/pythran/pythran/pythonic/include/cmath/exp.hpp index 8c5b3ba1f1..a970e3b148 100644 --- a/contrib/python/pythran/pythran/pythonic/include/cmath/exp.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/cmath/exp.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_CMATH_EXP_HPP #define PYTHONIC_INCLUDE_CMATH_EXP_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/include/cmath/isinf.hpp b/contrib/python/pythran/pythran/pythonic/include/cmath/isinf.hpp index 1b1a0e13de..24acc80756 100644 --- a/contrib/python/pythran/pythran/pythonic/include/cmath/isinf.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/cmath/isinf.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_CMATH_ISINF_HPP #define PYTHONIC_INCLUDE_CMATH_ISINF_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/include/cmath/isnan.hpp b/contrib/python/pythran/pythran/pythonic/include/cmath/isnan.hpp index be7cc9ad84..f52136c3e4 100644 --- a/contrib/python/pythran/pythran/pythonic/include/cmath/isnan.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/cmath/isnan.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_CMATH_ISNAN_HPP #define PYTHONIC_INCLUDE_CMATH_ISNAN_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/include/cmath/log.hpp b/contrib/python/pythran/pythran/pythonic/include/cmath/log.hpp index dd59e40200..618aeae30e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/cmath/log.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/cmath/log.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_CMATH_LOG_HPP #define PYTHONIC_INCLUDE_CMATH_LOG_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> @@ -13,7 +13,7 @@ namespace cmath using std::log; double log(double x, double base); DEFINE_FUNCTOR(pythonic::cmath, log); -} +} // namespace cmath PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/cmath/log10.hpp b/contrib/python/pythran/pythran/pythonic/include/cmath/log10.hpp index 85851944a5..6c2f62768b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/cmath/log10.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/cmath/log10.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_CMATH_LOG10_HPP #define PYTHONIC_INCLUDE_CMATH_LOG10_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/include/cmath/pi.hpp b/contrib/python/pythran/pythran/pythonic/include/cmath/pi.hpp index 6ddfe9f8d1..5672ddb31d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/cmath/pi.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/cmath/pi.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_CMATH_PI_HPP #define PYTHONIC_INCLUDE_CMATH_PI_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/include/cmath/sin.hpp b/contrib/python/pythran/pythran/pythonic/include/cmath/sin.hpp index 699b9268c6..12b6890105 100644 --- a/contrib/python/pythran/pythran/pythonic/include/cmath/sin.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/cmath/sin.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_CMATH_SIN_HPP #define PYTHONIC_INCLUDE_CMATH_SIN_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/include/cmath/sinh.hpp b/contrib/python/pythran/pythran/pythonic/include/cmath/sinh.hpp index 42a64fba04..3a773bc54d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/cmath/sinh.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/cmath/sinh.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_CMATH_SINH_HPP #define PYTHONIC_INCLUDE_CMATH_SINH_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/include/cmath/sqrt.hpp b/contrib/python/pythran/pythran/pythonic/include/cmath/sqrt.hpp index 4a78f2d1d8..1a7c0e1fd2 100644 --- a/contrib/python/pythran/pythran/pythonic/include/cmath/sqrt.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/cmath/sqrt.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_CMATH_SQRT_HPP #define PYTHONIC_INCLUDE_CMATH_SQRT_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/include/cmath/tan.hpp b/contrib/python/pythran/pythran/pythonic/include/cmath/tan.hpp index 605d6a5672..26336f5f20 100644 --- a/contrib/python/pythran/pythran/pythonic/include/cmath/tan.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/cmath/tan.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_CMATH_TAN_HPP #define PYTHONIC_INCLUDE_CMATH_TAN_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/include/cmath/tanh.hpp b/contrib/python/pythran/pythran/pythonic/include/cmath/tanh.hpp index 8a628bd5cc..ded400fd57 100644 --- a/contrib/python/pythran/pythran/pythonic/include/cmath/tanh.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/cmath/tanh.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_CMATH_TANH_HPP #define PYTHONIC_INCLUDE_CMATH_TANH_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> diff --git a/contrib/python/pythran/pythran/pythonic/include/functools/partial.hpp b/contrib/python/pythran/pythran/pythonic/include/functools/partial.hpp index ab6698502d..9fdf30ee90 100644 --- a/contrib/python/pythran/pythran/pythonic/include/functools/partial.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/functools/partial.hpp @@ -4,8 +4,8 @@ #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/seq.hpp" -#include <utility> #include <tuple> +#include <utility> PYTHONIC_NS_BEGIN @@ -33,10 +33,10 @@ namespace functools task(); task(task const &) = default; - task(ClosureTypes const &... types); + task(ClosureTypes const &...types); template <std::size_t... S, typename... Types> - auto call(utils::index_sequence<S...>, Types &&... types) const + auto call(utils::index_sequence<S...>, Types &&...types) const -> decltype(std::get<0>(closure)(std::get<S + 1>(closure)..., std::forward<Types>(types)...)) { @@ -45,20 +45,21 @@ namespace functools } template <typename... Types> - auto operator()(Types &&... types) const -> decltype( - this->call(utils::make_index_sequence<sizeof...(ClosureTypes)-1>(), - std::forward<Types>(types)...)); + auto operator()(Types &&...types) const + -> decltype(this->call( + utils::make_index_sequence<sizeof...(ClosureTypes) - 1>(), + std::forward<Types>(types)...)); }; - } + } // namespace details template <typename... Types> // remove references as closure capture the env by copy details::task<typename std::remove_cv< typename std::remove_reference<Types>::type>::type...> - partial(Types &&... types); + partial(Types &&...types); DEFINE_FUNCTOR(pythonic::functools, partial); -} +} // namespace functools PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/functools/reduce.hpp b/contrib/python/pythran/pythran/pythonic/include/functools/reduce.hpp index 02bb5bac48..c237c65c66 100644 --- a/contrib/python/pythran/pythran/pythonic/include/functools/reduce.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/functools/reduce.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_FUNCTOOLS_REDUCE_HPP #define PYTHONIC_INCLUDE_FUNCTOOLS_REDUCE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/builtins/reduce.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN diff --git a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/close.hpp b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/close.hpp index ae538dda8b..cfb4b1ede8 100644 --- a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/close.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/close.hpp @@ -14,7 +14,7 @@ namespace io { USING_FUNCTOR(close, builtins::file::functor::close); } - } -} + } // namespace _io +} // namespace io PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/fileno.hpp b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/fileno.hpp index 3798ee16d1..4a05685c05 100644 --- a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/fileno.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/fileno.hpp @@ -14,7 +14,7 @@ namespace io { USING_FUNCTOR(fileno, builtins::file::functor::fileno); } - } -} + } // namespace _io +} // namespace io PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/flush.hpp b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/flush.hpp index 48b802af02..7b06ae234c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/flush.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/flush.hpp @@ -14,7 +14,7 @@ namespace io { USING_FUNCTOR(flush, builtins::file::functor::flush); } - } -} + } // namespace _io +} // namespace io PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/isatty.hpp b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/isatty.hpp index f489ce4356..d5843b66e5 100644 --- a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/isatty.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/isatty.hpp @@ -14,7 +14,7 @@ namespace io { USING_FUNCTOR(isatty, builtins::file::functor::isatty); } - } -} + } // namespace _io +} // namespace io PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/next.hpp b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/next.hpp index 6b81cfbd98..aa1bcaea8d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/next.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/next.hpp @@ -13,7 +13,7 @@ namespace io { USING_FUNCTOR(next, builtins::file::functor::next); } - } -} + } // namespace _io +} // namespace io PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/read.hpp b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/read.hpp index 8a168d3276..5065064eed 100644 --- a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/read.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/read.hpp @@ -13,7 +13,7 @@ namespace io { USING_FUNCTOR(read, builtins::file::functor::read); } - } -} + } // namespace _io +} // namespace io PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/readline.hpp b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/readline.hpp index 8a81030be1..b2ee4f9478 100644 --- a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/readline.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/readline.hpp @@ -13,7 +13,7 @@ namespace io { USING_FUNCTOR(readline, builtins::file::functor::readline); } - } -} + } // namespace _io +} // namespace io PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/readlines.hpp b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/readlines.hpp index d4df432dfa..74b88c44f9 100644 --- a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/readlines.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/readlines.hpp @@ -13,7 +13,7 @@ namespace io { USING_FUNCTOR(readlines, builtins::file::functor::readlines); } - } -} + } // namespace _io +} // namespace io PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/seek.hpp b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/seek.hpp index 0bd1b54c7a..b2b576bc36 100644 --- a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/seek.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/seek.hpp @@ -13,7 +13,7 @@ namespace io { USING_FUNCTOR(seek, builtins::file::functor::seek); } - } -} + } // namespace _io +} // namespace io PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/tell.hpp b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/tell.hpp index 09deee54ae..c9d4c50b4a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/tell.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/tell.hpp @@ -13,7 +13,7 @@ namespace io { USING_FUNCTOR(tell, builtins::file::functor::tell); } - } -} + } // namespace _io +} // namespace io PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/truncate.hpp b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/truncate.hpp index 9dd855b745..20ff10f4ee 100644 --- a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/truncate.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/truncate.hpp @@ -13,7 +13,7 @@ namespace io { USING_FUNCTOR(truncate, builtins::file::functor::truncate); } - } -} + } // namespace _io +} // namespace io PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/write.hpp b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/write.hpp index 90813ffebc..7546220544 100644 --- a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/write.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/write.hpp @@ -13,7 +13,7 @@ namespace io { USING_FUNCTOR(write, builtins::file::functor::write); } - } -} + } // namespace _io +} // namespace io PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/writelines.hpp b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/writelines.hpp index ff55e19760..a77af96683 100644 --- a/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/writelines.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/io/_io/TextIOWrapper/writelines.hpp @@ -13,7 +13,7 @@ namespace io { USING_FUNCTOR(writelines, builtins::file::functor::writelines); } - } -} + } // namespace _io +} // namespace io PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/itertools/common.hpp b/contrib/python/pythran/pythran/pythonic/include/itertools/common.hpp index 41295a771d..ea5452d6e9 100644 --- a/contrib/python/pythran/pythran/pythonic/include/itertools/common.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/itertools/common.hpp @@ -8,7 +8,7 @@ namespace itertools struct npos { }; -} +} // namespace itertools PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/itertools/count.hpp b/contrib/python/pythran/pythran/pythonic/include/itertools/count.hpp index 16956112d8..06e93d9658 100644 --- a/contrib/python/pythran/pythran/pythonic/include/itertools/count.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/itertools/count.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_ITERTOOLS_COUNT_HPP #define PYTHONIC_INCLUDE_ITERTOOLS_COUNT_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/combined.hpp" +#include "pythonic/include/utils/functor.hpp" #include <iterator> @@ -38,7 +38,7 @@ namespace itertools iterator const &begin() const; iterator end() const; }; - } + } // namespace details template <typename T0, typename T1 = T0> details::count<typename __combined<T0, T1>::type> count(T0 start, @@ -47,7 +47,7 @@ namespace itertools details::count<long> count(); DEFINE_FUNCTOR(pythonic::itertools, count); -} +} // namespace itertools PYTHONIC_NS_END /* type inference stuff {*/ diff --git a/contrib/python/pythran/pythran/pythonic/include/itertools/islice.hpp b/contrib/python/pythran/pythran/pythonic/include/itertools/islice.hpp index 69c0afdad9..b6545a0a02 100644 --- a/contrib/python/pythran/pythran/pythonic/include/itertools/islice.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/itertools/islice.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_ITERTOOLS_ISLICE_HPP #define PYTHONIC_INCLUDE_ITERTOOLS_ISLICE_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/itertools/common.hpp" #include "pythonic/include/builtins/range.hpp" +#include "pythonic/include/itertools/common.hpp" +#include "pythonic/include/utils/functor.hpp" #include <iterator> PYTHONIC_NS_BEGIN @@ -64,7 +64,7 @@ namespace itertools islice(Iterable &&iterable, long stop); DEFINE_FUNCTOR(pythonic::itertools, islice); -} +} // namespace itertools PYTHONIC_NS_END /* type inference stuff {*/ diff --git a/contrib/python/pythran/pythran/pythonic/include/itertools/permutations.hpp b/contrib/python/pythran/pythran/pythonic/include/itertools/permutations.hpp index 5aff43d041..7b0630622c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/itertools/permutations.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/itertools/permutations.hpp @@ -88,7 +88,7 @@ namespace itertools permutations(T0 iter); template <typename T0, long N0> - _permutations<T0, types::array<typename T0::value_type, (size_t)N0>> + _permutations<T0, types::array_tuple<typename T0::value_type, (size_t)N0>> permutations(T0 iter, std::integral_constant<long, N0>); DEFINE_FUNCTOR(pythonic::itertools, permutations); diff --git a/contrib/python/pythran/pythran/pythonic/include/itertools/product.hpp b/contrib/python/pythran/pythran/pythonic/include/itertools/product.hpp index 7ca6f0c6a9..070726c630 100644 --- a/contrib/python/pythran/pythran/pythonic/include/itertools/product.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/itertools/product.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_INCLUDE_ITERTOOLS_PRODUCT_HPP #define PYTHONIC_INCLUDE_ITERTOOLS_PRODUCT_HPP -#include "pythonic/include/utils/iterator.hpp" -#include "pythonic/include/utils/seq.hpp" -#include "pythonic/include/utils/int_.hpp" #include "pythonic/include/itertools/common.hpp" #include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/utils/int_.hpp" +#include "pythonic/include/utils/iterator.hpp" +#include "pythonic/include/utils/seq.hpp" #include <iterator> #include <type_traits> @@ -60,21 +60,21 @@ namespace itertools iterator end_iter; product() = default; - product(Iters const &... _iters); + product(Iters const &..._iters); iterator &begin(); iterator const &begin() const; iterator const &end() const; }; - } + } // namespace details template <typename... Iter> details::product<typename std::remove_cv< typename std::remove_reference<Iter>::type>::type...> - product(Iter &&... iters); + product(Iter &&...iters); DEFINE_FUNCTOR(pythonic::itertools, product); -} +} // namespace itertools PYTHONIC_NS_END /* type inference stuff {*/ diff --git a/contrib/python/pythran/pythran/pythonic/include/itertools/repeat.hpp b/contrib/python/pythran/pythran/pythonic/include/itertools/repeat.hpp index c827e8d5e3..477a789af5 100644 --- a/contrib/python/pythran/pythran/pythonic/include/itertools/repeat.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/itertools/repeat.hpp @@ -43,7 +43,7 @@ namespace itertools _repeat<T, true> repeat(T iter); DEFINE_FUNCTOR(pythonic::itertools, repeat); -} +} // namespace itertools PYTHONIC_NS_END /* type inference stuff {*/ diff --git a/contrib/python/pythran/pythran/pythonic/include/math/ceil.hpp b/contrib/python/pythran/pythran/pythonic/include/math/ceil.hpp index 2b49601462..e46b2c0e50 100644 --- a/contrib/python/pythran/pythran/pythonic/include/math/ceil.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/math/ceil.hpp @@ -11,7 +11,7 @@ namespace math long ceil(T x); DEFINE_FUNCTOR(pythonic::math, ceil); -} +} // namespace math PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/math/degrees.hpp b/contrib/python/pythran/pythran/pythonic/include/math/degrees.hpp index 724ffd310e..7473031e9d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/math/degrees.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/math/degrees.hpp @@ -12,7 +12,7 @@ namespace math double degrees(T x); DEFINE_FUNCTOR(pythonic::math, degrees); -} +} // namespace math PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/math/factorial.hpp b/contrib/python/pythran/pythran/pythonic/include/math/factorial.hpp index cbfc061282..a0284876ee 100644 --- a/contrib/python/pythran/pythran/pythonic/include/math/factorial.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/math/factorial.hpp @@ -12,7 +12,7 @@ namespace math T factorial(T x); DEFINE_FUNCTOR(pythonic::math, factorial); -} +} // namespace math PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/math/floor.hpp b/contrib/python/pythran/pythran/pythonic/include/math/floor.hpp index 8e2b82dd29..f5d66ac20d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/math/floor.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/math/floor.hpp @@ -11,7 +11,7 @@ namespace math long floor(T x); DEFINE_FUNCTOR(pythonic::math, floor); -} +} // namespace math PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/math/frexp.hpp b/contrib/python/pythran/pythran/pythonic/include/math/frexp.hpp index 56d6a80427..bc91d27687 100644 --- a/contrib/python/pythran/pythran/pythonic/include/math/frexp.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/math/frexp.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_MATH_FREXP_HPP #define PYTHONIC_INCLUDE_MATH_FREXP_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> @@ -12,7 +12,7 @@ namespace math { std::tuple<double, long> frexp(double x); DEFINE_FUNCTOR(pythonic::math, frexp); -} +} // namespace math PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/math/gamma.hpp b/contrib/python/pythran/pythran/pythonic/include/math/gamma.hpp index 19e7d1eb8c..fc37585ee6 100644 --- a/contrib/python/pythran/pythran/pythonic/include/math/gamma.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/math/gamma.hpp @@ -10,7 +10,7 @@ namespace math { double gamma(double x); DEFINE_FUNCTOR(pythonic::math, gamma); -} +} // namespace math PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/math/isinf.hpp b/contrib/python/pythran/pythran/pythonic/include/math/isinf.hpp index 6c5f8b0d9e..5884b60d98 100644 --- a/contrib/python/pythran/pythran/pythonic/include/math/isinf.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/math/isinf.hpp @@ -14,7 +14,7 @@ namespace math return std::isinf(v); } DEFINE_FUNCTOR(pythonic::math, isinf); -} +} // namespace math PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/math/log.hpp b/contrib/python/pythran/pythran/pythonic/include/math/log.hpp index 0d4090d3c9..ab2056264c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/math/log.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/math/log.hpp @@ -11,7 +11,7 @@ namespace math using std::log; double log(double x, double base); DEFINE_FUNCTOR(pythonic::math, log); -} +} // namespace math PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/math/modf.hpp b/contrib/python/pythran/pythran/pythonic/include/math/modf.hpp index a3ccd0e8c6..566766971d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/math/modf.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/math/modf.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_MATH_MODF_HPP #define PYTHONIC_INCLUDE_MATH_MODF_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> @@ -12,7 +12,7 @@ namespace math { std::tuple<double, double> modf(double x); DEFINE_FUNCTOR(pythonic::math, modf); -} +} // namespace math PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/math/pi.hpp b/contrib/python/pythran/pythran/pythonic/include/math/pi.hpp index c7cc32985f..065b409812 100644 --- a/contrib/python/pythran/pythran/pythonic/include/math/pi.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/math/pi.hpp @@ -8,7 +8,7 @@ namespace math // see https://meetingcpp.com/blog/items/cpp-and-pi.html double constexpr pi = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651e+00; -} +} // namespace math PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/math/radians.hpp b/contrib/python/pythran/pythran/pythonic/include/math/radians.hpp index 1262a000f6..1ed2583a9b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/math/radians.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/math/radians.hpp @@ -11,7 +11,7 @@ namespace math template <class T> double radians(T x); DEFINE_FUNCTOR(pythonic::math, radians); -} +} // namespace math PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/math/trunc.hpp b/contrib/python/pythran/pythran/pythonic/include/math/trunc.hpp index bdb454b109..b9b6713c5d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/math/trunc.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/math/trunc.hpp @@ -11,7 +11,7 @@ namespace math long trunc(T x); DEFINE_FUNCTOR(pythonic::math, trunc); -} +} // namespace math PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/abs.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/abs.hpp index 1e6c928967..8459a6790f 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/abs.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/abs.hpp @@ -2,9 +2,9 @@ #define PYTHONIC_INCLUDE_NUMPY_ABS_HPP #include "pythonic/include/types/numpy_op_helper.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/utils/functor.hpp" #include <xsimd/xsimd.hpp> @@ -16,7 +16,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME abs #define NUMPY_NARY_FUNC_SYM xsimd::abs #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/absolute.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/absolute.hpp index 1b421ac57a..b5dae6727a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/absolute.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/absolute.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ABSOLUTE_HPP #define PYTHONIC_INCLUDE_NUMPY_ABSOLUTE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/abs.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/add.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/add.hpp index fbae482f7a..3e4be00470 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/add.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/add.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ADD_HPP #define PYTHONIC_INCLUDE_NUMPY_ADD_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/operator_/add.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/operator_/add.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME add #define NUMPY_NARY_FUNC_SYM pythonic::operator_::add #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/alen.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/alen.hpp index 6deccde09a..b072d9a6ef 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/alen.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/alen.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ALEN_HPP #define PYTHONIC_INCLUDE_NUMPY_ALEN_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -12,7 +12,7 @@ namespace numpy long alen(T &&expr); DEFINE_FUNCTOR(pythonic::numpy, alen); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/all.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/all.hpp index 77cc158b55..cfe8caf1be 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/all.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/all.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ALL_HPP #define PYTHONIC_INCLUDE_NUMPY_ALL_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/numpy/multiply.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -31,11 +31,12 @@ namespace numpy template <class E> typename std::enable_if< E::value != 1, - types::ndarray<typename E::dtype, types::array<long, E::value - 1>>>::type + types::ndarray<typename E::dtype, + types::array_tuple<long, E::value - 1>>>::type all(E const &array, long axis); DEFINE_FUNCTOR(pythonic::numpy, all); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/allclose.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/allclose.hpp index 07b26d4941..c2a373d459 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/allclose.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/allclose.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ALLCLOSE_HPP #define PYTHONIC_INCLUDE_NUMPY_ALLCLOSE_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/numpy/abs.hpp" #include "pythonic/include/numpy/isfinite.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy bool allclose(U const &u, V const &v, double rtol = 1e-5, double atol = 1e-8); DEFINE_FUNCTOR(pythonic::numpy, allclose); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/alltrue.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/alltrue.hpp index da988f7a42..e73ff3660a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/alltrue.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/alltrue.hpp @@ -8,11 +8,11 @@ PYTHONIC_NS_BEGIN namespace numpy { template <class... Types> - auto alltrue(Types &&... types) - -> decltype(all(std::forward<Types>(types)...)); + auto + alltrue(Types &&...types) -> decltype(all(std::forward<Types>(types)...)); DEFINE_FUNCTOR(pythonic::numpy, alltrue); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/angle.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/angle.hpp index 991ed7e3bf..619e2ac6a6 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/angle.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/angle.hpp @@ -18,7 +18,7 @@ namespace numpy auto angle(T const &t) -> decltype(functor::angle_in_rad()(t)); DEFINE_FUNCTOR(pythonic::numpy, angle); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/angle_in_deg.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/angle_in_deg.hpp index 210bc94cec..ebef8869ce 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/angle_in_deg.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/angle_in_deg.hpp @@ -22,11 +22,11 @@ namespace numpy { return angle_in_rad(t) * 180 / pi; } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME angle_in_deg #define NUMPY_NARY_FUNC_SYM wrapper::angle_in_deg #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/angle_in_rad.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/angle_in_rad.hpp index 5f5d7def3b..a0d032753a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/angle_in_rad.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/angle_in_rad.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ANGLEINRAD_HPP #define PYTHONIC_INCLUDE_NUMPY_ANGLEINRAD_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/numpy/arctan.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/numpy/arctan.hpp" /* NOTE: angle_in_rad is not part of the official Numpy API, * this file is here only to split the angle function in two parts @@ -17,13 +17,13 @@ namespace numpy namespace wrapper { template <class T> - auto angle_in_rad(T const &t) - -> decltype(std::atan2(std::imag(t), std::real(t))); + auto angle_in_rad(T const &t) -> decltype(std::atan2(std::imag(t), + std::real(t))); } #define NUMPY_NARY_FUNC_NAME angle_in_rad #define NUMPY_NARY_FUNC_SYM wrapper::angle_in_rad #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/any.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/any.hpp index 2add8b0405..044005a66a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/any.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/any.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ANY_HPP #define PYTHONIC_INCLUDE_NUMPY_ANY_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/numpy/add.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -31,11 +31,12 @@ namespace numpy template <class E> typename std::enable_if< E::value != 1, - types::ndarray<typename E::dtype, types::array<long, E::value - 1>>>::type + types::ndarray<typename E::dtype, + types::array_tuple<long, E::value - 1>>>::type any(E const &array, long axis); DEFINE_FUNCTOR(pythonic::numpy, any); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/append.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/append.hpp index 935ef25176..c78901598c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/append.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/append.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_APPEND_HPP #define PYTHONIC_INCLUDE_NUMPY_APPEND_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -31,7 +31,7 @@ namespace numpy append(T const &to, F const &data); DEFINE_FUNCTOR(pythonic::numpy, append); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/arange.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/arange.hpp index 0b6cb1bcb3..7148c51731 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/arange.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/arange.hpp @@ -148,9 +148,11 @@ namespace numpy } template <class... S> - auto operator()(S const &...s) const -> typename std::enable_if< - (sizeof...(S) > 1), - decltype(std::declval<types::ndarray<dtype, shape_t>>()(s...))>::type + auto operator()(S const &...s) const -> + typename std::enable_if< + (sizeof...(S) > 1), + decltype(std::declval<types::ndarray<dtype, shape_t>>()( + s...))>::type { return types::ndarray<dtype, shape_t>{ types::numpy_expr<pythonic::operator_::functor::pos, arange_index>{ diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/arccos.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/arccos.hpp index 9c6745408a..3921c46158 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/arccos.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/arccos.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ARCCOS_HPP #define PYTHONIC_INCLUDE_NUMPY_ARCCOS_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME arccos #define NUMPY_NARY_FUNC_SYM xsimd::acos #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/arccosh.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/arccosh.hpp index 8d1e7695ae..1a77b725f3 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/arccosh.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/arccosh.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ARCCOSH_HPP #define PYTHONIC_INCLUDE_NUMPY_ARCCOSH_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME arccosh #define NUMPY_NARY_FUNC_SYM xsimd::acosh #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/arcsin.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/arcsin.hpp index 849bead802..0a221c7ab3 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/arcsin.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/arcsin.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ARCSIN_HPP #define PYTHONIC_INCLUDE_NUMPY_ARCSIN_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME arcsin #define NUMPY_NARY_FUNC_SYM xsimd::asin #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/arcsinh.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/arcsinh.hpp index 94922c939c..efaafe1ee9 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/arcsinh.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/arcsinh.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ARCSINH_HPP #define PYTHONIC_INCLUDE_NUMPY_ARCSINH_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME arcsinh #define NUMPY_NARY_FUNC_SYM xsimd::asinh #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/arctan.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/arctan.hpp index fb44c56b94..1f12102aed 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/arctan.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/arctan.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ARCTAN_HPP #define PYTHONIC_INCLUDE_NUMPY_ARCTAN_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME arctan #define NUMPY_NARY_FUNC_SYM xsimd::atan #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/arctan2.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/arctan2.hpp index fb6ba8fbb3..fc32506c7a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/arctan2.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/arctan2.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ARCTAN2_HPP #define PYTHONIC_INCLUDE_NUMPY_ARCTAN2_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -16,7 +16,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME arctan2 #define NUMPY_NARY_FUNC_SYM xsimd::atan2 #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/arctanh.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/arctanh.hpp index ebf4a20807..9dc63e94ae 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/arctanh.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/arctanh.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ARCTANH_HPP #define PYTHONIC_INCLUDE_NUMPY_ARCTANH_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME arctanh #define NUMPY_NARY_FUNC_SYM xsimd::atanh #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/argmax.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/argmax.hpp index 1bc9c5522c..bc8de17e62 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/argmax.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/argmax.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ARGMAX_HPP #define PYTHONIC_INCLUDE_NUMPY_ARGMAX_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -13,11 +13,11 @@ namespace numpy long argmax(E const &expr); template <class E> - types::ndarray<long, types::array<long, E::value - 1>> argmax(E const &expr, - long axis); + types::ndarray<long, types::array_tuple<long, E::value - 1>> + argmax(E const &expr, long axis); DEFINE_FUNCTOR(pythonic::numpy, argmax); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/argmin.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/argmin.hpp index 429a168fd3..126ac3bb8c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/argmin.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/argmin.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ARGMIN_HPP #define PYTHONIC_INCLUDE_NUMPY_ARGMIN_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -12,11 +12,11 @@ namespace numpy long argmin(E const &expr); template <class E> - types::ndarray<long, types::array<long, E::value - 1>> argmin(E const &expr, - long axis); + types::ndarray<long, types::array_tuple<long, E::value - 1>> + argmin(E const &expr, long axis); DEFINE_FUNCTOR(pythonic::numpy, argmin); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/argsort.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/argsort.hpp index d7c3a189eb..6926de372e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/argsort.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/argsort.hpp @@ -1,30 +1,29 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ARGSORT_HPP #define PYTHONIC_INCLUDE_NUMPY_ARGSORT_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class E> - types::ndarray<long, types::array<long, 1>> argsort(E const &expr, - types::none_type, - types::none_type={}); + types::ndarray<long, types::array_tuple<long, 1>> + argsort(E const &expr, types::none_type, types::none_type = {}); template <class T, class pS> types::ndarray<long, pS> argsort(types::ndarray<T, pS> const &a, - long axis = -1, types::none_type kind={}); + long axis = -1, types::none_type kind = {}); template <class T, class pS> - types::ndarray<long, pS> argsort(types::ndarray<T, pS> const &a, - long axis, types::str const& kind); + types::ndarray<long, pS> argsort(types::ndarray<T, pS> const &a, long axis, + types::str const &kind); NUMPY_EXPR_TO_NDARRAY0_DECL(argsort); DEFINE_FUNCTOR(pythonic::numpy, argsort); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/argwhere.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/argwhere.hpp index c69144a76f..90107d2f58 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/argwhere.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/argwhere.hpp @@ -1,18 +1,19 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ARGWHERE_HPP #define PYTHONIC_INCLUDE_NUMPY_ARGWHERE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class E> - typename types::ndarray<long, types::array<long, 2>> argwhere(E const &expr); + typename types::ndarray<long, types::array_tuple<long, 2>> + argwhere(E const &expr); DEFINE_FUNCTOR(pythonic::numpy, argwhere); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/around.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/around.hpp index d79a3deff9..4e9ae04c52 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/around.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/around.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_AROUND_HPP #define PYTHONIC_INCLUDE_NUMPY_AROUND_HPP -#include "pythonic/include/numpy/rint.hpp" -#include "pythonic/include/numpy/floor_divide.hpp" #include "pythonic/include/numpy/asarray.hpp" #include "pythonic/include/numpy/float64.hpp" +#include "pythonic/include/numpy/floor_divide.hpp" #include "pythonic/include/numpy/multiply.hpp" +#include "pythonic/include/numpy/rint.hpp" PYTHONIC_NS_BEGIN @@ -17,30 +17,32 @@ namespace numpy // generic floating point version, pure numpy_expr template <class E> - auto around(E &&a, long decimals) -> typename std::enable_if< - !std::is_integral< - typename types::dtype_of<typename std::decay<E>::type>::type>::value, - decltype(functor::rint{}(functor::multiply{}( - std::forward<E>(a), + auto around(E &&a, long decimals) -> + typename std::enable_if< + !std::is_integral<typename types::dtype_of< + typename std::decay<E>::type>::type>::value, + decltype(functor::rint{}(functor::multiply{}( + std::forward<E>(a), + std::declval<typename types::dtype_of< + typename std::decay<E>::type>::type>())) / std::declval<typename types::dtype_of< - typename std::decay<E>::type>::type>())) / - std::declval<typename types::dtype_of< - typename std::decay<E>::type>::type>())>::type; + typename std::decay<E>::type>::type>())>::type; // the integer version is only relevant when decimals < 0 template <class E> - auto around(E &&a, long decimals) -> typename std::enable_if< - std::is_integral< - typename types::dtype_of<typename std::decay<E>::type>::type>::value, - decltype(numpy::functor::floor_divide{}( - functor::float64{}(std::forward<E>(a)), + auto around(E &&a, long decimals) -> + typename std::enable_if< + std::is_integral<typename types::dtype_of< + typename std::decay<E>::type>::type>::value, + decltype(numpy::functor::floor_divide{}( + functor::float64{}(std::forward<E>(a)), + std::declval<typename types::dtype_of< + typename std::decay<E>::type>::type>()) * std::declval<typename types::dtype_of< - typename std::decay<E>::type>::type>()) * - std::declval<typename types::dtype_of< - typename std::decay<E>::type>::type>())>::type; + typename std::decay<E>::type>::type>())>::type; DEFINE_FUNCTOR(pythonic::numpy, around); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/array.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/array.hpp index 694d7a53b1..fbc6081c7d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/array.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/array.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ARRAY_HPP #define PYTHONIC_INCLUDE_NUMPY_ARRAY_HPP +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/nested_container.hpp" -#include "pythonic/include/types/ndarray.hpp" PYTHONIC_NS_BEGIN @@ -14,16 +14,18 @@ namespace numpy typename std::enable_if< types::has_size<typename std::decay<T>::type>::value, types::ndarray<typename dtype::type, - types::array<long, std::decay<T>::type::value>>>::type - array(T &&iterable, dtype d = dtype()); + types::array_tuple<long, std::decay<T>::type::value>>>:: + type + array(T &&iterable, dtype d = dtype()); template <class T, class dtype = types::dtype_t<typename std::decay<T>::type::dtype>> typename std::enable_if< !types::has_size<typename std::decay<T>::type>::value && !types::is_dtype<typename std::decay<T>::type>::value, types::ndarray<typename dtype::type, - types::array<long, std::decay<T>::type::value>>>::type - array(T &&iterable, dtype d = dtype()); + types::array_tuple<long, std::decay<T>::type::value>>>:: + type + array(T &&iterable, dtype d = dtype()); template <class T, class dtype = types::dtype_t<typename types::dtype_of< typename std::decay<T>::type>::type>> @@ -52,7 +54,7 @@ namespace numpy array(types::array_base<T, N, V> &&, dtype d = dtype()); DEFINE_FUNCTOR(pythonic::numpy, array); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/array2string.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/array2string.hpp index 29d2b4960b..c689c72321 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/array2string.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/array2string.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ARRAY2STRING_HPP #define PYTHONIC_INCLUDE_NUMPY_ARRAY2STRING_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/str.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -13,7 +13,7 @@ namespace numpy types::str array2string(E &&a); DEFINE_FUNCTOR(pythonic::numpy, array2string); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/array_equal.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/array_equal.hpp index 617598aef7..218238fa23 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/array_equal.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/array_equal.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ARRAYEQUAL_HPP #define PYTHONIC_INCLUDE_NUMPY_ARRAYEQUAL_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -13,7 +13,7 @@ namespace numpy bool array_equal(U const &u, V const &v); DEFINE_FUNCTOR(pythonic::numpy, array_equal); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/array_equiv.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/array_equiv.hpp index 1ea7c52028..d79c84c6a5 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/array_equiv.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/array_equiv.hpp @@ -22,7 +22,7 @@ namespace numpy array_equiv(U const &u, V const &v); DEFINE_FUNCTOR(pythonic::numpy, array_equiv); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/asarray.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/asarray.hpp index 58fde934b9..40377c3ea2 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/asarray.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/asarray.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ASARRAY_HPP #define PYTHONIC_INCLUDE_NUMPY_ASARRAY_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/numpy/array.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -12,7 +12,7 @@ namespace numpy template <class E, class dtype> struct _asarray { template <class... Types> - auto operator()(Types &&... args) + auto operator()(Types &&...args) -> decltype(array(std::forward<Types>(args)...)); }; @@ -23,9 +23,10 @@ namespace numpy }; template <class E> - auto asarray(E &&e, types::none_type d = types::none_type()) -> decltype( - _asarray<typename std::decay<E>::type, - typename types::dtype_of<typename std::decay<E>::type>::type>{}( + auto asarray(E &&e, types::none_type d = types::none_type()) + -> decltype(_asarray<typename std::decay<E>::type, + typename types::dtype_of< + typename std::decay<E>::type>::type>{}( std::forward<E>(e))); template <class E, class dtype> @@ -34,7 +35,7 @@ namespace numpy typename dtype::type>{}(std::forward<E>(e), d)); DEFINE_FUNCTOR(pythonic::numpy, asarray); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/asarray_chkfinite.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/asarray_chkfinite.hpp index f028e6419f..4320bfd34d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/asarray_chkfinite.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/asarray_chkfinite.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ASARRAYCHKFINITE_HPP #define PYTHONIC_INCLUDE_NUMPY_ASARRAYCHKFINITE_HPP +#include "pythonic/include/numpy/isfinite.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/numpy/isfinite.hpp" PYTHONIC_NS_BEGIN @@ -19,7 +19,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME asarray_chkfinite #define NUMPY_NARY_FUNC_SYM wrapper::asarray_chkfinite #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/asfarray.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/asfarray.hpp index 1c306df3a9..114543d279 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/asfarray.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/asfarray.hpp @@ -9,10 +9,10 @@ PYTHONIC_NS_BEGIN namespace numpy { template <class E, class dtype = functor::float64> - auto asfarray(E &&e, dtype d = dtype()) - -> decltype(asarray(std::forward<E>(e), d)); + auto asfarray(E &&e, + dtype d = dtype()) -> decltype(asarray(std::forward<E>(e), d)); DEFINE_FUNCTOR(pythonic::numpy, asfarray); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/asscalar.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/asscalar.hpp index b35c22cafe..ef2c5f6cba 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/asscalar.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/asscalar.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ASSCALAR_HPP #define PYTHONIC_INCLUDE_NUMPY_ASSCALAR_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/numpy/asarray.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -19,7 +19,7 @@ namespace numpy asscalar_result_type<typename E::dtype> asscalar(E const &expr); DEFINE_FUNCTOR(pythonic::numpy, asscalar); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_1d.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_1d.hpp index ed73f588f5..f6a43e5128 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_1d.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_1d.hpp @@ -19,7 +19,7 @@ namespace numpy decltype(asarray(t))>::type; DEFINE_FUNCTOR(pythonic::numpy, atleast_1d); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_2d.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_2d.hpp index 4e22a00ce2..b882ae747a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_2d.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_2d.hpp @@ -15,23 +15,25 @@ namespace numpy atleast_2d(T t); template <class T> - auto atleast_2d(T const &t) -> - typename std::enable_if < (!types::is_dtype<T>::value) && - T::value<2, types::ndarray< - typename T::dtype, - types::pshape<std::integral_constant<long, 1>, - typename std::tuple_element< - 0, typename T::shape_t>::type>>>::type; + auto atleast_2d(T const &t) -> + typename std::enable_if < (!types::is_dtype<T>::value) && + T::value<2, + types::ndarray< + typename T::dtype, + types::pshape<std::integral_constant<long, 1>, + typename std::tuple_element< + 0, typename T::shape_t>::type>>>::type; template <class T> - auto atleast_2d(T &&t) -> typename std::enable_if< - (!types::is_dtype<typename std::remove_cv< - typename std::remove_reference<T>::type>::type>::value) && - std::decay<T>::type::value >= 2, - decltype(std::forward<T>(t))>::type; + auto atleast_2d(T &&t) -> + typename std::enable_if< + (!types::is_dtype<typename std::remove_cv< + typename std::remove_reference<T>::type>::type>::value) && + std::decay<T>::type::value >= 2, + decltype(std::forward<T>(t))>::type; DEFINE_FUNCTOR(pythonic::numpy, atleast_2d); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_3d.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_3d.hpp index b5755733d1..b7720c1022 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_3d.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_3d.hpp @@ -15,23 +15,25 @@ namespace numpy std::integral_constant<long, 1>>>>::type atleast_3d(T t); template <class T> - auto atleast_3d(T const &t) -> typename std::enable_if< - (!types::is_dtype<T>::value) && (T::value == 1), - types::ndarray<typename T::dtype, - types::pshape<std::integral_constant<long, 1>, - typename std::tuple_element< - 0, typename T::shape_t>::type, - std::integral_constant<long, 1>>>>::type; + auto atleast_3d(T const &t) -> + typename std::enable_if< + (!types::is_dtype<T>::value) && (T::value == 1), + types::ndarray<typename T::dtype, + types::pshape<std::integral_constant<long, 1>, + typename std::tuple_element< + 0, typename T::shape_t>::type, + std::integral_constant<long, 1>>>>::type; template <class T> - auto atleast_3d(T const &t) -> typename std::enable_if< - (!types::is_dtype<T>::value) && (T::value == 2), - types::ndarray< - typename T::dtype, - types::pshape< - typename std::tuple_element<0, typename T::shape_t>::type, - typename std::tuple_element<1, typename T::shape_t>::type, - std::integral_constant<long, 1>>>>::type; + auto atleast_3d(T const &t) -> + typename std::enable_if< + (!types::is_dtype<T>::value) && (T::value == 2), + types::ndarray< + typename T::dtype, + types::pshape< + typename std::tuple_element<0, typename T::shape_t>::type, + typename std::tuple_element<1, typename T::shape_t>::type, + std::integral_constant<long, 1>>>>::type; template <class T> auto atleast_3d(T const &t) -> @@ -39,7 +41,7 @@ namespace numpy decltype(asarray(t))>::type; DEFINE_FUNCTOR(pythonic::numpy, atleast_3d); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/average.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/average.hpp index fd93219520..c5ae85b534 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/average.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/average.hpp @@ -17,10 +17,10 @@ namespace numpy template <class E, class W> auto average(E const &expr, types::none_type const &axis, W const &weights) - -> decltype(average(expr *asarray(weights) / average(asarray(weights)))); + -> decltype(average(expr * asarray(weights) / average(asarray(weights)))); DEFINE_FUNCTOR(pythonic::numpy, average); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/base_repr.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/base_repr.hpp index f102143ef1..83adcc5267 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/base_repr.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/base_repr.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_BASEREPR_HPP #define PYTHONIC_INCLUDE_NUMPY_BASEREPR_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -12,7 +12,7 @@ namespace numpy types::str base_repr(long number, long base = 2, long padding = 0); DEFINE_FUNCTOR(pythonic::numpy, base_repr); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/binary_repr.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/binary_repr.hpp index f6bb382f7d..0891a90828 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/binary_repr.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/binary_repr.hpp @@ -13,7 +13,7 @@ namespace numpy types::str binary_repr(long number, long width); DEFINE_FUNCTOR(pythonic::numpy, binary_repr); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/bincount.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/bincount.hpp index 24022fd35c..087b41f550 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/bincount.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/bincount.hpp @@ -27,7 +27,7 @@ namespace numpy NUMPY_EXPR_TO_NDARRAY0_DECL(bincount); DEFINE_FUNCTOR(pythonic::numpy, bincount); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/bitwise_and.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/bitwise_and.hpp index f4389ca83a..34881a76df 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/bitwise_and.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/bitwise_and.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_BITWISE_AND_HPP #define PYTHONIC_INCLUDE_NUMPY_BITWISE_AND_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/operator_/and_.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/operator_/and_.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME bitwise_and #define NUMPY_NARY_FUNC_SYM pythonic::operator_::and_ #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/bitwise_not.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/bitwise_not.hpp index 3673eebe9a..b455b623f5 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/bitwise_not.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/bitwise_not.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_BITWISENOT_HPP #define PYTHONIC_INCLUDE_NUMPY_BITWISENOT_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -15,12 +15,12 @@ namespace numpy decltype(~std::declval<A const &>()) bitwise_not(A const &a); bool bitwise_not(bool t0); - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME bitwise_not #define NUMPY_NARY_FUNC_SYM wrapper::bitwise_not #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END // ndarray have to be include after as bitwise_not is used as a numpy_operator diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/bitwise_or.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/bitwise_or.hpp index be50b626d8..fd9e76c553 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/bitwise_or.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/bitwise_or.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_BITWISE_OR_HPP #define PYTHONIC_INCLUDE_NUMPY_BITWISE_OR_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/operator_/or_.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME bitwise_or #define NUMPY_NARY_FUNC_SYM pythonic::operator_::or_ #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/bitwise_xor.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/bitwise_xor.hpp index 9324d6d542..26fca6f8ed 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/bitwise_xor.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/bitwise_xor.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_BITWISE_XOR_HPP #define PYTHONIC_INCLUDE_NUMPY_BITWISE_XOR_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/operator_/xor_.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/operator_/xor_.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME bitwise_xor #define NUMPY_NARY_FUNC_SYM pythonic::operator_::xor_ #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/bool_.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/bool_.hpp index 546aa96fa4..224aa4313b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/bool_.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/bool_.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_BOOL_HPP #define PYTHONIC_INCLUDE_NUMPY_BOOL_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -17,13 +17,13 @@ namespace numpy bool bool_(); template <class V> bool bool_(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME bool_ #define NUMPY_NARY_FUNC_SYM details::bool_ #define NUMPY_NARY_EXTRA_METHOD using type = bool; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/broadcast_to.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/broadcast_to.hpp index 122c43c6ab..cc3f14b825 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/broadcast_to.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/broadcast_to.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_BROADCAST_TO_HPP #define PYTHONIC_INCLUDE_NUMPY_BROADCAST_TO_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/numpy/empty.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy shape, typename types::dtype_t<typename types::dtype_of<E>::type>{})); DEFINE_FUNCTOR(pythonic::numpy, broadcast_to); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/byte.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/byte.hpp index 79f388e5aa..c7478f393f 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/byte.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/byte.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_BYTE_HPP #define PYTHONIC_INCLUDE_NUMPY_BYTE_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -17,13 +17,13 @@ namespace numpy char byte(); template <class V> char byte(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME byte #define NUMPY_NARY_FUNC_SYM details::byte #define NUMPY_NARY_EXTRA_METHOD using type = char; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/cbrt.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/cbrt.hpp index b78a05ee1a..01e4fa0d95 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/cbrt.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/cbrt.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_CBRT_HPP #define PYTHONIC_INCLUDE_NUMPY_CBRT_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME cbrt #define NUMPY_NARY_FUNC_SYM xsimd::cbrt #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ceil.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ceil.hpp index fa8575c699..4230af7081 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ceil.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ceil.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_CEIL_HPP #define PYTHONIC_INCLUDE_NUMPY_CEIL_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME ceil #define NUMPY_NARY_FUNC_SYM xsimd::ceil #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/clip.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/clip.hpp index 610b214673..3d5e11ab6e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/clip.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/clip.hpp @@ -26,7 +26,7 @@ namespace numpy template <class T, class Mi> typename __combined<T, Mi>::type clip(T const &v, Mi a_min); - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME clip #define NUMPY_NARY_FUNC_SYM wrapper::clip @@ -45,7 +45,7 @@ namespace numpy } #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/complex.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/complex.hpp index 5d14999e4d..a44cacddef 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/complex.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/complex.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_COMPLEX_HPP #define PYTHONIC_INCLUDE_NUMPY_COMPLEX_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/types/numpy_op_helper.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -21,7 +21,7 @@ namespace numpy #define NUMPY_NARY_FUNC_SYM details::complex #define NUMPY_NARY_EXTRA_METHOD using type = std::complex<double>; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/complex128.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/complex128.hpp index 04c240b9b5..cc7a473013 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/complex128.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/complex128.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -17,13 +17,13 @@ namespace numpy std::complex<double> complex128(); template <class V> std::complex<double> complex128(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME complex128 #define NUMPY_NARY_FUNC_SYM details::complex128 #define NUMPY_NARY_EXTRA_METHOD using type = std::complex<double>; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/complex256.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/complex256.hpp index d92e057a2f..caed53d637 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/complex256.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/complex256.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -17,13 +17,13 @@ namespace numpy std::complex<long double> complex256(); template <class V> std::complex<long double> complex256(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME complex256 #define NUMPY_NARY_FUNC_SYM details::complex256 #define NUMPY_NARY_EXTRA_METHOD using type = std::complex<long double>; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/complex64.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/complex64.hpp index 623a84e288..f09026f40d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/complex64.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/complex64.hpp @@ -2,10 +2,10 @@ #define PYTHONIC_INCLUDE_NUMPY_COMPLEX64_HPP #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -18,13 +18,13 @@ namespace numpy std::complex<float> complex64(V v); template <class T> std::complex<float> complex64(std::complex<T> v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME complex64 #define NUMPY_NARY_FUNC_SYM details::complex64 #define NUMPY_NARY_EXTRA_METHOD using type = std::complex<float>; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/concatenate.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/concatenate.hpp index 8ce663f0bf..a5033900ec 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/concatenate.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/concatenate.hpp @@ -1,30 +1,30 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_CONCATENATE_HPP #define PYTHONIC_INCLUDE_NUMPY_CONCATENATE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class E, size_t M, class V> - types::ndarray<typename E::dtype, types::array<long, E::value>> + types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> concatenate(types::array_base<E, M, V> const &args, long axis = 0); template <class... Types> auto concatenate(std::tuple<Types...> const &args, long axis = 0) -> types::ndarray< typename __combined<typename std::decay<Types>::type::dtype...>::type, - types::array< + types::array_tuple< long, std::tuple_element<0, std::tuple<Types...>>::type::value>>; template <class E> - types::ndarray<typename E::dtype, types::array<long, E::value>> + types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> concatenate(types::list<E> const &args, long axis = 0); DEFINE_FUNCTOR(pythonic::numpy, concatenate); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/conj.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/conj.hpp index c4ecc6a883..79954543b6 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/conj.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/conj.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_CONJ_HPP #define PYTHONIC_INCLUDE_NUMPY_CONJ_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/conjugate.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/conjugate.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/conjugate.hpp index 686cd1fd27..442d2ccb08 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/conjugate.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/conjugate.hpp @@ -2,8 +2,8 @@ #define PYTHONIC_INCLUDE_NUMPY_CONJUGATE_HPP #include "pythonic/include/types/numpy_op_helper.hpp" -#include "pythonic/include/utils/numpy_traits.hpp" #include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -44,11 +44,11 @@ namespace numpy { return v; } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME conjugate #define NUMPY_NARY_FUNC_SYM wrapper::conjugate #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/convolve.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/convolve.hpp index b87fa07d51..dd63f4ec2d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/convolve.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/convolve.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_CONVOLVE_HPP #define PYTHONIC_INCLUDE_NUMPY_CONVOLVE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -18,7 +18,7 @@ namespace numpy NUMPY_EXPR_TO_NDARRAY0_DECL(convolve) DEFINE_FUNCTOR(pythonic::numpy, convolve) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/copy.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/copy.hpp index 891b562bd2..952f040735 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/copy.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/copy.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_COPY_HPP #define PYTHONIC_INCLUDE_NUMPY_COPY_HPP +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_conversion.hpp" -#include "pythonic/include/types/ndarray.hpp" PYTHONIC_NS_BEGIN @@ -13,7 +13,8 @@ namespace numpy template <class E> typename std::enable_if< !types::is_array<E>::value && !types::is_dtype<E>::value, - types::ndarray<typename E::dtype, types::array<long, E::value>>>::type + types::ndarray<typename E::dtype, + types::array_tuple<long, E::value>>>::type copy(E const &v); // scalar / complex case @@ -37,7 +38,7 @@ namespace numpy copy(types::numpy_texpr<types::ndarray<T, pS>> const &a); DEFINE_FUNCTOR(pythonic::numpy, copy); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/copysign.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/copysign.hpp index bafe162931..33dcbbfa80 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/copysign.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/copysign.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_COPYSIGN_HPP #define PYTHONIC_INCLUDE_NUMPY_COPYSIGN_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME copysign #define NUMPY_NARY_FUNC_SYM xsimd::copysign #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/copyto.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/copyto.hpp index 2fefe9470c..07854fec2e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/copyto.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/copyto.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_COPYTO_HPP #define PYTHONIC_INCLUDE_NUMPY_COPYTO_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -14,20 +14,23 @@ namespace numpy types::none_type copyto(types::ndarray<T, pS> &&out, E const &expr); template <class T, class pS, class E> - types::none_type copyto(types::numpy_texpr<types::ndarray<T, pS>> &out, E const &expr); + types::none_type copyto(types::numpy_texpr<types::ndarray<T, pS>> &out, + E const &expr); template <class T, class pS, class E> - types::none_type copyto(types::numpy_texpr<types::ndarray<T, pS>> &&out, E const &expr); + types::none_type copyto(types::numpy_texpr<types::ndarray<T, pS>> &&out, + E const &expr); // pythran extensions template <class E, class F> - types::none_type copyto(E &out, F const &expr) { + types::none_type copyto(E &out, F const &expr) + { out[types::fast_contiguous_slice(0, types::none_type{})] = expr; return {}; } DEFINE_FUNCTOR(pythonic::numpy, copyto); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/correlate.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/correlate.hpp index 8a33eec0ad..6e6216b78a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/correlate.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/correlate.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_CORRELATE_HPP #define PYTHONIC_INCLUDE_NUMPY_CORRELATE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy NUMPY_EXPR_TO_NDARRAY0_DECL(correlate) DEFINE_FUNCTOR(pythonic::numpy, correlate) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/cos.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/cos.hpp index aae84e4d5c..c19969a39e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/cos.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/cos.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_COS_HPP #define PYTHONIC_INCLUDE_NUMPY_COS_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME cos #define NUMPY_NARY_FUNC_SYM xsimd::cos #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/cosh.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/cosh.hpp index d028a6a12a..9b369f625f 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/cosh.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/cosh.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_COSH_HPP #define PYTHONIC_INCLUDE_NUMPY_COSH_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME cosh #define NUMPY_NARY_FUNC_SYM xsimd::cosh #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/count_nonzero.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/count_nonzero.hpp index 748511e808..3a140881bf 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/count_nonzero.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/count_nonzero.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_COUNT_NONZERO_HPP #define PYTHONIC_INCLUDE_NUMPY_COUNT_NONZERO_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -24,7 +24,7 @@ namespace numpy long count_nonzero(E const &array); DEFINE_FUNCTOR(pythonic::numpy, count_nonzero); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/cross.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/cross.hpp index 3f12a70544..139d0874a6 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/cross.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/cross.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_CROSS_HPP #define PYTHONIC_INCLUDE_NUMPY_CROSS_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -11,11 +11,11 @@ namespace numpy template <class E, class F> types::ndarray< typename __combined<typename E::dtype, typename F::dtype>::type, - types::array<long, E::value>> + types::array_tuple<long, E::value>> cross(E const &e, F const &f); DEFINE_FUNCTOR(pythonic::numpy, cross); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ctypeslib/as_array.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ctypeslib/as_array.hpp index d804c6d958..c6184dc998 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ctypeslib/as_array.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ctypeslib/as_array.hpp @@ -17,8 +17,8 @@ namespace numpy template <class T> types::ndarray<T, types::pshape<long>> as_array(types::pointer<T>, long); DEFINE_FUNCTOR(pythonic::numpy::ctypeslib, as_array); - } -} + } // namespace ctypeslib +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/cumprod.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/cumprod.hpp index a3bbd2cf98..b2e3b58354 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/cumprod.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/cumprod.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_CUMPROD_HPP #define PYTHONIC_INCLUDE_NUMPY_CUMPROD_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/partial_sum.hpp" #include "pythonic/include/operator_/imul.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -11,14 +11,14 @@ namespace numpy { template <class E, class... Opts> - auto cumprod(E &&e, Opts &&... opts) + auto cumprod(E &&e, Opts &&...opts) -> decltype(partial_sum<operator_::functor::imul>( std::forward<E>(e), std::forward<Opts>(opts)...)); NUMPY_EXPR_TO_NDARRAY0_DECL(cumprod); DEFINE_FUNCTOR(pythonic::numpy, cumprod); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/cumsum.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/cumsum.hpp index 8f16278a4a..cd37a1e657 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/cumsum.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/cumsum.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_CUMSUM_HPP #define PYTHONIC_INCLUDE_NUMPY_CUMSUM_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/partial_sum.hpp" #include "pythonic/include/operator_/iadd.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -11,12 +11,12 @@ namespace numpy { template <class E, class... Opts> - auto cumsum(E &&e, Opts &&... opts) + auto cumsum(E &&e, Opts &&...opts) -> decltype(partial_sum<operator_::functor::add>( std::forward<E>(e), std::forward<Opts>(opts)...)); DEFINE_FUNCTOR(pythonic::numpy, cumsum); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/deg2rad.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/deg2rad.hpp index b104663b38..cf040a3c53 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/deg2rad.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/deg2rad.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_DEG2RAD_HPP #define PYTHONIC_INCLUDE_NUMPY_DEG2RAD_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/numpy/pi.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/numpy/pi.hpp" PYTHONIC_NS_BEGIN @@ -13,15 +13,15 @@ namespace numpy namespace wrapper { template <class T> - auto deg2rad(T const &val) -> decltype(val *pi / 180) + auto deg2rad(T const &val) -> decltype(val * pi / 180) { return val * pi / 180; } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME deg2rad #define NUMPY_NARY_FUNC_SYM wrapper::deg2rad #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/degrees.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/degrees.hpp index 2e2edb275f..f74dcd8c95 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/degrees.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/degrees.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_DEGREES_HPP #define PYTHONIC_INCLUDE_NUMPY_DEGREES_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/numpy/rad2deg.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/numpy/rad2deg.hpp" PYTHONIC_NS_BEGIN diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/delete_.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/delete_.hpp index ebdbd409df..d8cc67c48d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/delete_.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/delete_.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_DELETE_HPP #define PYTHONIC_INCLUDE_NUMPY_DELETE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -21,7 +21,7 @@ namespace numpy NUMPY_EXPR_TO_NDARRAY0_DECL(delete_); DEFINE_FUNCTOR(pythonic::numpy, delete_); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/diag.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/diag.hpp index 3f4e20f836..c0813ccc99 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/diag.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/diag.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_DIAG_HPP #define PYTHONIC_INCLUDE_NUMPY_DIAG_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/numpy/asarray.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_conversion.hpp" -#include "pythonic/include/numpy/asarray.hpp" PYTHONIC_NS_BEGIN @@ -17,16 +17,16 @@ namespace numpy template <class T, class pS> typename std::enable_if<std::tuple_size<pS>::value == 1, - types::ndarray<T, types::array<long, 2>>>::type + types::ndarray<T, types::array_tuple<long, 2>>>::type diag(types::ndarray<T, pS> const &a, long k = 0); template <class T> - auto diag(types::list<T> const &a, long k = 0) - -> decltype(diag(asarray(a), k)); + auto diag(types::list<T> const &a, + long k = 0) -> decltype(diag(asarray(a), k)); NUMPY_EXPR_TO_NDARRAY0_DECL(diag); DEFINE_FUNCTOR(pythonic::numpy, diag); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/diff.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/diff.hpp index 2498aa5319..9b610f3a86 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/diff.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/diff.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_DIFF_HPP #define PYTHONIC_INCLUDE_NUMPY_DIFF_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/numpy/asarray.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -11,11 +11,11 @@ namespace numpy { template <class E> - types::ndarray<typename E::dtype, types::array<long, E::value>> + types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> diff(E const &expr, long n = 1, long axis = -1); DEFINE_FUNCTOR(pythonic::numpy, diff); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/digitize.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/digitize.hpp index 08ff40a6dd..ebf182a5a8 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/digitize.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/digitize.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_DIGITIZE_HPP #define PYTHONIC_INCLUDE_NUMPY_DIGITIZE_HPP -#include "pythonic/include/numpy/asarray.hpp" #include "pythonic/include/builtins/None.hpp" +#include "pythonic/include/numpy/asarray.hpp" #include "pythonic/include/operator_/gt.hpp" #include "pythonic/include/operator_/lt.hpp" @@ -14,7 +14,7 @@ namespace numpy types::ndarray<long, types::pshape<long>> digitize(E const &expr, F const &b); DEFINE_FUNCTOR(pythonic::numpy, digitize); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/divide.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/divide.hpp index 4b296246f5..b25972fcb8 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/divide.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/divide.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_DIVIDE_HPP #define PYTHONIC_INCLUDE_NUMPY_DIVIDE_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/operator_/div.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/operator_/div.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME divide #define NUMPY_NARY_FUNC_SYM pythonic::operator_::div #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/dot.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/dot.hpp index a8dc8089a8..1d7b2a2576 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/dot.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/dot.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_DOT_HPP #define PYTHONIC_INCLUDE_NUMPY_DOT_HPP -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/numpy/sum.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_expr.hpp" #include "pythonic/include/types/traits.hpp" @@ -28,13 +28,19 @@ struct is_strided { template <class E> struct is_blas_array { - // FIXME: also support gexpr with stride? static constexpr bool value = pythonic::types::is_array<E>::value && - is_blas_type<pythonic::types::dtype_of<E>>::value && + is_blas_type<typename pythonic::types::dtype_of<E>::type>::value && !is_strided<E>::value; }; +template <class E> +struct is_blas_expr { + static constexpr bool value = + pythonic::types::is_array<E>::value && + is_blas_type<typename pythonic::types::dtype_of<E>::type>::value; +}; + PYTHONIC_NS_BEGIN namespace numpy @@ -50,7 +56,7 @@ namespace numpy typename std::enable_if< types::is_numexpr_arg<E>::value && types::is_numexpr_arg<F>::value && E::value == 1 && F::value == 1 && - (!is_blas_array<E>::value || !is_blas_array<F>::value || + (!is_blas_expr<E>::value || !is_blas_expr<F>::value || !std::is_same<typename E::dtype, typename F::dtype>::value), typename __combined<typename E::dtype, typename F::dtype>::type>::type dot(E const &e, F const &f); @@ -91,6 +97,46 @@ namespace numpy std::complex<double>>::type dot(E const &e, F const &f); + template <class E, class F> + typename std::enable_if< + E::value == 1 && F::value == 1 && + std::is_same<typename E::dtype, float>::value && + std::is_same<typename F::dtype, float>::value && + (is_blas_expr<E>::value && is_blas_expr<F>::value && + !(is_blas_array<E>::value && is_blas_array<F>::value)), + float>::type + dot(E const &e, F const &f); + + template <class E, class F> + typename std::enable_if< + E::value == 1 && F::value == 1 && + std::is_same<typename E::dtype, double>::value && + std::is_same<typename F::dtype, double>::value && + (is_blas_expr<E>::value && is_blas_expr<F>::value && + !(is_blas_array<E>::value && is_blas_array<F>::value)), + double>::type + dot(E const &e, F const &f); + + template <class E, class F> + typename std::enable_if< + E::value == 1 && F::value == 1 && + std::is_same<typename E::dtype, std::complex<float>>::value && + std::is_same<typename F::dtype, std::complex<float>>::value && + (is_blas_expr<E>::value && is_blas_expr<F>::value && + !(is_blas_array<E>::value && is_blas_array<F>::value)), + std::complex<float>>::type + dot(E const &e, F const &f); + + template <class E, class F> + typename std::enable_if< + E::value == 1 && F::value == 1 && + std::is_same<typename E::dtype, std::complex<double>>::value && + std::is_same<typename F::dtype, std::complex<double>>::value && + (is_blas_expr<E>::value && is_blas_expr<F>::value && + !(is_blas_array<E>::value && is_blas_array<F>::value)), + std::complex<double>>::type + dot(E const &e, F const &f); + /// Matrix / Vector multiplication // We transpose the matrix to reflect our C order @@ -136,8 +182,7 @@ namespace numpy is_blas_type<typename E::dtype>::value && is_blas_type<typename F::dtype>::value // With dtype compatible with // blas - && - E::value == 2 && F::value == 1, // And it is matrix / vect + && E::value == 2 && F::value == 1, // And it is matrix / vect types::ndarray< typename __combined<typename E::dtype, typename F::dtype>::type, types::pshape<long>>>::type @@ -154,8 +199,7 @@ namespace numpy is_blas_type<typename E::dtype>::value && is_blas_type<typename F::dtype>::value // With dtype compatible with // blas - && - E::value == 1 && F::value == 2, // And it is vect / matrix + && E::value == 1 && F::value == 2, // And it is vect / matrix types::ndarray< typename __combined<typename E::dtype, typename F::dtype>::type, types::pshape<long>>>::type @@ -195,7 +239,7 @@ namespace numpy typename std::enable_if<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 && std::tuple_size<pS1>::value == 2, - types::ndarray<E, types::array<long, 2>>>::type + types::ndarray<E, types::array_tuple<long, 2>>>::type dot(types::ndarray<E, pS0> const &a, types::ndarray<E, pS1> const &b); template <class E, class pS0, class pS1, class pS2> @@ -211,21 +255,21 @@ namespace numpy typename std::enable_if<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 && std::tuple_size<pS1>::value == 2, - types::ndarray<E, types::array<long, 2>>>::type + types::ndarray<E, types::array_tuple<long, 2>>>::type dot(types::numpy_texpr<types::ndarray<E, pS0>> const &a, types::ndarray<E, pS1> const &b); template <class E, class pS0, class pS1> typename std::enable_if<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 && std::tuple_size<pS1>::value == 2, - types::ndarray<E, types::array<long, 2>>>::type + types::ndarray<E, types::array_tuple<long, 2>>>::type dot(types::ndarray<E, pS0> const &a, types::numpy_texpr<types::ndarray<E, pS1>> const &b); template <class E, class pS0, class pS1> typename std::enable_if<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 && std::tuple_size<pS1>::value == 2, - types::ndarray<E, types::array<long, 2>>>::type + types::ndarray<E, types::array_tuple<long, 2>>>::type dot(types::numpy_texpr<types::ndarray<E, pS0>> const &a, types::numpy_texpr<types::ndarray<E, pS1>> const &b); @@ -240,11 +284,10 @@ namespace numpy is_blas_type<typename E::dtype>::value && is_blas_type<typename F::dtype>::value // With dtype compatible with // blas - && - E::value == 2 && F::value == 2, // And both are matrix + && E::value == 2 && F::value == 2, // And both are matrix types::ndarray< typename __combined<typename E::dtype, typename F::dtype>::type, - types::array<long, 2>>>::type + types::array_tuple<long, 2>>>::type dot(E const &e, F const &f); // If one of the arg doesn't have a "blas compatible type", we use a slow @@ -256,7 +299,7 @@ namespace numpy E::value == 2 && F::value == 2, // And it is matrix / matrix types::ndarray< typename __combined<typename E::dtype, typename F::dtype>::type, - types::array<long, 2>>>::type + types::array_tuple<long, 2>>>::type dot(E const &e, F const &f); // N x M where N >= 3 and M == 1 @@ -265,7 +308,7 @@ namespace numpy (E::value >= 3 && F::value == 1), types::ndarray< typename __combined<typename E::dtype, typename F::dtype>::type, - types::array<long, E::value - 1>>>::type + types::array_tuple<long, E::value - 1>>>::type dot(E const &e, F const &f); // N x M where N >= 3 and M >= 2 @@ -274,11 +317,11 @@ namespace numpy (E::value >= 3 && F::value >= 2), types::ndarray< typename __combined<typename E::dtype, typename F::dtype>::type, - types::array<long, E::value - 1>>>::type + types::array_tuple<long, E::value - 1>>>::type dot(E const &e, F const &f); DEFINE_FUNCTOR(pythonic::numpy, dot); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/double_.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/double_.hpp index 3fd626d6e8..4a1ddca092 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/double_.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/double_.hpp @@ -11,7 +11,7 @@ namespace numpy #define NUMPY_NARY_FUNC_SYM details::float64 #define NUMPY_NARY_EXTRA_METHOD using type = double; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/dtype/type.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/dtype/type.hpp index 004d17dee5..20afbad814 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/dtype/type.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/dtype/type.hpp @@ -10,8 +10,8 @@ namespace numpy template <class T, class V> auto type(T const &t, V const &v) -> decltype(t(v)); DEFINE_FUNCTOR(pythonic::numpy::dtype, type); - } -} + } // namespace dtype +} // namespace numpy PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ediff1d.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ediff1d.hpp index 07c653f58b..7431b33383 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ediff1d.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ediff1d.hpp @@ -14,7 +14,7 @@ namespace numpy auto ediff1d(types::list<E> const &expr) -> decltype(ediff1d(asarray(expr))); DEFINE_FUNCTOR(pythonic::numpy, ediff1d); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/empty.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/empty.hpp index 38546b2060..77047e4c99 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/empty.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/empty.hpp @@ -1,17 +1,16 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_EMPTY_HPP #define PYTHONIC_INCLUDE_NUMPY_EMPTY_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/float64.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class dtype = functor::float64> - typename dtype::type - empty(types::pshape<> const &shape, dtype d = dtype()); + typename dtype::type empty(types::pshape<> const &shape, dtype d = dtype()); template <class pS, class dtype = functor::float64> types::ndarray<typename dtype::type, sutils::shape_t<pS>> @@ -27,7 +26,7 @@ namespace numpy empty(std::integral_constant<long, N>, dtype d = dtype()); DEFINE_FUNCTOR(pythonic::numpy, empty); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/empty_like.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/empty_like.hpp index 42d82b80da..28baea1b08 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/empty_like.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/empty_like.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_EMPTYLIKE_HPP #define PYTHONIC_INCLUDE_NUMPY_EMPTYLIKE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/empty.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -18,7 +18,7 @@ namespace numpy types::dtype_t<typename E::dtype>())); DEFINE_FUNCTOR(pythonic::numpy, empty_like) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/equal.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/equal.hpp index 8057acad76..99066bc844 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/equal.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/equal.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_EQUAL_HPP #define PYTHONIC_INCLUDE_NUMPY_EQUAL_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/operator_/eq.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/operator_/eq.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME equal #define NUMPY_NARY_FUNC_SYM pythonic::operator_::eq #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/exp.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/exp.hpp index 215a81e018..ff78511a8b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/exp.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/exp.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_EXP_HPP #define PYTHONIC_INCLUDE_NUMPY_EXP_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME exp #define NUMPY_NARY_FUNC_SYM xsimd::exp #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/expand_dims.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/expand_dims.hpp index c549b6cfe0..7ab322f6de 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/expand_dims.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/expand_dims.hpp @@ -8,11 +8,11 @@ PYTHONIC_NS_BEGIN namespace numpy { template <typename T> - types::ndarray<typename T::dtype, types::array<long, T::value + 1>> + types::ndarray<typename T::dtype, types::array_tuple<long, T::value + 1>> expand_dims(T const &input, int axis); DEFINE_FUNCTOR(pythonic::numpy, expand_dims); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/expm1.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/expm1.hpp index c755bc6460..a4bddf64ee 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/expm1.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/expm1.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_EXPM1_HPP #define PYTHONIC_INCLUDE_NUMPY_EXPM1_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME expm1 #define NUMPY_NARY_FUNC_SYM xsimd::expm1 #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/eye.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/eye.hpp index 54da451b1b..62033463c1 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/eye.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/eye.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_EYE_HPP #define PYTHONIC_INCLUDE_NUMPY_EYE_HPP -#include "pythonic/include/numpy/zeros.hpp" -#include "pythonic/include/numpy/float64.hpp" #include "pythonic/include/builtins/None.hpp" +#include "pythonic/include/numpy/float64.hpp" +#include "pythonic/include/numpy/zeros.hpp" PYTHONIC_NS_BEGIN @@ -11,16 +11,16 @@ namespace numpy { template <class dtype = functor::float64> - types::ndarray<typename dtype::type, types::array<long, 2>> + types::ndarray<typename dtype::type, types::array_tuple<long, 2>> eye(long N, long M, long k = 0, dtype d = dtype()); template <class dtype = functor::float64> - types::ndarray<typename dtype::type, types::array<long, 2>> + types::ndarray<typename dtype::type, types::array_tuple<long, 2>> eye(long N, types::none_type M = builtins::None, long k = 0, dtype d = dtype()); DEFINE_FUNCTOR(pythonic::numpy, eye); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fabs.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fabs.hpp index 64d6b4c49b..e43839bc5c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/fabs.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fabs.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FABS_HPP #define PYTHONIC_INCLUDE_NUMPY_FABS_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/abs.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/c2c.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/c2c.hpp index 50efdbe4a5..9ea27559ae 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/c2c.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/c2c.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FFT_C2C_HPP #define PYTHONIC_INCLUDE_NUMPY_FFT_C2C_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -13,11 +13,11 @@ namespace numpy template <class T, class pS> types::ndarray<std::complex<T>, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> c2c(types::ndarray<std::complex<T>, pS> const &a, long n = -1, long axis = -1, types::str const &norm = {}, bool const forward = true); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/fft.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/fft.hpp index faa4b0488a..512ac55d8e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/fft.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/fft.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FFT_FFT_HPP #define PYTHONIC_INCLUDE_NUMPY_FFT_FFT_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -25,31 +25,34 @@ namespace numpy namespace fft { - template <class T, class pS, class N = types::none_type, class Norm = types::none_type> + template <class T, class pS, class N = types::none_type, + class Norm = types::none_type> types::ndarray< typename std::enable_if<types::is_complex<T>::value, T>::type, - types::array<long, std::tuple_size<pS>::value>> - fft(types::ndarray<T, pS> const &a, N const & n = {}, long axis = -1, + types::array_tuple<long, std::tuple_size<pS>::value>> + fft(types::ndarray<T, pS> const &a, N const &n = {}, long axis = -1, Norm const &norm = {}); - template <class T, class pS, class N = types::none_type, class Norm = types::none_type> + template <class T, class pS, class N = types::none_type, + class Norm = types::none_type> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> - fft(types::ndarray<T, pS> const &a, N const & n = {}, long axis = -1, + types::array_tuple<long, std::tuple_size<pS>::value>> + fft(types::ndarray<T, pS> const &a, N const &n = {}, long axis = -1, Norm const &norm = {}); - template <class T, class pS, class N = types::none_type, class Norm = types::none_type> + template <class T, class pS, class N = types::none_type, + class Norm = types::none_type> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> - fft(types::ndarray<T, pS> const &a, N const & n = {}, long axis = -1, + types::array_tuple<long, std::tuple_size<pS>::value>> + fft(types::ndarray<T, pS> const &a, N const &n = {}, long axis = -1, Norm const &norm = {}); NUMPY_EXPR_TO_NDARRAY0_DECL(fft); DEFINE_FUNCTOR(pythonic::numpy::fft, fft); - } -} + } // namespace fft +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/fftn.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/fftn.hpp index c4c3561caf..8f7d78b17b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/fftn.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/fftn.hpp @@ -15,7 +15,7 @@ namespace numpy class Norm = types::none_type> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> fftn(types::ndarray<T, pS> const &a, types::none_type s = {}, Axes const &axes = {}, Norm const &norm = {}); @@ -23,7 +23,7 @@ namespace numpy class Norm = types::none_type> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> fftn(types::ndarray<T, pS> const &a, types::none_type s = {}, Axes const &axes = {}, Norm const &norm = {}); @@ -31,7 +31,7 @@ namespace numpy class Norm = types::none_type> types::ndarray< typename std::enable_if<types::is_complex<T>::value, T>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> fftn(types::ndarray<T, pS> const &a, types::none_type s = {}, Axes const &axes = {}, Norm const &norm = {}); @@ -40,7 +40,7 @@ namespace numpy class Axes = types::none_type, class Norm = types::none_type> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> fftn(types::ndarray<T, pS> const &a, types::array_base<I, N, V> const &s, Axes const &axes = {}, Norm const &norm = {}); @@ -48,7 +48,7 @@ namespace numpy class Axes = types::none_type, class Norm = types::none_type> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> fftn(types::ndarray<T, pS> const &a, types::array_base<I, N, V> const &s, Axes const &axes = {}, Norm const &norm = {}); @@ -56,7 +56,7 @@ namespace numpy class Axes = types::none_type, class Norm = types::none_type> types::ndarray< typename std::enable_if<types::is_complex<T>::value, T>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> fftn(types::ndarray<T, pS> const &a, types::array_base<I, N, V> const &s, Axes const &axes = {}, Norm const &norm = {}); diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/hfft.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/hfft.hpp index 38b06fd511..6337bd991f 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/hfft.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/hfft.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FFT_HFFT_HPP #define PYTHONIC_INCLUDE_NUMPY_FFT_HFFT_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" /** * **Noteable difference to numpy.fft.hfft:** @@ -26,22 +26,22 @@ namespace numpy { template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> hfft(types::ndarray<std::complex<T>, pS> const &a, long n = -1, long axis = -1, types::str const &norm = {}); template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> hfft(types::ndarray<std::complex<T>, pS> const &a, types::none_type n, long axis, types::str const &norm); template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> hfft(types::ndarray<std::complex<T>, pS> const &a, long n, long axis, types::none_type norm); template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> hfft(types::ndarray<std::complex<T>, pS> const &a, types::none_type n, long axis = -1, types::none_type norm = types::none_type{}); @@ -50,7 +50,7 @@ namespace numpy !types::is_complex<T>::value, typename std::conditional<std::is_integral<T>::value, double, T>::type>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> hfft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1, types::str const &norm = {}); @@ -59,7 +59,7 @@ namespace numpy !types::is_complex<T>::value, typename std::conditional<std::is_integral<T>::value, double, T>::type>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> hfft(types::ndarray<T, pS> const &a, types::none_type n, long axis, types::str const &norm); @@ -68,7 +68,7 @@ namespace numpy !types::is_complex<T>::value, typename std::conditional<std::is_integral<T>::value, double, T>::type>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> hfft(types::ndarray<T, pS> const &a, long n, long axis, types::none_type norm); @@ -77,14 +77,14 @@ namespace numpy !types::is_complex<T>::value, typename std::conditional<std::is_integral<T>::value, double, T>::type>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> hfft(types::ndarray<T, pS> const &a, types::none_type n, long axis = -1, types::none_type norm = types::none_type{}); NUMPY_EXPR_TO_NDARRAY0_DECL(hfft); DEFINE_FUNCTOR(pythonic::numpy::fft, hfft); - } -} + } // namespace fft +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/ifft.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/ifft.hpp index 24f6bfa88c..cb15442fd7 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/ifft.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/ifft.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FFT_IFFT_HPP #define PYTHONIC_INCLUDE_NUMPY_FFT_IFFT_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -28,91 +28,91 @@ namespace numpy template <class T, class pS> types::ndarray< typename std::enable_if<types::is_complex<T>::value, T>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1, types::str const &norm = {}); template <class T, class pS> types::ndarray< typename std::enable_if<types::is_complex<T>::value, T>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &a, types::none_type n, long axis, types::str const &norm); template <class T, class pS> types::ndarray< typename std::enable_if<types::is_complex<T>::value, T>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &a, long n, long axis, types::none_type norm); template <class T, class pS> types::ndarray< typename std::enable_if<types::is_complex<T>::value, T>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &a, types::none_type n, long axis = -1, types::none_type norm = types::none_type{}); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1, types::str const &norm = {}); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &a, types::none_type n, long axis, types::str const &norm); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &a, long n, long axis, types::none_type norm); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &a, types::none_type n, long axis = -1, types::none_type norm = types::none_type{}); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1, types::str const &norm = {}); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &a, types::none_type n, long axis, types::str const &norm); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &a, long n, long axis, types::none_type norm); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &a, types::none_type n, long axis = -1, types::none_type norm = types::none_type{}); NUMPY_EXPR_TO_NDARRAY0_DECL(ifft); DEFINE_FUNCTOR(pythonic::numpy::fft, ifft); - } -} + } // namespace fft +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/ihfft.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/ihfft.hpp index 6512191907..e1e2af123d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/ihfft.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/ihfft.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FFT_IHFFT_HPP #define PYTHONIC_INCLUDE_NUMPY_FFT_IHFFT_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" /** * **Noteable difference to numpy.fft.ihfft:** @@ -28,63 +28,63 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ihfft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1, types::str const &norm = {}); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ihfft(types::ndarray<T, pS> const &a, types::none_type n, long axis, types::str const &norm); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ihfft(types::ndarray<T, pS> const &a, long n, long axis, types::none_type norm); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ihfft(types::ndarray<T, pS> const &a, types::none_type n, long axis = -1, types::none_type norm = types::none_type{}); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ihfft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1, types::str const &norm = {}); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ihfft(types::ndarray<T, pS> const &a, types::none_type n, long axis, types::str const &norm); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ihfft(types::ndarray<T, pS> const &a, long n, long axis, types::none_type norm); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ihfft(types::ndarray<T, pS> const &a, types::none_type n, long axis = -1, types::none_type norm = types::none_type{}); NUMPY_EXPR_TO_NDARRAY0_DECL(ihfft); DEFINE_FUNCTOR(pythonic::numpy::fft, ihfft); - } -} + } // namespace fft +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/irfft.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/irfft.hpp index 2ec0ac26b3..b10c977bde 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/irfft.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/irfft.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FFT_IRFFT_HPP #define PYTHONIC_INCLUDE_NUMPY_FFT_IRFFT_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" /** * **Noteable difference to numpy.fft.irfft:** @@ -26,22 +26,22 @@ namespace numpy { template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> irfft(types::ndarray<std::complex<T>, pS> const &a, long n = -1, long axis = -1, types::str const &norm = {}); template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> irfft(types::ndarray<std::complex<T>, pS> const &a, types::none_type n, long axis, types::str const &norm); template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> irfft(types::ndarray<std::complex<T>, pS> const &a, long n, long axis, types::none_type norm); template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> irfft(types::ndarray<std::complex<T>, pS> const &a, types::none_type n, long axis = -1, types::none_type norm = types::none_type{}); @@ -50,7 +50,7 @@ namespace numpy !types::is_complex<T>::value, typename std::conditional<std::is_integral<T>::value, double, T>::type>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> irfft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1, types::str const &norm = {}); @@ -59,7 +59,7 @@ namespace numpy !types::is_complex<T>::value, typename std::conditional<std::is_integral<T>::value, double, T>::type>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> irfft(types::ndarray<T, pS> const &a, types::none_type n, long axis, types::str const &norm); @@ -68,7 +68,7 @@ namespace numpy !types::is_complex<T>::value, typename std::conditional<std::is_integral<T>::value, double, T>::type>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> irfft(types::ndarray<T, pS> const &a, long n, long axis, types::none_type norm); @@ -77,14 +77,14 @@ namespace numpy !types::is_complex<T>::value, typename std::conditional<std::is_integral<T>::value, double, T>::type>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> irfft(types::ndarray<T, pS> const &a, types::none_type n, long axis = -1, types::none_type norm = types::none_type{}); NUMPY_EXPR_TO_NDARRAY0_DECL(irfft); DEFINE_FUNCTOR(pythonic::numpy::fft, irfft); - } -} + } // namespace fft +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/rfft.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/rfft.hpp index 2125ab1764..e8b410ff42 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/rfft.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/rfft.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FFT_RFFT_HPP #define PYTHONIC_INCLUDE_NUMPY_FFT_RFFT_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" /** * **Noteable difference to numpy.fft.rfft:** @@ -28,63 +28,63 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> rfft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1, types::str const &norm = {}); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> rfft(types::ndarray<T, pS> const &a, types::none_type n, long axis, types::str const &norm); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> rfft(types::ndarray<T, pS> const &a, long n, long axis, types::none_type norm); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> rfft(types::ndarray<T, pS> const &a, types::none_type n, long axis = -1, types::none_type norm = types::none_type{}); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> rfft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1, types::str const &norm = {}); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> rfft(types::ndarray<T, pS> const &a, types::none_type n, long axis, types::str const &norm); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> rfft(types::ndarray<T, pS> const &a, long n, long axis, types::none_type norm); template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> rfft(types::ndarray<T, pS> const &a, types::none_type n, long axis = -1, types::none_type norm = types::none_type{}); NUMPY_EXPR_TO_NDARRAY0_DECL(rfft); DEFINE_FUNCTOR(pythonic::numpy::fft, rfft); - } -} + } // namespace fft +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fill_diagonal.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fill_diagonal.hpp index 94617bd027..ef8a05cf98 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/fill_diagonal.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fill_diagonal.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FILL_DIAGONAL_HPP #define PYTHONIC_INCLUDE_NUMPY_FILL_DIAGONAL_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -12,7 +12,7 @@ namespace numpy types::none_type fill_diagonal(E &&, typename std::decay<E>::type::dtype); DEFINE_FUNCTOR(pythonic::numpy, fill_diagonal) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/finfo.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/finfo.hpp index 9bde752540..93122dc226 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/finfo.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/finfo.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FINFO_HPP #define PYTHONIC_INCLUDE_NUMPY_FINFO_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/float64.hpp" #include "pythonic/include/types/finfo.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -13,7 +13,7 @@ namespace numpy types::finfo<typename dtype::type> finfo(dtype d = dtype()); DEFINE_FUNCTOR(pythonic::numpy, finfo) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fix.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fix.hpp index 2708930d6c..e4a85a5049 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/fix.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fix.hpp @@ -1,18 +1,29 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FIX_HPP #define PYTHONIC_INCLUDE_NUMPY_FIX_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN namespace numpy { + namespace wrapper + { + template <class E> + E fix(E const &e) + { + if (std::is_integral<E>::value) + return e; + else + return std::trunc(e); + } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME fix -#define NUMPY_NARY_FUNC_SYM std::trunc +#define NUMPY_NARY_FUNC_SYM wrapper::fix #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/flatnonzero.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/flatnonzero.hpp index a592be1df3..9b48111f26 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/flatnonzero.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/flatnonzero.hpp @@ -11,7 +11,7 @@ namespace numpy types::ndarray<long, types::pshape<long>> flatnonzero(E const &expr); DEFINE_FUNCTOR(pythonic::numpy, flatnonzero); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/flip.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/flip.hpp index cc22afce5a..ab2705cf0d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/flip.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/flip.hpp @@ -12,8 +12,8 @@ namespace numpy namespace details { template <class E, class S, size_t... I> - auto flip(E const &expr, S const &slices, utils::index_sequence<I...>) - -> decltype(expr(slices[I]...)); + auto flip(E const &expr, S const &slices, + utils::index_sequence<I...>) -> decltype(expr(slices[I]...)); } template <class E> @@ -22,7 +22,7 @@ namespace numpy utils::make_index_sequence<E::value>{})); DEFINE_FUNCTOR(pythonic::numpy, flip); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fliplr.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fliplr.hpp index c2738a93e8..605d2677ac 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/fliplr.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fliplr.hpp @@ -9,9 +9,10 @@ PYTHONIC_NS_BEGIN namespace numpy { template <class E> - auto fliplr(E &&expr) -> decltype(std::forward<E>(expr)( - types::cstride_slice<1>{builtins::None, builtins::None}, - types::slice{builtins::None, builtins::None, -1})); + auto + fliplr(E &&expr) -> decltype(std::forward<E>(expr)( + types::cstride_slice<1>{builtins::None, builtins::None}, + types::slice{builtins::None, builtins::None, -1})); DEFINE_FUNCTOR(pythonic::numpy, fliplr); } // namespace numpy diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/flipud.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/flipud.hpp index e02b76b434..a4b5f241a6 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/flipud.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/flipud.hpp @@ -1,19 +1,20 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FLIPUD_HPP #define PYTHONIC_INCLUDE_NUMPY_FLIPUD_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class E> - auto flipud(E &&expr) -> decltype( - std::forward<E>(expr)[types::slice{builtins::None, builtins::None, -1}]); + auto + flipud(E &&expr) -> decltype(std::forward<E>( + expr)[types::slice{builtins::None, builtins::None, -1}]); DEFINE_FUNCTOR(pythonic::numpy, flipud); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/float128.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/float128.hpp index d1638ca45f..a0051f56bc 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/float128.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/float128.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FLOAT128_HPP #define PYTHONIC_INCLUDE_NUMPY_FLOAT128_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -15,13 +15,13 @@ namespace numpy long double float128(); template <class V> long double float128(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME float128 #define NUMPY_NARY_FUNC_SYM details::float128 #define NUMPY_NARY_EXTRA_METHOD using type = long double; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/float32.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/float32.hpp index efb10431bc..a88b5b3d88 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/float32.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/float32.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FLOAT32_HPP #define PYTHONIC_INCLUDE_NUMPY_FLOAT32_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -17,13 +17,13 @@ namespace numpy float float32(); template <class V> float float32(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME float32 #define NUMPY_NARY_FUNC_SYM details::float32 #define NUMPY_NARY_EXTRA_METHOD using type = float; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/float64.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/float64.hpp index 8b5a7b5ebc..0494e3303e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/float64.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/float64.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FLOAT64_HPP #define PYTHONIC_INCLUDE_NUMPY_FLOAT64_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -15,13 +15,13 @@ namespace numpy double float64(); template <class V> double float64(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME float64 #define NUMPY_NARY_FUNC_SYM details::float64 #define NUMPY_NARY_EXTRA_METHOD using type = double; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/float_.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/float_.hpp index ed470a24c3..b4e25d97ad 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/float_.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/float_.hpp @@ -11,7 +11,7 @@ namespace numpy #define NUMPY_NARY_FUNC_SYM details::float64 #define NUMPY_NARY_EXTRA_METHOD using type = double; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/floor.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/floor.hpp index 8e3bec5dbe..ba8cc1eadd 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/floor.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/floor.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FLOOR_HPP #define PYTHONIC_INCLUDE_NUMPY_FLOOR_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME floor #define NUMPY_NARY_FUNC_SYM xsimd::floor #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/floor_divide.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/floor_divide.hpp index 8a9df6d4d4..85de7c5312 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/floor_divide.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/floor_divide.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FLOORDIVIDE_HPP #define PYTHONIC_INCLUDE_NUMPY_FLOORDIVIDE_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include//numpy/floor.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include//numpy/floor.hpp" PYTHONIC_NS_BEGIN @@ -38,11 +38,11 @@ namespace numpy { return functor::floor{}(arg0 / arg1); } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME floor_divide #define NUMPY_NARY_FUNC_SYM wrapper::divfloor #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fmod.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fmod.hpp index a7b3732c2f..e3d17ff228 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/fmod.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fmod.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FMOD_HPP #define PYTHONIC_INCLUDE_NUMPY_FMOD_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME fmod #define NUMPY_NARY_FUNC_SYM xsimd::fmod #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/frexp.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/frexp.hpp index 6a89480602..e9a2b202af 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/frexp.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/frexp.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FREXP_HPP #define PYTHONIC_INCLUDE_NUMPY_FREXP_HPP +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/types/traits.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_conversion.hpp" -#include "pythonic/include/types/traits.hpp" -#include "pythonic/include/types/ndarray.hpp" PYTHONIC_NS_BEGIN @@ -22,7 +22,7 @@ namespace numpy frexp(E const &arr); DEFINE_FUNCTOR(pythonic::numpy, frexp); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fromfile.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fromfile.hpp index 62498964bd..4352d16ba4 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/fromfile.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fromfile.hpp @@ -17,7 +17,7 @@ namespace numpy types::str const &sep = {}, long offset = 0); DEFINE_FUNCTOR(pythonic::numpy, fromfile); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fromfunction.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fromfunction.hpp index c4068d8a7f..ade065d146 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/fromfunction.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fromfunction.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FROMFUNCTION_HPP #define PYTHONIC_INCLUDE_NUMPY_FROMFUNCTION_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/builtins/None.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/tags.hpp" PYTHONIC_NS_BEGIN @@ -41,7 +41,7 @@ namespace numpy /* TODO: must specialize for higher order */ DEFINE_FUNCTOR(pythonic::numpy, fromfunction); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fromiter.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fromiter.hpp index 3c6009a2db..077c4de534 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/fromiter.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fromiter.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FROMITER_HPP #define PYTHONIC_INCLUDE_NUMPY_FROMITER_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/float64.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -16,7 +16,7 @@ namespace numpy fromiter(Iterable &&iterable, dtype d = dtype(), long count = -1); DEFINE_FUNCTOR(pythonic::numpy, fromiter); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fromstring.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fromstring.hpp index 38aeab73f3..545a053b17 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/fromstring.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fromstring.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FROMSTRING_HPP #define PYTHONIC_INCLUDE_NUMPY_FROMSTRING_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/float64.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/list.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/str.hpp" +#include "pythonic/include/utils/functor.hpp" #include <limits> #include <sstream> @@ -20,7 +20,7 @@ namespace numpy types::str const &sep = {}); DEFINE_FUNCTOR(pythonic::numpy, fromstring); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/full.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/full.hpp index 18deb0cb57..4c945f6dfb 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/full.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/full.hpp @@ -2,8 +2,8 @@ #define PYTHONIC_INCLUDE_NUMPY_FULL_HPP #include "pythonic/include/numpy/float64.hpp" -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -36,7 +36,7 @@ namespace numpy full(std::integral_constant<long, N>, F fill_value, types::none_type _ = {}); DEFINE_FUNCTOR(pythonic::numpy, full); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/full_like.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/full_like.hpp index 0c57174ed2..61cac42cf1 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/full_like.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/full_like.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_FULLLIKE_HPP #define PYTHONIC_INCLUDE_NUMPY_FULLLIKE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/full.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -20,7 +20,7 @@ namespace numpy types::dtype_t<typename E::dtype>())); DEFINE_FUNCTOR(pythonic::numpy, full_like) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/greater.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/greater.hpp index e04f675dda..fca6d15479 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/greater.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/greater.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_GREATER_HPP #define PYTHONIC_INCLUDE_NUMPY_GREATER_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/operator_/gt.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/operator_/gt.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME greater #define NUMPY_NARY_FUNC_SYM pythonic::operator_::gt #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/greater_equal.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/greater_equal.hpp index 7ab0b31745..a008201774 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/greater_equal.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/greater_equal.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_GREATEREQUAL_HPP #define PYTHONIC_INCLUDE_NUMPY_GREATEREQUAL_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/operator_/ge.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME greater_equal #define NUMPY_NARY_FUNC_SYM pythonic::operator_::ge #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/heaviside.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/heaviside.hpp index 1b7594b7f6..b1f749515f 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/heaviside.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/heaviside.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_HEAVISIDE_HPP #define PYTHONIC_INCLUDE_NUMPY_HEAVISIDE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME heaviside #define NUMPY_NARY_FUNC_SYM details::heaviside #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/hstack.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/hstack.hpp index 05ea492a4a..13caae7529 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/hstack.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/hstack.hpp @@ -13,7 +13,7 @@ namespace numpy -> decltype(concatenate(std::forward<ArraySequence>(seq), 1)); DEFINE_FUNCTOR(pythonic::numpy, hstack); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/hypot.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/hypot.hpp index 1f98eb076f..e318465c20 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/hypot.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/hypot.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_HYPOT_HPP #define PYTHONIC_INCLUDE_NUMPY_HYPOT_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME hypot #define NUMPY_NARY_FUNC_SYM xsimd::hypot #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/identity.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/identity.hpp index c506c11569..fb12e68022 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/identity.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/identity.hpp @@ -13,7 +13,7 @@ namespace numpy auto identity(long n, dtype d = dtype()) -> decltype(eye(n, n, 0, d)); DEFINE_FUNCTOR(pythonic::numpy, identity); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/imag.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/imag.hpp index 93c772a1ed..086b3b6f80 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/imag.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/imag.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_IMAG_HPP #define PYTHONIC_INCLUDE_NUMPY_IMAG_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/asarray.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/list.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -19,7 +19,7 @@ namespace numpy -> decltype(imag(numpy::functor::asarray{}(expr))); DEFINE_FUNCTOR(pythonic::numpy, imag); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/indices.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/indices.hpp index 4fd613a66d..544d96760e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/indices.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/indices.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_INDICES_HPP #define PYTHONIC_INCLUDE_NUMPY_INDICES_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/int64.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace numpy indices(pS const &shape, dtype d = dtype()); DEFINE_FUNCTOR(pythonic::numpy, indices); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/insert.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/insert.hpp index af748c18d4..5b8b94363f 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/insert.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/insert.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_INSERT_HPP #define PYTHONIC_INCLUDE_NUMPY_INSERT_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/builtins/None.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/traits.hpp" -#include "pythonic/include/builtins/None.hpp" +#include "pythonic/include/utils/functor.hpp" #include <algorithm> @@ -45,7 +45,7 @@ namespace numpy E insert(E, Args const &...); DEFINE_FUNCTOR(pythonic::numpy, insert); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/int16.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/int16.hpp index b4c5361e3f..fa3e9f34bb 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/int16.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/int16.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_INT16_HPP #define PYTHONIC_INCLUDE_NUMPY_INT16_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -17,13 +17,13 @@ namespace numpy int16_t int16(); template <class V> int16_t int16(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME int16 #define NUMPY_NARY_FUNC_SYM details::int16 #define NUMPY_NARY_EXTRA_METHOD using type = int16_t; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/int32.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/int32.hpp index 6e41d388f3..5bc35e04d6 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/int32.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/int32.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_INT32_HPP #define PYTHONIC_INCLUDE_NUMPY_INT32_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -17,13 +17,13 @@ namespace numpy int32_t int32(); template <class V> int32_t int32(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME int32 #define NUMPY_NARY_FUNC_SYM details::int32 #define NUMPY_NARY_EXTRA_METHOD using type = int32_t; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/int64.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/int64.hpp index 7a68ef324b..5e0bca6ed5 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/int64.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/int64.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_INT64_HPP #define PYTHONIC_INCLUDE_NUMPY_INT64_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -17,13 +17,13 @@ namespace numpy int64_t int64(); template <class V> int64_t int64(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME int64 #define NUMPY_NARY_FUNC_SYM details::int64 #define NUMPY_NARY_EXTRA_METHOD using type = int64_t; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/int8.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/int8.hpp index 9e8c5b643e..9021c0972a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/int8.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/int8.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_INT8_HPP #define PYTHONIC_INCLUDE_NUMPY_INT8_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -17,13 +17,13 @@ namespace numpy int8_t int8(); template <class V> int8_t int8(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME int8 #define NUMPY_NARY_FUNC_SYM details::int8 #define NUMPY_NARY_EXTRA_METHOD using type = int8_t; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/int_.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/int_.hpp index 57df3fe4b9..efc448dc79 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/int_.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/int_.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_INT__HPP #define PYTHONIC_INCLUDE_NUMPY_INT__HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -16,13 +16,13 @@ namespace numpy long int_(); template <class V> long int_(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME int_ #define NUMPY_NARY_FUNC_SYM details::int_ #define NUMPY_NARY_EXTRA_METHOD using type = long; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/intc.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/intc.hpp index 0293dc392b..a340dee7e6 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/intc.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/intc.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_INTC_HPP #define PYTHONIC_INCLUDE_NUMPY_INTC_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -17,13 +17,13 @@ namespace numpy int intc(); template <class V> int intc(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME intc #define NUMPY_NARY_FUNC_SYM details::intc #define NUMPY_NARY_EXTRA_METHOD using type = int; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/intersect1d.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/intersect1d.hpp index 9888a45a48..e07cb2c91b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/intersect1d.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/intersect1d.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_INTERSECT1D_HPP #define PYTHONIC_INCLUDE_NUMPY_INTERSECT1D_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" -#include "pythonic/include/types/combined.hpp" #include "pythonic/include/numpy/asarray.hpp" +#include "pythonic/include/types/combined.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include <algorithm> @@ -19,7 +19,7 @@ namespace numpy intersect1d(E const &e, F const &f); DEFINE_FUNCTOR(pythonic::numpy, intersect1d); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/intp.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/intp.hpp index d5ccb27c5a..bfaf84eb9d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/intp.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/intp.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_INTP_HPP #define PYTHONIC_INCLUDE_NUMPY_INTP_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -17,13 +17,13 @@ namespace numpy intptr_t intp(); template <class V> intptr_t intp(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME intp #define NUMPY_NARY_FUNC_SYM details::intp #define NUMPY_NARY_EXTRA_METHOD using type = intptr_t; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/invert.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/invert.hpp index eb1c8bc3fe..82ccfea6d3 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/invert.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/invert.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_INVERT_HPP #define PYTHONIC_INCLUDE_NUMPY_INVERT_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/operator_/invert.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/operator_/invert.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME invert #define NUMPY_NARY_FUNC_SYM operator_::invert #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/isclose.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/isclose.hpp index 1cdcc438a5..922f1c6459 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/isclose.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/isclose.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ISCLOSE_HPP #define PYTHONIC_INCLUDE_NUMPY_ISCLOSE_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/numpy/abs.hpp" #include "pythonic/include/numpy/isfinite.hpp" #include "pythonic/include/numpy/isnan.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -20,7 +20,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME isclose #define NUMPY_NARY_FUNC_SYM wrapper::isclose #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/iscomplex.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/iscomplex.hpp index f9fa2ca249..c64d8170dc 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/iscomplex.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/iscomplex.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ISCOMPLEX_HPP #define PYTHONIC_INCLUDE_NUMPY_ISCOMPLEX_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" -#include "pythonic/include/utils/numpy_traits.hpp" #include "pythonic/include/types/traits.hpp" +#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -20,12 +20,12 @@ namespace numpy template <class I> constexpr typename std::enable_if<!types::is_complex<I>::value, bool>::type iscomplex(I const &a); - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME iscomplex #define NUMPY_NARY_FUNC_SYM wrapper::iscomplex #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/isfinite.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/isfinite.hpp index e0f5e87f70..52c4467f8d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/isfinite.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/isfinite.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ISFINITE_HPP #define PYTHONIC_INCLUDE_NUMPY_ISFINITE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -21,12 +21,12 @@ namespace numpy { return std::isfinite(v); } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME isfinite #define NUMPY_NARY_FUNC_SYM wrapper::isfinite #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/isinf.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/isinf.hpp index 138f6a5cf2..6d23fa0b41 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/isinf.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/isinf.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ISINF_HPP #define PYTHONIC_INCLUDE_NUMPY_ISINF_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -16,11 +16,11 @@ namespace numpy template <class T> bool isinf(std::complex<T> const &v); - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME isinf #define NUMPY_NARY_FUNC_SYM wrapper::isinf #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/isnan.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/isnan.hpp index 4648d1b01f..d471777df7 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/isnan.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/isnan.hpp @@ -14,19 +14,21 @@ namespace numpy template <class T> bool isnan(std::complex<T> const &v); template <class T> - auto isnan(T const &v) -> typename std::enable_if< - std::is_floating_point<typename std::decay<T>::type>::value, - bool>::type; + auto isnan(T const &v) -> + typename std::enable_if< + std::is_floating_point<typename std::decay<T>::type>::value, + bool>::type; template <class T> - auto isnan(T const &v) -> typename std::enable_if< - !std::is_floating_point<typename std::decay<T>::type>::value, - bool>::type; - } + auto isnan(T const &v) -> + typename std::enable_if< + !std::is_floating_point<typename std::decay<T>::type>::value, + bool>::type; + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME isnan #define NUMPY_NARY_FUNC_SYM wrapper::isnan #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/isneginf.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/isneginf.hpp index 6e0dc821a0..8a21a2d4e5 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/isneginf.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/isneginf.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ISNEGINF_HPP #define PYTHONIC_INCLUDE_NUMPY_ISNEGINF_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include "pythonic/include/numpy/isinf.hpp" @@ -20,7 +20,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME isneginf #define NUMPY_NARY_FUNC_SYM wrapper::isneginf #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/isposinf.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/isposinf.hpp index a6ee98e41c..d7167946bf 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/isposinf.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/isposinf.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ISPOSINF_HPP #define PYTHONIC_INCLUDE_NUMPY_ISPOSINF_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/numpy/isinf.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/numpy/isinf.hpp" PYTHONIC_NS_BEGIN @@ -18,7 +18,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME isposinf #define NUMPY_NARY_FUNC_SYM wrapper::isposinf #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/isreal.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/isreal.hpp index f00ee32af2..a43a129b4c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/isreal.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/isreal.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ISREAL_HPP #define PYTHONIC_INCLUDE_NUMPY_ISREAL_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" -#include "pythonic/include/utils/numpy_traits.hpp" #include "pythonic/include/types/traits.hpp" +#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -20,12 +20,12 @@ namespace numpy template <class I> typename std::enable_if<!types::is_complex<I>::value, bool>::type isreal(I const &a); - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME isreal #define NUMPY_NARY_FUNC_SYM wrapper::isreal #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/isrealobj.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/isrealobj.hpp index 2f131e7b8a..0d9abf0f52 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/isrealobj.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/isrealobj.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ISREALOBJ_HPP #define PYTHONIC_INCLUDE_NUMPY_ISREALOBJ_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/traits.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -13,7 +13,7 @@ namespace numpy constexpr bool isrealobj(E const &expr); DEFINE_FUNCTOR(pythonic::numpy, isrealobj); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/isscalar.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/isscalar.hpp index a863c041da..e63e134022 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/isscalar.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/isscalar.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ISSCALAR_HPP #define PYTHONIC_INCLUDE_NUMPY_ISSCALAR_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/traits.hpp" #include "pythonic/include/types/str.hpp" +#include "pythonic/include/types/traits.hpp" +#include "pythonic/include/utils/functor.hpp" #include <type_traits> @@ -16,7 +16,7 @@ namespace numpy constexpr bool isscalar(E const &); DEFINE_FUNCTOR(pythonic::numpy, isscalar); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/issctype.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/issctype.hpp index bf552fb55c..e38e264753 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/issctype.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/issctype.hpp @@ -24,7 +24,7 @@ namespace numpy bool>::type; DEFINE_FUNCTOR(pythonic::numpy, issctype); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ldexp.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ldexp.hpp index 7d46b5aff3..e7af0bc2c5 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ldexp.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ldexp.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_LDEXP_HPP #define PYTHONIC_INCLUDE_NUMPY_LDEXP_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME ldexp #define NUMPY_NARY_FUNC_SYM std::ldexp #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/left_shift.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/left_shift.hpp index 7a4cd6decc..9071066dda 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/left_shift.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/left_shift.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_LEFT_SHIFT_HPP #define PYTHONIC_INCLUDE_NUMPY_LEFT_SHIFT_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/operator_/lshift.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME left_shift #define NUMPY_NARY_FUNC_SYM pythonic::operator_::lshift #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/less.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/less.hpp index d7980a67de..096be659d2 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/less.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/less.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_LESS_HPP #define PYTHONIC_INCLUDE_NUMPY_LESS_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/operator_/lt.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/operator_/lt.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME less #define NUMPY_NARY_FUNC_SYM pythonic::operator_::lt #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/less_equal.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/less_equal.hpp index 77f792b4c7..135782bf15 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/less_equal.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/less_equal.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_LESSEQUAL_HPP #define PYTHONIC_INCLUDE_NUMPY_LESSEQUAL_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/operator_/le.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/operator_/le.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME less_equal #define NUMPY_NARY_FUNC_SYM pythonic::operator_::le #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/lexsort.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/lexsort.hpp index 5a6478d8f8..5f5ef6db25 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/lexsort.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/lexsort.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_LEXSORT_HPP #define PYTHONIC_INCLUDE_NUMPY_LEXSORT_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -13,7 +13,7 @@ namespace numpy types::ndarray<long, types::pshape<long>> lexsort(pS const &keys); DEFINE_FUNCTOR(pythonic::numpy, lexsort) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/linalg/matrix_power.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/linalg/matrix_power.hpp index 4e00e25736..adb1af5d9c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/linalg/matrix_power.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/linalg/matrix_power.hpp @@ -9,12 +9,12 @@ namespace numpy namespace linalg { template <class E> - auto matrix_power(E const &expr, long n) - -> decltype(numpy::functor::array{}(expr)); + auto matrix_power(E const &expr, + long n) -> decltype(numpy::functor::array{}(expr)); DEFINE_FUNCTOR(pythonic::numpy::linalg, matrix_power); - } -} + } // namespace linalg +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/linalg/norm.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/linalg/norm.hpp index 8918ba5de6..42ab8dcaa0 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/linalg/norm.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/linalg/norm.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_LINALG_NORM_HPP #define PYTHONIC_INCLUDE_NUMPY_LINALG_NORM_HPP -#include "pythonic/include/numpy/sqrt.hpp" #include "pythonic/include/builtins/pythran/abssqr.hpp" -#include "pythonic/include/numpy/sum.hpp" #include "pythonic/include/numpy/asfarray.hpp" +#include "pythonic/include/numpy/sqrt.hpp" +#include "pythonic/include/numpy/sum.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -14,8 +14,8 @@ namespace numpy template <class Array> auto norm(Array &&array, types::none_type ord = {}, types::none_type axis = {}) - -> decltype( - pythonic::numpy::functor::sqrt{}(pythonic::numpy::functor::sum{}( + -> decltype(pythonic::numpy::functor::sqrt{}( + pythonic::numpy::functor::sum{}( pythonic::builtins::pythran::functor::abssqr{}( std::forward<Array>(array))))); @@ -28,9 +28,9 @@ namespace numpy template <class Array> using norm_t = typename std::conditional< std::decay<Array>::type::value == 1, norm_dtype_t<Array>, - types::ndarray< - norm_dtype_t<Array>, - types::array<long, std::decay<Array>::type::value - 1>>>::type; + types::ndarray<norm_dtype_t<Array>, + types::array_tuple<long, std::decay<Array>::type::value - + 1>>>::type; template <class Array> norm_t<Array> norm(Array &&array, double ord, types::none_type axis = {}); @@ -42,13 +42,15 @@ namespace numpy norm_t<Array> norm(Array &&array, double ord, long axis); template <class Array> - norm_t<Array> norm(Array &&array, double ord, types::array<long, 1> axis); + norm_t<Array> norm(Array &&array, double ord, + types::array_tuple<long, 1> axis); template <class Array> - norm_t<Array> norm(Array &&array, double ord, types::array<long, 2> axis); + norm_t<Array> norm(Array &&array, double ord, + types::array_tuple<long, 2> axis); DEFINE_FUNCTOR(pythonic::numpy::linalg, norm); - } -} + } // namespace linalg +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/linspace.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/linspace.hpp index 090649d85a..71d009c457 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/linspace.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/linspace.hpp @@ -14,7 +14,7 @@ namespace numpy bool retstep = false, dtype d = dtype()); DEFINE_FUNCTOR(pythonic::numpy, linspace); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/log.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/log.hpp index f9ef70567d..07562a4e14 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/log.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/log.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_LOG_HPP #define PYTHONIC_INCLUDE_NUMPY_LOG_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME log #define NUMPY_NARY_FUNC_SYM xsimd::log #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/log10.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/log10.hpp index 53edf98c8e..c5b3f5eb72 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/log10.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/log10.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_LOG10_HPP #define PYTHONIC_INCLUDE_NUMPY_LOG10_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME log10 #define NUMPY_NARY_FUNC_SYM xsimd::log10 #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/log1p.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/log1p.hpp index d294932cba..e27c46df16 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/log1p.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/log1p.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_LOG1P_HPP #define PYTHONIC_INCLUDE_NUMPY_LOG1P_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME log1p #define NUMPY_NARY_FUNC_SYM xsimd::log1p #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/log2.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/log2.hpp index b30b3c7ad4..a099783372 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/log2.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/log2.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_LOG2_HPP #define PYTHONIC_INCLUDE_NUMPY_LOG2_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME log2 #define NUMPY_NARY_FUNC_SYM xsimd::log2 #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/logaddexp.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/logaddexp.hpp index 9403527921..333d5f45a6 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/logaddexp.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/logaddexp.hpp @@ -1,12 +1,12 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_LOGADDEXP_HPP #define PYTHONIC_INCLUDE_NUMPY_LOGADDEXP_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/numpy/log.hpp" #include "pythonic/include/numpy/exp.hpp" +#include "pythonic/include/numpy/log.hpp" PYTHONIC_NS_BEGIN @@ -22,7 +22,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME logaddexp #define NUMPY_NARY_FUNC_SYM wrapper::logaddexp #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/logaddexp2.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/logaddexp2.hpp index b3dbcacd79..9fafebe1c7 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/logaddexp2.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/logaddexp2.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_LOGADDEXP2_HPP #define PYTHONIC_INCLUDE_NUMPY_LOGADDEXP2_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include "pythonic/include/numpy/log2.hpp" @@ -24,7 +24,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME logaddexp2 #define NUMPY_NARY_FUNC_SYM wrapper::logaddexp2 #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/logical_and.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/logical_and.hpp index bad0cefd0a..d509f71f6e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/logical_and.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/logical_and.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_LOGICALAND_HPP #define PYTHONIC_INCLUDE_NUMPY_LOGICALAND_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,13 +14,13 @@ namespace numpy namespace wrapper { template <class T0, class T1> - auto logical_and(T0 const &t0, T1 const &t1) -> decltype(t0 &&t1); + auto logical_and(T0 const &t0, T1 const &t1) -> decltype(t0 && t1); } #define NUMPY_NARY_FUNC_NAME logical_and #define NUMPY_NARY_FUNC_SYM wrapper::logical_and #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/logical_not.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/logical_not.hpp index 3307bb858b..3d83196980 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/logical_not.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/logical_not.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_LOGICALNOT_HPP #define PYTHONIC_INCLUDE_NUMPY_LOGICALNOT_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/operator_/not_.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/operator_/not_.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME logical_not #define NUMPY_NARY_FUNC_SYM pythonic::operator_::not_ #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/logical_or.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/logical_or.hpp index 5a91098fe9..f274b85339 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/logical_or.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/logical_or.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_LOGICALOR_HPP #define PYTHONIC_INCLUDE_NUMPY_LOGICALOR_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -19,7 +19,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME logical_or #define NUMPY_NARY_FUNC_SYM wrapper::logical_or #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/logical_xor.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/logical_xor.hpp index f7ad2abf81..1075eaef8b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/logical_xor.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/logical_xor.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_LOGICALXOR_HPP #define PYTHONIC_INCLUDE_NUMPY_LOGICALXOR_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -13,19 +13,19 @@ namespace numpy namespace wrapper { template <class T0, class T1> - auto logical_xor(T0 const &t0, T1 const &t1) - -> decltype((t0 && !t1) || (t1 && !t0)); + auto logical_xor(T0 const &t0, + T1 const &t1) -> decltype((t0 && !t1) || (t1 && !t0)); template <class T0, class T1> bool logical_xor(std::complex<T0> const &t0, std::complex<T1> const &t1) { return (!!t0 && !t1) || (!!t1 && !t0); } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME logical_xor #define NUMPY_NARY_FUNC_SYM wrapper::logical_xor #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/logspace.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/logspace.hpp index cc7b5c5963..478e497a92 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/logspace.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/logspace.hpp @@ -14,7 +14,7 @@ namespace numpy endpoint))); DEFINE_FUNCTOR(pythonic::numpy, logspace); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/longlong.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/longlong.hpp index cde5bf455f..393a0658f5 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/longlong.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/longlong.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_LONGLONG_HPP #define PYTHONIC_INCLUDE_NUMPY_LONGLONG_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -17,13 +17,13 @@ namespace numpy long long longlong(); template <class V> long long longlong(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME longlong #define NUMPY_NARY_FUNC_SYM details::longlong #define NUMPY_NARY_EXTRA_METHOD using type = long long; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/max.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/max.hpp index c1c212c59a..3120f92c94 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/max.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/max.hpp @@ -10,11 +10,11 @@ PYTHONIC_NS_BEGIN namespace numpy { template <class... Args> - auto max(Args &&... args) -> decltype( - reduce<operator_::functor::imax>(std::forward<Args>(args)...)); + auto max(Args &&...args) -> decltype(reduce<operator_::functor::imax>( + std::forward<Args>(args)...)); DEFINE_FUNCTOR(pythonic::numpy, max); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/maximum.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/maximum.hpp index e8dfc8545f..d13fcd5d6c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/maximum.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/maximum.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_MAXIMUM_HPP #define PYTHONIC_INCLUDE_NUMPY_MAXIMUM_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME maximum #define NUMPY_NARY_FUNC_SYM xsimd::max #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/mean.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/mean.hpp index 9028bc0e73..0aa0e9a5b9 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/mean.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/mean.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_MEAN_HPP #define PYTHONIC_INCLUDE_NUMPY_MEAN_HPP -#include "pythonic/include/numpy/sum.hpp" -#include "pythonic/include/numpy/expand_dims.hpp" #include "pythonic/include/builtins/None.hpp" +#include "pythonic/include/numpy/expand_dims.hpp" +#include "pythonic/include/numpy/sum.hpp" #include "pythonic/include/types/immediate.hpp" PYTHONIC_NS_BEGIN @@ -33,7 +33,7 @@ namespace numpy }; template <class dtype> using dtype_or_double = typename dtype_or_double_helper<dtype>::type; - } + } // namespace details template <class E, class dtype = types::none_type> auto mean(E const &expr, types::none_type axis = {}, dtype d = {}, @@ -43,8 +43,8 @@ namespace numpy template <class E, class dtype = types::none_type> auto mean(E const &expr, long axis, dtype d = {}, types::none_type out = {}, - types::false_immediate keep_dims = {}) - -> decltype(sum(expr, axis, d)); + types::false_immediate keep_dims = {}) -> decltype(sum(expr, axis, + d)); template <class E, class dtype> types::ndarray<details::dtype_or_double<dtype>, @@ -58,7 +58,7 @@ namespace numpy -> decltype(expand_dims(mean(expr, axis, d), axis)); DEFINE_FUNCTOR(pythonic::numpy, mean); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/median.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/median.hpp index 7abd73ec04..af1f229a87 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/median.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/median.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_MEDIAN_HPP #define PYTHONIC_INCLUDE_NUMPY_MEDIAN_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/numpy/asarray.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include <algorithm> PYTHONIC_NS_BEGIN @@ -17,8 +17,9 @@ namespace numpy template <class T, class pS> typename std::enable_if< std::tuple_size<pS>::value != 1, - types::ndarray<decltype(std::declval<T>() + 1.), - types::array<long, std::tuple_size<pS>::value - 1>>>::type + types::ndarray< + decltype(std::declval<T>() + 1.), + types::array_tuple<long, std::tuple_size<pS>::value - 1>>>::type median(types::ndarray<T, pS> const &arr, long axis); template <class T, class pS> @@ -29,7 +30,7 @@ namespace numpy NUMPY_EXPR_TO_NDARRAY0_DECL(median); DEFINE_FUNCTOR(pythonic::numpy, median); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/min.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/min.hpp index db6734550a..4e5137d9f1 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/min.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/min.hpp @@ -11,11 +11,11 @@ namespace numpy { template <class... Args> - auto min(Args &&... args) -> decltype( - reduce<operator_::functor::imin>(std::forward<Args>(args)...)); + auto min(Args &&...args) -> decltype(reduce<operator_::functor::imin>( + std::forward<Args>(args)...)); DEFINE_FUNCTOR(pythonic::numpy, min); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/minimum.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/minimum.hpp index 9611f20a5a..ba6e58a5b9 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/minimum.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/minimum.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_MINIMUM_HPP #define PYTHONIC_INCLUDE_NUMPY_MINIMUM_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME minimum #define NUMPY_NARY_FUNC_SYM xsimd::min #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/mod.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/mod.hpp index 247c3dcec5..72f1587c57 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/mod.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/mod.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_MOD_HPP #define PYTHONIC_INCLUDE_NUMPY_MOD_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/assignable.hpp" #include "pythonic/include/operator_/mod.hpp" +#include "pythonic/include/types/assignable.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy */ USING_FUNCTOR(mod, operator_::functor::mod); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/multiply.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/multiply.hpp index dd0803a20e..7234ace92b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/multiply.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/multiply.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_MULTIPLY_HPP #define PYTHONIC_INCLUDE_NUMPY_MULTIPLY_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/operator_/mul.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/operator_/mul.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME multiply #define NUMPY_NARY_FUNC_SYM pythonic::operator_::mul #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/nan_to_num.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/nan_to_num.hpp index fd14db8bd2..3ee762ced0 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/nan_to_num.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/nan_to_num.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_NANTONUM_HPP #define PYTHONIC_INCLUDE_NUMPY_NANTONUM_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/numpy/isnan.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/numpy/isnan.hpp" #include <limits> @@ -22,7 +22,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME nan_to_num #define NUMPY_NARY_FUNC_SYM wrapper::nan_to_num #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/nanargmax.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/nanargmax.hpp index 8815b77847..8611ee187c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/nanargmax.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/nanargmax.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_NANARGMAX_HPP #define PYTHONIC_INCLUDE_NUMPY_NANARGMAX_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/numpy/isnan.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -13,7 +13,7 @@ namespace numpy long nanargmax(E const &expr); DEFINE_FUNCTOR(pythonic::numpy, nanargmax); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/nanargmin.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/nanargmin.hpp index dba681ce9b..d1ff19d629 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/nanargmin.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/nanargmin.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_NANARGMIN_HPP #define PYTHONIC_INCLUDE_NUMPY_NANARGMIN_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -12,7 +12,7 @@ namespace numpy long nanargmin(E const &expr); DEFINE_FUNCTOR(pythonic::numpy, nanargmin); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/nanmax.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/nanmax.hpp index 542f6b0328..f3259f8ff2 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/nanmax.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/nanmax.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_NANMAX_HPP #define PYTHONIC_INCLUDE_NUMPY_NANMAX_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/numpy/isnan.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -13,7 +13,7 @@ namespace numpy typename E::dtype nanmax(E const &expr); DEFINE_FUNCTOR(pythonic::numpy, nanmax); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/nanmin.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/nanmin.hpp index 82853a94b8..ae970b3563 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/nanmin.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/nanmin.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_NANMIN_HPP #define PYTHONIC_INCLUDE_NUMPY_NANMIN_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/numpy/isnan.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -13,7 +13,7 @@ namespace numpy typename E::dtype nanmin(E const &expr); DEFINE_FUNCTOR(pythonic::numpy, nanmin); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/nansum.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/nansum.hpp index b47f54fa9c..d3d0ff7b96 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/nansum.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/nansum.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_NANSUM_HPP #define PYTHONIC_INCLUDE_NUMPY_NANSUM_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -18,7 +18,7 @@ namespace numpy typename E::dtype nansum(E const &expr); DEFINE_FUNCTOR(pythonic::numpy, nansum); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray.hpp index 655f0b1f13..293b0467a2 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_NDARRAY_HPP #define PYTHONIC_INCLUDE_NUMPY_NDARRAY_HPP +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/nested_container.hpp" -#include "pythonic/include/types/ndarray.hpp" PYTHONIC_NS_BEGIN @@ -24,7 +24,7 @@ namespace numpy ndarray(std::integral_constant<long, N>, dtype d = dtype()); DEFINE_FUNCTOR(pythonic::numpy, ndarray); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/astype.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/astype.hpp index 2cdde10c73..22fc0e4fce 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/astype.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/astype.hpp @@ -14,8 +14,8 @@ namespace numpy auto astype(E &&e, dtype d) -> decltype(asarray(std::forward<E>(e), d)); DEFINE_FUNCTOR(pythonic::numpy::ndarray, astype); - } -} + } // namespace ndarray +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/fill.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/fill.hpp index 5f23d7ea04..3a760ac116 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/fill.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/fill.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_NDARRAY_FILL_HPP #define PYTHONIC_INCLUDE_NUMPY_NDARRAY_FILL_HPP -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/builtins/None.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -19,8 +19,8 @@ namespace numpy types::none_type fill(types::ndarray<T, pS> &e, F f); DEFINE_FUNCTOR(pythonic::numpy::ndarray, fill); - } -} + } // namespace ndarray +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/flatten.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/flatten.hpp index c200718689..ab81081b71 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/flatten.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/flatten.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_NDARRAY_FLATTEN_HPP #define PYTHONIC_INCLUDE_NUMPY_NDARRAY_FLATTEN_HPP -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -17,8 +17,8 @@ namespace numpy NUMPY_EXPR_TO_NDARRAY0_DECL(flatten); DEFINE_FUNCTOR(pythonic::numpy::ndarray, flatten); - } -} + } // namespace ndarray +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/item.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/item.hpp index aed8c4928d..2391263fb6 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/item.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/item.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_NDARRAY_ITEM_HPP #define PYTHONIC_INCLUDE_NUMPY_NDARRAY_ITEM_HPP -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -16,15 +16,16 @@ namespace numpy T item(types::ndarray<T, pS> const &expr, long i); template <class E, size_t N> - auto item(E &&expr, types::array<long, N> const &i) -> decltype(expr[i]); + auto item(E &&expr, + types::array_tuple<long, N> const &i) -> decltype(expr[i]); // only for compatibility purpose, very bad impl template <class E> typename std::decay<E>::type::dtype item(E &&expr, long i); DEFINE_FUNCTOR(pythonic::numpy::ndarray, item); - } -} + } // namespace ndarray +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/reshape.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/reshape.hpp index b1f8359ffc..db3aad1d21 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/reshape.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/reshape.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_NDARRAY_RESHAPE_HPP #define PYTHONIC_INCLUDE_NUMPY_NDARRAY_RESHAPE_HPP +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_conversion.hpp" -#include "pythonic/include/types/ndarray.hpp" PYTHONIC_NS_BEGIN @@ -22,15 +22,15 @@ namespace numpy template <class T, class pS, class S0, class S1, class... S> auto reshape(types::ndarray<T, pS> const &expr, S0 i0, S1 i1, - S const &... indices) + S const &...indices) -> decltype(reshape(expr, types::pshape<S0, S1, S...>{i0, i1, indices...})); NUMPY_EXPR_TO_NDARRAY0_DECL(reshape); DEFINE_FUNCTOR(pythonic::numpy::ndarray, reshape); - } -} + } // namespace ndarray +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/sort.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/sort.hpp index a7ada510a2..191fe06375 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/sort.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/sort.hpp @@ -19,8 +19,8 @@ namespace numpy types::none_type sort(E &&expr, long axis, types::str const &kind); DEFINE_FUNCTOR(pythonic::numpy::ndarray, sort); - } -} + } // namespace ndarray +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/tofile.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/tofile.hpp index 8e379c504e..e0a38b7afd 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/tofile.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/tofile.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_NDARRAY_TOFILE_HPP #define PYTHONIC_INCLUDE_NUMPY_NDARRAY_TOFILE_HPP -#include "pythonic/utils/functor.hpp" -#include "pythonic/utils/numpy_conversion.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/str.hpp" +#include "pythonic/utils/functor.hpp" +#include "pythonic/utils/numpy_conversion.hpp" PYTHONIC_NS_BEGIN @@ -19,8 +19,8 @@ namespace numpy NUMPY_EXPR_TO_NDARRAY0_DECL(tofile); DEFINE_FUNCTOR(pythonic::numpy::ndarray, tofile); - } -} + } // namespace ndarray +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/tolist.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/tolist.hpp index 05b82e7919..e45630bb2e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/tolist.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/tolist.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_NDARRAY_TOLIST_HPP #define PYTHONIC_INCLUDE_NUMPY_NDARRAY_TOLIST_HPP +#include "pythonic/types/ndarray.hpp" #include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_conversion.hpp" -#include "pythonic/types/ndarray.hpp" PYTHONIC_NS_BEGIN @@ -35,8 +35,8 @@ namespace numpy NUMPY_EXPR_TO_NDARRAY0_DECL(tolist); DEFINE_FUNCTOR(pythonic::numpy::ndarray, tolist); - } -} + } // namespace ndarray +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/tostring.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/tostring.hpp index 302b74012b..8e126ef1cc 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/tostring.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/tostring.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_NDARRAY_TOSTRING_HPP #define PYTHONIC_INCLUDE_NUMPY_NDARRAY_TOSTRING_HPP -#include "pythonic/utils/functor.hpp" -#include "pythonic/utils/numpy_conversion.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/str.hpp" +#include "pythonic/utils/functor.hpp" +#include "pythonic/utils/numpy_conversion.hpp" PYTHONIC_NS_BEGIN @@ -18,7 +18,7 @@ namespace numpy NUMPY_EXPR_TO_NDARRAY0_DECL(tostring); DEFINE_FUNCTOR(pythonic::numpy::ndarray, tostring); - } -} + } // namespace ndarray +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ndenumerate.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ndenumerate.hpp index 74fb322f5b..18d78f2ef5 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ndenumerate.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ndenumerate.hpp @@ -11,7 +11,7 @@ namespace numpy struct ndenumerate_iterator : std::iterator< std::random_access_iterator_tag, - std::tuple<types::array<long, E::value>, typename E::dtype>> { + std::tuple<types::array_tuple<long, E::value>, typename E::dtype>> { long index; E const &expr; typename E::dtype *iter; @@ -19,7 +19,7 @@ namespace numpy ndenumerate_iterator(); ndenumerate_iterator(E const &expr, long first); - std::tuple<types::array<long, E::value>, typename E::dtype> + std::tuple<types::array_tuple<long, E::value>, typename E::dtype> operator*() const; ndenumerate_iterator &operator++(); @@ -48,7 +48,7 @@ namespace numpy NUMPY_EXPR_TO_NDARRAY0_DECL(ndenumerate); DEFINE_FUNCTOR(pythonic::numpy, ndenumerate); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ndim.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ndim.hpp index 18aaf4cf17..163e7470bb 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ndim.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ndim.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_NDIM_HPP #define PYTHONIC_INCLUDE_NUMPY_NDIM_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/numpy/shape.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy long ndim(E const &e); DEFINE_FUNCTOR(pythonic::numpy, ndim) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ndindex.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ndindex.hpp index ccc4dab5cf..387665cdbf 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ndindex.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ndindex.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_NDINDEX_HPP #define PYTHONIC_INCLUDE_NUMPY_NDINDEX_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" #include <numeric> @@ -13,15 +13,15 @@ namespace numpy template <size_t N> struct ndindex_iterator : std::iterator< - std::random_access_iterator_tag, types::array<long, N>, ptrdiff_t, - types::array<long, N> *, - types::array<long, - N> /* reference_type, but no reference is possible*/> { + std::random_access_iterator_tag, types::array_tuple<long, N>, + ptrdiff_t, types::array_tuple<long, N> *, + types::array_tuple< + long, N> /* reference_type, but no reference is possible*/> { long index; - types::array<long, N> shape; + types::array_tuple<long, N> shape; ndindex_iterator(); - ndindex_iterator(types::array<long, N> const &shape, long first); - types::array<long, N> operator*() const; + ndindex_iterator(types::array_tuple<long, N> const &shape, long first); + types::array_tuple<long, N> operator*() const; ndindex_iterator &operator++(); ndindex_iterator &operator+=(long n); bool operator!=(ndindex_iterator const &other) const; @@ -32,11 +32,11 @@ namespace numpy template <size_t N> struct _ndindex : ndindex_iterator<N> { using iterator = ndindex_iterator<N>; - types::array<long, N> shape; + types::array_tuple<long, N> shape; iterator end_iter; _ndindex(); - _ndindex(types::array<long, N> const &shape); + _ndindex(types::array_tuple<long, N> const &shape); iterator &begin(); iterator const &begin() const; iterator end() const; @@ -46,13 +46,13 @@ namespace numpy _ndindex<sizeof...(Types)> ndindex(Types... args); template <size_t N> - _ndindex<N> ndindex(types::array<long, N> const &args); + _ndindex<N> ndindex(types::array_tuple<long, N> const &args); template <class... Tys> _ndindex<sizeof...(Tys)> ndindex(types::pshape<Tys...> const &args); DEFINE_FUNCTOR(pythonic::numpy, ndindex); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/negative.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/negative.hpp index 26e1f9809a..8b659ac235 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/negative.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/negative.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_NEGATIVE_HPP #define PYTHONIC_INCLUDE_NUMPY_NEGATIVE_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/operator_/neg.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/operator_/neg.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME negative #define NUMPY_NARY_FUNC_SYM pythonic::operator_::neg #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/nextafter.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/nextafter.hpp index 4ecf25f5a5..451c85fb1e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/nextafter.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/nextafter.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_NEXTAFTER_HPP #define PYTHONIC_INCLUDE_NUMPY_NEXTAFTER_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -13,7 +13,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME nextafter #define NUMPY_NARY_FUNC_SYM std::nextafter #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/nonzero.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/nonzero.hpp index 15751d1029..add55d20ea 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/nonzero.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/nonzero.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_NONZERO_HPP #define PYTHONIC_INCLUDE_NUMPY_NONZERO_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -11,10 +11,11 @@ namespace numpy template <class E> auto nonzero(E const &expr) - -> types::array<types::ndarray<long, types::array<long, 1>>, E::value>; + -> types::array_tuple<types::ndarray<long, types::array_tuple<long, 1>>, + E::value>; DEFINE_FUNCTOR(pythonic::numpy, nonzero) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/not_equal.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/not_equal.hpp index 8c7fc9a007..5cc374625d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/not_equal.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/not_equal.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_NOTEQUAL_HPP #define PYTHONIC_INCLUDE_NUMPY_NOTEQUAL_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/operator_/ne.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/operator_/ne.hpp" PYTHONIC_NS_BEGIN @@ -13,7 +13,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME not_equal #define NUMPY_NARY_FUNC_SYM pythonic::operator_::ne #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ones.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ones.hpp index a4e6f69fa8..8ce8d3f505 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ones.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ones.hpp @@ -2,8 +2,8 @@ #define PYTHONIC_INCLUDE_NUMPY_ONES_HPP #include "pythonic/include/numpy/float64.hpp" -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -11,8 +11,7 @@ namespace numpy { template <class dtype = functor::float64> - typename dtype::type - ones(std::tuple<> const &shape, dtype d = dtype()); + typename dtype::type ones(std::tuple<> const &shape, dtype d = dtype()); template <class pS, class dtype = functor::float64> types::ndarray<typename dtype::type, sutils::shape_t<pS>> @@ -28,7 +27,7 @@ namespace numpy ones(std::integral_constant<long, N>, dtype d = dtype()); DEFINE_FUNCTOR(pythonic::numpy, ones); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ones_like.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ones_like.hpp index 7212aeeeaa..784b017d7e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ones_like.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ones_like.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ONESLIKE_HPP #define PYTHONIC_INCLUDE_NUMPY_ONESLIKE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/ones.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -19,7 +19,7 @@ namespace numpy types::dtype_t<typename E::dtype>())); DEFINE_FUNCTOR(pythonic::numpy, ones_like) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/outer.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/outer.hpp index bd25e14b1a..c125edba2e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/outer.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/outer.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_OUTER_HPP #define PYTHONIC_INCLUDE_NUMPY_OUTER_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/builtins/None.hpp" #include "pythonic/include/numpy/asarray.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -16,19 +16,19 @@ namespace numpy outer(types::ndarray<T0, pS0> const &a, types::ndarray<T1, pS1> const &b); template <class T0, class pS0, class E1> - auto outer(types::ndarray<T0, pS0> const &a, E1 const &b) - -> decltype(outer(a, asarray(b))); + auto outer(types::ndarray<T0, pS0> const &a, + E1 const &b) -> decltype(outer(a, asarray(b))); template <class E0, class T1, class pS1> auto outer(E0 const &a, types::ndarray<T1, pS1> const &b) -> decltype(outer(asarray(a), b)); template <class E0, class E1> - auto outer(E0 const &a, E1 const &b) - -> decltype(outer(asarray(a), asarray(b))); + auto outer(E0 const &a, + E1 const &b) -> decltype(outer(asarray(a), asarray(b))); DEFINE_FUNCTOR(pythonic::numpy, outer); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/partial_sum.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/partial_sum.hpp index 50267ce09d..968ae7ee2c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/partial_sum.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/partial_sum.hpp @@ -24,15 +24,16 @@ namespace numpy template <class Op, class E, class dtype = result_dtype<Op, E>> using partial_sum_type = - types::ndarray<typename dtype::type, types::array<long, E::value>>; + types::ndarray<typename dtype::type, types::array_tuple<long, E::value>>; template <class Op, class E, class dtype = result_dtype<Op, E>> using partial_sum_type2 = - types::ndarray<typename dtype::type, types::array<long, E::value - 1>>; + types::ndarray<typename dtype::type, + types::array_tuple<long, E::value - 1>>; template <class Op, class E, class dtype = result_dtype<Op, E>> typename std::enable_if<E::value != 1, partial_sum_type<Op, E, dtype>>::type partial_sum(E const &expr, long axis, dtype d = dtype()); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/place.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/place.hpp index c957d4b5b9..86e0094b91 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/place.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/place.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_PLACE_HPP #define PYTHONIC_INCLUDE_NUMPY_PLACE_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/builtins/None.hpp" #include "pythonic/include/numpy/asarray.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -22,7 +22,7 @@ namespace numpy types::none_type place(E &, M const &, F const &); DEFINE_FUNCTOR(pythonic::numpy, place); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/power.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/power.hpp index d1e439f962..18998d031c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/power.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/power.hpp @@ -2,9 +2,9 @@ #define PYTHONIC_INCLUDE_NUMPY_POWER_HPP #include "pythonic/include/types/numpy_op_helper.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/utils/functor.hpp" #include <xsimd/xsimd.hpp> @@ -17,7 +17,7 @@ namespace numpy // no need to adapt_type here, as it may turn a**2 into a**2.f #define NUMPY_NARY_RESHAPE_MODE reshape_type #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/prod.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/prod.hpp index 3a65ecd5d5..459108a512 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/prod.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/prod.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_PROD_HPP #define PYTHONIC_INCLUDE_NUMPY_PROD_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/reduce.hpp" #include "pythonic/include/operator_/imul.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -11,11 +11,11 @@ namespace numpy { template <class... Args> - auto prod(Args &&... args) -> decltype( - reduce<operator_::functor::imul>(std::forward<Args>(args)...)); + auto prod(Args &&...args) -> decltype(reduce<operator_::functor::imul>( + std::forward<Args>(args)...)); DEFINE_FUNCTOR(pythonic::numpy, prod); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ptp.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ptp.hpp index 31b6d3b327..6ee15eaaab 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ptp.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ptp.hpp @@ -1,22 +1,22 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_PTP_HPP #define PYTHONIC_INCLUDE_NUMPY_PTP_HPP -#include "pythonic/include/numpy/min.hpp" #include "pythonic/include/numpy/max.hpp" +#include "pythonic/include/numpy/min.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class E> - auto ptp(E const &expr, long axis) - -> decltype(max(expr, axis) - min(expr, axis)); + auto ptp(E const &expr, + long axis) -> decltype(max(expr, axis) - min(expr, axis)); template <class E> auto ptp(E const &expr) -> decltype(max(expr) - min(expr)); DEFINE_FUNCTOR(pythonic::numpy, ptp); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/put.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/put.hpp index 23f97766ca..fad2c56efe 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/put.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/put.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_PUT_HPP #define PYTHONIC_INCLUDE_NUMPY_PUT_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_conversion.hpp" PYTHONIC_NS_BEGIN @@ -21,7 +21,7 @@ namespace numpy types::none_type put(E &, M const &, V const &); DEFINE_FUNCTOR(pythonic::numpy, put); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/putmask.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/putmask.hpp index e66beae154..c10c896432 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/putmask.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/putmask.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_PUTMASK_HPP #define PYTHONIC_INCLUDE_NUMPY_PUTMASK_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" -#include "pythonic/include/numpy/asarray.hpp" #include "pythonic/include/builtins/None.hpp" +#include "pythonic/include/numpy/asarray.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -18,7 +18,7 @@ namespace numpy types::none_type putmask(E &, M const &, F const &); DEFINE_FUNCTOR(pythonic::numpy, putmask); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/rad2deg.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/rad2deg.hpp index 3a8b06880c..f737f3c612 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/rad2deg.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/rad2deg.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RAD2DEG_HPP #define PYTHONIC_INCLUDE_NUMPY_RAD2DEG_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/numpy/pi.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/numpy/pi.hpp" PYTHONIC_NS_BEGIN @@ -17,11 +17,11 @@ namespace numpy { return val * 180 / pi; } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME rad2deg #define NUMPY_NARY_FUNC_SYM wrapper::rad2deg #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/radians.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/radians.hpp index 7cb7630d41..a3c9252e86 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/radians.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/radians.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RADIANS_HPP #define PYTHONIC_INCLUDE_NUMPY_RADIANS_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/numpy/deg2rad.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/numpy/deg2rad.hpp" PYTHONIC_NS_BEGIN diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/binomial.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/binomial.hpp index fde9a6d5c3..af628750a7 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/binomial.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/binomial.hpp @@ -15,13 +15,13 @@ namespace numpy types::ndarray<long, pS> binomial(double n, double p, pS const &shape); auto binomial(double n, double p, long size) - -> decltype(binomial(n, p, types::array<long, 1>{{size}})); + -> decltype(binomial(n, p, types::array_tuple<long, 1>{{size}})); long binomial(double n, double p, types::none_type d = types::none_type()); DEFINE_FUNCTOR(pythonic::numpy::random, binomial); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/bytes.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/bytes.hpp index 5c2122f305..a33b1c9313 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/bytes.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/bytes.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_BYTES_HPP #define PYTHONIC_INCLUDE_NUMPY_RANDOM_BYTES_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/str.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -12,8 +12,8 @@ namespace numpy types::str bytes(long length); DEFINE_FUNCTOR(pythonic::numpy::random, bytes); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/chisquare.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/chisquare.hpp index 7b23a28005..a59171d57d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/chisquare.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/chisquare.hpp @@ -15,13 +15,13 @@ namespace numpy types::ndarray<double, pS> chisquare(double df, pS const &shape); auto chisquare(double df, long size) - -> decltype(chisquare(df, types::array<long, 1>{{size}})); + -> decltype(chisquare(df, types::array_tuple<long, 1>{{size}})); double chisquare(double df, types::none_type size = {}); DEFINE_FUNCTOR(pythonic::numpy::random, chisquare); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/choice.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/choice.hpp index f105eef022..38234fdbe3 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/choice.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/choice.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_CHOICE_HPP #define PYTHONIC_INCLUDE_NUMPY_RANDOM_CHOICE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/random/randint.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -20,8 +20,8 @@ namespace numpy bool replace, P &&p); template <class T> - auto choice(long max, T &&size) - -> decltype(randint(0, max, std::forward<T>(size))); + auto choice(long max, + T &&size) -> decltype(randint(0, max, std::forward<T>(size))); long choice(long max); @@ -44,8 +44,8 @@ namespace numpy choice(T &&a, long size, bool replace, P &&p); DEFINE_FUNCTOR(pythonic::numpy::random, choice); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/dirichlet.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/dirichlet.hpp index a4de3ff162..59f8d71c95 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/dirichlet.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/dirichlet.hpp @@ -15,13 +15,13 @@ namespace numpy types::ndarray<double, pS> dirichlet(double alpha, pS const &shape); auto dirichlet(double alpha, long size) - -> decltype(dirichlet(alpha, types::array<long, 1>{{size}})); + -> decltype(dirichlet(alpha, types::array_tuple<long, 1>{{size}})); double dirichlet(double alpha, types::none_type size = {}); DEFINE_FUNCTOR(pythonic::numpy::random, dirichlet); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/exponential.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/exponential.hpp index 14b8bd7a5e..136efcfabc 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/exponential.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/exponential.hpp @@ -15,13 +15,13 @@ namespace numpy types::ndarray<double, pS> exponential(double scale, pS const &shape); auto exponential(double scale, long size) - -> decltype(exponential(scale, types::array<long, 1>{{size}})); + -> decltype(exponential(scale, types::array_tuple<long, 1>{{size}})); double exponential(double scale = 1.0, types::none_type size = {}); DEFINE_FUNCTOR(pythonic::numpy::random, exponential); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/f.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/f.hpp index fca6ba2a06..32e9ae5399 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/f.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/f.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_F_HPP #define PYTHONIC_INCLUDE_NUMPY_RANDOM_F_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -14,14 +14,15 @@ namespace numpy template <class pS> types::ndarray<double, pS> f(double dfnum, double dfden, pS const &shape); - auto f(double dfnum, double dfden, long size) - -> decltype(f(dfnum, dfden, types::array<long, 1>{{size}})); + auto f(double dfnum, double dfden, + long size) -> decltype(f(dfnum, dfden, + types::array_tuple<long, 1>{{size}})); double f(double dfnum, double dfden, types::none_type size = {}); DEFINE_FUNCTOR(pythonic::numpy::random, f); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/gamma.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/gamma.hpp index a14ad16e76..336e10eb72 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/gamma.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/gamma.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_GAMMA_HPP #define PYTHONIC_INCLUDE_NUMPY_RANDOM_GAMMA_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -16,14 +16,14 @@ namespace numpy pS const &array_shape); auto gamma(double shape, double scale, long size) - -> decltype(gamma(shape, scale, types::array<long, 1>{{size}})); + -> decltype(gamma(shape, scale, types::array_tuple<long, 1>{{size}})); double gamma(double shape = 0.0, double scale = 1.0, types::none_type size = {}); DEFINE_FUNCTOR(pythonic::numpy::random, gamma); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/generator.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/generator.hpp index 2c9d7b5b02..f1d0728105 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/generator.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/generator.hpp @@ -95,8 +95,8 @@ namespace numpy std::random_device rd; pcg generator(rd); } // namespace details - } // namespace random -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/geometric.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/geometric.hpp index a3ab8f83f1..a41b673a1c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/geometric.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/geometric.hpp @@ -15,13 +15,13 @@ namespace numpy types::ndarray<double, pS> geometric(double p, pS const &shape); auto geometric(double p, long size) - -> decltype(geometric(p, types::array<long, 1>{{size}})); + -> decltype(geometric(p, types::array_tuple<long, 1>{{size}})); double geometric(double, types::none_type size = {}); DEFINE_FUNCTOR(pythonic::numpy::random, geometric); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/gumbel.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/gumbel.hpp index 2f2633aa01..0dd5481d50 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/gumbel.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/gumbel.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_GUMBEL_HPP #define PYTHONIC_INCLUDE_NUMPY_RANDOM_GUMBEL_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -16,14 +16,14 @@ namespace numpy pS const &shape); auto gumbel(double loc, double scale, long size) - -> decltype(gumbel(loc, scale, types::array<long, 1>{{size}})); + -> decltype(gumbel(loc, scale, types::array_tuple<long, 1>{{size}})); double gumbel(double loc = 0.0, double scale = 1.0, types::none_type size = {}); DEFINE_FUNCTOR(pythonic::numpy::random, gumbel); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/laplace.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/laplace.hpp index 7e017ab340..f0a5fab81a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/laplace.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/laplace.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_LAPLACE_HPP #define PYTHONIC_INCLUDE_NUMPY_RANDOM_LAPLACE_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -16,14 +16,14 @@ namespace numpy pS const &shape); auto laplace(double loc, double scale, long size) - -> decltype(laplace(loc, scale, types::array<long, 1>{{size}})); + -> decltype(laplace(loc, scale, types::array_tuple<long, 1>{{size}})); double laplace(double loc = 0.0, double scale = 1.0, types::none_type size = {}); DEFINE_FUNCTOR(pythonic::numpy::random, laplace); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/logistic.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/logistic.hpp index c4266581ba..938ce930ca 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/logistic.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/logistic.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_LOGISTIC_HPP #define PYTHONIC_INCLUDE_NUMPY_RANDOM_LOGISTIC_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -16,14 +16,14 @@ namespace numpy pS const &shape); auto logistic(double loc, double scale, long size) - -> decltype(logistic(loc, scale, types::array<long, 1>{{size}})); + -> decltype(logistic(loc, scale, types::array_tuple<long, 1>{{size}})); double logistic(double loc = 0.0, double scale = 1.0, types::none_type size = {}); DEFINE_FUNCTOR(pythonic::numpy::random, logistic); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/lognormal.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/lognormal.hpp index a1658a0885..5c1ee965f9 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/lognormal.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/lognormal.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_LOGNORMAL_HPP #define PYTHONIC_INCLUDE_NUMPY_RANDOM_LOGNORMAL_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -16,14 +16,15 @@ namespace numpy pS const &shape); auto lognormal(double mean, double sigma, long size) - -> decltype(lognormal(mean, sigma, types::array<long, 1>{{size}})); + -> decltype(lognormal(mean, sigma, + types::array_tuple<long, 1>{{size}})); double lognormal(double mean = 0.0, double sigma = 1.0, types::none_type size = {}); DEFINE_FUNCTOR(pythonic::numpy::random, lognormal); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/logseries.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/logseries.hpp index 70e013ea7b..460902ffc9 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/logseries.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/logseries.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_LOGSERIES_HPP #define PYTHONIC_INCLUDE_NUMPY_RANDOM_LOGSERIES_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -15,13 +15,13 @@ namespace numpy types::ndarray<double, pS> logseries(double loc, pS const &shape); auto logseries(double loc, long size) - -> decltype(logseries(loc, types::array<long, 1>{{size}})); + -> decltype(logseries(loc, types::array_tuple<long, 1>{{size}})); double logseries(double loc, types::none_type size = {}); DEFINE_FUNCTOR(pythonic::numpy::random, logseries); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/negative_binomial.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/negative_binomial.hpp index 2ee2f5b4e9..1b70ef5082 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/negative_binomial.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/negative_binomial.hpp @@ -16,7 +16,8 @@ namespace numpy pS const &shape); auto negative_binomial(long n, double p, long size) - -> decltype(negative_binomial(n, p, types::array<long, 1>{{size}})); + -> decltype(negative_binomial(n, p, + types::array_tuple<long, 1>{{size}})); long negative_binomial(long n, double p, types::none_type size = {}); diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/normal.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/normal.hpp index 0fa8994800..bc69b5ff00 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/normal.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/normal.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_NORMAL_HPP #define PYTHONIC_INCLUDE_NUMPY_RANDOM_NORMAL_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -16,14 +16,14 @@ namespace numpy pS const &shape); auto normal(double loc, double scale, long size) - -> decltype(normal(loc, scale, types::array<long, 1>{{size}})); + -> decltype(normal(loc, scale, types::array_tuple<long, 1>{{size}})); double normal(double loc = 0.0, double scale = 1.0, types::none_type size = {}); DEFINE_FUNCTOR(pythonic::numpy::random, normal); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/pareto.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/pareto.hpp index 0cc17e1dd7..a98eb23481 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/pareto.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/pareto.hpp @@ -16,13 +16,13 @@ namespace numpy types::ndarray<double, pS> pareto(double a, pS const &shape); auto pareto(double a, long size) - -> decltype(pareto(a, types::array<long, 1>{{size}})); + -> decltype(pareto(a, types::array_tuple<long, 1>{{size}})); double pareto(double a, types::none_type size = {}); DEFINE_FUNCTOR(pythonic::numpy::random, pareto); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/poisson.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/poisson.hpp index 5c55ce22c2..e9491470df 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/poisson.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/poisson.hpp @@ -15,13 +15,13 @@ namespace numpy types::ndarray<double, pS> poisson(double lam, pS const &shape); auto poisson(double lam, long size) - -> decltype(poisson(lam, types::array<long, 1>{{size}})); + -> decltype(poisson(lam, types::array_tuple<long, 1>{{size}})); double poisson(double lam = 1.0, types::none_type size = {}); DEFINE_FUNCTOR(pythonic::numpy::random, poisson); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/power.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/power.hpp index 3f9fc63ffc..f10fdc7553 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/power.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/power.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_POWER_HPP #define PYTHONIC_INCLUDE_NUMPY_RANDOM_POWER_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" #include <math.h> PYTHONIC_NS_BEGIN @@ -15,13 +15,13 @@ namespace numpy template <class pS> types::ndarray<double, pS> power(double a, pS const &shape); auto power(double a, long size) - -> decltype(power(a, types::array<long, 1>{{size}})); + -> decltype(power(a, types::array_tuple<long, 1>{{size}})); double power(double a, types::none_type size = {}); DEFINE_FUNCTOR(pythonic::numpy::random, power); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/rand.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/rand.hpp index 54f14c8ae6..5e10ebecc5 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/rand.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/rand.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_RAND_HPP #define PYTHONIC_INCLUDE_NUMPY_RANDOM_RAND_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -10,13 +10,14 @@ namespace numpy namespace random { template <class... T> - types::ndarray<double, types::array<long, sizeof...(T)>> rand(T... shape); + types::ndarray<double, types::array_tuple<long, sizeof...(T)>> + rand(T... shape); double rand(); DEFINE_FUNCTOR(pythonic::numpy::random, rand); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/randint.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/randint.hpp index 58117b85a5..bcc8ebbdeb 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/randint.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/randint.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_RANDINT_HPP #define PYTHONIC_INCLUDE_NUMPY_RANDOM_RANDINT_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -21,19 +21,19 @@ namespace numpy randint(long min, long max, pS const &shape); template <class pS> - auto randint(long max, types::none_type, pS const &shape) - -> decltype(randint(0, max, shape)); + auto randint(long max, types::none_type, + pS const &shape) -> decltype(randint(0, max, shape)); long randint(long min, long max); long randint(long max, types::none_type = {}); auto randint(long min, long max, long size) - -> decltype(randint(min, max, types::array<long, 1>{{size}})); + -> decltype(randint(min, max, types::array_tuple<long, 1>{{size}})); DEFINE_FUNCTOR(pythonic::numpy::random, randint); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/randn.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/randn.hpp index f33fce310b..1a9cdd1c64 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/randn.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/randn.hpp @@ -11,13 +11,14 @@ namespace numpy namespace random { template <class... T> - types::ndarray<double, types::array<long, sizeof...(T)>> randn(T... shape); + types::ndarray<double, types::array_tuple<long, sizeof...(T)>> + randn(T... shape); double randn(); DEFINE_FUNCTOR(pythonic::numpy::random, randn); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/random.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/random.hpp index faaaceaa1f..084c57b684 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/random.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/random.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_RANDOM_HPP #define PYTHONIC_INCLUDE_NUMPY_RANDOM_RANDOM_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -14,20 +14,22 @@ namespace numpy template <class pS> types::ndarray<double, pS> random(pS const &shape); - auto random(long size) -> decltype(random(types::array<long, 1>{{size}})); + auto + random(long size) -> decltype(random(types::array_tuple<long, 1>{{size}})); template <long N> auto random(std::integral_constant<long, N>) - -> decltype(random(types::array<std::integral_constant<long, N>, 1>{})) + -> decltype(random( + types::array_tuple<std::integral_constant<long, N>, 1>{})) { - return random(types::array<std::integral_constant<long, N>, 1>{}); + return random(types::array_tuple<std::integral_constant<long, N>, 1>{}); } double random(types::none_type d = types::none_type()); DEFINE_FUNCTOR(pythonic::numpy::random, random); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/random_integers.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/random_integers.hpp index a731edab40..26f2f38d66 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/random_integers.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/random_integers.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_RANDOM_INTEGERS_HPP #define PYTHONIC_INCLUDE_NUMPY_RANDOM_RANDOM_INTEGERS_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/random/randint.hpp" +#include "pythonic/include/utils/functor.hpp" #include <utility> @@ -20,8 +20,8 @@ namespace numpy long random_integers(long min, long max); DEFINE_FUNCTOR(pythonic::numpy::random, random_integers); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/random_sample.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/random_sample.hpp index bb17bed478..582ac1e8ee 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/random_sample.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/random_sample.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_RANDOM_SAMPLE_HPP #define PYTHONIC_INCLUDE_NUMPY_RANDOM_RANDOM_SAMPLE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/random/random.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -11,7 +11,7 @@ namespace numpy { USING_FUNCTOR(random_sample, random); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/ranf.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/ranf.hpp index 82c1db1f2f..b49b82467c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/ranf.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/ranf.hpp @@ -11,7 +11,7 @@ namespace numpy { USING_FUNCTOR(ranf, random); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/rayleigh.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/rayleigh.hpp index 6f3eb1f3b9..b638a296dc 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/rayleigh.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/rayleigh.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_RAYLEIGH_HPP #define PYTHONIC_INCLUDE_NUMPY_RANDOM_RAYLEIGH_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" #include <math.h> PYTHONIC_NS_BEGIN @@ -16,13 +16,13 @@ namespace numpy types::ndarray<double, pS> rayleigh(double scale, pS const &array_shape); auto rayleigh(double scale, long size) - -> decltype(rayleigh(scale, types::array<long, 1>{{size}})); + -> decltype(rayleigh(scale, types::array_tuple<long, 1>{{size}})); double rayleigh(double scale = 1.0, types::none_type size = {}); DEFINE_FUNCTOR(pythonic::numpy::random, rayleigh); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/sample.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/sample.hpp index 4ac5a4f2b3..908d1bab0b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/sample.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/sample.hpp @@ -11,7 +11,7 @@ namespace numpy { USING_FUNCTOR(sample, random); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/seed.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/seed.hpp index 358462fbc9..343ba16e32 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/seed.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/seed.hpp @@ -13,8 +13,8 @@ namespace numpy types::none_type seed(types::none_type _ = {}); DEFINE_FUNCTOR(pythonic::numpy::random, seed); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/shuffle.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/shuffle.hpp index 4245f55c22..4922a90c12 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/shuffle.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/shuffle.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_SHUFFLE_HPP #define PYTHONIC_INCLUDE_NUMPY_RANDOM_SHUFFLE_HPP -#include "pythonic/include/types/ndarray.hpp" -#include "pythonic/include/types/NoneType.hpp" #include "pythonic/include/numpy/random/generator.hpp" +#include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/ndarray.hpp" PYTHONIC_NS_BEGIN @@ -15,8 +15,8 @@ namespace numpy types::none_type shuffle(T &seq); DEFINE_FUNCTOR(pythonic::numpy::random, shuffle); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/standard_exponential.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/standard_exponential.hpp index 4ae39edc88..8e6e7517d5 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/standard_exponential.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/standard_exponential.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_STANDARD_EXPONENTIAL_HPP #define PYTHONIC_INCLUDE_NUMPY_RANDOM_STANDARD_EXPONENTIAL_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -15,13 +15,13 @@ namespace numpy types::ndarray<double, pS> standard_exponential(pS const &shape); auto standard_exponential(long size) - -> decltype(standard_exponential(types::array<long, 1>{{size}})); + -> decltype(standard_exponential(types::array_tuple<long, 1>{{size}})); double standard_exponential(types::none_type d = {}); DEFINE_FUNCTOR(pythonic::numpy::random, standard_exponential); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/standard_gamma.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/standard_gamma.hpp index 8ca27a1455..055c257a84 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/standard_gamma.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/standard_gamma.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_STANDARD_GAMMA_HPP #define PYTHONIC_INCLUDE_NUMPY_RANDOM_STANDARD_GAMMA_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -15,13 +15,13 @@ namespace numpy types::ndarray<double, pS> standard_gamma(double s, pS const &shape); auto standard_gamma(double s, long size) - -> decltype(standard_gamma(s, types::array<long, 1>{{size}})); + -> decltype(standard_gamma(s, types::array_tuple<long, 1>{{size}})); double standard_gamma(double s, types::none_type d = {}); DEFINE_FUNCTOR(pythonic::numpy::random, standard_gamma); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/standard_normal.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/standard_normal.hpp index 3dd2be0475..f2f7c00b66 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/standard_normal.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/standard_normal.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RANDOM_STANDARD_NORMAL_HPP #define PYTHONIC_INCLUDE_NUMPY_RANDOM_STANDARD_NORMAL_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -15,13 +15,13 @@ namespace numpy types::ndarray<double, pS> standard_normal(pS const &shape); auto standard_normal(long size) - -> decltype(standard_normal(types::array<long, 1>{{size}})); + -> decltype(standard_normal(types::array_tuple<long, 1>{{size}})); double standard_normal(types::none_type d = {}); DEFINE_FUNCTOR(pythonic::numpy::random, standard_normal); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/uniform.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/uniform.hpp index fee7eb84da..da81018b81 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/uniform.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/uniform.hpp @@ -17,7 +17,7 @@ namespace numpy pS const &array_shape); auto uniform(double low, double high, long size) - -> decltype(uniform(low, high, types::array<long, 1>{{size}})); + -> decltype(uniform(low, high, types::array_tuple<long, 1>{{size}})); double uniform(double low = 0.0, double high = 1.0, types::none_type size = {}); diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/weibull.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/weibull.hpp index b4411da214..2f96e7d0b9 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/weibull.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/weibull.hpp @@ -15,13 +15,13 @@ namespace numpy types::ndarray<double, pS> weibull(double a, pS const &shape); auto weibull(double a, long size) - -> decltype(weibull(a, types::array<long, 1>{{size}})); + -> decltype(weibull(a, types::array_tuple<long, 1>{{size}})); double weibull(double a, types::none_type size = {}); DEFINE_FUNCTOR(pythonic::numpy::random, weibull); - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ravel.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ravel.hpp index 797b00edb2..9fd9e8e51e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ravel.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ravel.hpp @@ -14,7 +14,7 @@ namespace numpy NUMPY_EXPR_TO_NDARRAY0_DECL(ravel); DEFINE_FUNCTOR(pythonic::numpy, ravel); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/real.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/real.hpp index ef6fedb391..900733f5f8 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/real.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/real.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_REAL_HPP #define PYTHONIC_INCLUDE_NUMPY_REAL_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/asarray.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/list.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -18,7 +18,7 @@ namespace numpy -> decltype(real(numpy::functor::asarray{}(expr))); DEFINE_FUNCTOR(pythonic::numpy, real); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/reciprocal.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/reciprocal.hpp index de6e15078d..06d54a00c3 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/reciprocal.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/reciprocal.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RECIPROCAL_HPP #define PYTHONIC_INCLUDE_NUMPY_RECIPROCAL_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -16,11 +16,11 @@ namespace numpy { return static_cast<T>(1.) / val; } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME reciprocal #define NUMPY_NARY_FUNC_SYM wrapper::reciprocal #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/reduce.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/reduce.hpp index 36ce15dca2..6923590ca5 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/reduce.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/reduce.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_REDUCE_HPP #define PYTHONIC_INCLUDE_NUMPY_REDUCE_HPP -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/builtins/None.hpp" +#include "pythonic/include/types/ndarray.hpp" #include <algorithm> @@ -13,8 +13,8 @@ namespace operator_ { struct imax; struct imin; - } -} + } // namespace functor +} // namespace operator_ namespace numpy { @@ -43,7 +43,7 @@ namespace numpy template <class Op, class E, class T = types::none_type> using reduce_result_type = typename reduce_result_type_helper<Op, E, T>::type; - } + } // namespace template <class Op, class E> typename std::enable_if< @@ -79,7 +79,7 @@ namespace numpy { template <class E, class Op, class dtype = types::none_type> using reduced_type = types::ndarray<reduce_result_type<Op, E, dtype>, - types::array<long, E::value - 1>>; + types::array_tuple<long, E::value - 1>>; } template <class Op, class E, class dtype = types::none_type> @@ -98,7 +98,7 @@ namespace numpy template <class Op, class E, class Out> typename std::enable_if<E::value != 1, reduced_type<E, Op>>::type reduce(E const &array, long axis, types::none_type dtype, Out &&out); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/remainder.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/remainder.hpp index e2d310d863..691687ff80 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/remainder.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/remainder.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_REMAINDER_HPP #define PYTHONIC_INCLUDE_NUMPY_REMAINDER_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -15,17 +15,17 @@ namespace numpy namespace wrapper { template <class T0, class T1> - auto remainder(T0 const &x, T1 const &y) - -> decltype(x - y * xsimd::floor(x / y)) + auto remainder(T0 const &x, + T1 const &y) -> decltype(x - y * xsimd::floor(x / y)) { return x - y * xsimd::floor(x / y); } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME remainder #define NUMPY_NARY_FUNC_SYM wrapper::remainder #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/repeat.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/repeat.hpp index e5a37d1ea5..39dba3a7c0 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/repeat.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/repeat.hpp @@ -1,17 +1,17 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_REPEAT_HPP #define PYTHONIC_INCLUDE_NUMPY_REPEAT_HPP +#include "pythonic/include/builtins/None.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_conversion.hpp" -#include "pythonic/include/types/ndarray.hpp" -#include "pythonic/include/builtins/None.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> repeat(types::ndarray<T, pS> const &expr, long repeats, long axis); template <class T, class pS> @@ -21,7 +21,7 @@ namespace numpy NUMPY_EXPR_TO_NDARRAY0_DECL(repeat); DEFINE_FUNCTOR(pythonic::numpy, repeat); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/resize.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/resize.hpp index 4ea024f99b..3028f7cbf8 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/resize.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/resize.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RESIZE_HPP #define PYTHONIC_INCLUDE_NUMPY_RESIZE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/ndarray/reshape.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/right_shift.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/right_shift.hpp index e6f93acc2f..ec440429cd 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/right_shift.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/right_shift.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RIGHTSHIFT_HPP #define PYTHONIC_INCLUDE_NUMPY_RIGHTSHIFT_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include "pythonic/include/operator_/rshift.hpp" @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME right_shift #define NUMPY_NARY_FUNC_SYM operator_::rshift #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/rint.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/rint.hpp index 49f8694ed5..1b5e78d86e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/rint.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/rint.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_RINT_HPP #define PYTHONIC_INCLUDE_NUMPY_RINT_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -15,11 +15,11 @@ namespace numpy T rint(T const &v); template <class T> std::complex<T> rint(std::complex<T> const &v); - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME rint #define NUMPY_NARY_FUNC_SYM wrapper::rint #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/roll.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/roll.hpp index 1df6f3181d..cf8e122e52 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/roll.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/roll.hpp @@ -18,8 +18,8 @@ namespace numpy template <class T, class pS, size_t N> types::ndarray<T, pS> roll(types::ndarray<T, pS> const &expr, - types::array<long, N> shift, - types::array<long, N> axis); + types::array_tuple<long, N> shift, + types::array_tuple<long, N> axis); NUMPY_EXPR_TO_NDARRAY0_DECL(roll); DEFINE_FUNCTOR(pythonic::numpy, roll); diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/rollaxis.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/rollaxis.hpp index b26633f387..15f1325ebf 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/rollaxis.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/rollaxis.hpp @@ -1,20 +1,20 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ROLLAXIS_HPP #define PYTHONIC_INCLUDE_NUMPY_ROLLAXIS_HPP -#include "pythonic/include/numpy/transpose.hpp" #include "pythonic/include/numpy/copy.hpp" +#include "pythonic/include/numpy/transpose.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> rollaxis(types::ndarray<T, pS> const &a, long axis, long start = 0); NUMPY_EXPR_TO_NDARRAY0_DECL(rollaxis); DEFINE_FUNCTOR(pythonic::numpy, rollaxis); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/rot90.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/rot90.hpp index 1faa224a5d..6b3a5cba5a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/rot90.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/rot90.hpp @@ -1,22 +1,22 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ROT90_HPP #define PYTHONIC_INCLUDE_NUMPY_ROT90_HPP +#include "pythonic/include/numpy/copy.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_conversion.hpp" -#include "pythonic/include/types/ndarray.hpp" -#include "pythonic/include/numpy/copy.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> rot90(types::ndarray<T, pS> const &expr, int k = 1); NUMPY_EXPR_TO_NDARRAY0_DECL(rot90) DEFINE_FUNCTOR(pythonic::numpy, rot90); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/searchsorted.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/searchsorted.hpp index af23a56ef9..378b30d021 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/searchsorted.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/searchsorted.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_SEARCHSORTED_HPP #define PYTHONIC_INCLUDE_NUMPY_SEARCHSORTED_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/utils/numpy_conversion.hpp" -#include "pythonic/include/utils/int_.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/str.hpp" +#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/utils/int_.hpp" +#include "pythonic/include/utils/numpy_conversion.hpp" #include <algorithm> @@ -21,11 +21,11 @@ namespace numpy template <class E, class T> typename std::enable_if< types::is_numexpr_arg<E>::value, - types::ndarray<long, types::array<long, E::value>>>::type + types::ndarray<long, types::array_tuple<long, E::value>>>::type searchsorted(T const &a, E const &v, types::str const &side = "left"); DEFINE_FUNCTOR(pythonic::numpy, searchsorted); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/select.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/select.hpp index 106bf0ad7b..c8040d7a3a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/select.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/select.hpp @@ -10,14 +10,15 @@ namespace numpy { template <class C, class L> - types::ndarray<typename L::dtype, types::array<long, L::value - 1>> + types::ndarray<typename L::dtype, types::array_tuple<long, L::value - 1>> select(C const &condlist, L const &choicelist, typename L::dtype _default = 0); template <class T, class TpS, class U, class UpS> typename std::enable_if< std::tuple_size<TpS>::value == std::tuple_size<UpS>::value, - types::ndarray<T, types::array<long, std::tuple_size<TpS>::value>>>::type + types::ndarray< + T, types::array_tuple<long, std::tuple_size<TpS>::value>>>::type select(types::list<types::ndarray<U, UpS>> const &condlist, types::list<types::ndarray<T, TpS>> const &choicelist, T _default = 0); @@ -45,7 +46,7 @@ namespace numpy T _default = 0); DEFINE_FUNCTOR(pythonic::numpy, select); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/setdiff1d.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/setdiff1d.hpp index 84b3fad818..2389da8478 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/setdiff1d.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/setdiff1d.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_SETDIFF1D_HPP #define PYTHONIC_INCLUDE_NUMPY_SETDIFF1D_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -16,7 +16,7 @@ namespace numpy setdiff1d(T const &ar1, U const &ar2, bool assume_unique = false); DEFINE_FUNCTOR(pythonic::numpy, setdiff1d); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/shape.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/shape.hpp index ebb09f40f7..a39ac8591c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/shape.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/shape.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_SHAPE_HPP #define PYTHONIC_INCLUDE_NUMPY_SHAPE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -16,7 +16,7 @@ namespace numpy auto shape(E const &e) -> decltype(sutils::getshape(e)); DEFINE_FUNCTOR(pythonic::numpy, shape) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/short_.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/short_.hpp index 74e7443684..df740d99f8 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/short_.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/short_.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_SHORT__HPP #define PYTHONIC_INCLUDE_NUMPY_SHORT__HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -17,13 +17,13 @@ namespace numpy short short_(); template <class V> short short_(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME short_ #define NUMPY_NARY_FUNC_SYM details::short_ #define NUMPY_NARY_EXTRA_METHOD using type = short; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/sin.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/sin.hpp index acb1ee91f3..d0b89b8def 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/sin.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/sin.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_SIN_HPP #define PYTHONIC_INCLUDE_NUMPY_SIN_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME sin #define NUMPY_NARY_FUNC_SYM xsimd::sin #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/sinh.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/sinh.hpp index b834cdc97d..d70bdf0ac5 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/sinh.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/sinh.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_SINH_HPP #define PYTHONIC_INCLUDE_NUMPY_SINH_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME sinh #define NUMPY_NARY_FUNC_SYM xsimd::sinh #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/sort.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/sort.hpp index 95231004e5..97c4056813 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/sort.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/sort.hpp @@ -3,28 +3,28 @@ #include <algorithm> -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/str.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class E> - types::ndarray<typename E::dtype, types::array<long, 1>> + types::ndarray<typename E::dtype, types::array_tuple<long, 1>> sort(E const &expr, types::none_type); template <class E> - types::ndarray<typename E::dtype, types::array<long, E::value>> + types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> sort(E const &expr, long axis = -1); template <class E> - types::ndarray<typename E::dtype, types::array<long, E::value>> + types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> sort(E const &expr, long axis, types::str const &kind); NUMPY_EXPR_TO_NDARRAY0_DECL(sort); DEFINE_FUNCTOR(pythonic::numpy, sort); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/sort_complex.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/sort_complex.hpp index d0cb3c7d04..746a9eacc9 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/sort_complex.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/sort_complex.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_SORTCOMPLEX_HPP #define PYTHONIC_INCLUDE_NUMPY_SORTCOMPLEX_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/sort.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/spacing.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/spacing.hpp index 3f7fe91e55..c099acd80e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/spacing.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/spacing.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_SPACING_HPP #define PYTHONIC_INCLUDE_NUMPY_SPACING_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -16,11 +16,11 @@ namespace numpy { return std::nextafter(v, 1) - v; } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME spacing #define NUMPY_NARY_FUNC_SYM wrapper::spacing #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/split.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/split.hpp index b6d7ccee27..dfc5167347 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/split.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/split.hpp @@ -8,22 +8,24 @@ PYTHONIC_NS_BEGIN namespace numpy { template <class T, class pS> - types::list<types::ndarray<T, types::array<long, std::tuple_size<pS>::value>>> + types::list< + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>> split(types::ndarray<T, pS> const &a, long nb_split); template <class T, class pS, class I> typename std::enable_if< types::is_iterable<I>::value, types::list<types::ndarray< - T, types::array<long, std::tuple_size<pS>::value>>>>::type + T, types::array_tuple<long, std::tuple_size<pS>::value>>>>::type split(types::ndarray<T, pS> const &a, I const &split_mask); template <class E, class I> - types::list<types::ndarray<typename E::dtype, types::array<long, E::value>>> + types::list< + types::ndarray<typename E::dtype, types::array_tuple<long, E::value>>> split(E const &a, I const &); DEFINE_FUNCTOR(pythonic::numpy, split); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/sqrt.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/sqrt.hpp index 4a2aae60fe..6f58776bf1 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/sqrt.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/sqrt.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_SQRT_HPP #define PYTHONIC_INCLUDE_NUMPY_SQRT_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME sqrt #define NUMPY_NARY_FUNC_SYM xsimd::sqrt #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/square.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/square.hpp index ab5fe9b1c8..5f93d421df 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/square.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/square.hpp @@ -2,8 +2,8 @@ #define PYTHONIC_INCLUDE_NUMPY_SQUARE_HPP #include "pythonic/include/types/numpy_op_helper.hpp" -#include "pythonic/include/utils/numpy_traits.hpp" #include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/utils/numpy_traits.hpp" #include <complex> @@ -19,7 +19,7 @@ namespace numpy namespace wrapper { template <class T> - auto square(T const &arg) -> decltype(arg *arg) + auto square(T const &arg) -> decltype(arg * arg) { return arg * arg; } @@ -32,12 +32,12 @@ namespace numpy auto i2 = i * i; return {r2 - i2, t + t}; } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME square #define NUMPY_NARY_FUNC_SYM wrapper::square #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/stack.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/stack.hpp index 070efe7cce..94cbfcc5dd 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/stack.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/stack.hpp @@ -9,7 +9,7 @@ namespace numpy { template <class ArraySequence> types::ndarray<typename ArraySequence::value_type::dtype, - types::array<long, ArraySequence::value_type::value + 1>> + types::array_tuple<long, ArraySequence::value_type::value + 1>> stack(ArraySequence const &args, long axis = 0); namespace details @@ -20,12 +20,13 @@ namespace numpy } template <class... Tys> - types::ndarray<typename details::stack_helper_t<Tys...>::dtype, - types::array<long, details::stack_helper_t<Tys...>::value + 1>> + types::ndarray< + typename details::stack_helper_t<Tys...>::dtype, + types::array_tuple<long, details::stack_helper_t<Tys...>::value + 1>> stack(std::tuple<Tys...> const &args, long axis = 0); DEFINE_FUNCTOR(pythonic::numpy, stack); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/std_.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/std_.hpp index 101e533bdc..0e403bf214 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/std_.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/std_.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_STD_HPP #define PYTHONIC_INCLUDE_NUMPY_STD_HPP -#include "pythonic/include/numpy/var.hpp" #include "pythonic/include/numpy/sqrt.hpp" +#include "pythonic/include/numpy/var.hpp" PYTHONIC_NS_BEGIN @@ -10,11 +10,11 @@ namespace numpy { template <class... Args> - auto std_(Args &&... args) + auto std_(Args &&...args) -> decltype(functor::sqrt{}(var(std::forward<Args>(args)...))); DEFINE_FUNCTOR(pythonic::numpy, std_); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/subtract.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/subtract.hpp index 99e6184aa3..45cfeb1527 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/subtract.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/subtract.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_SUBTRACT_HPP #define PYTHONIC_INCLUDE_NUMPY_SUBTRACT_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/operator_/sub.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/operator_/sub.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME subtract #define NUMPY_NARY_FUNC_SYM pythonic::operator_::sub #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/sum.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/sum.hpp index 6ca19b4768..835603298c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/sum.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/sum.hpp @@ -11,14 +11,14 @@ namespace numpy { template <class... Args> - auto sum(Args &&... args) + auto sum(Args &&...args) -> decltype(reduce<operator_::functor::iadd>(std::forward<Args>(args)...)) { return reduce<operator_::functor::iadd>(std::forward<Args>(args)...); } DEFINE_FUNCTOR(pythonic::numpy, sum); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/swapaxes.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/swapaxes.hpp index f0dfd4d437..13552f2cd3 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/swapaxes.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/swapaxes.hpp @@ -8,12 +8,14 @@ PYTHONIC_NS_BEGIN namespace numpy { template <class T> - auto swapaxes(T &&a, int axis1, int axis2) -> decltype(functor::transpose{}( - std::forward<T>(a), - std::declval<types::array<long, std::decay<T>::type::value>>())); + auto swapaxes(T &&a, int axis1, int axis2) + -> decltype(functor::transpose{}( + std::forward<T>(a), + std::declval< + types::array_tuple<long, std::decay<T>::type::value>>())); DEFINE_FUNCTOR(pythonic::numpy, swapaxes); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/take.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/take.hpp index cd2f7e764f..47c311c86d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/take.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/take.hpp @@ -10,7 +10,7 @@ namespace numpy -> decltype(std::forward<T>(expr)[std::forward<F>(indices)]); DEFINE_FUNCTOR(pythonic::numpy, take); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/tan.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/tan.hpp index 91d322d8a2..142bba6bbe 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/tan.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/tan.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_TAN_HPP #define PYTHONIC_INCLUDE_NUMPY_TAN_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME tan #define NUMPY_NARY_FUNC_SYM xsimd::tan #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/tanh.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/tanh.hpp index 18f38f2d24..edbdb7891a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/tanh.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/tanh.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_TANH_HPP #define PYTHONIC_INCLUDE_NUMPY_TANH_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME tanh #define NUMPY_NARY_FUNC_SYM xsimd::tanh #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/tile.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/tile.hpp index 011f00892d..6c844eecee 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/tile.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/tile.hpp @@ -1,23 +1,23 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_TILE_HPP #define PYTHONIC_INCLUDE_NUMPY_TILE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class E> - types::ndarray<typename E::dtype, types::array<long, E::value>> + types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> tile(E const &expr, long reps); template <class E, size_t N> - types::ndarray<typename E::dtype, types::array<long, N>> - tile(E const &expr, types::array<long, N> const &reps); + types::ndarray<typename E::dtype, types::array_tuple<long, N>> + tile(E const &expr, types::array_tuple<long, N> const &reps); DEFINE_FUNCTOR(pythonic::numpy, tile); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/trace.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/trace.hpp index fbd3282c90..a9ae44b1dc 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/trace.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/trace.hpp @@ -12,7 +12,7 @@ namespace numpy typename T::dtype trace(T const &expr, int offset = 0); DEFINE_FUNCTOR(pythonic::numpy, trace) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/transpose.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/transpose.hpp index 5a9aa973ea..0eb9ade8b3 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/transpose.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/transpose.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_TRANSPOSE_HPP #define PYTHONIC_INCLUDE_NUMPY_TRANSPOSE_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/utils/numpy_conversion.hpp" -#include "pythonic/include/utils/nested_container.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_expr.hpp" +#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/utils/nested_container.hpp" +#include "pythonic/include/utils/numpy_conversion.hpp" PYTHONIC_NS_BEGIN @@ -41,19 +41,21 @@ namespace numpy template <class T, class pS> typename std::enable_if< (std::tuple_size<pS>::value > 2), - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>>>::type - transpose(types::ndarray<T, pS> const &a); + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>>:: + type + transpose(types::ndarray<T, pS> const &a); template <class T, class pS, size_t M> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> - transpose(types::ndarray<T, pS> const &a, types::array<long, M> const &t); + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> + transpose(types::ndarray<T, pS> const &a, + types::array_tuple<long, M> const &t); template <class T, class pS, class... Args> - types::ndarray<T, types::array<long, 1 + sizeof...(Args)>> - transpose(types::ndarray<T, pS> const &a, long index, Args const &... indices) + types::ndarray<T, types::array_tuple<long, 1 + sizeof...(Args)>> + transpose(types::ndarray<T, pS> const &a, long index, Args const &...indices) { - return transpose( - a, types::array<long, 1 + sizeof...(Args)>{{index, (long)indices...}}); + return transpose(a, types::array_tuple<long, 1 + sizeof...(Args)>{ + {index, (long)indices...}}); } template <class T> @@ -79,17 +81,18 @@ namespace numpy }; template <class E> - auto transpose(E const &expr) -> typename std::enable_if< - (E::value > 2), - decltype(transpose(types::ndarray<typename E::dtype, typename E::shape_t>{ - expr}))>::type + auto transpose(E const &expr) -> + typename std::enable_if< + (E::value > 2), + decltype(transpose(types::ndarray<typename E::dtype, + typename E::shape_t>{expr}))>::type { return transpose( types::ndarray<typename E::dtype, typename E::shape_t>{expr}); } DEFINE_FUNCTOR(pythonic::numpy, transpose); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/tri.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/tri.hpp index bcdd251019..06b1e194be 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/tri.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/tri.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_TRI_HPP #define PYTHONIC_INCLUDE_NUMPY_TRI_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/numpy/float64.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy tri(long N, long M = -1, long k = 0, dtype d = dtype()); DEFINE_FUNCTOR(pythonic::numpy, tri) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/tril.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/tril.hpp index a7a6df584d..242674d9c0 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/tril.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/tril.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_TRIL_HPP #define PYTHONIC_INCLUDE_NUMPY_TRIL_HPP +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_conversion.hpp" -#include "pythonic/include/types/ndarray.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy NUMPY_EXPR_TO_NDARRAY0_DECL(tril) DEFINE_FUNCTOR(pythonic::numpy, tril) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/triu.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/triu.hpp index a30e68e127..bccfc5af50 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/triu.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/triu.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_TRIU_HPP #define PYTHONIC_INCLUDE_NUMPY_TRIU_HPP +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_conversion.hpp" -#include "pythonic/include/types/ndarray.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy NUMPY_EXPR_TO_NDARRAY0_DECL(triu) DEFINE_FUNCTOR(pythonic::numpy, triu) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/true_divide.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/true_divide.hpp index dc7b68a252..0f6d9e4152 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/true_divide.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/true_divide.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_TRUEDIVIDE_HPP #define PYTHONIC_INCLUDE_NUMPY_TRUEDIVIDE_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/operator_/div.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/operator_/div.hpp" PYTHONIC_NS_BEGIN @@ -16,7 +16,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME true_divide #define NUMPY_NARY_FUNC_SYM pythonic::operator_::div #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/trunc.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/trunc.hpp index a5ec9f9429..8a01b4204f 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/trunc.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/trunc.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_TRUNC_HPP #define PYTHONIC_INCLUDE_NUMPY_TRUNC_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME trunc #define NUMPY_NARY_FUNC_SYM xsimd::trunc #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ubyte.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ubyte.hpp index 51327e593b..e95fd990de 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ubyte.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ubyte.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_UBYTE_HPP #define PYTHONIC_INCLUDE_NUMPY_UBYTE_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -17,13 +17,13 @@ namespace numpy unsigned char ubyte(); template <class V> unsigned char ubyte(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME ubyte #define NUMPY_NARY_FUNC_SYM details::ubyte #define NUMPY_NARY_EXTRA_METHOD using type = unsigned char; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ufunc_accumulate.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ufunc_accumulate.hpp index ffbfa83fb5..be76448d59 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ufunc_accumulate.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ufunc_accumulate.hpp @@ -21,6 +21,6 @@ namespace numpy -> decltype(partial_sum<numpy::functor::UFUNC_NAME>(std::forward<T>(a), axis, d)); DEFINE_FUNCTOR(pythonic::numpy::UFUNC_NAME, accumulate); - } -} + } // namespace UFUNC_NAME +} // namespace numpy PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ufunc_reduce.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ufunc_reduce.hpp index f7d6c7caf0..8f8b19f599 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ufunc_reduce.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ufunc_reduce.hpp @@ -27,16 +27,17 @@ namespace numpy std::forward<Arg>(arg), 0L); } template <class... Args> - auto reduce(Args &&... args) -> typename std::enable_if< - sizeof...(Args) != 1, - decltype(numpy::reduce<operator_::functor::UFUNC_INAME>( - std::forward<Args>(args)...))>::type + auto reduce(Args &&...args) -> + typename std::enable_if< + sizeof...(Args) != 1, + decltype(numpy::reduce<operator_::functor::UFUNC_INAME>( + std::forward<Args>(args)...))>::type { return numpy::reduce<operator_::functor::UFUNC_INAME>( std::forward<Args>(args)...); } DEFINE_FUNCTOR(pythonic::numpy::UFUNC_NAME, reduce); - } -} + } // namespace UFUNC_NAME +} // namespace numpy PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/uint.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/uint.hpp index ec4773dae2..dd6242f775 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/uint.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/uint.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_UINT_HPP #define PYTHONIC_INCLUDE_NUMPY_UINT_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -16,13 +16,13 @@ namespace numpy unsigned long uint(); template <class V> unsigned long uint(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME uint #define NUMPY_NARY_FUNC_SYM details::uint #define NUMPY_NARY_EXTRA_METHOD using type = unsigned long; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/uint16.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/uint16.hpp index 05eea7869f..0d1f6c3353 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/uint16.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/uint16.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_UINT16_HPP #define PYTHONIC_INCLUDE_NUMPY_UINT16_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -17,13 +17,13 @@ namespace numpy uint16_t uint16(); template <class V> uint16_t uint16(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME uint16 #define NUMPY_NARY_FUNC_SYM details::uint16 #define NUMPY_NARY_EXTRA_METHOD using type = uint16_t; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/uint32.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/uint32.hpp index 2c81cac769..0d0bfcb17b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/uint32.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/uint32.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_UINT32_HPP #define PYTHONIC_INCLUDE_NUMPY_UINT32_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -16,13 +16,13 @@ namespace numpy uint32_t uint32(); template <class V> uint32_t uint32(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME uint32 #define NUMPY_NARY_FUNC_SYM details::uint32 #define NUMPY_NARY_EXTRA_METHOD using type = uint32_t; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/uint64.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/uint64.hpp index caefe91ef4..85264f209c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/uint64.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/uint64.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_UINT64_HPP #define PYTHONIC_INCLUDE_NUMPY_UINT64_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -16,13 +16,13 @@ namespace numpy uint64_t uint64(); template <class V> uint64_t uint64(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME uint64 #define NUMPY_NARY_FUNC_SYM details::uint64 #define NUMPY_NARY_EXTRA_METHOD using type = uint64_t; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/uint8.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/uint8.hpp index c268272cc1..8eef53ba88 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/uint8.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/uint8.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_UINT8_HPP #define PYTHONIC_INCLUDE_NUMPY_UINT8_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -17,13 +17,13 @@ namespace numpy uint8_t uint8(); template <class V> uint8_t uint8(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME uint8 #define NUMPY_NARY_FUNC_SYM details::uint8 #define NUMPY_NARY_EXTRA_METHOD using type = uint8_t; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/uintc.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/uintc.hpp index 027326c312..dc9a6e25c7 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/uintc.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/uintc.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_UINTC_HPP #define PYTHONIC_INCLUDE_NUMPY_UINTC_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -17,13 +17,13 @@ namespace numpy unsigned uintc(); template <class V> unsigned uintc(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME uintc #define NUMPY_NARY_FUNC_SYM details::uintc #define NUMPY_NARY_EXTRA_METHOD using type = unsigned; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/uintp.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/uintp.hpp index f8184e349a..10b035e7c5 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/uintp.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/uintp.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_UINTP_HPP #define PYTHONIC_INCLUDE_NUMPY_UINTP_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -17,13 +17,13 @@ namespace numpy uintptr_t uintp(); template <class V> uintptr_t uintp(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME uintp #define NUMPY_NARY_FUNC_SYM details::uintp #define NUMPY_NARY_EXTRA_METHOD using type = uintptr_t; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ulonglong.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ulonglong.hpp index 8811bd2cc9..b78622d956 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ulonglong.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ulonglong.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ULONGLONG_HPP #define PYTHONIC_INCLUDE_NUMPY_ULONGLONG_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -17,13 +17,13 @@ namespace numpy unsigned long long ulonglong(); template <class V> unsigned long long ulonglong(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME ulonglong #define NUMPY_NARY_FUNC_SYM details::ulonglong #define NUMPY_NARY_EXTRA_METHOD using type = unsigned long long; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/union1d.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/union1d.hpp index 5b578c3d9b..241fd221ec 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/union1d.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/union1d.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_UNION1D_HPP #define PYTHONIC_INCLUDE_NUMPY_UNION1D_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy union1d(E const &e, F const &f); DEFINE_FUNCTOR(pythonic::numpy, union1d) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/unique.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/unique.hpp index b4d8b0cc2f..e353f4de2a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/unique.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/unique.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_UNIQUE_HPP #define PYTHONIC_INCLUDE_NUMPY_UNIQUE_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/types/immediate.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/tuple.hpp" -#include "pythonic/include/types/immediate.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -107,7 +107,7 @@ namespace numpy types::true_immediate return_counts); DEFINE_FUNCTOR(pythonic::numpy, unique) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/unravel_index.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/unravel_index.hpp index 9f585f10e1..fcab8025b3 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/unravel_index.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/unravel_index.hpp @@ -9,12 +9,13 @@ PYTHONIC_NS_BEGIN namespace numpy { template <class E, class S> - typename std::enable_if<std::is_scalar<E>::value, - types::array<long, std::tuple_size<S>::value>>::type + typename std::enable_if< + std::is_scalar<E>::value, + types::array_tuple<long, std::tuple_size<S>::value>>::type unravel_index(E const &expr, S const &shape, types::str const &order = "C"); DEFINE_FUNCTOR(pythonic::numpy, unravel_index); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/unwrap.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/unwrap.hpp index 1615cf59f9..e0928a5001 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/unwrap.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/unwrap.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_UNWRAP_HPP #define PYTHONIC_INCLUDE_NUMPY_UNWRAP_HPP +#include "pythonic/include/numpy/pi.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/int_.hpp" -#include "pythonic/include/types/ndarray.hpp" -#include "pythonic/include/numpy/pi.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy double discont = pi); DEFINE_FUNCTOR(pythonic::numpy, unwrap) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ushort.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ushort.hpp index 11d2980017..de2018e795 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/ushort.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ushort.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_USHORT_HPP #define PYTHONIC_INCLUDE_NUMPY_USHORT_HPP +#include "pythonic/include/types/numpy_op_helper.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/meta.hpp" #include "pythonic/include/utils/numpy_traits.hpp" -#include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -17,13 +17,13 @@ namespace numpy unsigned short ushort(); template <class V> unsigned short ushort(V v); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME ushort #define NUMPY_NARY_FUNC_SYM details::ushort #define NUMPY_NARY_EXTRA_METHOD using type = unsigned short; #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/var.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/var.hpp index 104a4f6401..f6a74f69b1 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/var.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/var.hpp @@ -1,12 +1,12 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_VAR_HPP #define PYTHONIC_INCLUDE_NUMPY_VAR_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/builtins/None.hpp" #include "pythonic/include/numpy/add.hpp" #include "pythonic/include/numpy/mean.hpp" #include "pythonic/include/numpy/sum.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" #include <algorithm> @@ -22,8 +22,8 @@ namespace numpy template <class E> auto var(E const &expr, types::none_type axis = builtins::None, types::none_type dtype = builtins::None, - types::none_type out = builtins::None, long ddof = 0) - -> decltype(var_type<E>(std::real(mean(expr)))); + types::none_type out = builtins::None, + long ddof = 0) -> decltype(var_type<E>(std::real(mean(expr)))); template <class E> auto var(E const &expr, long axis, types::none_type dtype = builtins::None, @@ -31,7 +31,7 @@ namespace numpy typename assignable<decltype(var_type<E>() * mean(expr, axis))>::type; DEFINE_FUNCTOR(pythonic::numpy, var); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/vdot.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/vdot.hpp index 67f9ffdad9..db4cdcd64d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/vdot.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/vdot.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_VDOT_HPP #define PYTHONIC_INCLUDE_NUMPY_VDOT_HPP -#include "pythonic/include/utils/functor.hpp" -#include "pythonic/include/types/ndarray.hpp" -#include "pythonic/include/numpy/dot.hpp" #include "pythonic/include/numpy/asarray.hpp" +#include "pythonic/include/numpy/dot.hpp" +#include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -16,7 +16,7 @@ namespace numpy functor::asarray{}(v).flat())); DEFINE_FUNCTOR(pythonic::numpy, vdot); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/vstack.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/vstack.hpp index 38afc53698..9742af5e88 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/vstack.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/vstack.hpp @@ -25,13 +25,14 @@ namespace numpy // // the enable if is there to match this behavior template <class ArraySequence> - auto vstack(ArraySequence &&seq) -> typename std::enable_if< - (impl::vstack_helper<ArraySequence>::value == 1), - decltype(std::declval<impl::vstack_helper<ArraySequence>>().reshape( - std::declval<types::array<long, 2>>()))>::type; + auto vstack(ArraySequence &&seq) -> + typename std::enable_if< + (impl::vstack_helper<ArraySequence>::value == 1), + decltype(std::declval<impl::vstack_helper<ArraySequence>>().reshape( + std::declval<types::array_tuple<long, 2>>()))>::type; DEFINE_FUNCTOR(pythonic::numpy, vstack); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/where.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/where.hpp index b75fa19621..559c9aca5b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/where.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/where.hpp @@ -2,8 +2,8 @@ #define PYTHONIC_INCLUDE_NUMPY_WHERE_HPP #include "pythonic/include/numpy/asarray.hpp" -#include "pythonic/include/numpy/nonzero.hpp" #include "pythonic/include/numpy/copy.hpp" +#include "pythonic/include/numpy/nonzero.hpp" PYTHONIC_NS_BEGIN @@ -18,7 +18,7 @@ namespace numpy #define NUMPY_NARY_EXTRA_METHOD \ template <class E> \ - auto operator()(E && expr)->decltype(nonzero{}(std::forward<E>(expr))) \ + auto operator()(E &&expr)->decltype(nonzero{}(std::forward<E>(expr))) \ { \ return nonzero{}(std::forward<E>(expr)); \ } @@ -27,7 +27,7 @@ namespace numpy #define NUMPY_NARY_FUNC_SYM impl::where #define NUMPY_NARY_RESHAPE_MODE reshape_type #include "pythonic/include/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/zeros.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/zeros.hpp index d525edaff6..d716de5d1b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/zeros.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/zeros.hpp @@ -2,16 +2,15 @@ #define PYTHONIC_INCLUDE_NUMPY_ZEROS_HPP #include "pythonic/include/numpy/float64.hpp" -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class dtype = functor::float64> - typename dtype::type - zeros(std::tuple<> const &shape, dtype d = dtype()); + typename dtype::type zeros(std::tuple<> const &shape, dtype d = dtype()); template <class pS, class dtype = functor::float64> types::ndarray<typename dtype::type, sutils::shape_t<pS>> @@ -27,7 +26,7 @@ namespace numpy zeros(std::integral_constant<long, N>, dtype d = dtype()); DEFINE_FUNCTOR(pythonic::numpy, zeros); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/zeros_like.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/zeros_like.hpp index 80e063feef..c593ddbad1 100644 --- a/contrib/python/pythran/pythran/pythonic/include/numpy/zeros_like.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/numpy/zeros_like.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_NUMPY_ZEROSLIKE_HPP #define PYTHONIC_INCLUDE_NUMPY_ZEROSLIKE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/zeros.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -19,7 +19,7 @@ namespace numpy types::dtype_t<typename E::dtype>())); DEFINE_FUNCTOR(pythonic::numpy, zeros_like) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/omp/get_num_threads.hpp b/contrib/python/pythran/pythran/pythonic/include/omp/get_num_threads.hpp index 48262f6629..d537b642eb 100644 --- a/contrib/python/pythran/pythran/pythonic/include/omp/get_num_threads.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/omp/get_num_threads.hpp @@ -13,7 +13,7 @@ namespace omp long get_num_threads(); DEFINE_FUNCTOR(pythonic::omp, get_num_threads); -} +} // namespace omp PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/omp/get_thread_num.hpp b/contrib/python/pythran/pythran/pythonic/include/omp/get_thread_num.hpp index 36829d9b25..3a1eb8c6f4 100644 --- a/contrib/python/pythran/pythran/pythonic/include/omp/get_thread_num.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/omp/get_thread_num.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OMP_GET_THREAD_NUM_HPP #define PYTHONIC_INCLUDE_OMP_GET_THREAD_NUM_HPP -#include <omp.h> #include "pythonic/include/utils/functor.hpp" +#include <omp.h> PYTHONIC_NS_BEGIN @@ -12,7 +12,7 @@ namespace omp long get_thread_num(); DEFINE_FUNCTOR(pythonic::omp, get_thread_num); -} +} // namespace omp PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/omp/get_wtick.hpp b/contrib/python/pythran/pythran/pythonic/include/omp/get_wtick.hpp index 5deab26d53..f237f8ab3e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/omp/get_wtick.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/omp/get_wtick.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OMP_GET_WTICK_HPP #define PYTHONIC_INCLUDE_OMP_GET_WTICK_HPP -#include <omp.h> #include "pythonic/include/utils/functor.hpp" +#include <omp.h> PYTHONIC_NS_BEGIN @@ -11,7 +11,7 @@ namespace omp long get_wtick(); DEFINE_FUNCTOR(pythonic::omp, get_wtick); -} +} // namespace omp PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/omp/get_wtime.hpp b/contrib/python/pythran/pythran/pythonic/include/omp/get_wtime.hpp index 68760a6cb0..5d89da8b89 100644 --- a/contrib/python/pythran/pythran/pythonic/include/omp/get_wtime.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/omp/get_wtime.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OMP_GET_WTIME_HPP #define PYTHONIC_INCLUDE_OMP_GET_WTIME_HPP -#include <omp.h> #include "pythonic/include/utils/functor.hpp" +#include <omp.h> PYTHONIC_NS_BEGIN @@ -12,7 +12,7 @@ namespace omp long get_wtime(); DEFINE_FUNCTOR(pythonic::omp, get_wtime); -} +} // namespace omp PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/omp/in_parallel.hpp b/contrib/python/pythran/pythran/pythonic/include/omp/in_parallel.hpp index 0fc99b376b..d7496c5455 100644 --- a/contrib/python/pythran/pythran/pythonic/include/omp/in_parallel.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/omp/in_parallel.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OMP_IN_PARALLEL_HPP #define PYTHONIC_INCLUDE_OMP_IN_PARALLEL_HPP -#include <omp.h> #include "pythonic/include/utils/functor.hpp" +#include <omp.h> PYTHONIC_NS_BEGIN @@ -11,7 +11,7 @@ namespace omp bool in_parallel(); DEFINE_FUNCTOR(pythonic::omp, in_parallel); -} +} // namespace omp PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/omp/set_nested.hpp b/contrib/python/pythran/pythran/pythonic/include/omp/set_nested.hpp index 2760fe13fc..a5aff3cc53 100644 --- a/contrib/python/pythran/pythran/pythonic/include/omp/set_nested.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/omp/set_nested.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OMP_SET_NESTED_HPP #define PYTHONIC_INCLUDE_OMP_SET_NESTED_HPP -#include <omp.h> #include "pythonic/include/utils/functor.hpp" +#include <omp.h> PYTHONIC_NS_BEGIN @@ -12,7 +12,7 @@ namespace omp void set_nested(long val); DEFINE_FUNCTOR(pythonic::omp, set_nested); -} +} // namespace omp PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/omp/set_num_threads.hpp b/contrib/python/pythran/pythran/pythonic/include/omp/set_num_threads.hpp index e31ac8ae96..619fefee97 100644 --- a/contrib/python/pythran/pythran/pythonic/include/omp/set_num_threads.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/omp/set_num_threads.hpp @@ -13,7 +13,7 @@ namespace omp void set_num_threads(long); DEFINE_FUNCTOR(pythonic::omp, set_num_threads); -} +} // namespace omp PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/__abs__.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/__abs__.hpp index add04278d8..7e9b4652fd 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/__abs__.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/__abs__.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_ABS__HPP #define PYTHONIC_INCLUDE_OPERATOR_ABS__HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/builtins/abs.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/__add__.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/__add__.hpp index 1814c94b2d..11e1f97ca6 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/__add__.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/__add__.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_ADD__HPP #define PYTHONIC_INCLUDE_OPERATOR_ADD__HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/operator_/add.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/__truediv__.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/__truediv__.hpp index fdf8d716bf..5a884adfa0 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/__truediv__.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/__truediv__.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_TRUEDIV__HPP #define PYTHONIC_INCLUDE_OPERATOR_TRUEDIV__HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/operator_/truediv.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/abs.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/abs.hpp index 92eda417cd..e04370d51d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/abs.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/abs.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_ABS_HPP #define PYTHONIC_INCLUDE_OPERATOR_ABS_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/builtins/abs.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/add.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/add.hpp index 4da63a2df9..a3f424457d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/add.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/add.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_ADD_HPP #define PYTHONIC_INCLUDE_OPERATOR_ADD_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/operator_/overloads.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace operator_ DEFINE_ALL_OPERATOR_OVERLOADS_DECL(add, +) DEFINE_FUNCTOR(pythonic::operator_, add); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/and_.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/and_.hpp index 1c90e41208..430dc280f1 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/and_.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/and_.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_AND_HPP #define PYTHONIC_INCLUDE_OPERATOR_AND_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/operator_/overloads.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace operator_ DEFINE_ALL_OPERATOR_OVERLOADS_DECL(and_, &) DEFINE_FUNCTOR(pythonic::operator_, and_); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/concat.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/concat.hpp index b4e5979e69..beba5e98f7 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/concat.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/concat.hpp @@ -9,11 +9,11 @@ namespace operator_ { template <class A, class B> - auto concat(A &&a, B &&b) - -> decltype(std::forward<A>(a) + std::forward<B>(b)); + auto concat(A &&a, + B &&b) -> decltype(std::forward<A>(a) + std::forward<B>(b)); DEFINE_FUNCTOR(pythonic::operator_, concat); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/contains.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/contains.hpp index cb2b7307d7..ce741d860e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/contains.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/contains.hpp @@ -1,19 +1,19 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_CONTAINS_HPP #define PYTHONIC_INCLUDE_OPERATOR_CONTAINS_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/builtins/in.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace operator_ { template <class A, class B> - auto contains(A &&a, B &&b) - -> decltype(in(std::forward<A>(a), std::forward<B>(b))); + auto contains(A &&a, + B &&b) -> decltype(in(std::forward<A>(a), std::forward<B>(b))); DEFINE_FUNCTOR(pythonic::operator_, contains); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/countOf.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/countOf.hpp index bb941666fe..6e463a5668 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/countOf.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/countOf.hpp @@ -12,7 +12,7 @@ namespace operator_ long countOf(A &&a, B &&b); DEFINE_FUNCTOR(pythonic::operator_, countOf); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/delitem.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/delitem.hpp index 56ff597978..9371fae95e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/delitem.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/delitem.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_DELITEM_HPP #define PYTHONIC_INCLUDE_OPERATOR_DELITEM_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/builtins/None.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -12,7 +12,7 @@ namespace operator_ types::none_type delitem(A &&a, B &&b); DEFINE_FUNCTOR(pythonic::operator_, delitem); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/div.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/div.hpp index 3ac0faccb5..3d8d44f6a4 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/div.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/div.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_DIV_HPP #define PYTHONIC_INCLUDE_OPERATOR_DIV_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/operator_/overloads.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -18,7 +18,7 @@ namespace operator_ double div(double a, double b); DEFINE_FUNCTOR(pythonic::operator_, div); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/eq.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/eq.hpp index eb9db18ed4..15ecae9c50 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/eq.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/eq.hpp @@ -13,7 +13,7 @@ namespace operator_ bool eq(char const *a, char const *b); DEFINE_FUNCTOR(pythonic::operator_, eq); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/floordiv.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/floordiv.hpp index 4f53b9fc26..6da873f404 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/floordiv.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/floordiv.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_FLOORDIV_HPP #define PYTHONIC_INCLUDE_OPERATOR_FLOORDIV_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/floor_divide.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/ge.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/ge.hpp index 7b4e07ee64..eb68863292 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/ge.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/ge.hpp @@ -13,7 +13,7 @@ namespace operator_ bool ge(char const *, char const *); DEFINE_FUNCTOR(pythonic::operator_, ge); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/getitem.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/getitem.hpp index 380007aa3a..78697dec48 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/getitem.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/getitem.hpp @@ -8,11 +8,11 @@ PYTHONIC_NS_BEGIN namespace operator_ { template <class A, class B> - auto getitem(A &&a, B &&b) - -> decltype(std::forward<A>(a)[std::forward<B>(b)]); + auto getitem(A &&a, + B &&b) -> decltype(std::forward<A>(a)[std::forward<B>(b)]); DEFINE_FUNCTOR(pythonic::operator_, getitem); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/gt.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/gt.hpp index 805cd62134..371d247e16 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/gt.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/gt.hpp @@ -13,7 +13,7 @@ namespace operator_ bool gt(char const *, char const *); DEFINE_FUNCTOR(pythonic::operator_, gt); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/iadd.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/iadd.hpp index 83eaaf3371..e8844df8f3 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/iadd.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/iadd.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_IADD_HPP #define PYTHONIC_INCLUDE_OPERATOR_IADD_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/types/dict.hpp" #include "pythonic/include/types/list.hpp" #include "pythonic/include/types/set.hpp" -#include "pythonic/include/types/dict.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -19,7 +19,7 @@ namespace operator_ template <class A> auto iadd(types::empty_set, types::set<A> const &b) -> decltype(b); -} +} // namespace operator_ PYTHONIC_NS_END #define OPERATOR_NAME iadd #define OPERATOR_SYMBOL + diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/icommon.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/icommon.hpp index 23814a8c10..2d5c6a1745 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/icommon.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/icommon.hpp @@ -22,23 +22,25 @@ namespace operator_ { template <class A, class B> - auto OPERATOR_NAME(bool, A &&a, B &&b, ...) - -> decltype(std::forward<A>(a) OPERATOR_SYMBOL std::forward<B>(b)); + auto OPERATOR_NAME(bool, A &&a, B &&b, + ...) -> decltype(std::forward<A>(a) + OPERATOR_SYMBOL std::forward<B>(b)); template <class A, class B> auto OPERATOR_NAME(bool, A &&a, B &&b, std::nullptr_t) -> decltype(std::forward<A>(a) OPERATOR_ISYMBOL std::forward<B>(b)); template <class A, class B> - auto OPERATOR_NAME(A &&a, B &&b) - -> decltype(OPERATOR_NAME(true, std::forward<A>(a), std::forward<B>(b), - nullptr)) + auto OPERATOR_NAME(A &&a, + B &&b) -> decltype(OPERATOR_NAME(true, std::forward<A>(a), + std::forward<B>(b), + nullptr)) { return OPERATOR_NAME(true, std::forward<A>(a), std::forward<B>(b), nullptr); } DEFINE_FUNCTOR(pythonic::operator_, OPERATOR_NAME); -} +} // namespace operator_ PYTHONIC_NS_END #undef OPERATOR_NAME diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/iconcat.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/iconcat.hpp index 96266ca263..3513f6c277 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/iconcat.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/iconcat.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_ICONCAT_HPP #define PYTHONIC_INCLUDE_OPERATOR_ICONCAT_HPP -#include "pythonic/include/utils/functor.hpp" +#include "pythonic/include/types/dict.hpp" #include "pythonic/include/types/list.hpp" #include "pythonic/include/types/set.hpp" -#include "pythonic/include/types/dict.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -23,7 +23,7 @@ namespace operator_ auto iconcat(types::empty_set a, types::set<A> b) -> decltype(b); DEFINE_FUNCTOR(pythonic::operator_, iconcat); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/ifloordiv.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/ifloordiv.hpp index 721565a647..fc18841ef1 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/ifloordiv.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/ifloordiv.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_IFLOORDIV_HPP #define PYTHONIC_INCLUDE_OPERATOR_IFLOORDIV_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/operator_/mod.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace operator_ auto ifloordiv(A const &a, B &&b) -> decltype((a - mod(a, b)) / b); DEFINE_FUNCTOR(pythonic::operator_, ifloordiv); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/imax.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/imax.hpp index a22a04954b..c57935e245 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/imax.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/imax.hpp @@ -1,27 +1,29 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_IMAX_HPP #define PYTHONIC_INCLUDE_OPERATOR_IMAX_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/maximum.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace operator_ { template <class A, class B> - auto imax(A &&a, B &&b) -> typename std::enable_if< - std::is_const<A>::value || !std::is_assignable<A, B>::value, - decltype(numpy::functor::maximum{}(std::forward<A>(a), - std::forward<B>(b)))>::type; + auto imax(A &&a, B &&b) -> + typename std::enable_if< + std::is_const<A>::value || !std::is_assignable<A, B>::value, + decltype(numpy::functor::maximum{}(std::forward<A>(a), + std::forward<B>(b)))>::type; template <class A, class B> - auto imax(A &&a, B &&b) -> typename std::enable_if< - !std::is_const<A>::value && std::is_assignable<A, B>::value, - decltype(a = numpy::functor::maximum{}(std::forward<A>(a), - std::forward<B>(b)))>::type; + auto imax(A &&a, B &&b) -> + typename std::enable_if< + !std::is_const<A>::value && std::is_assignable<A, B>::value, + decltype(a = numpy::functor::maximum{}(std::forward<A>(a), + std::forward<B>(b)))>::type; DEFINE_FUNCTOR(pythonic::operator_, imax); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/imin.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/imin.hpp index 0fea5836f6..6036ff10db 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/imin.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/imin.hpp @@ -1,27 +1,29 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_IMIN_HPP #define PYTHONIC_INCLUDE_OPERATOR_IMIN_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/minimum.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace operator_ { template <class A, class B> - auto imin(A &&a, B &&b) -> typename std::enable_if< - std::is_const<A>::value || !std::is_assignable<A, B>::value, - decltype(numpy::functor::minimum{}(std::forward<A>(a), - std::forward<B>(b)))>::type; + auto imin(A &&a, B &&b) -> + typename std::enable_if< + std::is_const<A>::value || !std::is_assignable<A, B>::value, + decltype(numpy::functor::minimum{}(std::forward<A>(a), + std::forward<B>(b)))>::type; template <class A, class B> - auto imin(A &&a, B &&b) -> typename std::enable_if< - !std::is_const<A>::value && std::is_assignable<A, B>::value, - decltype(a = numpy::functor::minimum{}(std::forward<A>(a), - std::forward<B>(b)))>::type; + auto imin(A &&a, B &&b) -> + typename std::enable_if< + !std::is_const<A>::value && std::is_assignable<A, B>::value, + decltype(a = numpy::functor::minimum{}(std::forward<A>(a), + std::forward<B>(b)))>::type; DEFINE_FUNCTOR(pythonic::operator_, imin); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/imod.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/imod.hpp index 477d80afbb..e7a828a8b3 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/imod.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/imod.hpp @@ -14,7 +14,7 @@ namespace operator_ A imod(A const &a, B &&b); DEFINE_FUNCTOR(pythonic::operator_, imod); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/indexOf.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/indexOf.hpp index b66ff2b5bd..8a2d306e66 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/indexOf.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/indexOf.hpp @@ -12,7 +12,7 @@ namespace operator_ long indexOf(A &&a, B &&b); DEFINE_FUNCTOR(pythonic::operator_, indexOf); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/inv.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/inv.hpp index 1f96938880..03c033d002 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/inv.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/inv.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_INV_HPP #define PYTHONIC_INCLUDE_OPERATOR_INV_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/operator_/invert.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/invert.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/invert.hpp index e647e6f549..cdb0c2cb69 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/invert.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/invert.hpp @@ -12,7 +12,7 @@ namespace operator_ auto invert(A &&a) -> decltype(~std::forward<A>(a)); DEFINE_FUNCTOR(pythonic::operator_, invert); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/ipow.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/ipow.hpp index e6ab178fb3..baa721745a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/ipow.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/ipow.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_IPOW_HPP #define PYTHONIC_INCLUDE_OPERATOR_IPOW_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/builtins/pow.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace operator_ A &ipow(A &a, B &&b); DEFINE_FUNCTOR(pythonic::operator_, ipow); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/is_.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/is_.hpp index 455ad489e1..2426ff1db0 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/is_.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/is_.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_IS_HPP #define PYTHONIC_INCLUDE_OPERATOR_IS_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/builtins/id.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace operator_ builtins::id(std::forward<B>(b))); DEFINE_FUNCTOR(pythonic::operator_, is_); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/is_not.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/is_not.hpp index f1fe2132ac..46b51a1d83 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/is_not.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/is_not.hpp @@ -13,7 +13,7 @@ namespace operator_ builtins::id(std::forward<B>(b))); DEFINE_FUNCTOR(pythonic::operator_, is_not); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/itemgetter.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/itemgetter.hpp index 4ae3b91fa2..7fd8943fcf 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/itemgetter.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/itemgetter.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_ITEMGETTER_HPP #define PYTHONIC_INCLUDE_OPERATOR_ITEMGETTER_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/int_.hpp" PYTHONIC_NS_BEGIN @@ -44,7 +44,7 @@ namespace operator_ itemgetter(long const &item1, long const &item2, L... items); DEFINE_FUNCTOR(pythonic::operator_, itemgetter); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/itruediv.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/itruediv.hpp index c903aca21d..75b058e449 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/itruediv.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/itruediv.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_ITRUEDIV_HPP #define PYTHONIC_INCLUDE_OPERATOR_ITRUEDIV_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/operator_/truediv.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -12,17 +12,19 @@ namespace operator_ auto itruediv(A const &a, B &&b) -> decltype(truediv(a, std::forward<B>(b))); template <class A, class B> - auto itruediv(A &a, B &&b) -> typename std::enable_if< - std::is_same<A, decltype(truediv(a, std::forward<B>(b)))>::value, - A &>::type; + auto itruediv(A &a, B &&b) -> + typename std::enable_if< + std::is_same<A, decltype(truediv(a, std::forward<B>(b)))>::value, + A &>::type; template <class A, class B> - auto itruediv(A &a, B &&b) -> typename std::enable_if< - !std::is_same<A, decltype(truediv(a, std::forward<B>(b)))>::value, - decltype(truediv(a, std::forward<B>(b)))>::type; + auto itruediv(A &a, B &&b) -> + typename std::enable_if< + !std::is_same<A, decltype(truediv(a, std::forward<B>(b)))>::value, + decltype(truediv(a, std::forward<B>(b)))>::type; DEFINE_FUNCTOR(pythonic::operator_, itruediv); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/le.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/le.hpp index 3ea728cb92..f8456b3268 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/le.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/le.hpp @@ -12,7 +12,7 @@ namespace operator_ bool le(char const *self, char const *other); DEFINE_FUNCTOR(pythonic::operator_, le); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/lshift.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/lshift.hpp index 33b8936ad6..0de91c7292 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/lshift.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/lshift.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_LSHIFT_HPP #define PYTHONIC_INCLUDE_OPERATOR_LSHIFT_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/operator_/overloads.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -10,13 +10,13 @@ namespace operator_ { template <class A, class B> - auto lshift(A &&a, B &&b) - -> decltype(std::forward<A>(a) << std::forward<B>(b)); + auto lshift(A &&a, B &&b) -> decltype(std::forward<A>(a) + << std::forward<B>(b)); - DEFINE_ALL_OPERATOR_OVERLOADS_DECL(lshift, << ) + DEFINE_ALL_OPERATOR_OVERLOADS_DECL(lshift, <<) DEFINE_FUNCTOR(pythonic::operator_, lshift); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/lt.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/lt.hpp index 791301650f..b670073c9d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/lt.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/lt.hpp @@ -13,7 +13,7 @@ namespace operator_ bool lt(char const *self, char const *other); DEFINE_FUNCTOR(pythonic::operator_, lt); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/matmul.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/matmul.hpp index 6800c34192..e0733b7d2b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/matmul.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/matmul.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_MATMUL_HPP #define PYTHONIC_INCLUDE_OPERATOR_MATMUL_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/numpy/dot.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -10,12 +10,12 @@ namespace operator_ { template <class A, class B> - auto matmul(A &&a, B &&b) - -> decltype(numpy::functor::dot{}(std::forward<A>(a), - std::forward<B>(b))); + auto matmul(A &&a, + B &&b) -> decltype(numpy::functor::dot{}(std::forward<A>(a), + std::forward<B>(b))); DEFINE_FUNCTOR(pythonic::operator_, matmul); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/mod.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/mod.hpp index 3b18e51fe7..3fecdec3d1 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/mod.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/mod.hpp @@ -9,10 +9,11 @@ namespace operator_ { template <class A, class B> - auto mod(A &&a, B &&b) -> typename std::enable_if< - std::is_fundamental<typename std::decay<A>::type>::value && - std::is_fundamental<typename std::decay<B>::type>::value, - decltype(std::forward<A>(a) % std::forward<B>(b))>::type; + auto mod(A &&a, B &&b) -> + typename std::enable_if< + std::is_fundamental<typename std::decay<A>::type>::value && + std::is_fundamental<typename std::decay<B>::type>::value, + decltype(std::forward<A>(a) % std::forward<B>(b))>::type; inline double mod(double a, long b); @@ -26,7 +27,7 @@ namespace operator_ decltype(std::forward<A>(a) % std::forward<B>(b))>::type; DEFINE_FUNCTOR(pythonic::operator_, mod); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/mul.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/mul.hpp index 2fbcfeed1c..e5f30d1e66 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/mul.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/mul.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_MUL_HPP #define PYTHONIC_INCLUDE_OPERATOR_MUL_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/operator_/overloads.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace operator_ DEFINE_ALL_OPERATOR_OVERLOADS_DECL(mul, *) DEFINE_FUNCTOR(pythonic::operator_, mul); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/ne.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/ne.hpp index 650db40338..97b9172232 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/ne.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/ne.hpp @@ -14,7 +14,7 @@ namespace operator_ bool ne(char const *a, char const *b); DEFINE_FUNCTOR(pythonic::operator_, ne); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/neg.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/neg.hpp index 584e77d8d8..0b30fbfef1 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/neg.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/neg.hpp @@ -12,7 +12,7 @@ namespace operator_ auto neg(A &&a) -> decltype(-std::forward<A>(a)); DEFINE_FUNCTOR(pythonic::operator_, neg); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/not_.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/not_.hpp index b756eba2e7..0c105ca2ed 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/not_.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/not_.hpp @@ -14,7 +14,7 @@ namespace operator_ bool not_(std::complex<T> const &a); DEFINE_FUNCTOR(pythonic::operator_, not_); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/or_.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/or_.hpp index 20aaddf55c..7504264275 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/or_.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/or_.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_OR_HPP #define PYTHONIC_INCLUDE_OPERATOR_OR_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/operator_/overloads.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -12,10 +12,10 @@ namespace operator_ template <class A, class B> auto or_(A &&a, B &&b) -> decltype(std::forward<A>(a) | std::forward<B>(b)); - DEFINE_ALL_OPERATOR_OVERLOADS_DECL(or_, | ) + DEFINE_ALL_OPERATOR_OVERLOADS_DECL(or_, |) DEFINE_FUNCTOR(pythonic::operator_, or_); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/pos.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/pos.hpp index e3df7fb72b..744b67fd37 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/pos.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/pos.hpp @@ -12,7 +12,7 @@ namespace operator_ A pos(A const &a); DEFINE_FUNCTOR(pythonic::operator_, pos); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/rshift.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/rshift.hpp index 0d662582b1..cc64a33a52 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/rshift.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/rshift.hpp @@ -1,21 +1,21 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_RSHIFT_HPP #define PYTHONIC_INCLUDE_OPERATOR_RSHIFT_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/operator_/overloads.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace operator_ { template <class A, class B> - auto rshift(A &&a, B &&b) - -> decltype(std::forward<A>(a) >> std::forward<B>(b)); + auto rshift(A &&a, + B &&b) -> decltype(std::forward<A>(a) >> std::forward<B>(b)); - DEFINE_ALL_OPERATOR_OVERLOADS_DECL(rshift, >> ) + DEFINE_ALL_OPERATOR_OVERLOADS_DECL(rshift, >>) DEFINE_FUNCTOR(pythonic::operator_, rshift); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/sub.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/sub.hpp index a5c9e62767..f0c8ac96f5 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/sub.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/sub.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_SUB_HPP #define PYTHONIC_INCLUDE_OPERATOR_SUB_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/operator_/overloads.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace operator_ DEFINE_ALL_OPERATOR_OVERLOADS_DECL(sub, -) DEFINE_FUNCTOR(pythonic::operator_, sub); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/truediv.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/truediv.hpp index b48350018e..b6df765b47 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/truediv.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/truediv.hpp @@ -8,11 +8,11 @@ PYTHONIC_NS_BEGIN namespace operator_ { template <class A, class B> - auto truediv(A &&a, B &&b) - -> decltype(std::forward<A>(a) / (double)std::forward<B>(b)); + auto truediv(A &&a, B &&b) -> decltype(std::forward<A>(a) / + (double)std::forward<B>(b)); DEFINE_FUNCTOR(pythonic::operator_, truediv); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/truth.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/truth.hpp index dd7dd80fff..73a8473cd3 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/truth.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/truth.hpp @@ -10,7 +10,7 @@ namespace operator_ bool truth(bool const &a); DEFINE_FUNCTOR(pythonic::operator_, truth); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/xor_.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/xor_.hpp index aad75e9821..8ff75bacde 100644 --- a/contrib/python/pythran/pythran/pythonic/include/operator_/xor_.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/operator_/xor_.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_OPERATOR_XOR_HPP #define PYTHONIC_INCLUDE_OPERATOR_XOR_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/operator_/overloads.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace operator_ DEFINE_ALL_OPERATOR_OVERLOADS_DECL(xor_, ^) DEFINE_FUNCTOR(pythonic::operator_, xor_); -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/os/path/join.hpp b/contrib/python/pythran/pythran/pythonic/include/os/path/join.hpp index 74c68b5844..5c2300118f 100644 --- a/contrib/python/pythran/pythran/pythonic/include/os/path/join.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/os/path/join.hpp @@ -13,11 +13,11 @@ namespace os T join(T &&head); template <class T, class... Types> - types::str join(T &&head, Types &&... tail); + types::str join(T &&head, Types &&...tail); DEFINE_FUNCTOR(pythonic::os::path, join); - } -} + } // namespace path +} // namespace os PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/random/choice.hpp b/contrib/python/pythran/pythran/pythonic/include/random/choice.hpp index 10c93749a5..a69fba9096 100644 --- a/contrib/python/pythran/pythran/pythonic/include/random/choice.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/random/choice.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_RANDOM_CHOICE_HPP #define PYTHONIC_INCLUDE_RANDOM_CHOICE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/random/random.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -13,7 +13,7 @@ namespace random typename Seq::value_type choice(Seq const &seq); DEFINE_FUNCTOR(pythonic::random, choice); -} +} // namespace random PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/random/expovariate.hpp b/contrib/python/pythran/pythran/pythonic/include/random/expovariate.hpp index 28dbb3d499..1d7e1a66d5 100644 --- a/contrib/python/pythran/pythran/pythonic/include/random/expovariate.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/random/expovariate.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_RANDOM_EXPOVARIATE_HPP #define PYTHONIC_INCLUDE_RANDOM_EXPOVARIATE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/random/random.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -11,7 +11,7 @@ namespace random double expovariate(double l); DEFINE_FUNCTOR(pythonic::random, expovariate); -} +} // namespace random PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/random/gauss.hpp b/contrib/python/pythran/pythran/pythonic/include/random/gauss.hpp index 440a55fdb1..d06ebd9eaf 100644 --- a/contrib/python/pythran/pythran/pythonic/include/random/gauss.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/random/gauss.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_RANDOM_GAUSS_HPP #define PYTHONIC_INCLUDE_RANDOM_GAUSS_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/random/random.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -12,7 +12,7 @@ namespace random double gauss(double mu, double sigma); DEFINE_FUNCTOR(pythonic::random, gauss); -} +} // namespace random PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/random/randint.hpp b/contrib/python/pythran/pythran/pythonic/include/random/randint.hpp index a4dcfbbd2d..0c74182242 100644 --- a/contrib/python/pythran/pythran/pythonic/include/random/randint.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/random/randint.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_RANDOM_RANDINT_HPP #define PYTHONIC_INCLUDE_RANDOM_RANDINT_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/random/randrange.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -12,7 +12,7 @@ namespace random long randint(long a, long b); DEFINE_FUNCTOR(pythonic::random, randint); -} +} // namespace random PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/random/random.hpp b/contrib/python/pythran/pythran/pythonic/include/random/random.hpp index 84ed72880a..d2dec8be45 100644 --- a/contrib/python/pythran/pythran/pythonic/include/random/random.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/random/random.hpp @@ -14,7 +14,7 @@ namespace random double random(); DEFINE_FUNCTOR(pythonic::random, random); -} +} // namespace random PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/random/randrange.hpp b/contrib/python/pythran/pythran/pythonic/include/random/randrange.hpp index 08b5899189..84925cee4a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/random/randrange.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/random/randrange.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_RANDOM_RANDRANGE_HPP #define PYTHONIC_INCLUDE_RANDOM_RANDRANGE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/random/random.hpp" +#include "pythonic/include/utils/functor.hpp" #include <cmath> @@ -15,7 +15,7 @@ namespace random long randrange(long start, long stop, long step); DEFINE_FUNCTOR(pythonic::random, randrange) -} +} // namespace random PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/random/sample.hpp b/contrib/python/pythran/pythran/pythonic/include/random/sample.hpp index 230e57b7d7..df2cfc2382 100644 --- a/contrib/python/pythran/pythran/pythonic/include/random/sample.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/random/sample.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_RANDOM_SAMPLE_HPP #define PYTHONIC_INCLUDE_RANDOM_SAMPLE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/random/random.hpp" +#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/list.hpp" @@ -17,7 +17,7 @@ namespace random sample(Iterable &&s, size_t k); DEFINE_FUNCTOR(pythonic::random, sample); -} +} // namespace random PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/random/seed.hpp b/contrib/python/pythran/pythran/pythonic/include/random/seed.hpp index cc41715f7a..455eb49d5a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/random/seed.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/random/seed.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_RANDOM_SEED_HPP #define PYTHONIC_INCLUDE_RANDOM_SEED_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/builtins/None.hpp" #include "pythonic/include/random/random.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -13,7 +13,7 @@ namespace random types::none_type seed(); DEFINE_FUNCTOR(pythonic::random, seed); -} +} // namespace random PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/include/random/shuffle.hpp b/contrib/python/pythran/pythran/pythonic/include/random/shuffle.hpp index 797256d4bb..d5db47aa42 100644 --- a/contrib/python/pythran/pythran/pythonic/include/random/shuffle.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/random/shuffle.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_RANDOM_SHUFFLE_HPP #define PYTHONIC_INCLUDE_RANDOM_SHUFFLE_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/random/random.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace random types::none_type shuffle(T &seq, function &&randf); DEFINE_FUNCTOR(pythonic::random, shuffle) -} +} // namespace random PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/random/uniform.hpp b/contrib/python/pythran/pythran/pythonic/include/random/uniform.hpp index 2559716bc7..f2bada0491 100644 --- a/contrib/python/pythran/pythran/pythonic/include/random/uniform.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/random/uniform.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_RANDOM_UNIFORM_HPP #define PYTHONIC_INCLUDE_RANDOM_UNIFORM_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/random/random.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -11,7 +11,7 @@ namespace random double uniform(double a, double b); DEFINE_FUNCTOR(pythonic::random, uniform); -} +} // namespace random PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/scipy/special/binom.hpp b/contrib/python/pythran/pythran/pythonic/include/scipy/special/binom.hpp index df2982d605..8cf1773d40 100644 --- a/contrib/python/pythran/pythran/pythonic/include/scipy/special/binom.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/scipy/special/binom.hpp @@ -21,8 +21,8 @@ namespace scipy #define NUMPY_NARY_FUNC_NAME binom #define NUMPY_NARY_FUNC_SYM details::binom #include "pythonic/include/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/scipy/special/gamma.hpp b/contrib/python/pythran/pythran/pythonic/include/scipy/special/gamma.hpp index 1cf8ae271e..6567924195 100644 --- a/contrib/python/pythran/pythran/pythonic/include/scipy/special/gamma.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/scipy/special/gamma.hpp @@ -17,8 +17,8 @@ namespace scipy #define NUMPY_NARY_FUNC_NAME gamma #define NUMPY_NARY_FUNC_SYM xsimd::tgamma #include "pythonic/include/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/scipy/special/gammaincinv.hpp b/contrib/python/pythran/pythran/pythonic/include/scipy/special/gammaincinv.hpp index 8982931245..666ba823ba 100644 --- a/contrib/python/pythran/pythran/pythonic/include/scipy/special/gammaincinv.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/scipy/special/gammaincinv.hpp @@ -22,8 +22,8 @@ namespace scipy #define NUMPY_NARY_FUNC_NAME gammaincinv #define NUMPY_NARY_FUNC_SYM details::gammaincinv #include "pythonic/include/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/scipy/special/gammaln.hpp b/contrib/python/pythran/pythran/pythonic/include/scipy/special/gammaln.hpp index 7d96d3f9e9..c1048dfbb1 100644 --- a/contrib/python/pythran/pythran/pythonic/include/scipy/special/gammaln.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/scipy/special/gammaln.hpp @@ -17,8 +17,8 @@ namespace scipy #define NUMPY_NARY_FUNC_SYM xsimd::lgamma #include "pythonic/include/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/scipy/special/hankel1.hpp b/contrib/python/pythran/pythran/pythonic/include/scipy/special/hankel1.hpp index 70382e8344..e204d98563 100644 --- a/contrib/python/pythran/pythran/pythonic/include/scipy/special/hankel1.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/scipy/special/hankel1.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_SCIPY_SPECIAL_HANKEL1_HPP #define PYTHONIC_INCLUDE_SCIPY_SPECIAL_HANKEL1_HPP -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" @@ -22,8 +22,8 @@ namespace scipy #define NUMPY_NARY_FUNC_NAME hankel1 #define NUMPY_NARY_FUNC_SYM details::hankel1 #include "pythonic/include/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/scipy/special/hankel2.hpp b/contrib/python/pythran/pythran/pythonic/include/scipy/special/hankel2.hpp index b3b6f26cf9..d6c126abd2 100644 --- a/contrib/python/pythran/pythran/pythonic/include/scipy/special/hankel2.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/scipy/special/hankel2.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_SCIPY_SPECIAL_HANKEL2_HPP #define PYTHONIC_INCLUDE_SCIPY_SPECIAL_HANKEL2_HPP -#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/types/complex.hpp" +#include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/utils/numpy_traits.hpp" @@ -22,8 +22,8 @@ namespace scipy #define NUMPY_NARY_FUNC_NAME hankel2 #define NUMPY_NARY_FUNC_SYM details::hankel2 #include "pythonic/include/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/scipy/special/i0.hpp b/contrib/python/pythran/pythran/pythonic/include/scipy/special/i0.hpp index a42dee0928..fd7d18d33a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/scipy/special/i0.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/scipy/special/i0.hpp @@ -61,13 +61,13 @@ namespace scipy template <class T> double i0(T x); - } + } // namespace details #define NUMPY_NARY_FUNC_NAME i0 #define NUMPY_NARY_FUNC_SYM details::i0 #include "pythonic/include/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/scipy/special/i0e.hpp b/contrib/python/pythran/pythran/pythonic/include/scipy/special/i0e.hpp index dbb47435ef..1ec5260c12 100644 --- a/contrib/python/pythran/pythran/pythonic/include/scipy/special/i0e.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/scipy/special/i0e.hpp @@ -23,8 +23,8 @@ namespace scipy #define NUMPY_NARY_FUNC_NAME i0e #define NUMPY_NARY_FUNC_SYM details::i0e #include "pythonic/include/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/scipy/special/iv.hpp b/contrib/python/pythran/pythran/pythonic/include/scipy/special/iv.hpp index 0c4b0f846c..1ef41ad3e4 100644 --- a/contrib/python/pythran/pythran/pythonic/include/scipy/special/iv.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/scipy/special/iv.hpp @@ -21,8 +21,8 @@ namespace scipy #define NUMPY_NARY_FUNC_NAME iv #define NUMPY_NARY_FUNC_SYM details::iv #include "pythonic/include/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/scipy/special/ivp.hpp b/contrib/python/pythran/pythran/pythonic/include/scipy/special/ivp.hpp index f9f03e6de5..53e96c2d84 100644 --- a/contrib/python/pythran/pythran/pythonic/include/scipy/special/ivp.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/scipy/special/ivp.hpp @@ -21,8 +21,8 @@ namespace scipy #define NUMPY_NARY_FUNC_NAME ivp #define NUMPY_NARY_FUNC_SYM details::ivp #include "pythonic/include/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/scipy/special/jv.hpp b/contrib/python/pythran/pythran/pythonic/include/scipy/special/jv.hpp index 97440d85eb..d72502feec 100644 --- a/contrib/python/pythran/pythran/pythonic/include/scipy/special/jv.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/scipy/special/jv.hpp @@ -21,8 +21,8 @@ namespace scipy #define NUMPY_NARY_FUNC_NAME jv #define NUMPY_NARY_FUNC_SYM details::jv #include "pythonic/include/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/scipy/special/jvp.hpp b/contrib/python/pythran/pythran/pythonic/include/scipy/special/jvp.hpp index 2eea0b4ebf..aacbb96842 100644 --- a/contrib/python/pythran/pythran/pythonic/include/scipy/special/jvp.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/scipy/special/jvp.hpp @@ -21,8 +21,8 @@ namespace scipy #define NUMPY_NARY_FUNC_NAME jvp #define NUMPY_NARY_FUNC_SYM details::jvp #include "pythonic/include/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/scipy/special/kv.hpp b/contrib/python/pythran/pythran/pythonic/include/scipy/special/kv.hpp index b8b2bff86c..7a4f0b3283 100644 --- a/contrib/python/pythran/pythran/pythonic/include/scipy/special/kv.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/scipy/special/kv.hpp @@ -21,8 +21,8 @@ namespace scipy #define NUMPY_NARY_FUNC_NAME kv #define NUMPY_NARY_FUNC_SYM details::kv #include "pythonic/include/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/scipy/special/kvp.hpp b/contrib/python/pythran/pythran/pythonic/include/scipy/special/kvp.hpp index 3727176292..a5bc58c9fa 100644 --- a/contrib/python/pythran/pythran/pythonic/include/scipy/special/kvp.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/scipy/special/kvp.hpp @@ -21,8 +21,8 @@ namespace scipy #define NUMPY_NARY_FUNC_NAME kvp #define NUMPY_NARY_FUNC_SYM details::kvp #include "pythonic/include/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/scipy/special/ndtr.hpp b/contrib/python/pythran/pythran/pythonic/include/scipy/special/ndtr.hpp index e0c3d4ca41..1f8a0b7e4c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/scipy/special/ndtr.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/scipy/special/ndtr.hpp @@ -22,8 +22,8 @@ namespace scipy #define NUMPY_NARY_FUNC_NAME ndtr #define NUMPY_NARY_FUNC_SYM details::ndtr #include "pythonic/include/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/scipy/special/ndtri.hpp b/contrib/python/pythran/pythran/pythonic/include/scipy/special/ndtri.hpp index 17e70609ec..44915c7400 100644 --- a/contrib/python/pythran/pythran/pythonic/include/scipy/special/ndtri.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/scipy/special/ndtri.hpp @@ -22,8 +22,8 @@ namespace scipy #define NUMPY_NARY_FUNC_NAME ndtri #define NUMPY_NARY_FUNC_SYM details::ndtri #include "pythonic/include/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/scipy/special/spherical_jn.hpp b/contrib/python/pythran/pythran/pythonic/include/scipy/special/spherical_jn.hpp index eba7a55b08..8e2e8a14c7 100644 --- a/contrib/python/pythran/pythran/pythonic/include/scipy/special/spherical_jn.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/scipy/special/spherical_jn.hpp @@ -21,8 +21,8 @@ namespace scipy #define NUMPY_NARY_FUNC_NAME spherical_jn #define NUMPY_NARY_FUNC_SYM details::spherical_jn #include "pythonic/include/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/scipy/special/spherical_yn.hpp b/contrib/python/pythran/pythran/pythonic/include/scipy/special/spherical_yn.hpp index 211a8e1d2c..6cb9d0fe28 100644 --- a/contrib/python/pythran/pythran/pythonic/include/scipy/special/spherical_yn.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/scipy/special/spherical_yn.hpp @@ -21,8 +21,8 @@ namespace scipy #define NUMPY_NARY_FUNC_NAME spherical_yn #define NUMPY_NARY_FUNC_SYM details::spherical_yn #include "pythonic/include/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/scipy/special/yv.hpp b/contrib/python/pythran/pythran/pythonic/include/scipy/special/yv.hpp index c8936a8e1e..a4f40ebb6c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/scipy/special/yv.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/scipy/special/yv.hpp @@ -21,8 +21,8 @@ namespace scipy #define NUMPY_NARY_FUNC_NAME yv #define NUMPY_NARY_FUNC_SYM details::yv #include "pythonic/include/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/scipy/special/yvp.hpp b/contrib/python/pythran/pythran/pythonic/include/scipy/special/yvp.hpp index 53aba998de..b39ff9086e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/scipy/special/yvp.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/scipy/special/yvp.hpp @@ -21,8 +21,8 @@ namespace scipy #define NUMPY_NARY_FUNC_NAME yvp #define NUMPY_NARY_FUNC_SYM details::yvp #include "pythonic/include/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/string/find.hpp b/contrib/python/pythran/pythran/pythonic/include/string/find.hpp index 9e26442ff5..3486e832cf 100644 --- a/contrib/python/pythran/pythran/pythonic/include/string/find.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/string/find.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_STRING_FIND_HPP #define PYTHONIC_INCLUDE_STRING_FIND_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/str.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -13,7 +13,7 @@ namespace string long find(types::str const &s, T &&val); DEFINE_FUNCTOR(pythonic::string, find); -} +} // namespace string PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/time/sleep.hpp b/contrib/python/pythran/pythran/pythonic/include/time/sleep.hpp index 9634aa2979..12056ff8d3 100644 --- a/contrib/python/pythran/pythran/pythonic/include/time/sleep.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/time/sleep.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_TIME_SLEEP_HPP #define PYTHONIC_INCLUDE_TIME_SLEEP_HPP -#include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -11,7 +11,7 @@ namespace time types::none_type sleep(double const value); DEFINE_FUNCTOR(pythonic::time, sleep) -} +} // namespace time PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/time/time.hpp b/contrib/python/pythran/pythran/pythonic/include/time/time.hpp index 6ee19ae75a..d8481c09c1 100644 --- a/contrib/python/pythran/pythran/pythonic/include/time/time.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/time/time.hpp @@ -11,7 +11,7 @@ namespace time double time(); DEFINE_FUNCTOR(pythonic::time, time) -} +} // namespace time PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/types/array.hpp b/contrib/python/pythran/pythran/pythonic/include/types/array.hpp new file mode 100644 index 0000000000..d4e6c1e06e --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/include/types/array.hpp @@ -0,0 +1,660 @@ +#ifndef PYTHONIC_INCLUDE_TYPES_ARRAY_HPP +#define PYTHONIC_INCLUDE_TYPES_ARRAY_HPP + +#include "pythonic/include/types/assignable.hpp" +#include "pythonic/include/types/empty_iterator.hpp" +#include "pythonic/include/types/list.hpp" +#include "pythonic/include/types/nditerator.hpp" +#include "pythonic/include/types/slice.hpp" +#include "pythonic/include/types/tuple.hpp" +#include "pythonic/include/types/vectorizable_type.hpp" +#include "pythonic/include/utils/allocate.hpp" +#include "pythonic/include/utils/int_.hpp" +#include "pythonic/include/utils/reserve.hpp" +#include "pythonic/include/utils/shared_ref.hpp" + +#include <algorithm> +#include <iterator> +#include <ostream> +#include <utility> +#include <vector> + +PYTHONIC_NS_BEGIN + +namespace types +{ + template <class T> + using container = std::vector<T, utils::allocator<T>>; + + /* forward declaration */ + template <class T> + class array; + template <class T, class S> + class sliced_array; + template <class T, class pS> + struct ndarray; + template <class... Tys> + struct pshape; + + template <class E> + struct array_reference { + typename E::data_type &data; + array_reference(typename E::data_type &data) : data(data) + { + } + array_reference &operator=(typename E::value_type value) + { + data = value; + return *this; + } + array_reference &operator=(array_reference value) + { + data = value.data; + return *this; + } + + operator typename E::value_type() const + { + return data; + } + + friend void swap(array_reference self, array_reference other) + { + std::swap(self.data, other.data); + } + }; + + template <class E> + struct array_iterator + : std::iterator<std::random_access_iterator_tag, typename E::value_type> { + E data; + long index; + array_iterator(E data, long index) : data(data), index(index) + { + } + + array_reference<E> operator*() + { + return data.fast(index); + } + auto operator*() const -> decltype(data.fast(index)) + { + return data.fast(index); + } + array_iterator &operator++() + { + ++index; + return *this; + } + array_iterator &operator--() + { + --index; + return *this; + } + array_iterator &operator+=(long i) + { + index += i; + return *this; + } + array_iterator &operator-=(long i) + { + index -= i; + return *this; + } + array_iterator operator+(long i) const + { + array_iterator res(*this); + res += i; + return res; + } + array_iterator operator-(long i) const + { + array_iterator res(*this); + res -= i; + return res; + } + long operator-(array_iterator const &other) const + { + return index - other.index; + } + bool operator!=(array_iterator const &other) const + { + return index != other.index; + } + bool operator==(array_iterator const &other) const + { + return index == other.index; + } + bool operator<(array_iterator const &other) const + { + return index < other.index; + } + array_iterator &operator=(array_iterator const &other) + { + index = other.index; + return *this; + } + }; + + /* array view */ + template <class T, class S = slice> + class sliced_array + { + + // data holder + typedef + typename std::remove_cv<typename std::remove_reference<T>::type>::type + _type; + typedef container<_type> container_type; + utils::shared_ref<container_type> _data; + + template <class U> + friend class array; + + typename S::normalized_type slicing; + + public: + // types + typedef T data_type; + typedef typename std::conditional<std::is_integral<T>::value, long, + double>::type value_type; + typedef array_reference<sliced_array> reference; + typedef value_type const_reference; + typedef array_iterator<sliced_array> iterator; + typedef array_iterator<sliced_array> const_iterator; + typedef typename container_type::size_type size_type; + typedef typename container_type::difference_type difference_type; + typedef typename container_type::allocator_type allocator_type; + typedef typename container_type::pointer pointer; + typedef typename container_type::const_pointer const_pointer; + typedef std::reverse_iterator<iterator> reverse_iterator; + typedef std::reverse_iterator<const_iterator> const_reverse_iterator; + + // minimal ndarray interface + typedef data_type dtype; + static const size_t value = 1; + static const bool is_vectorizable = + types::is_vectorizable_dtype<dtype>::value && + !std::is_same<S, slice>::value; + static const bool is_flat = std::is_same<slice, S>::value; + static const bool is_strided = std::is_same<slice, S>::value; + + using shape_t = types::array_tuple<long, value>; + template <size_t I> + auto shape() const -> decltype(details::extract_shape(*this, + utils::int_<I>{})) + { + return details::extract_shape(*this, utils::int_<I>{}); + } + + // constructor + sliced_array(); + sliced_array(sliced_array<T, S> const &s); + sliced_array(array<T> const &other, S const &s); + template <class Sn> + sliced_array(utils::shared_ref<container_type> const &other, Sn const &s); + + // assignment + sliced_array &operator=(array<T> const &); + sliced_array &operator=(sliced_array<T, S> const &); + array<T> operator+(array<T> const &) const; + template <size_t N, class V> + array<T> operator+(array_base<T, N, V> const &) const; + template <class Tp, class Sp> + array<typename __combined<T, Tp>::type> + operator+(sliced_array<Tp, Sp> const &) const; + + // iterators + iterator begin(); + const_iterator begin() const; + iterator end(); + const_iterator end() const; + reverse_iterator rbegin() + { + return {end()}; + } + const_reverse_iterator rbegin() const + { + return {end()}; + } + reverse_iterator rend() + { + return {begin()}; + } + const_reverse_iterator rend() const + { + return {begin()}; + } + + // size + long size() const; + explicit operator bool() const; + + // accessors + const_reference fast(long i) const; + reference fast(long i); + const_reference operator[](long i) const; + reference operator[](long i); + template <class Sp> + typename std::enable_if< + is_slice<Sp>::value, + sliced_array<T, decltype(std::declval<S>() * std::declval<Sp>())>>::type + operator[](Sp s) const; + + template <class... Indices> + dtype load(long index0, long index1, Indices... indices) const + { + return fast(index0).load(index1, indices...); + } + + dtype load(long index) const + { + return fast(index); + } + // comparison + template <class K> + bool operator==(array<K> const &other) const; + +#ifdef USE_XSIMD + using simd_iterator = const_simd_nditerator<sliced_array>; + using simd_iterator_nobroadcast = simd_iterator; + template <class vectorizer> + simd_iterator vbegin(vectorizer) const; + template <class vectorizer> + simd_iterator vend(vectorizer) const; +#endif + + // other operations + template <class V> + bool contains(V const &v) const; + intptr_t id() const; + + intptr_t baseid() const + { + return reinterpret_cast<intptr_t>(&(*_data)); + } + + long count(T const &x) const; + template <class Tp, class Sp> + friend std::ostream &operator<<(std::ostream &os, + sliced_array<Tp, Sp> const &v); + }; + + /* array */ + template <class T> + class array + { + + static const size_t DEFAULT_CAPACITY = 16; + + // data holder + typedef + typename std::remove_cv<typename std::remove_reference<T>::type>::type + _type; + typedef container<_type> container_type; + utils::shared_ref<container_type> _data; + + template <class U, class S> + friend class sliced_array; + + template <class U> + friend class array; + + public: + // types + typedef T data_type; + typedef typename std::conditional<std::is_integral<T>::value, long, + double>::type value_type; + typedef array_reference<array> reference; + typedef value_type const_reference; + typedef array_iterator<array> iterator; + typedef array_iterator<array> const_iterator; + typedef typename container_type::size_type size_type; + typedef typename container_type::difference_type difference_type; + typedef typename container_type::allocator_type allocator_type; + typedef typename container_type::pointer pointer; + typedef typename container_type::const_pointer const_pointer; + typedef std::reverse_iterator<iterator> reverse_iterator; + typedef std::reverse_iterator<const_iterator> const_reverse_iterator; + + // minimal ndarray interface + typedef data_type dtype; + static const size_t value = 1; + static const bool is_vectorizable = types::is_vectorizable<dtype>::value; + static const bool is_flat = true; + static const bool is_strided = false; + + // constructors + array(); + template <class InputIterator> + array(InputIterator start, InputIterator stop); + array(size_type sz); + array(array &&other); + array(array const &other); + template <class Tp> + array(list<Tp> const &other) : array(other.begin(), other.end()) + { + } + template <class Tp, size_t N> + array(static_list<Tp, N> const &other) : array(other.begin(), other.end()) + { + } + template <class F> + array(array<F> const &other); + template <class Tp, class S> + array(sliced_array<Tp, S> const &other); + array<T> &operator=(array<T> &&other); + template <class F> + array<T> &operator=(array<F> const &other); + array<T> &operator=(array<T> const &other); + template <class Tp, size_t N, class V> + array<T> &operator=(array_base<Tp, N, V> const &); + template <class Tp, class S> + array<T> &operator=(sliced_array<Tp, S> const &other); + + template <class pS> + array & + operator=(ndarray<T, pshape<pS>> const &); // implemented in ndarray.hpp + + template <class S> + array<T> &operator+=(sliced_array<T, S> const &other); + template <class S> + array<T> operator+(sliced_array<T, S> const &other) const; + template <size_t N, class V> + array<T> operator+(array_base<T, N, V> const &other) const; + + // io + template <class S> + friend std::ostream &operator<<(std::ostream &os, array<S> const &v); + + // comparison + template <class K> + bool operator==(array<K> const &other) const; + template <class K> + bool operator!=(array<K> const &other) const; + + // iterators + iterator begin(); + const_iterator begin() const; + iterator end(); + const_iterator end() const; + reverse_iterator rbegin() + { + return {end()}; + } + const_reverse_iterator rbegin() const + { + return {end()}; + } + reverse_iterator rend() + { + return {begin()}; + } + const_reverse_iterator rend() const + { + return {begin()}; + } + + // comparison + bool operator<(array<T> const &other) const; + bool operator<=(array<T> const &other) const; + bool operator>(array<T> const &other) const; + bool operator>=(array<T> const &other) const; + +// element access +#ifdef USE_XSIMD + using simd_iterator = const_simd_nditerator<array>; + using simd_iterator_nobroadcast = simd_iterator; + template <class vectorizer> + simd_iterator vbegin(vectorizer) const; + template <class vectorizer> + simd_iterator vend(vectorizer) const; +#endif + reference fast(long n); + reference operator[](long n); + + const_reference fast(long n) const; + const_reference operator[](long n) const; + + template <class Sp> + typename std::enable_if<is_slice<Sp>::value, sliced_array<T, Sp>>::type + operator[](Sp const &s) const; + + template <class... Indices> + dtype load(long index0, long index1, Indices... indices) const + { + return fast(index0).load(index1, indices...); + } + + dtype load(long index) const + { + return fast(index); + } + + dtype *data() + { + return _data->data(); + } + const dtype *data() const + { + return _data->data(); + } + + // modifiers + template <class Tp> + void push_back(Tp &&x); + template <class Tp> + void insert(long i, Tp &&x); + + void reserve(size_t n); + void resize(size_t n); + void erase(size_t n); + + T pop(long x = -1); + void clear(); + + // TODO: have to raise a valueError + none_type remove(T const &x); + + // Misc + // TODO: have to raise a valueError + long index(T const &x) const; + + // array interface + explicit operator bool() const; + + template <class F> + array<typename __combined<T, F>::type> operator+(array<F> const &s) const; + + template <class F, class S> + array<decltype(std::declval<T>() + + std::declval<typename sliced_array<F, S>::value_type>())> + operator+(sliced_array<F, S> const &s) const; + + array<T> operator*(long t) const; + array<T> const &operator*=(long t); + + template <class F> + array<T> &operator+=(F const &s); + + long size() const; + template <class E> + long _flat_size(E const &e, utils::int_<1>) const; + template <class E, size_t L> + long _flat_size(E const &e, utils::int_<L>) const; + long flat_size() const; + + template <class V> + bool contains(V const &v) const; + intptr_t id() const; + + long count(T const &x) const; + using shape_t = array_tuple<long, value>; + template <size_t I> + long shape() const + { + if (I == 0) + return size(); + else + return details::extract_shape(*this, utils::int_<I>{}); + } + + template <class Tp, size_t N, class V> + operator array_base<Tp, N, V>() const + { + assert(size() == N && "consistent size"); + array_base<Tp, N, V> res; + std::copy(begin(), end(), res.begin()); + return res; + } + }; + +} // namespace types + +namespace utils +{ + /** + * Reserve enough space to save all values generated from f. + * + * We use a dummy arguments (p) to reserve only when f have a + * const_iterator type. + */ + template <class T, class From> + void reserve(types::array<T> &l, From const &f, + typename From::const_iterator *p = nullptr); +} // namespace utils + +template <class T> +struct assignable<types::array<T>> { + typedef types::array<typename assignable<T>::type> type; +}; + +template <class T, class S> +struct assignable<types::sliced_array<T, S>> { + typedef types::array<typename assignable<T>::type> type; +}; + +template <class E> +struct assignable<types::array_reference<E>> { + typedef typename E::value_type type; +}; + +PYTHONIC_NS_END + +/* overload std::get */ +namespace std +{ + template <size_t I, class T> + typename pythonic::types::array<T>::reference + get(pythonic::types::array<T> &t); + + template <size_t I, class T> + typename pythonic::types::array<T>::const_reference + get(pythonic::types::array<T> const &t); + + template <size_t I, class T> + typename pythonic::types::array<T>::value_type + get(pythonic::types::array<T> &&t); + + template <size_t I, class T, class S> + typename pythonic::types::sliced_array<T, S>::reference + get(pythonic::types::sliced_array<T, S> &t); + + template <size_t I, class T, class S> + typename pythonic::types::sliced_array<T, S>::const_reference + get(pythonic::types::sliced_array<T, S> const &t); + + template <size_t I, class T, class S> + typename pythonic::types::sliced_array<T, S>::value_type + get(pythonic::types::sliced_array<T, S> &&t); + + template <size_t I, class T> + struct tuple_element<I, pythonic::types::array<T>> { + typedef typename pythonic::types::array<T>::value_type type; + }; + template <size_t I, class T, class S> + struct tuple_element<I, pythonic::types::sliced_array<T, S>> { + typedef typename pythonic::types::sliced_array<T, S>::value_type type; + }; +} // namespace std + +/* type inference stuff {*/ +#include "pythonic/include/types/combined.hpp" + +template <class A, class B> +struct __combined<container<A>, pythonic::types::array<B>> { + typedef pythonic::types::array<typename __combined<A, B>::type> type; +}; + +template <class A, class B> +struct __combined<pythonic::types::array<B>, container<A>> { + typedef pythonic::types::array<typename __combined<A, B>::type> type; +}; + +template <class K, class V> +struct __combined<indexable<K>, pythonic::types::array<V>> { + typedef pythonic::types::array<V> type; +}; + +template <class V, class K> +struct __combined<pythonic::types::array<V>, indexable<K>> { + typedef pythonic::types::array<V> type; +}; + +template <class K, class V0, class V1> +struct __combined<indexable_container<K, V0>, pythonic::types::array<V1>> { + typedef pythonic::types::array<typename __combined<V0, V1>::type> type; +}; + +template <class K, class V0, class V1> +struct __combined<pythonic::types::array<V1>, indexable_container<K, V0>> { + typedef pythonic::types::array<typename __combined<V0, V1>::type> type; +}; + +template <class T0, class T1> +struct __combined<pythonic::types::array<T0>, pythonic::types::array<T1>> { + typedef pythonic::types::array<typename __combined<T0, T1>::type> type; +}; + +template <class T0, class T1, class S> +struct __combined<pythonic::types::sliced_array<T1, S>, + pythonic::types::array<T0>> { + typedef pythonic::types::array<typename __combined<T0, T1>::type> type; +}; +template <class T0, class T1, class S> +struct __combined<pythonic::types::array<T0>, + pythonic::types::sliced_array<T1, S>> { + typedef pythonic::types::array<typename __combined<T0, T1>::type> type; +}; + +template <class T, size_t N, class V, class Tp> +struct __combined<pythonic::types::array_base<T, N, V>, + pythonic::types::array<Tp>> { + typedef pythonic::types::array<typename __combined<T, Tp>::type> type; +}; +template <class T, size_t N, class V, class Tp> +struct __combined<pythonic::types::array<Tp>, + pythonic::types::array_base<T, N, V>> { + typedef pythonic::types::array<typename __combined<T, Tp>::type> type; +}; + +/* } */ + +#ifdef ENABLE_PYTHON_MODULE + +PYTHONIC_NS_BEGIN + +template <typename T> +struct to_python<types::array<T>> { + static PyObject *convert(types::array<T> const &v); +}; +template <typename T, typename S> +struct to_python<types::sliced_array<T, S>> { + static PyObject *convert(types::sliced_array<T, S> const &v); +}; + +PYTHONIC_NS_END + +#endif + +#endif diff --git a/contrib/python/pythran/pythran/pythonic/include/types/attr.hpp b/contrib/python/pythran/pythran/pythonic/include/types/attr.hpp index 41d483d0cf..6b73e92410 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/attr.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/attr.hpp @@ -61,8 +61,8 @@ namespace types struct STEP { }; /* */ - } -} + } // namespace attr +} // namespace types PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/types/cfun.hpp b/contrib/python/pythran/pythran/pythonic/include/types/cfun.hpp index 2dc6d48ed4..6c88f2dd5c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/cfun.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/cfun.hpp @@ -20,7 +20,7 @@ namespace types ReturnType operator()(ArgsType... args) const; }; -} +} // namespace types PYTHONIC_NS_END #ifdef ENABLE_PYTHON_MODULE diff --git a/contrib/python/pythran/pythran/pythonic/include/types/combined.hpp b/contrib/python/pythran/pythran/pythonic/include/types/combined.hpp index cc5e5973f7..6f531e9fb9 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/combined.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/combined.hpp @@ -13,7 +13,7 @@ namespace types PYTHONIC_NS_END /* type inference stuff -*/ + */ template <class... Types> struct __combined; @@ -33,12 +33,12 @@ struct __combined<T0, T1> { // callable -> functor template <class F0, class F1> static pythonic::types::variant_functor<F0, F1> - get(std::integral_constant<bool, true>); + get(std::integral_constant<bool, true>); // operator+ exists -> deduce type template <class F0, class F1> - static decltype(std::declval<F0>() + std::declval<F1>()) - get(std::integral_constant<bool, false>); + static decltype(std::declval<F0>() + + std::declval<F1>()) get(std::integral_constant<bool, false>); // operator+ does not exists -> pick first one, better than error // note that this is needed because broadcasting is too complex to be modeled @@ -53,9 +53,10 @@ struct __combined<T0, T1> { using type = typename std::conditional< std::is_same<T0, T1>::value, T0, - decltype(get<T0, T1>(std::integral_constant< - bool, pythonic::types::is_callable<T0>::value && - pythonic::types::is_callable<T1>::value>()))>::type; + decltype(get<T0, T1>(std::integral_constant < bool, + pythonic::types::is_callable<T0>::value + &&pythonic::types::is_callable<T1>::value > + ()))>::type; }; template <class T0, class T1> diff --git a/contrib/python/pythran/pythran/pythonic/include/types/complex.hpp b/contrib/python/pythran/pythran/pythonic/include/types/complex.hpp index fbb4209c1a..19ae86680a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/complex.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/complex.hpp @@ -4,14 +4,12 @@ #include <complex> #if defined(_OPENMP) -#pragma omp declare reduction(+ : std::complex < float > : omp_out += omp_in) -#pragma omp declare reduction(* : std::complex < float > : omp_out *= omp_in) -#pragma omp declare reduction(+ : std::complex < double > : omp_out += omp_in) -#pragma omp declare reduction(* : std::complex < double > : omp_out *= omp_in) -#pragma omp declare reduction(+ : std::complex < long double > : omp_out += \ - omp_in) -#pragma omp declare reduction(* : std::complex < long double > : omp_out *= \ - omp_in) +#pragma omp declare reduction(+ : std::complex<float> : omp_out += omp_in) +#pragma omp declare reduction(* : std::complex<float> : omp_out *= omp_in) +#pragma omp declare reduction(+ : std::complex<double> : omp_out += omp_in) +#pragma omp declare reduction(* : std::complex<double> : omp_out *= omp_in) +#pragma omp declare reduction(+ : std::complex<long double> : omp_out += omp_in) +#pragma omp declare reduction(* : std::complex<long double> : omp_out *= omp_in) #endif PYTHONIC_NS_BEGIN @@ -22,8 +20,8 @@ namespace numpy struct complex64; struct complex128; struct complex256; - } -} + } // namespace functor +} // namespace numpy PYTHONIC_NS_END @@ -84,7 +82,7 @@ namespace std struct hash<std::complex<T>> { size_t operator()(std::complex<T> const &x) const; }; -} +} // namespace std PYTHONIC_NS_BEGIN namespace builtins @@ -99,7 +97,7 @@ namespace builtins std::complex<double> const &self); numpy::functor::complex256 getattr(types::attr::DTYPE, std::complex<long double> const &self); -} +} // namespace builtins PYTHONIC_NS_END /* for type inference { */ @@ -127,19 +125,15 @@ struct __combined<std::complex<T0>, std::complex<T1>> { ->std::complex<typename std::common_type<T, U>::type> \ { \ using ctype = std::complex<typename std::common_type<T, U>::type>; \ - return ctype \ - { \ - lhs \ - } \ - op ctype{rhs}; \ + return ctype{lhs} op ctype{rhs}; \ } STD_COMPLEX_IMPLICT_OPERATOR_CAST(+) STD_COMPLEX_IMPLICT_OPERATOR_CAST(-) STD_COMPLEX_IMPLICT_OPERATOR_CAST(*) -STD_COMPLEX_IMPLICT_OPERATOR_CAST(/ ) -STD_COMPLEX_IMPLICT_OPERATOR_CAST(== ) -STD_COMPLEX_IMPLICT_OPERATOR_CAST(!= ) +STD_COMPLEX_IMPLICT_OPERATOR_CAST(/) +STD_COMPLEX_IMPLICT_OPERATOR_CAST(==) +STD_COMPLEX_IMPLICT_OPERATOR_CAST(!=) #ifdef ENABLE_PYTHON_MODULE diff --git a/contrib/python/pythran/pythran/pythonic/include/types/dynamic_tuple.hpp b/contrib/python/pythran/pythran/pythonic/include/types/dynamic_tuple.hpp index 389edbfc1a..0db63dcff6 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/dynamic_tuple.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/dynamic_tuple.hpp @@ -173,8 +173,8 @@ namespace types using shape_t = typename shape_builder<dynamic_tuple, value>::type; template <size_t I> - auto shape() const - -> decltype(details::extract_shape(*this, utils::int_<I>{})) + auto shape() const -> decltype(details::extract_shape(*this, + utils::int_<I>{})) { return details::extract_shape(*this, utils::int_<I>{}); } diff --git a/contrib/python/pythran/pythran/pythonic/include/types/empty_iterator.hpp b/contrib/python/pythran/pythran/pythonic/include/types/empty_iterator.hpp index 2d58573af0..50ddda302a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/empty_iterator.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/empty_iterator.hpp @@ -20,7 +20,7 @@ namespace types double operator*() const; void operator->() const; }; -} +} // namespace types PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/types/exceptions.hpp b/contrib/python/pythran/pythran/pythonic/include/types/exceptions.hpp index 33b5fac887..3cdb832ece 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/exceptions.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/exceptions.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_INCLUDE_TYPES_EXCEPTIONS_HPP #define PYTHONIC_INCLUDE_TYPES_EXCEPTIONS_HPP -#include "pythonic/include/types/str.hpp" -#include "pythonic/include/types/dynamic_tuple.hpp" -#include "pythonic/include/types/attr.hpp" #include "pythonic/include/builtins/str.hpp" +#include "pythonic/include/types/attr.hpp" +#include "pythonic/include/types/dynamic_tuple.hpp" +#include "pythonic/include/types/str.hpp" #include <stdexcept> @@ -18,7 +18,7 @@ namespace types public: BaseException(const BaseException &e) = default; template <typename... Types> - BaseException(Types const &... types); + BaseException(Types const &...types); virtual ~BaseException() noexcept = default; dynamic_tuple<str> args; }; @@ -31,8 +31,7 @@ namespace types name() = default; \ name(const name &e) = default; \ template <class... Types> \ - name(Types const &... types) \ - : parent(types...) \ + name(Types const &...types) : parent(types...) \ { \ } \ virtual ~name() noexcept = default; \ @@ -85,13 +84,13 @@ namespace types CLASS_EXCEPTION_DECL(IndentationError, SyntaxError); CLASS_EXCEPTION_DECL(TabError, IndentationError); CLASS_EXCEPTION_DECL(UnicodeError, ValueError); -} +} // namespace types PYTHONIC_NS_END #include "pythonic/include/utils/functor.hpp" #define PYTHONIC_EXCEPTION_DECL(name) \ template <typename... Types> \ - types::name name(Types const &... args); \ + types::name name(Types const &...args); \ \ DEFINE_FUNCTOR(pythonic::builtins, name); @@ -185,7 +184,7 @@ namespace types * */ std::ostream &operator<<(std::ostream &o, EnvironmentError const &e); -} +} // namespace types PYTHONIC_NS_END /* } */ diff --git a/contrib/python/pythran/pythran/pythonic/include/types/file.hpp b/contrib/python/pythran/pythran/pythonic/include/types/file.hpp index 8781adb250..7d192c9a9d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/file.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/file.hpp @@ -1,12 +1,12 @@ #ifndef PYTHONIC_INCLUDE_TYPES_FILE_HPP #define PYTHONIC_INCLUDE_TYPES_FILE_HPP -#include "pythonic/include/types/assignable.hpp" -#include "pythonic/include/utils/shared_ref.hpp" -#include "pythonic/include/types/str.hpp" -#include "pythonic/include/types/list.hpp" #include "pythonic/include/types/NoneType.hpp" +#include "pythonic/include/types/assignable.hpp" #include "pythonic/include/types/attr.hpp" +#include "pythonic/include/types/list.hpp" +#include "pythonic/include/types/str.hpp" +#include "pythonic/include/utils/shared_ref.hpp" #include <fstream> #include <iterator> @@ -92,6 +92,9 @@ namespace types types::str read(long size = -1); + template <class T> + void read_as(long n, T *buffer); + types::str readline(long size = std::numeric_limits<long>::max()); types::list<types::str> readlines(long sizehint = -1); @@ -107,7 +110,7 @@ namespace types template <class T> void writelines(T const &seq); }; -} +} // namespace types PYTHONIC_NS_END /* pythran attribute system { */ @@ -123,7 +126,7 @@ namespace builtins // Python seems to always return none... Doing the same. types::none_type getattr(types::attr::NEWLINES, types::file const &f); -} +} // namespace builtins PYTHONIC_NS_END /* } */ diff --git a/contrib/python/pythran/pythran/pythonic/include/types/finfo.hpp b/contrib/python/pythran/pythran/pythonic/include/types/finfo.hpp index f5af81c04b..f15b2acc57 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/finfo.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/finfo.hpp @@ -18,7 +18,7 @@ namespace types struct finfo<std::complex<T>> { T eps() const; }; -} +} // namespace types PYTHONIC_NS_END /* pythran attribute system { */ @@ -26,8 +26,8 @@ PYTHONIC_NS_BEGIN namespace builtins { template <class T> - auto getattr(types::attr::EPS, pythonic::types::finfo<T> const &f) - -> decltype(f.eps()); + auto getattr(types::attr::EPS, + pythonic::types::finfo<T> const &f) -> decltype(f.eps()); } PYTHONIC_NS_END /* } */ diff --git a/contrib/python/pythran/pythran/pythonic/include/types/generator.hpp b/contrib/python/pythran/pythran/pythonic/include/types/generator.hpp index 587d71c6eb..85998cccb5 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/generator.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/generator.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_TYPES_GENERATOR_HPP #define PYTHONIC_INCLUDE_TYPES_GENERATOR_HPP -#include <iterator> #include <cstddef> +#include <iterator> PYTHONIC_NS_BEGIN @@ -23,7 +23,7 @@ namespace types bool operator==(generator_iterator<T> const &other) const; bool operator<(generator_iterator<T> const &other) const; }; -} +} // namespace types PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/types/immediate.hpp b/contrib/python/pythran/pythran/pythonic/include/types/immediate.hpp index 7e7bf3e075..7b8de529d4 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/immediate.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/immediate.hpp @@ -26,7 +26,7 @@ namespace types using true_immediate = immediate<bool, true>; using false_immediate = immediate<bool, false>; -} +} // namespace types PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/include/types/int.hpp b/contrib/python/pythran/pythran/pythonic/include/types/int.hpp index ebd94eb8d1..40a53da214 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/int.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/int.hpp @@ -12,7 +12,7 @@ namespace builtins template <class T> typename std::enable_if<std::is_integral<T>::value, T>::value getattr(types::attr::IMAG, T self); -} +} // namespace builtins PYTHONIC_NS_END #ifdef ENABLE_PYTHON_MODULE diff --git a/contrib/python/pythran/pythran/pythonic/include/types/lazy.hpp b/contrib/python/pythran/pythran/pythonic/include/types/lazy.hpp index b5ea869df6..13680b0c1a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/lazy.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/lazy.hpp @@ -15,7 +15,7 @@ namespace types std::is_same<lazy_res_t<T0>, lazy_res_t<T1>>::value, lazy_res_t<T0>, typename __combined<lazy_res_decay_t<T0>, lazy_res_decay_t<T1>>::type>::type; -} +} // namespace types PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/types/list.hpp b/contrib/python/pythran/pythran/pythonic/include/types/list.hpp index 15a1db3086..be008c7bcc 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/list.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/list.hpp @@ -26,8 +26,6 @@ namespace types template <class T> using container = std::vector<T, utils::allocator<T>>; - static const size_t DEFAULT_LIST_CAPACITY = 16; - /* forward declaration */ struct empty_list; template <class T> @@ -38,22 +36,6 @@ namespace types struct ndarray; template <class... Tys> struct pshape; - template <class T> - struct is_list { - static const bool value = false; - }; - template <class T> - struct is_list<list<T>> { - static const bool value = true; - }; - template <class T, class S> - struct is_list<sliced_list<T, S>> { - static const bool value = true; - }; - template <class T, size_t N> - struct is_list<static_list<T, N>> { - static const bool value = true; - }; /* for type disambiguification */ struct single_value { @@ -104,10 +86,10 @@ namespace types static const bool is_flat = std::is_same<slice, S>::value; static const bool is_strided = std::is_same<slice, S>::value; - using shape_t = types::array<long, value>; + using shape_t = types::array_tuple<long, value>; template <size_t I> - auto shape() const - -> decltype(details::extract_shape(*this, utils::int_<I>{})) + auto shape() const -> decltype(details::extract_shape(*this, + utils::int_<I>{})) { return details::extract_shape(*this, utils::int_<I>{}); } @@ -193,6 +175,7 @@ namespace types template <class T> class list { + static constexpr size_t DEFAULT_CAPACITY = 16; // data holder typedef @@ -391,7 +374,7 @@ namespace types intptr_t id() const; long count(T const &x) const; - using shape_t = array<long, value>; + using shape_t = array_tuple<long, value>; template <size_t I> long shape() const { @@ -439,7 +422,7 @@ namespace types static const size_t value = 1; static const bool is_vectorizable = false; static const bool is_strided = false; - using shape_t = types::array<long, value>; + using shape_t = types::array_tuple<long, value>; typedef char value_type; typedef empty_iterator iterator; diff --git a/contrib/python/pythran/pythran/pythonic/include/types/ndarray.hpp b/contrib/python/pythran/pythran/pythonic/include/types/ndarray.hpp index e28d665e1f..49c8254987 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/ndarray.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/ndarray.hpp @@ -168,7 +168,7 @@ namespace types }; template <class T, class pS> - struct type_helper<ndarray<T, array<pS, 1>>> { + struct type_helper<ndarray<T, array_tuple<pS, 1>>> { using type = T; using iterator = T *; @@ -176,18 +176,18 @@ namespace types type_helper() = delete; // Not intended to be instantiated - static iterator make_iterator(ndarray<T, array<pS, 1>> &n, long i); - static const_iterator make_iterator(ndarray<T, array<pS, 1>> const &n, + static iterator make_iterator(ndarray<T, array_tuple<pS, 1>> &n, long i); + static const_iterator make_iterator(ndarray<T, array_tuple<pS, 1>> const &n, long i); template <class S, class Iter> static T *initialize_from_iterable(S &shape, T *from, Iter &&iter); - static type get(ndarray<T, array<pS, 1>> &&self, long i); + static type get(ndarray<T, array_tuple<pS, 1>> &&self, long i); }; template <class T, class pS> - struct type_helper<ndarray<T, array<pS, 1>> const &> { + struct type_helper<ndarray<T, array_tuple<pS, 1>> const &> { using type = T; using iterator = T *; @@ -195,13 +195,13 @@ namespace types type_helper() = delete; // Not intended to be instantiated - static iterator make_iterator(ndarray<T, array<pS, 1>> &n, long i); - static const_iterator make_iterator(ndarray<T, array<pS, 1>> const &n, + static iterator make_iterator(ndarray<T, array_tuple<pS, 1>> &n, long i); + static const_iterator make_iterator(ndarray<T, array_tuple<pS, 1>> const &n, long i); template <class S, class Iter> static T *initialize_from_iterable(S &shape, T *from, Iter &&iter); - static type &get(ndarray<T, array<pS, 1>> const &self, long i); + static type &get(ndarray<T, array_tuple<pS, 1>> const &self, long i); }; /* Multidimensional array of values @@ -240,7 +240,7 @@ namespace types T *buffer; // pointer to the first data stored in the equivalent flat // array shape_t _shape; // shape of the multidimensional array - sutils::concat_t<types::array<long, value - 1>, + sutils::concat_t<types::array_tuple<long, value - 1>, pshape<std::integral_constant<long, 1>>> _strides; // strides @@ -346,14 +346,14 @@ namespace types { static_assert(is_dtype<E>::value, "valid store"); *(buffer + noffset<std::tuple_size<pS>::value>{}( - *this, array<long, value>{{indices...}})) = + *this, array_tuple<long, value>{{indices...}})) = static_cast<E>(elt); } template <class... Indices> dtype load(Indices... indices) const { return *(buffer + noffset<std::tuple_size<pS>::value>{}( - *this, array<long, value>{{indices...}})); + *this, array_tuple<long, value>{{indices...}})); } template <class Op, class E, class... Indices> @@ -361,7 +361,7 @@ namespace types { static_assert(is_dtype<E>::value, "valid store"); Op{}(*(buffer + noffset<std::tuple_size<pS>::value>{}( - *this, array<long, value>{{indices...}})), + *this, array_tuple<long, value>{{indices...}})), static_cast<E>(elt)); } @@ -382,19 +382,19 @@ namespace types template <class Ty> typename std::enable_if<std::is_integral<Ty>::value, T &>::type - fast(array<Ty, value> const &indices); + fast(array_tuple<Ty, value> const &indices); template <class Ty> typename std::enable_if<std::is_integral<Ty>::value, T>::type - fast(array<Ty, value> const &indices) const; + fast(array_tuple<Ty, value> const &indices) const; template <class Ty, size_t M> - auto fast(array<Ty, M> const &indices) const & -> + auto fast(array_tuple<Ty, M> const &indices) const & -> typename std::enable_if<std::is_integral<Ty>::value, decltype(nget<M - 1>().fast(*this, indices))>::type; template <class Ty, size_t M> - auto fast(array<Ty, M> const &indices) && -> + auto fast(array_tuple<Ty, M> const &indices) && -> typename std::enable_if<std::is_integral<Ty>::value, decltype(nget<M - 1>().fast(std::move(*this), indices))>::type; @@ -449,17 +449,20 @@ namespace types } template <class S0, class... S> - auto operator()(S0 const &s0, S const &...s) const & -> decltype( - extended_slice<count_new_axis<S0, S...>::value>{}((*this), s0, s...)); + auto operator()(S0 const &s0, S const &...s) + const & -> decltype(extended_slice<count_new_axis<S0, S...>::value>{}( + (*this), s0, s...)); template <class S0, class... S> - auto operator()(S0 const &s0, S const &...s) & -> decltype( - extended_slice<count_new_axis<S0, S...>::value>{}((*this), s0, s...)); + auto operator()(S0 const &s0, S const &...s) + & -> decltype(extended_slice<count_new_axis<S0, S...>::value>{}((*this), + s0, + s...)); template <class S0, class... S> - auto operator()(S0 const &s0, S const &...s) && -> decltype( - extended_slice<count_new_axis<S0, S...>::value>{}(std::move(*this), s0, - s...)); + auto operator()(S0 const &s0, S const &...s) + && -> decltype(extended_slice<count_new_axis<S0, S...>::value>{}( + std::move(*this), s0, s...)); /* element filtering */ template <class F> // indexing through an array of boolean -- a mask @@ -528,19 +531,19 @@ namespace types template <class Ty> typename std::enable_if<std::is_integral<Ty>::value, T const &>::type - operator[](array<Ty, value> const &indices) const; + operator[](array_tuple<Ty, value> const &indices) const; template <class Ty> typename std::enable_if<std::is_integral<Ty>::value, T &>::type - operator[](array<Ty, value> const &indices); + operator[](array_tuple<Ty, value> const &indices); template <class Ty, size_t M> - auto operator[](array<Ty, M> const &indices) const & -> + auto operator[](array_tuple<Ty, M> const &indices) const & -> typename std::enable_if<std::is_integral<Ty>::value, decltype(nget<M - 1>()(*this, indices))>::type; template <class Ty, size_t M> - auto operator[](array<Ty, M> const &indices) && -> + auto operator[](array_tuple<Ty, M> const &indices) && -> typename std::enable_if<std::is_integral<Ty>::value, decltype(nget<M - 1>()(std::move(*this), indices))>::type; @@ -622,7 +625,7 @@ namespace types template <class Ty, size_t M, class _ = typename std::enable_if<!std::is_integral<Ty>::value, void>::type> - auto operator[](array<Ty, M> const &indices) const + auto operator[](array_tuple<Ty, M> const &indices) const & -> decltype(this->_fwdindex(indices, utils::make_index_sequence<M>())) { return _fwdindex(indices, utils::make_index_sequence<M>()); @@ -664,12 +667,12 @@ namespace types ndarray<T, qS> reshape(qS const &shape) &&; template <class OT> - ndarray<OT, types::array<long, value>> recast() + ndarray<OT, types::array_tuple<long, value>> recast() { auto new_shape = sutils::array(_shape); new_shape[value - 1] = new_shape[value - 1] * sizeof(T) / sizeof(OT); auto new_mem = mem.template recast<raw_array<OT>>(); - return ndarray<OT, types::array<long, value>>(new_mem, new_shape); + return ndarray<OT, types::array_tuple<long, value>>(new_mem, new_shape); } explicit operator bool() const; @@ -715,10 +718,11 @@ namespace std { template <size_t I, class E> - auto get(E &&a) -> typename std::enable_if< - pythonic::types::is_array<typename std::remove_cv< - typename std::remove_reference<E>::type>::type>::value, - decltype(std::forward<E>(a)[I])>::type; + auto get(E &&a) -> + typename std::enable_if< + pythonic::types::is_array<typename std::remove_cv< + typename std::remove_reference<E>::type>::type>::value, + decltype(std::forward<E>(a)[I])>::type; template <size_t I, class T, class pS> struct tuple_element<I, pythonic::types::ndarray<T, pS>> { @@ -748,7 +752,8 @@ namespace std template <size_t I, class T, class F> struct tuple_element<I, pythonic::types::numpy_vexpr<T, F>> { - using type = decltype(std::declval<pythonic::types::numpy_vexpr<T, F>>()[0]); + using type = + decltype(std::declval<pythonic::types::numpy_vexpr<T, F>>()[0]); }; } // namespace std @@ -825,8 +830,8 @@ namespace builtins template <> struct _build_gexpr<1> { template <class E, class... S> - auto - operator()(E const &a, S const &...slices) -> decltype(E(a)(slices...)); + auto operator()(E const &a, + S const &...slices) -> decltype(E(a)(slices...)); }; template <class E> @@ -836,7 +841,7 @@ namespace builtins auto _make_real(E const &a, utils::int_<1>) -> decltype(_build_gexpr<E::value>{}( types::ndarray<typename types::is_complex<typename E::dtype>::type, - types::array<long, E::value>>{}, + types::array_tuple<long, E::value>>{}, types::slice())); template <class T, class Ss, size_t... Is> auto real_get(T &&expr, Ss const &indices, utils::index_sequence<Is...>) @@ -852,7 +857,7 @@ namespace builtins auto _make_imag(E const &a, utils::int_<1>) -> decltype(_build_gexpr<E::value>{}( types::ndarray<typename types::is_complex<typename E::dtype>::type, - types::array<long, E::value>>{}, + types::array_tuple<long, E::value>>{}, types::slice())); template <class T, class Ss, size_t... Is> auto imag_get(T &&expr, Ss const &indices, utils::index_sequence<Is...>) @@ -863,7 +868,7 @@ namespace builtins } // namespace details template <class E> - types::array<long, E::value> getattr(types::attr::SHAPE, E const &a); + types::array_tuple<long, E::value> getattr(types::attr::SHAPE, E const &a); inline types::pshape<> getattr(types::attr::SHAPE, ...) { @@ -883,7 +888,7 @@ namespace builtins } template <class E> - types::array<long, E::value> getattr(types::attr::STRIDES, E const &a); + types::array_tuple<long, E::value> getattr(types::attr::STRIDES, E const &a); inline std::tuple<> getattr(types::attr::STRIDES, ...) { @@ -924,22 +929,24 @@ namespace builtins typename types::numpy_expr<Op, Args...>::dtype>::value>{})); template <class E> - auto getattr(types::attr::REAL, types::numpy_texpr<E> const &a) -> decltype( - types::numpy_texpr<decltype(getattr(types::attr::REAL{}, a.arg))>{ + auto getattr(types::attr::REAL, types::numpy_texpr<E> const &a) + -> decltype(types::numpy_texpr<decltype(getattr(types::attr::REAL{}, + a.arg))>{ getattr(types::attr::REAL{}, a.arg)}); template <class E> - auto getattr(types::attr::REAL, types::numpy_iexpr<E> const &a) -> decltype( - types::numpy_iexpr<decltype(getattr(types::attr::REAL{}, a.arg))>{ + auto getattr(types::attr::REAL, types::numpy_iexpr<E> const &a) + -> decltype(types::numpy_iexpr<decltype(getattr(types::attr::REAL{}, + a.arg))>{ getattr(types::attr::REAL{}, a.arg)}) { return {getattr(types::attr::REAL{}, a.arg)}; } template <class T, class F> - auto - getattr(types::attr::REAL, types::numpy_vexpr<T, F> const &a) -> decltype( - types::numpy_vexpr<decltype(getattr(types::attr::REAL{}, a.data_)), F>{ + auto getattr(types::attr::REAL, types::numpy_vexpr<T, F> const &a) + -> decltype(types::numpy_vexpr< + decltype(getattr(types::attr::REAL{}, a.data_)), F>{ getattr(types::attr::REAL{}, a.data_), a.view_}) { return {getattr(types::attr::REAL{}, a.data_), a.view_}; @@ -969,22 +976,24 @@ namespace builtins typename types::numpy_expr<Op, Args...>::dtype>::value>{})); template <class E> - auto getattr(types::attr::IMAG, types::numpy_texpr<E> const &a) -> decltype( - types::numpy_texpr<decltype(getattr(types::attr::IMAG{}, a.arg))>{ + auto getattr(types::attr::IMAG, types::numpy_texpr<E> const &a) + -> decltype(types::numpy_texpr<decltype(getattr(types::attr::IMAG{}, + a.arg))>{ getattr(types::attr::IMAG{}, a.arg)}); template <class E> - auto geatttr(types::attr::IMAG, types::numpy_iexpr<E> const &a) -> decltype( - types::numpy_iexpr<decltype(getattr(types::attr::IMAG{}, a.arg))>{ + auto geatttr(types::attr::IMAG, types::numpy_iexpr<E> const &a) + -> decltype(types::numpy_iexpr<decltype(getattr(types::attr::IMAG{}, + a.arg))>{ getattr(types::attr::IMAG{}, a.arg)}) { return {getattr(types::attr::IMAG{}, a.arg)}; } template <class T, class F> - auto - getattr(types::attr::IMAG, types::numpy_vexpr<T, F> const &a) -> decltype( - types::numpy_vexpr<decltype(getattr(types::attr::IMAG{}, a.data_)), F>{ + auto getattr(types::attr::IMAG, types::numpy_vexpr<T, F> const &a) + -> decltype(types::numpy_vexpr< + decltype(getattr(types::attr::IMAG{}, a.data_)), F>{ getattr(types::attr::IMAG{}, a.data_), a.view_}) { return {getattr(types::attr::IMAG{}, a.data_), a.view_}; diff --git a/contrib/python/pythran/pythran/pythonic/include/types/nditerator.hpp b/contrib/python/pythran/pythran/pythonic/include/types/nditerator.hpp index e74f19c2b5..0d1f8281ad 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/nditerator.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/nditerator.hpp @@ -48,8 +48,8 @@ namespace types template <class E> struct nditerator : public std::iterator<std::random_access_iterator_tag, - typename std::remove_reference<decltype( - std::declval<E &>().fast(0))>::type> { + typename std::remove_reference< + decltype(std::declval<E &>().fast(0))>::type> { E &data; long index; nditerator(E &data, long index); @@ -75,8 +75,8 @@ namespace types template <class E> struct const_nditerator : public std::iterator<std::random_access_iterator_tag, - typename std::remove_reference<decltype( - std::declval<E &>().fast(0))>::type> { + typename std::remove_reference< + decltype(std::declval<E &>().fast(0))>::type> { E const &data; long index; const_nditerator(E const &data, long index); @@ -153,8 +153,8 @@ namespace types template <bool is_strided> struct make_const_nditerator { template <class T> - auto operator()(T const &self, long i) - -> decltype(const_nditerator<T>(self, i)) const; + auto operator()(T const &self, + long i) -> decltype(const_nditerator<T>(self, i)) const; }; template <> @@ -162,7 +162,7 @@ namespace types template <class T> typename T::dtype const *operator()(T const &self, long i) const; }; -} +} // namespace types PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/types/numpy_broadcast.hpp b/contrib/python/pythran/pythran/pythonic/include/types/numpy_broadcast.hpp index 2340b10d16..f86dc628fe 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/numpy_broadcast.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/numpy_broadcast.hpp @@ -87,7 +87,7 @@ namespace types using iterator = const_iterator; T ref; - using shape_t = types::array<long, value>; + using shape_t = types::array_tuple<long, value>; template <size_t I> long shape() const @@ -259,8 +259,10 @@ namespace types template <class T, class B> struct broadcast_dtype { using type = - typename std::conditional<(std::is_integral<T>::value && std::is_integral<B>::value) - ||(std::is_floating_point<T>::value && std::is_floating_point<B>::value), + typename std::conditional<(std::is_integral<T>::value && + std::is_integral<B>::value) || + (std::is_floating_point<T>::value && + std::is_floating_point<B>::value), T, typename __combined<T, B>::type>::type; }; #ifndef USE_XSIMD @@ -299,7 +301,7 @@ namespace types dtype operator[](long) const; template <size_t N> - dtype operator[](array<long, N>) const; + dtype operator[](array_tuple<long, N>) const; template <class S> typename std::enable_if<is_slice<S>::value, broadcast const &>::type diff --git a/contrib/python/pythran/pythran/pythonic/include/types/numpy_expr.hpp b/contrib/python/pythran/pythran/pythonic/include/types/numpy_expr.hpp index c6ae90eb17..0d13801a6b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/numpy_expr.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/numpy_expr.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_TYPES_NUMPY_EXPR_HPP #define PYTHONIC_INCLUDE_TYPES_NUMPY_EXPR_HPP -#include "pythonic/include/utils/meta.hpp" #include "pythonic/include/types/nditerator.hpp" +#include "pythonic/include/utils/meta.hpp" PYTHONIC_NS_BEGIN @@ -85,9 +85,10 @@ namespace types template <class Op, class Steps, class... Iters> struct numpy_expr_iterator - : std::iterator<std::random_access_iterator_tag, - typename std::remove_reference<decltype(std::declval< - Op>()(*std::declval<Iters>()...))>::type> { + : std::iterator< + std::random_access_iterator_tag, + typename std::remove_reference<decltype(std::declval<Op>()( + *std::declval<Iters>()...))>::type> { Steps steps_; std::tuple<Iters...> iters_; @@ -114,8 +115,8 @@ namespace types return Dereferencer<Op>{}(iters_, s); } - auto operator*() const -> decltype( - this->_dereference(utils::make_index_sequence<sizeof...(Iters)>{})) + auto operator*() const -> decltype(this->_dereference( + utils::make_index_sequence<sizeof...(Iters)>{})) { return _dereference(utils::make_index_sequence<sizeof...(Iters)>{}); } @@ -141,9 +142,10 @@ namespace types template <size_t... I> void _incr(utils::index_sequence<I...>) { - (void)std::initializer_list<bool>{_incr_opt<I>(std::integral_constant< - bool, std::is_same<long, typename std::tuple_element< - I, Steps>::type>::value>{})...}; + (void)std::initializer_list<bool>{_incr_opt<I>( + std::integral_constant< + bool, std::is_same<long, typename std::tuple_element< + I, Steps>::type>::value>{})...}; } numpy_expr_iterator &operator++() { @@ -242,14 +244,15 @@ namespace types #ifdef USE_XSIMD template <class E, class Op, class Steps, class SIters, class... Iters> struct numpy_expr_simd_iterator - : std::iterator<std::random_access_iterator_tag, - typename std::remove_reference<decltype(std::declval< - Op>()(*std::declval<Iters>()...))>::type> { + : std::iterator< + std::random_access_iterator_tag, + typename std::remove_reference<decltype(std::declval<Op>()( + *std::declval<Iters>()...))>::type> { Steps steps_; std::tuple<Iters...> iters_; SIters siters_; - numpy_expr_simd_iterator(array<long, sizeof...(Iters)> steps, + numpy_expr_simd_iterator(array_tuple<long, sizeof...(Iters)> steps, SIters const &siters, Iters... iters) : steps_(steps), iters_(iters...), siters_(siters) { @@ -275,8 +278,8 @@ namespace types : (std::get<I>(siters_)))...); } - auto operator*() const -> decltype( - this->_dereference(utils::make_index_sequence<sizeof...(Iters)>{})) + auto operator*() const -> decltype(this->_dereference( + utils::make_index_sequence<sizeof...(Iters)>{})) { return _dereference(utils::make_index_sequence<sizeof...(Iters)>{}); } @@ -302,9 +305,10 @@ namespace types template <size_t... I> void _incr(utils::index_sequence<I...>) { - (void)std::initializer_list<bool>{_incr_opt<I>(std::integral_constant< - bool, std::is_same<long, typename std::tuple_element< - I, Steps>::type>::value>{})...}; + (void)std::initializer_list<bool>{_incr_opt<I>( + std::integral_constant< + bool, std::is_same<long, typename std::tuple_element< + I, Steps>::type>::value>{})...}; } numpy_expr_simd_iterator &operator++() { @@ -404,9 +408,10 @@ namespace types template <class E, class Op, class... Iters> struct numpy_expr_simd_iterator_nobroadcast - : std::iterator<std::random_access_iterator_tag, - typename std::remove_reference<decltype(std::declval< - Op>()(*std::declval<Iters>()...))>::type> { + : std::iterator< + std::random_access_iterator_tag, + typename std::remove_reference<decltype(std::declval<Op>()( + *std::declval<Iters>()...))>::type> { std::tuple<Iters...> iters_; numpy_expr_simd_iterator_nobroadcast(Iters... iters) : iters_(iters...) @@ -433,8 +438,8 @@ namespace types return Op{}((*std::get<I>(iters_))...); } - auto operator*() const -> decltype( - this->_dereference(utils::make_index_sequence<sizeof...(Iters)>{})) + auto operator*() const -> decltype(this->_dereference( + utils::make_index_sequence<sizeof...(Iters)>{})) { return _dereference(utils::make_index_sequence<sizeof...(Iters)>{}); } @@ -563,8 +568,9 @@ namespace types template <class S, class Sp, class... Ss> constexpr size_t count_none(size_t I) { - return I == 0 ? 0 : (std::is_same<S, none_type>::value + - count_none<Sp, Ss...>(I - 1)); + return I == 0 ? 0 + : (std::is_same<S, none_type>::value + + count_none<Sp, Ss...>(I - 1)); } template <class BT, class T> @@ -577,9 +583,9 @@ namespace types } template <size_t... J, class Arg, class Shp, class... S> - auto make_subslice(utils::index_sequence<J...>, Arg const &arg, - Shp const &shp, std::tuple<S...> const &ss) - -> decltype(arg(std::get<J>(ss)...)) + auto + make_subslice(utils::index_sequence<J...>, Arg const &arg, Shp const &shp, + std::tuple<S...> const &ss) -> decltype(arg(std::get<J>(ss)...)) { // we need to adapt_slice to take broadcasting into account return arg(adapt_slice( @@ -610,8 +616,9 @@ namespace types static constexpr size_t value = utils::max_element<std::remove_reference<Args>::type::value...>::value; - using value_type = decltype(Op()(std::declval< - typename std::remove_reference<Args>::type::value_type>()...)); + using value_type = decltype(Op()( + std::declval< + typename std::remove_reference<Args>::type::value_type>()...)); using dtype = decltype(Op()( std::declval<typename std::remove_reference<Args>::type::dtype>()...)); @@ -639,13 +646,12 @@ namespace types #ifdef CYTHON_ABI template <class... Argp> - numpy_expr(numpy_expr<Op, Argp...> const &other) - : args(other.args) + numpy_expr(numpy_expr<Op, Argp...> const &other) : args(other.args) { } #endif - numpy_expr(Args const &... args); + numpy_expr(Args const &...args); template <size_t... I> const_iterator _begin(utils::index_sequence<I...>) const; @@ -694,7 +700,7 @@ namespace types } template <size_t... I> - auto _map_fast(array<long, sizeof...(I)> const &indices, + auto _map_fast(array_tuple<long, sizeof...(I)> const &indices, utils::index_sequence<I...>) const -> decltype(Op()(std::get<I>(args).fast(std::get<I>(indices))...)) { @@ -702,14 +708,15 @@ namespace types } template <class... Indices> - auto map_fast(Indices... indices) const -> decltype( - this->_map_fast(array<long, sizeof...(Indices)>{{indices...}}, - utils::make_index_sequence<sizeof...(Args)>{})); + auto map_fast(Indices... indices) const + -> decltype(this->_map_fast( + array_tuple<long, sizeof...(Indices)>{{indices...}}, + utils::make_index_sequence<sizeof...(Args)>{})); public: template <size_t I> auto shape() const -> decltype(details::init_shape_element<I>( - args, valid_indices<value, std::tuple<Args...>>{})) + args, valid_indices<value, std::tuple<Args...>>{})) { return details::init_shape_element<I>( args, valid_indices<value, std::tuple<Args...>>{}); @@ -733,8 +740,9 @@ namespace types typename std::remove_reference<Args>::type::value_type>...>, typename std::remove_reference<Args>::type::simd_iterator...>; using simd_iterator_nobroadcast = numpy_expr_simd_iterator_nobroadcast< - numpy_expr, Op, typename std::remove_reference< - Args>::type::simd_iterator_nobroadcast...>; + numpy_expr, Op, + typename std::remove_reference< + Args>::type::simd_iterator_nobroadcast...>; template <size_t... I> simd_iterator _vbegin(types::vectorize, utils::index_sequence<I...>) const; simd_iterator vbegin(types::vectorize) const; @@ -754,9 +762,10 @@ namespace types #endif template <size_t... I, class... S> - auto _get(utils::index_sequence<I...> is, S const &... s) const -> decltype( - Op{}(make_subslice(utils::make_index_sequence<sizeof...(S)>{}, - std::get<I>(args), *this, std::make_tuple(s...))...)) + auto _get(utils::index_sequence<I...> is, S const &...s) const + -> decltype(Op{}( + make_subslice(utils::make_index_sequence<sizeof...(S)>{}, + std::get<I>(args), *this, std::make_tuple(s...))...)) { return Op{}(make_subslice(utils::make_index_sequence<sizeof...(S)>{}, std::get<I>(args), *this, @@ -764,7 +773,7 @@ namespace types } template <class... S> - auto operator()(S const &... s) const + auto operator()(S const &...s) const -> decltype(this->_get(utils::make_index_sequence<sizeof...(Args)>{}, s...)); @@ -811,14 +820,13 @@ namespace types } template <class S> auto operator[](S s) const - -> decltype((*this) - ._index((s.lower, s), - utils::make_index_sequence<sizeof...(Args)>{})) + -> decltype((*this)._index( + (s.lower, s), utils::make_index_sequence<sizeof...(Args)>{})) { return _index(s, utils::make_index_sequence<sizeof...(Args)>{}); } - dtype operator[](array<long, value> const &indices) const + dtype operator[](array_tuple<long, value> const &indices) const { return _index(indices, utils::make_index_sequence<sizeof...(Args)>{}); } @@ -829,7 +837,7 @@ namespace types long size() const; }; -} +} // namespace types template <class Op, class... Args> struct assignable<types::numpy_expr<Op, Args...>> { @@ -882,8 +890,8 @@ struct __combined<pythonic::types::numpy_expr<Op, Args...>, pythonic::types::numpy_expr<Op2, Args2...>> { using type = pythonic::types::ndarray< typename pythonic::types::numpy_expr<Op, Args...>::dtype, - pythonic::types::array<long, - pythonic::types::numpy_expr<Op, Args...>::value>>; + pythonic::types::array_tuple< + long, pythonic::types::numpy_expr<Op, Args...>::value>>; }; template <class E, class Op, class... Args> struct __combined<pythonic::types::numpy_iexpr<E>, @@ -907,8 +915,8 @@ struct __combined<pythonic::types::numpy_expr<Op, Args...>, pythonic::types::numpy_texpr<T>> { using type = pythonic::types::ndarray< typename pythonic::types::numpy_expr<Op, Args...>::dtype, - pythonic::types::array<long, - pythonic::types::numpy_expr<Op, Args...>::value>>; + pythonic::types::array_tuple< + long, pythonic::types::numpy_expr<Op, Args...>::value>>; }; template <class T, class Op, class... Args> @@ -916,8 +924,8 @@ struct __combined<pythonic::types::numpy_texpr<T>, pythonic::types::numpy_expr<Op, Args...>> { using type = pythonic::types::ndarray< typename pythonic::types::numpy_expr<Op, Args...>::dtype, - pythonic::types::array<long, - pythonic::types::numpy_expr<Op, Args...>::value>>; + pythonic::types::array_tuple< + long, pythonic::types::numpy_expr<Op, Args...>::value>>; }; /*}*/ diff --git a/contrib/python/pythran/pythran/pythonic/include/types/numpy_gexpr.hpp b/contrib/python/pythran/pythran/pythonic/include/types/numpy_gexpr.hpp index cda948ff80..9057e4da1f 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/numpy_gexpr.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/numpy_gexpr.hpp @@ -150,12 +150,12 @@ namespace types typename std::enable_if< !is_slice<F>::value, numpy_gexpr<ndarray<typename std::decay<E>::type::dtype, - array<long, std::decay<E>::type::value>>, + array_tuple<long, std::decay<E>::type::value>>, cstride_normalized_slice<1>, normalize_t<S>...>>::type operator()(E &&expr, F const &s0, S const &...s) { return numpy_vexpr<ndarray<typename std::decay<E>::type::dtype, - array<long, std::decay<E>::type::value>>, + array_tuple<long, std::decay<E>::type::value>>, F>{std::forward<E>(expr), s0}( fast_contiguous_slice(none_type{}, none_type{}), s...); } @@ -234,9 +234,10 @@ namespace types } template <class T, class Ts> - auto - tuple_push_head(T const &val, Ts const &vals) -> decltype(tuple_push_head( - val, vals, utils::make_index_sequence<std::tuple_size<Ts>::value>())) + auto tuple_push_head(T const &val, Ts const &vals) + -> decltype(tuple_push_head( + val, vals, + utils::make_index_sequence<std::tuple_size<Ts>::value>())) { return tuple_push_head( val, vals, utils::make_index_sequence<std::tuple_size<Ts>::value>()); @@ -515,13 +516,13 @@ namespace types }; template <class... Tys> - struct gexpr_shape<pshape<Tys...>, array<long, 0>> { + struct gexpr_shape<pshape<Tys...>, array_tuple<long, 0>> { using type = pshape<Tys...>; }; template <class... Tys, size_t N> - struct gexpr_shape<pshape<Tys...>, array<long, N>> - : gexpr_shape<pshape<Tys..., long>, array<long, N - 1>> { + struct gexpr_shape<pshape<Tys...>, array_tuple<long, N>> + : gexpr_shape<pshape<Tys..., long>, array_tuple<long, N - 1>> { }; template <class... Tys, class... oTys, class... S, long stride> @@ -548,12 +549,12 @@ namespace types : gexpr_shape<pshape<Tys..., long>, pshape<oTys...>, S...> { }; template <class... Tys, size_t N, class... S> - struct gexpr_shape<pshape<Tys...>, array<long, N>, long, S...> - : gexpr_shape<pshape<Tys...>, array<long, N - 1>, S...> { + struct gexpr_shape<pshape<Tys...>, array_tuple<long, N>, long, S...> + : gexpr_shape<pshape<Tys...>, array_tuple<long, N - 1>, S...> { }; template <class... Tys, size_t N, class cS, class... S> - struct gexpr_shape<pshape<Tys...>, array<long, N>, cS, S...> - : gexpr_shape<pshape<Tys..., long>, array<long, N - 1>, S...> { + struct gexpr_shape<pshape<Tys...>, array_tuple<long, N>, cS, S...> + : gexpr_shape<pshape<Tys..., long>, array_tuple<long, N - 1>, S...> { }; template <class pS, class... S> @@ -640,13 +641,13 @@ namespace types template <long stride> static constexpr types::pshape<std::integral_constant<long, stride>> last_stride(cstride_normalized_slice<stride>); - static constexpr types::array<long, 1> last_stride(...); + static constexpr types::array_tuple<long, 1> last_stride(...); - sutils::concat_t<types::array<long, value - 1>, + sutils::concat_t<types::array_tuple<long, value - 1>, typename std::conditional< sizeof...(S) == std::decay<Arg>::type::value, decltype(last_stride(std::declval<last_slice_t>())), - types::array<long, 1>>::type> + types::array_tuple<long, 1>>::type> _strides; // strides template <size_t I> @@ -743,6 +744,9 @@ namespace types _copy(E const &expr); template <class E> + numpy_gexpr &_copy_restrict(E const &expr); + + template <class E> numpy_gexpr &operator=(E const &expr); numpy_gexpr &operator=(numpy_gexpr const &expr); @@ -814,22 +818,23 @@ namespace types void store(E elt, Indices... indices) { static_assert(is_dtype<E>::value, "valid store"); - *(buffer + noffset<value>{}(*this, array<long, value>{{indices...}})) = + *(buffer + + noffset<value>{}(*this, array_tuple<long, value>{{indices...}})) = static_cast<E>(elt); } template <class... Indices> dtype load(Indices... indices) const { return *(buffer + - noffset<value>{}(*this, array<long, value>{{indices...}})); + noffset<value>{}(*this, array_tuple<long, value>{{indices...}})); } template <class Op, class E, class... Indices> void update(E elt, Indices... indices) const { static_assert(is_dtype<E>::value, "valid store"); - Op{}( - *(buffer + noffset<value>{}(*this, array<long, value>{{indices...}})), - static_cast<E>(elt)); + Op{}(*(buffer + + noffset<value>{}(*this, array_tuple<long, value>{{indices...}})), + static_cast<E>(elt)); } #ifdef USE_XSIMD @@ -845,24 +850,26 @@ namespace types auto operator()(Sp const &...s) const -> decltype(make_gexpr(*this, s...)); template <class Sp> - auto operator[](Sp const &s) const -> typename std::enable_if< - is_slice<Sp>::value, decltype(make_gexpr(*this, (s.lower, s)))>::type; + auto operator[](Sp const &s) const -> + typename std::enable_if<is_slice<Sp>::value, + decltype(make_gexpr(*this, + (s.lower, s)))>::type; template <size_t M> - auto fast(array<long, M> const &indices) + auto fast(array_tuple<long, M> const &indices) const & -> decltype(nget<M - 1>().fast(*this, indices)); template <size_t M> - auto fast(array<long, M> const &indices) && -> decltype(nget<M - 1>().fast( - std::move(*this), indices)); + auto fast(array_tuple<long, M> const &indices) + && -> decltype(nget<M - 1>().fast(std::move(*this), indices)); template <size_t M> - auto operator[](array<long, M> const &indices) + auto operator[](array_tuple<long, M> const &indices) const & -> decltype(nget<M - 1>()(*this, indices)); template <size_t M> - auto operator[](array<long, M> const &indices) && -> decltype(nget<M - 1>()( - std::move(*this), indices)); + auto operator[](array_tuple<long, M> const &indices) + && -> decltype(nget<M - 1>()(std::move(*this), indices)); template <class F> // indexing through an array of indices -- a view typename std::enable_if<is_numexpr_arg<F>::value && @@ -927,9 +934,10 @@ namespace types } template <class Tp, size_t... Is> - auto recast(utils::index_sequence<Is...>) -> decltype(make_gexpr( - arg.template recast<Tp>(), - recast_slice<sizeof(dtype), sizeof(Tp)>(std::get<Is>(slices))...)) + auto recast(utils::index_sequence<Is...>) + -> decltype(make_gexpr( + arg.template recast<Tp>(), + recast_slice<sizeof(dtype), sizeof(Tp)>(std::get<Is>(slices))...)) { return make_gexpr( arg.template recast<Tp>(), @@ -937,8 +945,8 @@ namespace types } template <class Tp> - auto recast() - -> decltype(recast<Tp>(utils::make_index_sequence<sizeof...(S)>())) + auto + recast() -> decltype(recast<Tp>(utils::make_index_sequence<sizeof...(S)>())) { return recast<Tp>(utils::make_index_sequence<sizeof...(S)>()); } @@ -988,8 +996,8 @@ struct __combined<pythonic::types::numpy_gexpr<Arg, S...>, using type = pythonic::types::ndarray < typename __combined<typename t0::dtype, typename t1::dtype>::type, - pythonic::types::array<long, - t0::value<t1::value ? t1::value : t0::value>>; + pythonic::types::array_tuple< + long, t0::value<t1::value ? t1::value : t0::value>>; }; template <class Arg, class... S, class O> diff --git a/contrib/python/pythran/pythran/pythonic/include/types/numpy_iexpr.hpp b/contrib/python/pythran/pythran/pythonic/include/types/numpy_iexpr.hpp index 18cd024213..d0a6526231 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/numpy_iexpr.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/numpy_iexpr.hpp @@ -14,9 +14,9 @@ namespace types template <size_t L> struct noffset { template <class S, class Ty, size_t M> - long operator()(S const &strides, array<Ty, M> const &indices) const; + long operator()(S const &strides, array_tuple<Ty, M> const &indices) const; template <class S, class Ty, size_t M, class pS> - long operator()(S const &strides, array<Ty, M> const &indices, + long operator()(S const &strides, array_tuple<Ty, M> const &indices, pS const &shape) const; }; @@ -175,11 +175,11 @@ namespace types return numpy_iexpr_helper<value>::get(std::move(*this), i); } - dtype const &fast(array<long, value> const &indices) const; - dtype &fast(array<long, value> const &indices); + dtype const &fast(array_tuple<long, value> const &indices) const; + dtype &fast(array_tuple<long, value> const &indices); template <size_t M> - auto fast(array<long, M> const &indices) const + auto fast(array_tuple<long, M> const &indices) const -> decltype(nget<M - 1>()(*this, indices)) { return nget<M - 1>()(*this, indices); @@ -197,7 +197,8 @@ namespace types { static_assert(is_dtype<E>::value, "valid store"); assert(buffer); - *(buffer + noffset<value>{}(*this, array<long, value>{{indices...}})) = + *(buffer + + noffset<value>{}(*this, array_tuple<long, value>{{indices...}})) = static_cast<E>(elt); } template <class... Indices> @@ -205,16 +206,16 @@ namespace types { assert(buffer); return *(buffer + - noffset<value>{}(*this, array<long, value>{{indices...}})); + noffset<value>{}(*this, array_tuple<long, value>{{indices...}})); } template <class Op, class E, class... Indices> void update(E elt, Indices... indices) const { static_assert(is_dtype<E>::value, "valid store"); assert(buffer); - Op{}( - *(buffer + noffset<value>{}(*this, array<long, value>{{indices...}})), - static_cast<E>(elt)); + Op{}(*(buffer + + noffset<value>{}(*this, array_tuple<long, value>{{indices...}})), + static_cast<E>(elt)); } #ifdef USE_XSIMD @@ -258,10 +259,10 @@ namespace types numpy_gexpr<numpy_iexpr, normalize_t<Sp>>>::type operator[](Sp const &s0) const; - dtype const &operator[](array<long, value> const &indices) const; - dtype &operator[](array<long, value> const &indices); + dtype const &operator[](array_tuple<long, value> const &indices) const; + dtype &operator[](array_tuple<long, value> const &indices); template <size_t M> - auto operator[](array<long, M> const &indices) + auto operator[](array_tuple<long, M> const &indices) const & -> decltype(nget<M - 1>()(*this, indices)) { return nget<M - 1>()(*this, indices); diff --git a/contrib/python/pythran/pythran/pythonic/include/types/numpy_nary_expr.hpp b/contrib/python/pythran/pythran/pythonic/include/types/numpy_nary_expr.hpp index df7142e881..dd42278b3b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/numpy_nary_expr.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/numpy_nary_expr.hpp @@ -26,10 +26,11 @@ namespace functor NUMPY_NARY_EXTRA_METHOD template <typename... T> - auto operator()(T &&... args) const -> typename std::enable_if< - !types::valid_numexpr_parameters< - typename std::decay<T>::type...>::value, - decltype(NUMPY_NARY_FUNC_SYM(std::forward<T>(args)...))>::type; + auto operator()(T &&...args) const -> + typename std::enable_if< + !types::valid_numexpr_parameters< + typename std::decay<T>::type...>::value, + decltype(NUMPY_NARY_FUNC_SYM(std::forward<T>(args)...))>::type; template <class... E> typename std::enable_if< @@ -37,14 +38,14 @@ namespace functor types::numpy_expr< NUMPY_NARY_FUNC_NAME, typename types::NUMPY_NARY_RESHAPE_MODE<E, E...>::type...>>::type - operator()(E &&... args) const; + operator()(E &&...args) const; friend std::ostream &operator<<(std::ostream &os, NUMPY_NARY_FUNC_NAME) { return os << STR(NUMPY_NARY_FUNC_NAME); } }; -} +} // namespace functor #undef NUMPY_NARY_FUNC_NAME #undef NUMPY_NARY_FUNC_SYM diff --git a/contrib/python/pythran/pythran/pythonic/include/types/numpy_op_helper.hpp b/contrib/python/pythran/pythran/pythonic/include/types/numpy_op_helper.hpp index 226c883ffb..d61e0b875b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/numpy_op_helper.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/numpy_op_helper.hpp @@ -63,6 +63,12 @@ namespace types template <class T, class S> struct any_numop_arg<sliced_list<T, S>> : std::false_type { }; + template <class T> + struct any_numop_arg<array<T>> : std::false_type { + }; + template <class T, class S> + struct any_numop_arg<sliced_array<T, S>> : std::false_type { + }; template <class T, size_t N, class V> struct any_numop_arg<array_base<T, N, V>> : std::false_type { }; @@ -217,7 +223,7 @@ namespace types struct is_array_index : std::false_type { }; template <size_t N> - struct is_array_index<array<long, N>> : std::true_type { + struct is_array_index<array_tuple<long, N>> : std::true_type { }; } // namespace types PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/include/types/numpy_operators.hpp b/contrib/python/pythran/pythran/pythonic/include/types/numpy_operators.hpp index 6a8a1dacc1..4348df93d0 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/numpy_operators.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/numpy_operators.hpp @@ -1,27 +1,27 @@ #ifndef PYTHONIC_INCLUDE_TYPES_NUMPY_OPERATORS_HPP #define PYTHONIC_INCLUDE_TYPES_NUMPY_OPERATORS_HPP -#include "pythonic/include/types/numpy_broadcast.hpp" +#include "pythonic/include/numpy/bitwise_not.hpp" +#include "pythonic/include/numpy/mod.hpp" #include "pythonic/include/operator_/add.hpp" #include "pythonic/include/operator_/and_.hpp" -#include "pythonic/include/operator_/or_.hpp" -#include "pythonic/include/operator_/xor_.hpp" #include "pythonic/include/operator_/div.hpp" #include "pythonic/include/operator_/eq.hpp" -#include "pythonic/include/operator_/gt.hpp" #include "pythonic/include/operator_/ge.hpp" +#include "pythonic/include/operator_/gt.hpp" +#include "pythonic/include/operator_/le.hpp" #include "pythonic/include/operator_/lshift.hpp" #include "pythonic/include/operator_/lt.hpp" -#include "pythonic/include/operator_/le.hpp" #include "pythonic/include/operator_/mul.hpp" +#include "pythonic/include/operator_/ne.hpp" #include "pythonic/include/operator_/neg.hpp" #include "pythonic/include/operator_/not_.hpp" -#include "pythonic/include/operator_/ne.hpp" +#include "pythonic/include/operator_/or_.hpp" #include "pythonic/include/operator_/pos.hpp" #include "pythonic/include/operator_/rshift.hpp" #include "pythonic/include/operator_/sub.hpp" -#include "pythonic/include/numpy/mod.hpp" -#include "pythonic/include/numpy/bitwise_not.hpp" +#include "pythonic/include/operator_/xor_.hpp" +#include "pythonic/include/types/numpy_broadcast.hpp" #include "pythonic/include/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -107,7 +107,7 @@ namespace types #define NUMPY_BINARY_FUNC_NAME operator- #define NUMPY_BINARY_FUNC_SYM operator_::functor::sub #include "pythonic/include/types/numpy_binary_op.hpp" -} +} // namespace types PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/types/numpy_texpr.hpp b/contrib/python/pythran/pythran/pythonic/include/types/numpy_texpr.hpp index 5f7f29f218..592bbaf76e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/numpy_texpr.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/numpy_texpr.hpp @@ -73,15 +73,15 @@ namespace types -> decltype(this->arg(fast_contiguous_slice(pythonic::builtins::None, pythonic::builtins::None), i)); - auto fast(array<long, value> const &indices) - -> decltype(arg.fast(array<long, 2>{{indices[1], indices[0]}})) + auto fast(array_tuple<long, value> const &indices) + -> decltype(arg.fast(array_tuple<long, 2>{{indices[1], indices[0]}})) { - return arg.fast(array<long, 2>{{indices[1], indices[0]}}); + return arg.fast(array_tuple<long, 2>{{indices[1], indices[0]}}); } - auto fast(array<long, value> const &indices) const - -> decltype(arg.fast(array<long, 2>{{indices[1], indices[0]}})) + auto fast(array_tuple<long, value> const &indices) const + -> decltype(arg.fast(array_tuple<long, 2>{{indices[1], indices[0]}})) { - return arg.fast(array<long, 2>{{indices[1], indices[0]}}); + return arg.fast(array_tuple<long, 2>{{indices[1], indices[0]}}); } auto load(long i, long j) const -> decltype(arg.load(j, i)) @@ -157,16 +157,16 @@ namespace types auto operator[](long i) const -> decltype(this->fast(i)); auto operator[](long i) -> decltype(this->fast(i)); template <class T> - auto operator[](array<T, value> const &indices) - -> decltype(arg[array<T, 2>{{indices[1], indices[0]}}]) + auto operator[](array_tuple<T, value> const &indices) + -> decltype(arg[array_tuple<T, 2>{{indices[1], indices[0]}}]) { - return arg[array<T, 2>{{indices[1], indices[0]}}]; + return arg[array_tuple<T, 2>{{indices[1], indices[0]}}]; } template <class T> - auto operator[](array<T, value> const &indices) const - -> decltype(arg[array<T, 2>{{indices[1], indices[0]}}]) + auto operator[](array_tuple<T, value> const &indices) const + -> decltype(arg[array_tuple<T, 2>{{indices[1], indices[0]}}]) { - return arg[array<T, 2>{{indices[1], indices[0]}}]; + return arg[array_tuple<T, 2>{{indices[1], indices[0]}}]; } template <class T0, class T1> auto operator[](std::tuple<T0, T1> const &indices) @@ -188,20 +188,22 @@ namespace types } template <class S> - auto operator[](S const &s0) const -> numpy_texpr< - decltype(this->arg(fast_contiguous_slice(pythonic::builtins::None, - pythonic::builtins::None), - (s0.step, s0)))>; + auto operator[](S const &s0) const + -> numpy_texpr< + decltype(this->arg(fast_contiguous_slice(pythonic::builtins::None, + pythonic::builtins::None), + (s0.step, s0)))>; template <class S> - auto operator[](S const &s0) -> numpy_texpr< - decltype(this->arg(fast_contiguous_slice(pythonic::builtins::None, - pythonic::builtins::None), - (s0.step, s0)))>; + auto + operator[](S const &s0) -> numpy_texpr<decltype(this->arg( + fast_contiguous_slice(pythonic::builtins::None, + pythonic::builtins::None), + (s0.step, s0)))>; template <class S, size_t... I> auto _reverse_index(S const &indices, utils::index_sequence<I...>) const - -> decltype( - numpy::functor::transpose{}(this->arg(std::get<I>(indices)...))) + -> decltype(numpy::functor::transpose{}( + this->arg(std::get<I>(indices)...))) { return numpy::functor::transpose{}(arg(std::get<I>(indices)...)); } @@ -211,19 +213,20 @@ namespace types } template <class Tp, size_t... Is> - auto recast() - -> decltype(numpy::functor::transpose{}(arg.template recast<Tp>())) + auto + recast() -> decltype(numpy::functor::transpose{}(arg.template recast<Tp>())) { return numpy::functor::transpose{}(arg.template recast<Tp>()); } template <class S0, class... S> - auto - operator()(S0 const &s0, S const &...s) const -> typename std::enable_if< - !is_numexpr_arg<S0>::value, - decltype(this->_reverse_index( - std::tuple<S0 const &, S const &...>{s0, s...}, - utils::make_reversed_index_sequence<1 + sizeof...(S)>()))>::type; + auto operator()(S0 const &s0, S const &...s) const -> + typename std::enable_if< + !is_numexpr_arg<S0>::value, + decltype(this->_reverse_index( + std::tuple<S0 const &, S const &...>{s0, s...}, + utils::make_reversed_index_sequence<1 + sizeof...(S)>()))>:: + type; template <class S0, class... S> auto operator()(S0 const &s0, S const &...s) const -> @@ -280,16 +283,16 @@ namespace types using numpy_texpr_2<ndarray<T, pshape<S0, S1>>>::operator=; }; template <class T> - struct numpy_texpr<ndarray<T, array<long, 2>>> - : numpy_texpr_2<ndarray<T, array<long, 2>>> { + struct numpy_texpr<ndarray<T, array_tuple<long, 2>>> + : numpy_texpr_2<ndarray<T, array_tuple<long, 2>>> { numpy_texpr() = default; numpy_texpr(numpy_texpr const &) = default; numpy_texpr(numpy_texpr &&) = default; - numpy_texpr(ndarray<T, array<long, 2>> const &arg); + numpy_texpr(ndarray<T, array_tuple<long, 2>> const &arg); numpy_texpr &operator=(numpy_texpr const &) = default; - using numpy_texpr_2<ndarray<T, array<long, 2>>>::operator=; + using numpy_texpr_2<ndarray<T, array_tuple<long, 2>>>::operator=; }; template <class E, class... S> @@ -314,7 +317,7 @@ namespace types static constexpr auto value = broadcasted<E>::value; using value_type = broadcast<typename E::dtype, typename E::dtype>; using dtype = typename broadcasted<E>::dtype; - using shape_t = types::array<long, value>; + using shape_t = types::array_tuple<long, value>; using iterator = nditerator<numpy_texpr<broadcasted<E>>>; using const_iterator = const_nditerator<numpy_texpr<broadcasted<E>>>; // FIXME: I've got the feeling that this could be improved diff --git a/contrib/python/pythran/pythran/pythonic/include/types/numpy_vexpr.hpp b/contrib/python/pythran/pythran/pythonic/include/types/numpy_vexpr.hpp index 02c5f1e5cf..a58d796f91 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/numpy_vexpr.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/numpy_vexpr.hpp @@ -48,7 +48,7 @@ namespace types numpy_vexpr &operator=(numpy_vexpr const &); - using shape_t = array<long, value>; + using shape_t = array_tuple<long, value>; template <size_t I> long shape() const { @@ -97,8 +97,8 @@ namespace types return data_.fast(view_.fast(i)); } template <class... S> - auto operator()(S const &... slices) const - -> decltype(ndarray<dtype, array<long, value>>{*this}(slices...)); + auto operator()(S const &...slices) const + -> decltype(ndarray<dtype, array_tuple<long, value>>{*this}(slices...)); auto operator[](long i) const -> decltype(data_[i]) { @@ -171,7 +171,7 @@ namespace types template <class E> numpy_vexpr &operator^=(E const &expr); }; -} +} // namespace types template <class T, class F> struct assignable<types::numpy_vexpr<T, F>> { diff --git a/contrib/python/pythran/pythran/pythonic/include/types/pointer.hpp b/contrib/python/pythran/pythran/pythonic/include/types/pointer.hpp index cdb8513093..ee6fddb21c 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/pointer.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/pointer.hpp @@ -19,7 +19,7 @@ namespace types reference fast(long); value_type fast(long) const; }; -} +} // namespace types PYTHONIC_NS_END namespace std @@ -40,7 +40,7 @@ namespace std struct tuple_element<I, pythonic::types::pointer<T>> { typedef typename pythonic::types::pointer<T>::value_type type; }; -} +} // namespace std #ifdef ENABLE_PYTHON_MODULE diff --git a/contrib/python/pythran/pythran/pythonic/include/types/raw_array.hpp b/contrib/python/pythran/pythran/pythonic/include/types/raw_array.hpp index b27bcc8395..55f3548837 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/raw_array.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/raw_array.hpp @@ -33,7 +33,7 @@ namespace types private: bool external; }; -} +} // namespace types PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/types/static_if.hpp b/contrib/python/pythran/pythran/pythonic/include/types/static_if.hpp index 86e4b6c946..f5cb1f7038 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/static_if.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/static_if.hpp @@ -124,7 +124,7 @@ namespace types { } }; -} +} // namespace types PYTHONIC_NS_END @@ -181,7 +181,7 @@ namespace std { return t.get(std::integral_constant<size_t, I>{}); } -} +} // namespace std /* type inference stuff { */ #include "pythonic/include/types/combined.hpp" diff --git a/contrib/python/pythran/pythran/pythonic/include/types/str.hpp b/contrib/python/pythran/pythran/pythonic/include/types/str.hpp index 4771a181fb..ca373c734f 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/str.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/str.hpp @@ -328,8 +328,9 @@ namespace operator_ { template <size_t N, class Arg> - auto mod(const char (&fmt)[N], Arg &&arg) - -> decltype(pythonic::types::str(fmt) % std::forward<Arg>(arg)); + auto mod(const char (&fmt)[N], + Arg &&arg) -> decltype(pythonic::types::str(fmt) % + std::forward<Arg>(arg)); pythonic::types::str add(char const *self, char const *other); @@ -355,7 +356,9 @@ struct assignable<char[N]> { using type = types::str; }; template <size_t N> -struct assignable<char const [N]> { using type = types::str; }; +struct assignable<char const[N]> { + using type = types::str; +}; PYTHONIC_NS_END namespace std diff --git a/contrib/python/pythran/pythran/pythonic/include/types/traits.hpp b/contrib/python/pythran/pythran/pythonic/include/types/traits.hpp index 1434466419..c14ca8fce6 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/traits.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/traits.hpp @@ -47,8 +47,9 @@ namespace types static std::integral_constant<bool, true> _test(decltype(&C::member)); \ template <class C> \ static std::integral_constant<bool, false> _test(...); \ - static const bool value = decltype( \ - _test<typename std::remove_reference<T>::type>(nullptr))::value; \ + static const bool value = \ + decltype(_test<typename std::remove_reference<T>::type>( \ + nullptr))::value; \ }; /* trait to check if a type is iterable*/ @@ -87,7 +88,7 @@ namespace types struct len_of { static long constexpr value = -1; }; -} +} // namespace types PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/types/tuple.hpp b/contrib/python/pythran/pythran/pythonic/include/types/tuple.hpp index 40c6f55a9f..a5eed3475e 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/tuple.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/tuple.hpp @@ -66,7 +66,7 @@ namespace types }; template <class T, size_t N> - using array = array_base<T, N, tuple_version>; + using array_tuple = array_base<T, N, tuple_version>; template <class T, size_t N> using static_list = array_base<T, N, list_version>; @@ -134,7 +134,7 @@ namespace types template <class... Tys> struct iterator<pshape<Tys...>> { - using type = array<long, sizeof...(Tys)>; + using type = array_tuple<long, sizeof...(Tys)>; }; template <long N> @@ -230,16 +230,17 @@ namespace types pshape &operator=(pshape &&) = default; template <size_t... Is> - types::array<long, sizeof...(Tys)> array(utils::index_sequence<Is...>) const + types::array_tuple<long, sizeof...(Tys)> + array(utils::index_sequence<Is...>) const { return {{get<Is>()...}}; } - types::array<long, sizeof...(Tys)> array() const + types::array_tuple<long, sizeof...(Tys)> array() const { return array(utils::make_index_sequence<sizeof...(Tys)>()); } - operator types::array<long, sizeof...(Tys)>() const + operator types::array_tuple<long, sizeof...(Tys)>() const { return array(); } @@ -275,14 +276,14 @@ namespace types struct array_base_slicer { template <class T, size_t N> - dynamic_tuple<T> operator()(array<T, N> const &b, slice const &s); + dynamic_tuple<T> operator()(array_tuple<T, N> const &b, slice const &s); template <class T, size_t N, long stride> - dynamic_tuple<T> operator()(array<T, N> const &b, + dynamic_tuple<T> operator()(array_tuple<T, N> const &b, cstride_slice<stride> const &s); template <class T, size_t N> - dynamic_tuple<T> operator()(array<T, N> const &b, + dynamic_tuple<T> operator()(array_tuple<T, N> const &b, fast_contiguous_slice const &s); template <class T, size_t N, class S> @@ -404,8 +405,8 @@ namespace types const_reference operator[](long __n) const noexcept; template <class S> - auto operator[](S s) const - -> decltype(array_base_slicer{}(*this, (s.lower, s))) + auto operator[](S s) const -> decltype(array_base_slicer{}(*this, + (s.lower, s))) { return array_base_slicer{}(*this, s); } @@ -483,8 +484,8 @@ namespace types using shape_t = typename shape_builder<array_base, value>::type; template <size_t I> - auto shape() const - -> decltype(details::extract_shape(*this, utils::int_<I>{})) + auto shape() const -> decltype(details::extract_shape(*this, + utils::int_<I>{})) { return details::extract_shape(*this, utils::int_<I>{}); } @@ -587,7 +588,7 @@ namespace types template <class... Types> struct _make_tuple<true, Types...> { - types::array<typename alike<Types...>::type, sizeof...(Types)> + types::array_tuple<typename alike<Types...>::type, sizeof...(Types)> operator()(Types &&...types) { return {{std::forward<Types>(types)...}}; @@ -609,14 +610,14 @@ namespace types using make_tuple_t = decltype(types::make_tuple(std::declval<Tys>()...)); template <class T, class Tuple, size_t... S> - types::array<T, sizeof...(S)> _to_array(Tuple const &t, - utils::index_sequence<S...>) + types::array_tuple<T, sizeof...(S)> _to_array(Tuple const &t, + utils::index_sequence<S...>) { return {{static_cast<T>(std::get<S>(t))...}}; } template <class T, class... Tys> - types::array<T, sizeof...(Tys)> to_array(std::tuple<Tys...> const &t) + types::array_tuple<T, sizeof...(Tys)> to_array(std::tuple<Tys...> const &t) { return _to_array<T>(t, utils::make_index_sequence<sizeof...(Tys)>()); } @@ -734,8 +735,9 @@ struct __combined<pythonic::types::static_list<T, N>, }; template <class T, size_t N> -struct __combined<pythonic::types::array<T, N>, pythonic::types::array<T, N>> { - using type = pythonic::types::array<T, N>; +struct __combined<pythonic::types::array_tuple<T, N>, + pythonic::types::array_tuple<T, N>> { + using type = pythonic::types::array_tuple<T, N>; }; template <class T0, class T1, size_t N, class V> @@ -833,8 +835,9 @@ struct __combined<std::tuple<t0...>, static std::tuple<typename pythonic::details::pick_combined< typename std::tuple_element<Is, holder>::type, t, I == Is>::type...> make_type(pythonic::utils::index_sequence<Is...>); - static auto make_type() -> decltype(make_type( - pythonic::utils::make_index_sequence<sizeof...(t0)>())); + static auto + make_type() -> decltype(make_type( + pythonic::utils::make_index_sequence<sizeof...(t0)>())); using type = decltype(make_type()); }; @@ -844,23 +847,23 @@ struct __combined<indexable_container<k, t>, std::tuple<t0...>> }; template <class t, size_t n, class... types> -struct __combined<pythonic::types::array<t, n>, std::tuple<types...>> { +struct __combined<pythonic::types::array_tuple<t, n>, std::tuple<types...>> { using type = std::tuple<typename __combined<t, types>::type...>; }; template <class t, size_t n, class... types> -struct __combined<pythonic::types::array<t, n>, +struct __combined<pythonic::types::array_tuple<t, n>, pythonic::types::pshape<types...>> { - using type = pythonic::types::array<t, n>; + using type = pythonic::types::array_tuple<t, n>; }; template <class t, size_t n, class... types> struct __combined<pythonic::types::pshape<types...>, - pythonic::types::array<t, n>> { - using type = pythonic::types::array<t, n>; + pythonic::types::array_tuple<t, n>> { + using type = pythonic::types::array_tuple<t, n>; }; template <class t, size_t n, class... types> -struct __combined<std::tuple<types...>, pythonic::types::array<t, n>> { +struct __combined<std::tuple<types...>, pythonic::types::array_tuple<t, n>> { using type = std::tuple<typename __combined<types, t>::type...>; }; template <class t00, class t01, class t10, class t11> @@ -946,7 +949,7 @@ namespace sutils template <typename T, size_t N, class V> struct make_shape<types::array_base<T, N, V>> { - using type = types::array<long, N>; + using type = types::array_tuple<long, N>; }; template <class T> @@ -1050,8 +1053,8 @@ namespace sutils template <class T> struct transpose; template <class T> - struct transpose<types::array<T, 2>> { - using type = types::array<T, 2>; + struct transpose<types::array_tuple<T, 2>> { + using type = types::array_tuple<T, 2>; }; template <class T0, class T1> @@ -1118,7 +1121,7 @@ namespace sutils }; template <typename T, size_t N, class V> struct pop_tail<types::array_base<T, N, V>> { - using type = types::array<T, N - 1>; + using type = types::array_tuple<T, N - 1>; }; template <class T> @@ -1130,7 +1133,7 @@ namespace sutils }; template <typename T, size_t N, class V> struct pop_head<types::array_base<T, N, V>> { - using type = types::array<T, N - 1>; + using type = types::array_tuple<T, N - 1>; }; template <class T> @@ -1155,7 +1158,8 @@ namespace sutils using head_t = typename head<T>::type; template <class... Tys> - types::array<long, sizeof...(Tys)> array(types::pshape<Tys...> const &pS) + types::array_tuple<long, sizeof...(Tys)> + array(types::pshape<Tys...> const &pS) { return pS.array(); } @@ -1166,8 +1170,8 @@ namespace sutils return pS; } template <class E, size_t... Is> - types::array<long, sizeof...(Is)> getshape(E const &e, - utils::index_sequence<Is...>) + types::array_tuple<long, sizeof...(Is)> getshape(E const &e, + utils::index_sequence<Is...>) { return {(long)(e.template shape<Is>())...}; } @@ -1192,27 +1196,27 @@ namespace sutils }; template <class... Tys> - struct concat<types::pshape<Tys...>, types::array<long, 0>> { + struct concat<types::pshape<Tys...>, types::array_tuple<long, 0>> { using type = types::pshape<Tys...>; }; template <class... Tys, size_t N> - struct concat<types::pshape<Tys...>, types::array<long, N>> - : concat<types::pshape<Tys..., long>, types::array<long, N - 1>> { + struct concat<types::pshape<Tys...>, types::array_tuple<long, N>> + : concat<types::pshape<Tys..., long>, types::array_tuple<long, N - 1>> { }; template <class... Ty1s> - struct concat<types::array<long, 0>, types::pshape<Ty1s...>> { + struct concat<types::array_tuple<long, 0>, types::pshape<Ty1s...>> { using type = types::pshape<Ty1s...>; }; template <size_t N, class... Ty1s> - struct concat<types::array<long, N>, types::pshape<Ty1s...>> - : concat<types::array<long, N - 1>, types::pshape<long, Ty1s...>> { + struct concat<types::array_tuple<long, N>, types::pshape<Ty1s...>> + : concat<types::array_tuple<long, N - 1>, types::pshape<long, Ty1s...>> { }; template <size_t N, size_t M> - struct concat<types::array<long, N>, types::array<long, M>> { - using type = types::array<long, N + M>; + struct concat<types::array_tuple<long, N>, types::array_tuple<long, M>> { + using type = types::array_tuple<long, N + M>; }; template <class... Tys> @@ -1619,12 +1623,12 @@ struct to_python<std::tuple<Types...>> { }; template <typename T, size_t N> -struct to_python<types::array<T, N>> { +struct to_python<types::array_tuple<T, N>> { template <size_t... S> - static PyObject *do_convert(types::array<T, N> const &t, + static PyObject *do_convert(types::array_tuple<T, N> const &t, utils::index_sequence<S...>); - static PyObject *convert(types::array<T, N> const &t); + static PyObject *convert(types::array_tuple<T, N> const &t); }; template <typename T, size_t N> @@ -1652,14 +1656,14 @@ struct from_python<std::tuple<Types...>> { }; template <typename T, size_t N> -struct from_python<types::array<T, N>> { +struct from_python<types::array_tuple<T, N>> { static bool is_convertible(PyObject *obj); template <size_t... S> - static types::array<T, N> do_convert(PyObject *obj, - typename utils::index_sequence<S...>); - static types::array<T, N> convert(PyObject *obj); + static types::array_tuple<T, N> + do_convert(PyObject *obj, typename utils::index_sequence<S...>); + static types::array_tuple<T, N> convert(PyObject *obj); }; PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/types/variant_functor.hpp b/contrib/python/pythran/pythran/pythonic/include/types/variant_functor.hpp index 2225cb029a..46df29576d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/variant_functor.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/variant_functor.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_INCLUDE_TYPES_VARIANT_FUNCTOR_HPP #define PYTHONIC_INCLUDE_TYPES_VARIANT_FUNCTOR_HPP -#include "pythonic/include/utils/meta.hpp" #include "pythonic/include/types/combined.hpp" +#include "pythonic/include/utils/meta.hpp" #include <utility> @@ -80,11 +80,11 @@ namespace types void assign(char mem[], variant_functor<OtherType> const &); template <class... Args> - auto operator()(Args &&... args) + auto operator()(Args &&...args) -> decltype(std::declval<Type>()(std::forward<Args>(args)...)); template <class... Args> - auto operator()(Args &&... args) const + auto operator()(Args &&...args) const -> decltype(std::declval<Type>()(std::forward<Args>(args)...)); }; @@ -98,7 +98,7 @@ namespace types variant_functor_impl(variant_functor_impl const &) = delete; template <class... OtherTypes> - variant_functor_impl(char mem[], OtherTypes const &... t); + variant_functor_impl(char mem[], OtherTypes const &...t); template <class... OtherTypes> variant_functor_impl(char mem[], @@ -112,16 +112,20 @@ namespace types void assign(char mem[], OtherType const &); template <class... Args> - auto operator()(Args &&... args) -> typename __combined< - decltype(std::declval<Type>()(std::forward<Args>(args)...)), - decltype(std::declval<Types>()(std::forward<Args>(args)...))...>::type; + auto operator()(Args &&...args) -> + typename __combined< + decltype(std::declval<Type>()(std::forward<Args>(args)...)), + decltype(std::declval<Types>()( + std::forward<Args>(args)...))...>::type; template <class... Args> - auto operator()(Args &&... args) const -> typename __combined< - decltype(std::declval<Type>()(std::forward<Args>(args)...)), - decltype(std::declval<Types>()(std::forward<Args>(args)...))...>::type; + auto operator()(Args &&...args) const -> + typename __combined< + decltype(std::declval<Type>()(std::forward<Args>(args)...)), + decltype(std::declval<Types>()( + std::forward<Args>(args)...))...>::type; }; - } + } // namespace details template <class... Types> struct variant_functor : details::variant_functor_impl<Types...> { @@ -144,11 +148,11 @@ namespace types variant_functor &operator=(variant_functor<OtherTypes...> const &); template <class... OtherTypes> - variant_functor(OtherTypes const &... t); + variant_functor(OtherTypes const &...t); template <class... OtherTypes> variant_functor(variant_functor<OtherTypes...> const &t); }; -} +} // namespace types PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/types/vectorizable_type.hpp b/contrib/python/pythran/pythran/pythonic/include/types/vectorizable_type.hpp index 4c1ea98788..e8a3f77342 100644 --- a/contrib/python/pythran/pythran/pythonic/include/types/vectorizable_type.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/types/vectorizable_type.hpp @@ -14,14 +14,14 @@ namespace types }; struct vectorizer { template <class E> - static auto vbegin(E &&expr) - -> decltype(std::forward<E>(expr).vbegin(vectorize{})) + static auto + vbegin(E &&expr) -> decltype(std::forward<E>(expr).vbegin(vectorize{})) { return std::forward<E>(expr).vbegin(vectorize{}); } template <class E> - static auto vend(E &&expr) - -> decltype(std::forward<E>(expr).vend(vectorize{})) + static auto + vend(E &&expr) -> decltype(std::forward<E>(expr).vend(vectorize{})) { return std::forward<E>(expr).vend(vectorize{}); } @@ -52,7 +52,7 @@ namespace types }; /* trait to check if is T is an array-like type that supports vectorization - */ + */ template <class T, bool scalar = has_vectorizable<T>::value> struct is_vectorizable_array; @@ -77,7 +77,7 @@ namespace types template <class Op, class... Args> struct numpy_expr; -} +} // namespace types namespace utils { @@ -111,6 +111,6 @@ namespace utils { return true; } -} +} // namespace utils PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/array_helper.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/array_helper.hpp index 694e117aeb..2a309b2322 100644 --- a/contrib/python/pythran/pythran/pythonic/include/utils/array_helper.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/utils/array_helper.hpp @@ -13,20 +13,20 @@ PYTHONIC_NS_BEGIN template <size_t L> struct nget { template <class A, size_t M> - auto operator()(A &&self, types::array<long, M> const &indices) + auto operator()(A &&self, types::array_tuple<long, M> const &indices) -> decltype(nget<L - 1>()(std::forward<A>(self)[0], indices)); template <class A, size_t M> - auto fast(A &&self, types::array<long, M> const &indices) + auto fast(A &&self, types::array_tuple<long, M> const &indices) -> decltype(nget<L - 1>().fast(std::forward<A>(self).fast(0), indices)); }; template <> struct nget<0> { template <class A, size_t M> - auto operator()(A &&self, types::array<long, M> const &indices) + auto operator()(A &&self, types::array_tuple<long, M> const &indices) -> decltype(std::forward<A>(self)[indices[M - 1]]); template <class A, size_t M> - auto fast(A &&self, types::array<long, M> const &indices) + auto fast(A &&self, types::array_tuple<long, M> const &indices) -> decltype(std::forward<A>(self).fast(indices[M - 1])); }; PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/functor.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/functor.hpp index 5c40c6b495..260e4d597a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/utils/functor.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/utils/functor.hpp @@ -11,7 +11,7 @@ struct name { \ using callable = void; \ template <typename... Types> \ - auto operator()(Types && ... types) const \ + auto operator()(Types &&...types) const \ -> decltype(f(std::forward<Types>(types)...)) \ { \ return f(std::forward<Types>(types)...); \ diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/fwd.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/fwd.hpp index 102d9c27ca..fb3a962005 100644 --- a/contrib/python/pythran/pythran/pythonic/include/utils/fwd.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/utils/fwd.hpp @@ -7,7 +7,7 @@ namespace utils { template <typename... Types> - void fwd(Types const &... types); + void fwd(Types const &...types); } PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/int_.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/int_.hpp index 7f1d30b4f7..4790c074df 100644 --- a/contrib/python/pythran/pythran/pythonic/include/utils/int_.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/utils/int_.hpp @@ -8,7 +8,7 @@ namespace utils template <size_t> struct int_ { }; // compile-time counter -} +} // namespace utils PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/iterator.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/iterator.hpp index 398ffd03c2..306d96376a 100644 --- a/contrib/python/pythran/pythran/pythonic/include/utils/iterator.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/utils/iterator.hpp @@ -24,7 +24,7 @@ namespace utils // FIXME : It works only because template arguments are ! references // so it trigger a copy. iterator_reminder() = default; - iterator_reminder(T const &v, Others const &... o); + iterator_reminder(T const &v, Others const &...o); }; template <class T> @@ -60,7 +60,7 @@ namespace utils std::forward_iterator_tag>::value, std::forward_iterator_tag, typename iterator_min<Iters...>::type>::type; }; -} +} // namespace utils PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/meta.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/meta.hpp index e955d21267..f2962595da 100644 --- a/contrib/python/pythran/pythran/pythonic/include/utils/meta.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/utils/meta.hpp @@ -61,7 +61,7 @@ namespace utils static constexpr size_t value = V0; static constexpr size_t index = 0; }; -} +} // namespace utils PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/nested_container.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/nested_container.hpp index aaedefa8c4..e53703a1ce 100644 --- a/contrib/python/pythran/pythran/pythonic/include/utils/nested_container.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/utils/nested_container.hpp @@ -1,9 +1,9 @@ #ifndef PYTHONIC_INCLUDE_UTILS_NESTED_CONTAINER_HPP #define PYTHONIC_INCLUDE_UTILS_NESTED_CONTAINER_HPP -#include <limits> #include "pythonic/include/types/traits.hpp" #include "pythonic/include/utils/numpy_traits.hpp" +#include <limits> PYTHONIC_NS_BEGIN namespace types @@ -12,11 +12,15 @@ namespace types class sliced_list; template <class T> class list; + template <class T, class S> + class sliced_array; + template <class T> + class array; template <class T, size_t N, class V> struct array_base; template <class T> struct dynamic_tuple; -} +} // namespace types namespace utils { @@ -52,6 +56,16 @@ namespace utils }; template <class T> + struct nested_container_depth<types::array<T>> { + static const int value = 1; + }; + + template <class T, class S> + struct nested_container_depth<types::sliced_array<T, S>> { + static const int value = 1; + }; + + template <class T> struct nested_container_depth<types::dynamic_tuple<T>> { static const int value = 1 + nested_container_depth<T>::value; }; @@ -120,6 +134,16 @@ namespace utils using type = typename nested_container_value_type<T>::type; }; + template <class T> + struct nested_container_value_type<types::array<T>> { + using type = T; + }; + + template <class T, class S> + struct nested_container_value_type<types::sliced_array<T, S>> { + using type = T; + }; + template <class T, size_t N, class V> struct nested_container_value_type<types::array_base<T, N, V>> { using type = typename nested_container_value_type<T>::type; @@ -129,7 +153,7 @@ namespace utils struct nested_container_value_type<types::ndarray<T, sP>> { using type = T; }; -} +} // namespace utils PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/neutral.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/neutral.hpp index 8ddc471013..21eecd2b8d 100644 --- a/contrib/python/pythran/pythran/pythonic/include/utils/neutral.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/utils/neutral.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/operator_/iadd.hpp" #include "pythonic/include/operator_/iand.hpp" -#include "pythonic/include/operator_/ior.hpp" -#include "pythonic/include/operator_/imul.hpp" #include "pythonic/include/operator_/imax.hpp" #include "pythonic/include/operator_/imin.hpp" +#include "pythonic/include/operator_/imul.hpp" +#include "pythonic/include/operator_/ior.hpp" #include "pythonic/include/operator_/ixor.hpp" PYTHONIC_NS_BEGIN @@ -69,7 +69,7 @@ namespace utils template <class T> T const neutral<operator_::functor::ixor, T>::value = 0; -} +} // namespace utils PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/numpy_conversion.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/numpy_conversion.hpp index da399d29e5..8fafd52d79 100644 --- a/contrib/python/pythran/pythran/pythonic/include/utils/numpy_conversion.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/utils/numpy_conversion.hpp @@ -15,8 +15,8 @@ #else #define NUMPY_EXPR_TO_NDARRAY0_DECL(fname) \ template <class E, class... Types> \ - auto fname(E const &expr, Types &&...others) \ - ->typename std::enable_if< \ + auto fname(E const &expr, Types &&...others) -> \ + typename std::enable_if< \ !types::is_ndarray<E>::value && types::is_numexpr_arg<E>::value, \ decltype(fname( \ types::ndarray<typename E::dtype, typename E::shape_t>{expr}, \ diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/numpy_traits.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/numpy_traits.hpp index 967d385a43..112ff7a949 100644 --- a/contrib/python/pythran/pythran/pythonic/include/utils/numpy_traits.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/utils/numpy_traits.hpp @@ -36,6 +36,12 @@ namespace types struct empty_list; + template <class T> + class array; + + template <class T, class S> + class sliced_array; + template <class T, size_t N, class V> struct array_base; @@ -130,9 +136,7 @@ namespace types }; template <class T, class S> - struct is_numexpr_arg<sliced_list<T, S>> { - static constexpr bool value = - is_numexpr_arg<T>::value || is_dtype<T>::value; + struct is_numexpr_arg<sliced_list<T, S>> : is_numexpr_arg<list<T>> { }; template <> @@ -141,6 +145,15 @@ namespace types }; template <class T> + struct is_numexpr_arg<array<T>> : is_numexpr_arg<list<T>> { + }; + + template <class T, class S> + struct is_numexpr_arg<sliced_array<T, S>> + : is_numexpr_arg<sliced_list<T, S>> { + }; + + template <class T> struct is_numexpr_arg<broadcasted<T>> { static constexpr bool value = is_numexpr_arg<T>::value || is_dtype<T>::value; @@ -172,7 +185,7 @@ namespace types static T get(...); using type = decltype(get<E>(nullptr)); }; -} +} // namespace types PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/seq.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/seq.hpp index 470e9860ad..abb47fe97b 100644 --- a/contrib/python/pythran/pythran/pythonic/include/utils/seq.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/utils/seq.hpp @@ -27,7 +27,7 @@ namespace utils struct make_integer_sequence<T, 0, S...> { using type = integer_sequence<T, S...>; }; - } + } // namespace details template <class T, std::size_t N> using make_integer_sequence = @@ -50,7 +50,7 @@ namespace utils struct make_reversed_integer_sequence<T, 0, S...> { using type = integer_sequence<T, S...>; }; - } + } // namespace details template <class T, std::size_t N> using make_reversed_integer_sequence = @@ -74,14 +74,14 @@ namespace utils struct repeated_type<T, 0, Tys...> { using type = type_sequence<Tys...>; }; - } + } // namespace details template <class T, std::size_t N> struct repeated_type : details::repeated_type<T, N> { }; template <class T, std::size_t N> using make_repeated_type = typename repeated_type<T, N>::type; -} +} // namespace utils PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/tags.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/tags.hpp index 00687a6b18..593bfcdbd1 100644 --- a/contrib/python/pythran/pythran/pythonic/include/utils/tags.hpp +++ b/contrib/python/pythran/pythran/pythonic/include/utils/tags.hpp @@ -12,7 +12,7 @@ namespace purity struct pure_tag { }; -} +} // namespace purity template <class T> struct purity_of { diff --git a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/close.hpp b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/close.hpp index a6baf27edb..3bd77d7fdf 100644 --- a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/close.hpp +++ b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/close.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_IO__IO_TEXTIOWRAPPER_CLOSE_HPP #define PYTHONIC_IO__IO_TEXTIOWRAPPER_CLOSE_HPP -#include "pythonic/include/io/_io/TextIOWrapper/close.hpp" #include "pythonic/builtins/file/close.hpp" +#include "pythonic/include/io/_io/TextIOWrapper/close.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/fileno.hpp b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/fileno.hpp index 8df4ed963e..e00a67b2da 100644 --- a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/fileno.hpp +++ b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/fileno.hpp @@ -1,6 +1,6 @@ #ifndef PYTHONIC_IO__IO_TEXTIOWRAPPER_FILENO_HPP #define PYTHONIC_IO__IO_TEXTIOWRAPPER_FILENO_HPP -#include "pythonic/include/io/_io/TextIOWrapper/fileno.hpp" #include "pythonic/builtins/file/fileno.hpp" +#include "pythonic/include/io/_io/TextIOWrapper/fileno.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/flush.hpp b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/flush.hpp index b082f39d25..3b7676e7ea 100644 --- a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/flush.hpp +++ b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/flush.hpp @@ -1,6 +1,6 @@ #ifndef PYTHONIC_IO__IO_TEXTIOWRAPPER_FLUSH_HPP #define PYTHONIC_IO__IO_TEXTIOWRAPPER_FLUSH_HPP -#include "pythonic/include/io/_io/TextIOWrapper/flush.hpp" #include "pythonic/builtins/file/flush.hpp" +#include "pythonic/include/io/_io/TextIOWrapper/flush.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/isatty.hpp b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/isatty.hpp index 10c3faa4f3..9e393a649c 100644 --- a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/isatty.hpp +++ b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/isatty.hpp @@ -1,6 +1,6 @@ #ifndef PYTHONIC_IO__IO_TEXTIOWRAPPER_ISATTY_HPP #define PYTHONIC_IO__IO_TEXTIOWRAPPER_ISATTY_HPP -#include "pythonic/include/io/_io/TextIOWrapper/isatty.hpp" #include "pythonic/builtins/file/isatty.hpp" +#include "pythonic/include/io/_io/TextIOWrapper/isatty.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/next.hpp b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/next.hpp index f372876871..80356c8401 100644 --- a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/next.hpp +++ b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/next.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_IO__IO_TEXTIOWRAPPER_NEXT_HPP #define PYTHONIC_IO__IO_TEXTIOWRAPPER_NEXT_HPP -#include "pythonic/include/io/_io/TextIOWrapper/next.hpp" #include "pythonic/builtins/file/next.hpp" +#include "pythonic/include/io/_io/TextIOWrapper/next.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/read.hpp b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/read.hpp index b684eb8a56..ed10885418 100644 --- a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/read.hpp +++ b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/read.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_IO__IO_TEXTIOWRAPPER_READ_HPP #define PYTHONIC_IO__IO_TEXTIOWRAPPER_READ_HPP -#include "pythonic/include/io/_io/TextIOWrapper/read.hpp" #include "pythonic/builtins/file/read.hpp" +#include "pythonic/include/io/_io/TextIOWrapper/read.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/readline.hpp b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/readline.hpp index 326bec25f8..0b47014dc4 100644 --- a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/readline.hpp +++ b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/readline.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_IO__IO_TEXTIOWRAPPER_READLINE_HPP #define PYTHONIC_IO__IO_TEXTIOWRAPPER_READLINE_HPP -#include "pythonic/include/io/_io/TextIOWrapper/readline.hpp" #include "pythonic/builtins/file/readline.hpp" +#include "pythonic/include/io/_io/TextIOWrapper/readline.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/readlines.hpp b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/readlines.hpp index d3aa0b1669..680dab661e 100644 --- a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/readlines.hpp +++ b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/readlines.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_IO__IO_TEXTIOWRAPPER_READLINES_HPP #define PYTHONIC_IO__IO_TEXTIOWRAPPER_READLINES_HPP -#include "pythonic/include/io/_io/TextIOWrapper/readlines.hpp" #include "pythonic/builtins/file/readlines.hpp" +#include "pythonic/include/io/_io/TextIOWrapper/readlines.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/seek.hpp b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/seek.hpp index ecc145890b..51b045754e 100644 --- a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/seek.hpp +++ b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/seek.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_IO__IO_TEXTIOWRAPPER_SEEK_HPP #define PYTHONIC_IO__IO_TEXTIOWRAPPER_SEEK_HPP -#include "pythonic/include/io/_io/TextIOWrapper/seek.hpp" #include "pythonic/builtins/file/seek.hpp" +#include "pythonic/include/io/_io/TextIOWrapper/seek.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/tell.hpp b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/tell.hpp index 616d5c4cd0..15e7c3898b 100644 --- a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/tell.hpp +++ b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/tell.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_IO__IO_TEXTIOWRAPPER_TELL_HPP #define PYTHONIC_IO__IO_TEXTIOWRAPPER_TELL_HPP -#include "pythonic/include/io/_io/TextIOWrapper/tell.hpp" #include "pythonic/builtins/file/tell.hpp" +#include "pythonic/include/io/_io/TextIOWrapper/tell.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/truncate.hpp b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/truncate.hpp index 26f1ad6322..d489e96b0b 100644 --- a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/truncate.hpp +++ b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/truncate.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_IO__IO_TEXTIOWRAPPER_TRUNCATE_HPP #define PYTHONIC_IO__IO_TEXTIOWRAPPER_TRUNCATE_HPP -#include "pythonic/include/io/_io/TextIOWrapper/truncate.hpp" #include "pythonic/builtins/file/truncate.hpp" +#include "pythonic/include/io/_io/TextIOWrapper/truncate.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/write.hpp b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/write.hpp index 2a229ebcd3..1bd33acfec 100644 --- a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/write.hpp +++ b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/write.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_IO__IO_TEXTIOWRAPPER_WRITE_HPP #define PYTHONIC_IO__IO_TEXTIOWRAPPER_WRITE_HPP -#include "pythonic/include/io/_io/TextIOWrapper/write.hpp" #include "pythonic/builtins/file/write.hpp" +#include "pythonic/include/io/_io/TextIOWrapper/write.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/writelines.hpp b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/writelines.hpp index f0749fd41a..00fb4dd3bd 100644 --- a/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/writelines.hpp +++ b/contrib/python/pythran/pythran/pythonic/io/_io/TextIOWrapper/writelines.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_IO__IO_TEXTIOWRAPPER_WRITELINES_HPP #define PYTHONIC_IO__IO_TEXTIOWRAPPER_WRITELINES_HPP -#include "pythonic/include/io/_io/TextIOWrapper/writelines.hpp" #include "pythonic/builtins/file/writelines.hpp" +#include "pythonic/include/io/_io/TextIOWrapper/writelines.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/itertools/islice.hpp b/contrib/python/pythran/pythran/pythonic/itertools/islice.hpp index f8bda4f878..5220c0f15d 100644 --- a/contrib/python/pythran/pythran/pythonic/itertools/islice.hpp +++ b/contrib/python/pythran/pythran/pythonic/itertools/islice.hpp @@ -1,10 +1,10 @@ #ifndef PYTHONIC_ITERTOOLS_ISLICE_HPP #define PYTHONIC_ITERTOOLS_ISLICE_HPP +#include "pythonic/builtins/range.hpp" #include "pythonic/include/itertools/islice.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/itertools/common.hpp" -#include "pythonic/builtins/range.hpp" +#include "pythonic/utils/functor.hpp" #include <iterator> PYTHONIC_NS_BEGIN @@ -50,29 +50,29 @@ namespace itertools } template <typename Iterable> - bool islice_iterator<Iterable>:: - operator==(islice_iterator<Iterable> const &other) const + bool islice_iterator<Iterable>::operator==( + islice_iterator<Iterable> const &other) const { return (state == other.state); } template <typename Iterable> - bool islice_iterator<Iterable>:: - operator!=(islice_iterator<Iterable> const &other) const + bool islice_iterator<Iterable>::operator!=( + islice_iterator<Iterable> const &other) const { return state != other.state; } template <typename Iterable> - bool islice_iterator<Iterable>:: - operator<(islice_iterator<Iterable> const &other) const + bool islice_iterator<Iterable>::operator<( + islice_iterator<Iterable> const &other) const { return state != other.state; } template <typename Iterable> - int islice_iterator<Iterable>:: - operator-(islice_iterator<Iterable> const &other) const + int islice_iterator<Iterable>::operator-( + islice_iterator<Iterable> const &other) const { return state - other.state; } @@ -122,7 +122,7 @@ namespace itertools { return {iterable, builtins::range(0, stop, 1)}; } -} +} // namespace itertools PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/itertools/permutations.hpp b/contrib/python/pythran/pythran/pythonic/itertools/permutations.hpp index 2dd2e4feab..cba48890fd 100644 --- a/contrib/python/pythran/pythran/pythonic/itertools/permutations.hpp +++ b/contrib/python/pythran/pythran/pythonic/itertools/permutations.hpp @@ -37,7 +37,8 @@ namespace itertools return res; } template <class T, size_t N> - types::array<T, N> init_permut_from(size_t n, types::array<T, N> *) + types::array_tuple<T, N> init_permut_from(size_t n, + types::array_tuple<T, N> *) { assert(N == n && "consistent init"); return {}; @@ -60,9 +61,10 @@ namespace itertools return {begin, end}; } template <class T, size_t N, class I> - types::array<T, N> init_permut_from(I begin, I end, types::array<T, N> *) + types::array_tuple<T, N> init_permut_from(I begin, I end, + types::array_tuple<T, N> *) { - types::array<T, N> res; + types::array_tuple<T, N> res; std::copy(begin, end, res.begin()); return res; } @@ -167,7 +169,7 @@ namespace itertools } template <typename T, long N> - _permutations<T, types::array<typename T::value_type, (size_t)N>> + _permutations<T, types::array_tuple<typename T::value_type, (size_t)N>> permutations(T iter, std::integral_constant<long, N>) { return {iter, N}; diff --git a/contrib/python/pythran/pythran/pythonic/itertools/product.hpp b/contrib/python/pythran/pythran/pythonic/itertools/product.hpp index db31e83c78..7572ed249f 100644 --- a/contrib/python/pythran/pythran/pythonic/itertools/product.hpp +++ b/contrib/python/pythran/pythran/pythonic/itertools/product.hpp @@ -2,11 +2,11 @@ #define PYTHONIC_ITERTOOLS_PRODUCT_HPP #include "pythonic/include/itertools/product.hpp" -#include "pythonic/utils/int_.hpp" -#include "pythonic/utils/seq.hpp" -#include "pythonic/utils/iterator.hpp" #include "pythonic/itertools/common.hpp" #include "pythonic/utils/functor.hpp" +#include "pythonic/utils/int_.hpp" +#include "pythonic/utils/iterator.hpp" +#include "pythonic/utils/seq.hpp" PYTHONIC_NS_BEGIN @@ -48,7 +48,7 @@ namespace itertools template <typename... Iters> types::make_tuple_t<typename Iters::value_type...> - product_iterator<Iters...>::operator*() const + product_iterator<Iters...>::operator*() const { return get_value(utils::make_index_sequence<sizeof...(Iters)>{}); } @@ -73,27 +73,27 @@ namespace itertools template <typename... Iters> product_iterator<Iters...> &product_iterator<Iters...>::operator++() { - advance(utils::int_<sizeof...(Iters)-1>{}); + advance(utils::int_<sizeof...(Iters) - 1>{}); return *this; } template <typename... Iters> - bool product_iterator<Iters...>:: - operator==(product_iterator<Iters...> const &other) const + bool product_iterator<Iters...>::operator==( + product_iterator<Iters...> const &other) const { return end == other.end; } template <typename... Iters> - bool product_iterator<Iters...>:: - operator!=(product_iterator<Iters...> const &other) const + bool product_iterator<Iters...>::operator!=( + product_iterator<Iters...> const &other) const { return end != other.end; } template <typename... Iters> - bool product_iterator<Iters...>:: - operator<(product_iterator<Iters...> const &other) const + bool product_iterator<Iters...>::operator<( + product_iterator<Iters...> const &other) const { return end != other.end; } @@ -103,7 +103,7 @@ namespace itertools // FIXME: Iterators need to be evaluated as they may be used multiple // times template <typename... Iters> - product<Iters...>::product(Iters const &... _iters) + product<Iters...>::product(Iters const &..._iters) : utils::iterator_reminder<true, Iters...>(_iters...), iterator(this->values, utils::make_index_sequence<sizeof...(Iters)>{}), @@ -129,16 +129,16 @@ namespace itertools { return end_iter; } - } + } // namespace details template <typename... Iter> details::product<typename std::remove_cv< typename std::remove_reference<Iter>::type>::type...> - product(Iter &&... iters) + product(Iter &&...iters) { return {std::forward<Iter>(iters)...}; } -} +} // namespace itertools PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/itertools/repeat.hpp b/contrib/python/pythran/pythran/pythonic/itertools/repeat.hpp index cbaffb8626..7e9f3ab674 100644 --- a/contrib/python/pythran/pythran/pythonic/itertools/repeat.hpp +++ b/contrib/python/pythran/pythran/pythonic/itertools/repeat.hpp @@ -2,8 +2,8 @@ #define PYTHONIC_ITERTOOLS_REPEAT_HPP #include "pythonic/include/itertools/repeat.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/list.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -30,20 +30,20 @@ namespace itertools } template <class T, bool Endless> - bool repeat_iterator<T, Endless>:: - operator!=(repeat_iterator<T, Endless> const &other) const + bool repeat_iterator<T, Endless>::operator!=( + repeat_iterator<T, Endless> const &other) const { return Endless || count_ != other.count_; } template <class T, bool Endless> - bool repeat_iterator<T, Endless>:: - operator==(repeat_iterator<T, Endless> const &other) const + bool repeat_iterator<T, Endless>::operator==( + repeat_iterator<T, Endless> const &other) const { return !Endless && count_ == other.count_; } template <class T, bool Endless> - bool repeat_iterator<T, Endless>:: - operator<(repeat_iterator<T, Endless> const &other) const + bool repeat_iterator<T, Endless>::operator<( + repeat_iterator<T, Endless> const &other) const { return !Endless && count_ < other.count_; } @@ -76,7 +76,7 @@ namespace itertools { return {value, -1}; } -} +} // namespace itertools PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/math/ceil.hpp b/contrib/python/pythran/pythran/pythonic/math/ceil.hpp index f39319198d..b29180fadc 100644 --- a/contrib/python/pythran/pythran/pythonic/math/ceil.hpp +++ b/contrib/python/pythran/pythran/pythonic/math/ceil.hpp @@ -15,7 +15,7 @@ namespace math { return std::ceil(x); } -} +} // namespace math PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/math/degrees.hpp b/contrib/python/pythran/pythran/pythonic/math/degrees.hpp index b3d43b2a4d..5b79001046 100644 --- a/contrib/python/pythran/pythran/pythonic/math/degrees.hpp +++ b/contrib/python/pythran/pythran/pythonic/math/degrees.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/math/degrees.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/math/pi.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -16,7 +16,7 @@ namespace math { return (x * 360.) / (2. * pi); } -} +} // namespace math PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/math/factorial.hpp b/contrib/python/pythran/pythran/pythonic/math/factorial.hpp index 5b7b4d6384..dfb4963e96 100644 --- a/contrib/python/pythran/pythran/pythonic/math/factorial.hpp +++ b/contrib/python/pythran/pythran/pythonic/math/factorial.hpp @@ -18,7 +18,7 @@ namespace math res *= i; return res; } -} +} // namespace math PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/math/floor.hpp b/contrib/python/pythran/pythran/pythonic/math/floor.hpp index f30c2bac63..a7d88a5470 100644 --- a/contrib/python/pythran/pythran/pythonic/math/floor.hpp +++ b/contrib/python/pythran/pythran/pythonic/math/floor.hpp @@ -15,7 +15,7 @@ namespace math { return std::floor(x); } -} +} // namespace math PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/math/frexp.hpp b/contrib/python/pythran/pythran/pythonic/math/frexp.hpp index 2a694c703d..36c0424931 100644 --- a/contrib/python/pythran/pythran/pythonic/math/frexp.hpp +++ b/contrib/python/pythran/pythran/pythonic/math/frexp.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/math/frexp.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/tuple.hpp" +#include "pythonic/utils/functor.hpp" #include <cmath> @@ -18,7 +18,7 @@ namespace math double sig = std::frexp(x, &exp); return std::tuple<double, long>(sig, exp); } -} +} // namespace math PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/math/gamma.hpp b/contrib/python/pythran/pythran/pythonic/math/gamma.hpp index caf5ed5c92..537ef39e76 100644 --- a/contrib/python/pythran/pythran/pythonic/math/gamma.hpp +++ b/contrib/python/pythran/pythran/pythonic/math/gamma.hpp @@ -14,7 +14,7 @@ namespace math { return std::tgamma(x); } -} +} // namespace math PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/math/modf.hpp b/contrib/python/pythran/pythran/pythonic/math/modf.hpp index fef342fe01..26c62292c5 100644 --- a/contrib/python/pythran/pythran/pythonic/math/modf.hpp +++ b/contrib/python/pythran/pythran/pythonic/math/modf.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/math/modf.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/tuple.hpp" +#include "pythonic/utils/functor.hpp" #include <cmath> @@ -19,7 +19,7 @@ namespace math double frac = std::modf(x, &i); return std::make_tuple(frac, i); } -} +} // namespace math PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/math/radians.hpp b/contrib/python/pythran/pythran/pythonic/math/radians.hpp index e45ee692ed..14f81246fc 100644 --- a/contrib/python/pythran/pythran/pythonic/math/radians.hpp +++ b/contrib/python/pythran/pythran/pythonic/math/radians.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/math/radians.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/math/pi.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace math { return (x * 2. * pi) / 360.; } -} +} // namespace math PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/math/trunc.hpp b/contrib/python/pythran/pythran/pythonic/math/trunc.hpp index a45a7c7f1f..220ac4d514 100644 --- a/contrib/python/pythran/pythran/pythonic/math/trunc.hpp +++ b/contrib/python/pythran/pythran/pythonic/math/trunc.hpp @@ -15,7 +15,7 @@ namespace math { return x; } -} +} // namespace math PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/abs.hpp b/contrib/python/pythran/pythran/pythonic/numpy/abs.hpp index 3c13b5f5a9..779fee4360 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/abs.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/abs.hpp @@ -13,7 +13,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME abs #define NUMPY_NARY_FUNC_SYM xsimd::abs #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/add.hpp b/contrib/python/pythran/pythran/pythonic/numpy/add.hpp index cfb74a8f3f..1a0352888c 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/add.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/add.hpp @@ -3,11 +3,11 @@ #include "pythonic/include/numpy/add.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/operator_/add.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic/operator_/add.hpp" PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME add #define NUMPY_NARY_FUNC_SYM pythonic::operator_::add #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/alen.hpp b/contrib/python/pythran/pythran/pythonic/numpy/alen.hpp index 0b34f03282..b5ef5ccc75 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/alen.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/alen.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/alen.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy { return expr.template shape<0>(); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/all.hpp b/contrib/python/pythran/pythran/pythonic/numpy/all.hpp index 3c4a8c750d..516e0dff9d 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/all.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/all.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/all.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/builtins/ValueError.hpp" #include "pythonic/numpy/multiply.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -15,9 +15,10 @@ namespace numpy template <class E> bool _all(E begin, E end, utils::int_<1>) { - return std::all_of(begin, end, - [](typename std::iterator_traits<E>::value_type e) - -> bool { return e; }); + return std::all_of( + begin, end, [](typename std::iterator_traits<E>::value_type e) -> bool { + return e; + }); } template <class E, size_t N> @@ -67,7 +68,8 @@ namespace numpy template <class E> typename std::enable_if< E::value != 1, - types::ndarray<typename E::dtype, types::array<long, E::value - 1>>>::type + types::ndarray<typename E::dtype, + types::array_tuple<long, E::value - 1>>>::type all(E const &array, long axis) { constexpr long N = E::value; @@ -75,24 +77,25 @@ namespace numpy if (axis < 0 || axis >= long(N)) throw types::ValueError("axis out of bounds"); if (axis == 0) { - types::array<long, N - 1> shp; + types::array_tuple<long, N - 1> shp; sutils::copy_shape<0, 1>(shp, array, utils::make_index_sequence<N - 1>()); - types::ndarray<bool, types::array<long, N - 1>> out(shp, true); + types::ndarray<bool, types::array_tuple<long, N - 1>> out(shp, true); return std::accumulate(array.begin(), array.end(), out, functor::multiply()); } else { - types::array<long, N - 1> shp; + types::array_tuple<long, N - 1> shp; sutils::copy_shape<0, 0>(shp, array, utils::make_index_sequence<N - 1>()); - types::ndarray<bool, types::array<long, N - 1>> ally(shp, builtins::None); + types::ndarray<bool, types::array_tuple<long, N - 1>> ally( + shp, builtins::None); std::transform( array.begin(), array.end(), ally.begin(), - [=](types::ndarray<T, types::array<long, N - 1>> const &other) { + [=](types::ndarray<T, types::array_tuple<long, N - 1>> const &other) { return all(other, axis - 1); }); return ally; } } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/allclose.hpp b/contrib/python/pythran/pythran/pythonic/numpy/allclose.hpp index 3a78e441f0..d630a99ba2 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/allclose.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/allclose.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/allclose.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/numpy/abs.hpp" #include "pythonic/numpy/isfinite.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -40,7 +40,7 @@ namespace numpy return false; return true; } - } + } // namespace template <class U, class V> bool allclose(U const &u, V const &v, double rtol, double atol) @@ -48,7 +48,7 @@ namespace numpy return _allclose(u.begin(), u.end(), v.begin(), rtol, atol, utils::int_<U::value>()); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/alltrue.hpp b/contrib/python/pythran/pythran/pythonic/numpy/alltrue.hpp index 98674c88ef..296f63cb55 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/alltrue.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/alltrue.hpp @@ -10,12 +10,11 @@ PYTHONIC_NS_BEGIN namespace numpy { template <class... Types> - auto alltrue(Types &&... types) - -> decltype(all(std::forward<Types>(types)...)) + auto alltrue(Types &&...types) -> decltype(all(std::forward<Types>(types)...)) { return all(std::forward<Types>(types)...); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/angle.hpp b/contrib/python/pythran/pythran/pythonic/numpy/angle.hpp index 78ef2fd7f5..eae62451b8 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/angle.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/angle.hpp @@ -28,7 +28,7 @@ namespace numpy { return functor::angle_in_rad()(t); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/angle_in_deg.hpp b/contrib/python/pythran/pythran/pythonic/numpy/angle_in_deg.hpp index a77eb7e1b9..376a0111d0 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/angle_in_deg.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/angle_in_deg.hpp @@ -4,8 +4,8 @@ #include "pythonic/include/numpy/angle_in_deg.hpp" #include "pythonic/numpy/angle_in_rad.hpp" -#include "pythonic/utils/numpy_traits.hpp" #include "pythonic/numpy/pi.hpp" +#include "pythonic/utils/numpy_traits.hpp" /* NOTE: angle_in_deg is not part of the official Numpy API, * this file is here only to split the angle function in two parts @@ -19,7 +19,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME angle_in_deg #define NUMPY_NARY_FUNC_SYM wrapper::angle_in_deg #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/angle_in_rad.hpp b/contrib/python/pythran/pythran/pythonic/numpy/angle_in_rad.hpp index 7e955d1a9f..5bcbfc39d8 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/angle_in_rad.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/angle_in_rad.hpp @@ -3,11 +3,11 @@ #include "pythonic/include/numpy/angle_in_rad.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" -#include "pythonic/utils/numpy_traits.hpp" #include "pythonic/numpy/arctan.hpp" #include "pythonic/numpy/pi.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" +#include "pythonic/utils/numpy_traits.hpp" /* NOTE: angle_in_rad is not part of the official Numpy API, * this file is here only to split the angle function in two parts @@ -20,17 +20,17 @@ namespace numpy namespace wrapper { template <class T> - auto angle_in_rad(T const &t) - -> decltype(std::atan2(std::imag(t), std::real(t))) + auto angle_in_rad(T const &t) -> decltype(std::atan2(std::imag(t), + std::real(t))) { return std::atan2(std::imag(t), std::real(t)); } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME angle_in_rad #define NUMPY_NARY_FUNC_SYM wrapper::angle_in_rad #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/any.hpp b/contrib/python/pythran/pythran/pythonic/numpy/any.hpp index 9f15c2d961..a234db5b37 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/any.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/any.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/any.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/builtins/ValueError.hpp" #include "pythonic/numpy/add.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -67,7 +67,8 @@ namespace numpy template <class E> typename std::enable_if< E::value != 1, - types::ndarray<typename E::dtype, types::array<long, E::value - 1>>>::type + types::ndarray<typename E::dtype, + types::array_tuple<long, E::value - 1>>>::type any(E const &array, long axis) { constexpr long N = E::value; @@ -75,25 +76,26 @@ namespace numpy if (axis < 0 || axis >= long(N)) throw types::ValueError("axis out of bounds"); if (axis == 0) { - types::array<long, N> shp; + types::array_tuple<long, N> shp; shp[0] = 1; sutils::copy_shape<1, 0>(shp, array, utils::make_index_sequence<N - 1>()); - types::ndarray<bool, types::array<long, N>> out(shp, false); + types::ndarray<bool, types::array_tuple<long, N>> out(shp, false); return std::accumulate(array.begin(), array.end(), *out.begin(), numpy::functor::add()); } else { - types::array<long, N - 1> shp; + types::array_tuple<long, N - 1> shp; sutils::copy_shape<0, 0>(shp, array, utils::make_index_sequence<N - 1>()); - types::ndarray<bool, types::array<long, N - 1>> anyy(shp, builtins::None); + types::ndarray<bool, types::array_tuple<long, N - 1>> anyy( + shp, builtins::None); std::transform( array.begin(), array.end(), anyy.begin(), - [=](types::ndarray<T, types::array<long, N - 1>> const &other) { + [=](types::ndarray<T, types::array_tuple<long, N - 1>> const &other) { return any(other, axis - 1); }); return anyy; } } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/append.hpp b/contrib/python/pythran/pythran/pythonic/numpy/append.hpp index c2d4590a72..82779af552 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/append.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/append.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/append.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/numpy/asarray.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -24,7 +24,7 @@ namespace numpy types::ndarray< typename __combined<T, typename types::dtype_of<F>::type>::type, types::pshape<long>> - out(types::pshape<long>(nsize), builtins::None); + out(types::pshape<long>(nsize), builtins::None); auto out_back = std::copy(nto.fbegin(), nto.fend(), out.fbegin()); std::copy(ndata.fbegin(), ndata.fend(), out_back); return out; @@ -41,7 +41,7 @@ namespace numpy types::ndarray< typename __combined<T, typename types::dtype_of<F>::type>::type, types::pshape<long>> - out(types::pshape<long>(nsize), builtins::None); + out(types::pshape<long>(nsize), builtins::None); auto out_back = std::copy(nto.fbegin(), nto.fend(), out.fbegin()); *out_back = data; return out; @@ -55,7 +55,7 @@ namespace numpy { return append(numpy::functor::asarray{}(to), data); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/arange.hpp b/contrib/python/pythran/pythran/pythonic/numpy/arange.hpp index 14e1d0ad44..a483e1dba3 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/arange.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/arange.hpp @@ -4,8 +4,8 @@ #include "pythonic/include/numpy/arange.hpp" #include "pythonic/operator_/pos.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -32,7 +32,7 @@ namespace numpy { return arange<T, T, T, types::dtype_t<T>>(T(0), end); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/arccos.hpp b/contrib/python/pythran/pythran/pythonic/numpy/arccos.hpp index a1d827daa5..f323c65a26 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/arccos.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/arccos.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/arccos.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME arccos #define NUMPY_NARY_FUNC_SYM xsimd::acos #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/numpy/arccosh.hpp b/contrib/python/pythran/pythran/pythonic/numpy/arccosh.hpp index b915e8bbb5..d0e7bd18c9 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/arccosh.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/arccosh.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/arccosh.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME arccosh #define NUMPY_NARY_FUNC_SYM xsimd::acosh #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/arcsin.hpp b/contrib/python/pythran/pythran/pythonic/numpy/arcsin.hpp index cbec9c2386..5a8d57bfd9 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/arcsin.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/arcsin.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/arcsin.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME arcsin #define NUMPY_NARY_FUNC_SYM xsimd::asin #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/arcsinh.hpp b/contrib/python/pythran/pythran/pythonic/numpy/arcsinh.hpp index 96edf5d252..d5d4313089 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/arcsinh.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/arcsinh.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/arcsinh.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME arcsinh #define NUMPY_NARY_FUNC_SYM xsimd::asinh #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/arctan.hpp b/contrib/python/pythran/pythran/pythonic/numpy/arctan.hpp index c7239fcf46..e7e5080859 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/arctan.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/arctan.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/arctan.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -16,7 +16,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME arctan #define NUMPY_NARY_FUNC_SYM xsimd::atan #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/arctan2.hpp b/contrib/python/pythran/pythran/pythonic/numpy/arctan2.hpp index 1c79695feb..40302bf911 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/arctan2.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/arctan2.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/arctan2.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -16,7 +16,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME arctan2 #define NUMPY_NARY_FUNC_SYM xsimd::atan2 #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/arctanh.hpp b/contrib/python/pythran/pythran/pythonic/numpy/arctanh.hpp index 0b9d267dca..50a5716a6b 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/arctanh.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/arctanh.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/arctanh.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME arctanh #define NUMPY_NARY_FUNC_SYM xsimd::atanh #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/argmax.hpp b/contrib/python/pythran/pythran/pythonic/numpy/argmax.hpp index a2887c1630..4be4ce6044 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/argmax.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/argmax.hpp @@ -36,8 +36,8 @@ namespace numpy } template <class E> - types::ndarray<long, types::array<long, E::value - 1>> argmax(E const &expr, - long axis) + types::ndarray<long, types::array_tuple<long, E::value - 1>> + argmax(E const &expr, long axis) { return argminmax<argmax_op<E>>(expr, axis); } diff --git a/contrib/python/pythran/pythran/pythonic/numpy/argmin.hpp b/contrib/python/pythran/pythran/pythonic/numpy/argmin.hpp index 35652a89f2..e146da20d8 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/argmin.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/argmin.hpp @@ -37,8 +37,8 @@ namespace numpy } template <class E> - types::ndarray<long, types::array<long, E::value - 1>> argmin(E const &expr, - long axis) + types::ndarray<long, types::array_tuple<long, E::value - 1>> + argmin(E const &expr, long axis) { return argminmax<argmin_op<E>>(expr, axis); } diff --git a/contrib/python/pythran/pythran/pythonic/numpy/argminmax.hpp b/contrib/python/pythran/pythran/pythonic/numpy/argminmax.hpp index c1286d6348..11aca63b3a 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/argminmax.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/argminmax.hpp @@ -225,7 +225,7 @@ namespace numpy _argminmax_head(T &&out, E const &expr, std::integral_constant<size_t, N>) { static_assert(N > 1, "specialization ok"); - types::ndarray<typename E::dtype, types::array<long, N - 1>> val{ + types::ndarray<typename E::dtype, types::array_tuple<long, N - 1>> val{ sutils::getshape(out), Op::limit()}; long i = 0; for (auto &&elt : expr) { @@ -258,7 +258,7 @@ namespace numpy } template <class Op, class E> - types::ndarray<long, types::array<long, E::value - 1>> + types::ndarray<long, types::array_tuple<long, E::value - 1>> argminmax(E const &array, long axis) { if (axis < 0) @@ -266,11 +266,11 @@ namespace numpy if (axis < 0 || size_t(axis) >= E::value) throw types::ValueError("axis out of bounds"); auto shape = sutils::getshape(array); - types::array<long, E::value - 1> shp; + types::array_tuple<long, E::value - 1> shp; auto next = std::copy(shape.begin(), shape.begin() + axis, shp.begin()); std::copy(shape.begin() + axis + 1, shape.end(), next); - types::ndarray<long, types::array<long, E::value - 1>> out{shp, - builtins::None}; + types::ndarray<long, types::array_tuple<long, E::value - 1>> out{ + shp, builtins::None}; _argminmax_pick_axis<Op, E::value>(axis, out, array, utils::make_index_sequence<E::value>()); return out; diff --git a/contrib/python/pythran/pythran/pythonic/numpy/argsort.hpp b/contrib/python/pythran/pythran/pythonic/numpy/argsort.hpp index 8ed208e9ac..68bf4b76fb 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/argsort.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/argsort.hpp @@ -9,15 +9,16 @@ PYTHONIC_NS_BEGIN namespace numpy { template <class E> - types::ndarray<long, types::array<long, 1>> argsort(E const &expr, - types::none_type, types::none_type) + types::ndarray<long, types::array_tuple<long, 1>> + argsort(E const &expr, types::none_type, types::none_type) { auto out = functor::array{}(expr).flat(); return argsort(out); } template <class T, class pS, class Sorter> - types::ndarray<long, pS> _argsort(types::ndarray<T, pS> const &a, long axis, Sorter sorter) + types::ndarray<long, pS> _argsort(types::ndarray<T, pS> const &a, long axis, + Sorter sorter) { constexpr auto N = std::tuple_size<pS>::value; if (axis < 0) @@ -36,7 +37,7 @@ namespace numpy std::iota(iter_indices, iter_indices + step, 0L); // sort the index using the value from a sorter(iter_indices, iter_indices + step, - [a_base](long i1, long i2) { return a_base[i1] < a_base[i2]; }); + [a_base](long i1, long i2) { return a_base[i1] < a_base[i2]; }); } } else { auto out_shape = sutils::getshape(a); @@ -54,9 +55,9 @@ namespace numpy for (long i = 0; i < n; i++) { auto a_base = a.fbegin() + ith; sorter(buffer, buffer + buffer_size, - [a_base, stepper](long i1, long i2) { - return a_base[i1 * stepper] < a_base[i2 * stepper]; - }); + [a_base, stepper](long i1, long i2) { + return a_base[i1 * stepper] < a_base[i2 * stepper]; + }); for (long j = 0; j < buffer_size; ++j) indices.buffer[ith + j * stepper] = buffer[j]; @@ -72,20 +73,23 @@ namespace numpy } template <class T, class pS> - types::ndarray<long, pS> argsort(types::ndarray<T, pS> const &a, long axis, types::none_type) { + types::ndarray<long, pS> argsort(types::ndarray<T, pS> const &a, long axis, + types::none_type) + { return _argsort(a, axis, ndarray::quicksorter()); } template <class T, class pS> - types::ndarray<long, pS> argsort(types::ndarray<T, pS> const &a, long axis, types::str const& kind) + types::ndarray<long, pS> argsort(types::ndarray<T, pS> const &a, long axis, + types::str const &kind) { - if (kind == "mergesort") - return _argsort(a, axis, ndarray::mergesorter()); - else if (kind == "heapsort") - return _argsort(a, axis, ndarray::heapsorter()); - else if (kind == "stable") - return _argsort(a, axis, ndarray::stablesorter()); - return _argsort(a, axis, ndarray::quicksorter()); + if (kind == "mergesort") + return _argsort(a, axis, ndarray::mergesorter()); + else if (kind == "heapsort") + return _argsort(a, axis, ndarray::heapsorter()); + else if (kind == "stable") + return _argsort(a, axis, ndarray::stablesorter()); + return _argsort(a, axis, ndarray::quicksorter()); } NUMPY_EXPR_TO_NDARRAY0_IMPL(argsort); diff --git a/contrib/python/pythran/pythran/pythonic/numpy/argwhere.hpp b/contrib/python/pythran/pythran/pythonic/numpy/argwhere.hpp index 30186da5d3..0a366decfb 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/argwhere.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/argwhere.hpp @@ -3,16 +3,17 @@ #include "pythonic/include/numpy/argwhere.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/numpy/asarray.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class E> - typename types::ndarray<long, types::array<long, 2>> argwhere(E const &expr) + typename types::ndarray<long, types::array_tuple<long, 2>> + argwhere(E const &expr) { constexpr long N = E::value; auto arr = asarray(expr); @@ -37,10 +38,10 @@ namespace numpy buffer_iter += N; } } - types::array<long, 2> shape = {real_sz, N}; + types::array_tuple<long, 2> shape = {real_sz, N}; return {buffer, shape}; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/around.hpp b/contrib/python/pythran/pythran/pythonic/numpy/around.hpp index 1b467e523b..920e53e92a 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/around.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/around.hpp @@ -3,12 +3,12 @@ #include "pythonic/include/numpy/around.hpp" -#include "pythonic/numpy/rint.hpp" -#include "pythonic/numpy/power.hpp" #include "pythonic/numpy/asarray.hpp" -#include "pythonic/numpy/floor_divide.hpp" #include "pythonic/numpy/float64.hpp" +#include "pythonic/numpy/floor_divide.hpp" #include "pythonic/numpy/multiply.hpp" +#include "pythonic/numpy/power.hpp" +#include "pythonic/numpy/rint.hpp" PYTHONIC_NS_BEGIN @@ -23,15 +23,16 @@ namespace numpy // generic floating point version, pure numpy_expr template <class E> - auto around(E &&a, long decimals) -> typename std::enable_if< - !std::is_integral< - typename types::dtype_of<typename std::decay<E>::type>::type>::value, - decltype(functor::rint{}(functor::multiply{}( - std::forward<E>(a), + auto around(E &&a, long decimals) -> + typename std::enable_if< + !std::is_integral<typename types::dtype_of< + typename std::decay<E>::type>::type>::value, + decltype(functor::rint{}(functor::multiply{}( + std::forward<E>(a), + std::declval<typename types::dtype_of< + typename std::decay<E>::type>::type>())) / std::declval<typename types::dtype_of< - typename std::decay<E>::type>::type>())) / - std::declval<typename types::dtype_of< - typename std::decay<E>::type>::type>())>::type + typename std::decay<E>::type>::type>())>::type { typename types::dtype_of<typename std::decay<E>::type>::type const fact = functor::power{}(10., decimals); @@ -41,15 +42,16 @@ namespace numpy // the integer version is only relevant when decimals < 0 template <class E> - auto around(E &&a, long decimals) -> typename std::enable_if< - std::is_integral< - typename types::dtype_of<typename std::decay<E>::type>::type>::value, - decltype(numpy::functor::floor_divide{}( - functor::float64{}(std::forward<E>(a)), + auto around(E &&a, long decimals) -> + typename std::enable_if< + std::is_integral<typename types::dtype_of< + typename std::decay<E>::type>::type>::value, + decltype(numpy::functor::floor_divide{}( + functor::float64{}(std::forward<E>(a)), + std::declval<typename types::dtype_of< + typename std::decay<E>::type>::type>()) * std::declval<typename types::dtype_of< - typename std::decay<E>::type>::type>()) * - std::declval<typename types::dtype_of< - typename std::decay<E>::type>::type>())>::type + typename std::decay<E>::type>::type>())>::type { typename types::dtype_of<typename std::decay<E>::type>::type const fact = functor::power{}(10L, std::max(0L, -decimals)); @@ -57,7 +59,7 @@ namespace numpy functor::float64{}(std::forward<E>(a)), fact) * fact; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/array.hpp b/contrib/python/pythran/pythran/pythonic/numpy/array.hpp index 284dbba8b4..2feaf5cd70 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/array.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/array.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/array.hpp" +#include "pythonic/types/ndarray.hpp" #include "pythonic/utils/functor.hpp" #include "pythonic/utils/nested_container.hpp" -#include "pythonic/types/ndarray.hpp" PYTHONIC_NS_BEGIN @@ -15,8 +15,9 @@ namespace numpy typename std::enable_if< types::has_size<typename std::decay<T>::type>::value, types::ndarray<typename dtype::type, - types::array<long, std::decay<T>::type::value>>>::type - array(T &&iterable, dtype d) + types::array_tuple<long, std::decay<T>::type::value>>>:: + type + array(T &&iterable, dtype d) { return {std::forward<T>(iterable)}; } @@ -25,8 +26,9 @@ namespace numpy !types::has_size<typename std::decay<T>::type>::value && !types::is_dtype<typename std::decay<T>::type>::value, types::ndarray<typename dtype::type, - types::array<long, std::decay<T>::type::value>>>::type - array(T &&iterable, dtype d) + types::array_tuple<long, std::decay<T>::type::value>>>:: + type + array(T &&iterable, dtype d) { types::list<typename std::decay<T>::type::value_type> tmp{iterable.begin(), iterable.end()}; @@ -46,7 +48,7 @@ namespace numpy template <class dtype> types::ndarray<typename dtype::type, types::pshape<std::integral_constant<long, 0>>> - array(std::tuple<>, dtype) + array(std::tuple<>, dtype) { return {types::pshape<std::integral_constant<long, 0>>{}, types::none_type{}}; @@ -73,7 +75,7 @@ namespace numpy { return {std::move(a)}; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/array2string.hpp b/contrib/python/pythran/pythran/pythonic/numpy/array2string.hpp index d27984a8a1..d4c8cdbc7b 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/array2string.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/array2string.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/array2string.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/str.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -18,7 +18,7 @@ namespace numpy oss << std::forward<E>(a); return oss.str(); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/array_equal.hpp b/contrib/python/pythran/pythran/pythonic/numpy/array_equal.hpp index 606444c675..962450002b 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/array_equal.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/array_equal.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/array_equal.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/numpy/all.hpp" #include "pythonic/numpy/equal.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -19,7 +19,7 @@ namespace numpy return all(functor::equal{}(u, v)); return false; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/array_equiv.hpp b/contrib/python/pythran/pythran/pythonic/numpy/array_equiv.hpp index aa576deb69..77b45bae84 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/array_equiv.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/array_equiv.hpp @@ -20,7 +20,7 @@ namespace numpy return false; return true; } - } + } // namespace template <class U, class V> typename std::enable_if<U::value == V::value, bool>::type @@ -45,7 +45,7 @@ namespace numpy { return array_equiv(v, u); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/asarray.hpp b/contrib/python/pythran/pythran/pythonic/numpy/asarray.hpp index ceb8d68df0..a1e19f7121 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/asarray.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/asarray.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/asarray.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/numpy/array.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy template <class E, class dtype> template <class... Types> - auto _asarray<E, dtype>::operator()(Types &&... args) + auto _asarray<E, dtype>::operator()(Types &&...args) -> decltype(array(std::forward<Types>(args)...)) { return array(std::forward<Types>(args)...); @@ -28,9 +28,10 @@ namespace numpy } template <class E> - auto asarray(E &&e, types::none_type d) -> decltype( - _asarray<typename std::decay<E>::type, - typename types::dtype_of<typename std::decay<E>::type>::type>{}( + auto asarray(E &&e, types::none_type d) + -> decltype(_asarray<typename std::decay<E>::type, + typename types::dtype_of< + typename std::decay<E>::type>::type>{}( std::forward<E>(e))) { return _asarray< @@ -47,7 +48,7 @@ namespace numpy return _asarray<typename std::decay<E>::type, typename dtype::type>{}( std::forward<E>(e), d); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/asarray_chkfinite.hpp b/contrib/python/pythran/pythran/pythonic/numpy/asarray_chkfinite.hpp index 78df26bcf5..3454a7d9d8 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/asarray_chkfinite.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/asarray_chkfinite.hpp @@ -4,9 +4,9 @@ #include "pythonic/include/numpy/asarray_chkfinite.hpp" #include "pythonic/builtins/ValueError.hpp" +#include "pythonic/numpy/isfinite.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic/numpy/isfinite.hpp" PYTHONIC_NS_BEGIN @@ -22,12 +22,12 @@ namespace numpy throw types::ValueError("array must ! contain infs || NaNs"); return a; } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME asarray_chkfinite #define NUMPY_NARY_FUNC_SYM wrapper::asarray_chkfinite #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/asfarray.hpp b/contrib/python/pythran/pythran/pythonic/numpy/asfarray.hpp index 4b1629c35a..6ca0bae10b 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/asfarray.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/asfarray.hpp @@ -15,7 +15,7 @@ namespace numpy "expected a floating point type"); return asarray(std::forward<E>(e), d); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/asscalar.hpp b/contrib/python/pythran/pythran/pythonic/numpy/asscalar.hpp index 06631f0d62..23213ad439 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/asscalar.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/asscalar.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/asscalar.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" -#include "pythonic/numpy/asarray.hpp" #include "pythonic/builtins/ValueError.hpp" +#include "pythonic/numpy/asarray.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -20,7 +20,7 @@ namespace numpy "can only convert an array of size 1 to a Python scalar"); return *asarray(expr).fbegin(); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/atleast_1d.hpp b/contrib/python/pythran/pythran/pythonic/numpy/atleast_1d.hpp index a154d9f7a8..f5d5c6c767 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/atleast_1d.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/atleast_1d.hpp @@ -25,7 +25,7 @@ namespace numpy { return asarray(t); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/atleast_2d.hpp b/contrib/python/pythran/pythran/pythonic/numpy/atleast_2d.hpp index 6ff35ab3f4..e26f8abde9 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/atleast_2d.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/atleast_2d.hpp @@ -22,30 +22,32 @@ namespace numpy } template <class T> - auto atleast_2d(T const &t) -> - typename std::enable_if < (!types::is_dtype<T>::value) && - T::value<2, types::ndarray< - typename T::dtype, - types::pshape<std::integral_constant<long, 1>, - typename std::tuple_element< - 0, typename T::shape_t>::type>>>::type + auto atleast_2d(T const &t) -> + typename std::enable_if < (!types::is_dtype<T>::value) && + T::value<2, + types::ndarray< + typename T::dtype, + types::pshape<std::integral_constant<long, 1>, + typename std::tuple_element< + 0, typename T::shape_t>::type>>>::type { return t.reshape(types::pshape< - std::integral_constant<long, 1>, - typename std::tuple_element<0, typename T::shape_t>::type>( + std::integral_constant<long, 1>, + typename std::tuple_element<0, typename T::shape_t>::type>( std::integral_constant<long, 1>(), t.template shape<0>())); } template <class T> - auto atleast_2d(T &&t) -> typename std::enable_if< - (!types::is_dtype<typename std::remove_cv< - typename std::remove_reference<T>::type>::type>::value) && - std::decay<T>::type::value >= 2, - decltype(std::forward<T>(t))>::type + auto atleast_2d(T &&t) -> + typename std::enable_if< + (!types::is_dtype<typename std::remove_cv< + typename std::remove_reference<T>::type>::type>::value) && + std::decay<T>::type::value >= 2, + decltype(std::forward<T>(t))>::type { return std::forward<T>(t); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/atleast_3d.hpp b/contrib/python/pythran/pythran/pythonic/numpy/atleast_3d.hpp index 1ce01bf89b..3bf8a3fbe4 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/atleast_3d.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/atleast_3d.hpp @@ -24,13 +24,14 @@ namespace numpy } template <class T> - auto atleast_3d(T const &t) -> typename std::enable_if< - (!types::is_dtype<T>::value) && (T::value == 1), - types::ndarray<typename T::dtype, - types::pshape<std::integral_constant<long, 1>, - typename std::tuple_element< - 0, typename T::shape_t>::type, - std::integral_constant<long, 1>>>>::type + auto atleast_3d(T const &t) -> + typename std::enable_if< + (!types::is_dtype<T>::value) && (T::value == 1), + types::ndarray<typename T::dtype, + types::pshape<std::integral_constant<long, 1>, + typename std::tuple_element< + 0, typename T::shape_t>::type, + std::integral_constant<long, 1>>>>::type { auto r = asarray(t); return r.reshape( @@ -42,14 +43,15 @@ namespace numpy } template <class T> - auto atleast_3d(T const &t) -> typename std::enable_if< - (!types::is_dtype<T>::value) && (T::value == 2), - types::ndarray< - typename T::dtype, - types::pshape< - typename std::tuple_element<0, typename T::shape_t>::type, - typename std::tuple_element<1, typename T::shape_t>::type, - std::integral_constant<long, 1>>>>::type + auto atleast_3d(T const &t) -> + typename std::enable_if< + (!types::is_dtype<T>::value) && (T::value == 2), + types::ndarray< + typename T::dtype, + types::pshape< + typename std::tuple_element<0, typename T::shape_t>::type, + typename std::tuple_element<1, typename T::shape_t>::type, + std::integral_constant<long, 1>>>>::type { auto r = asarray(t); return r.reshape( @@ -67,7 +69,7 @@ namespace numpy { return asarray(t); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/average.hpp b/contrib/python/pythran/pythran/pythonic/numpy/average.hpp index ff01b3a233..3be4975aa7 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/average.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/average.hpp @@ -11,8 +11,8 @@ PYTHONIC_NS_BEGIN namespace numpy { template <class E> - auto average(E const &expr, types::none_type const &axis) - -> decltype(sum(expr, axis) / 1.) + auto average(E const &expr, + types::none_type const &axis) -> decltype(sum(expr, axis) / 1.) { return sum(expr, axis) / double(expr.flat_size()); } @@ -26,13 +26,13 @@ namespace numpy template <class E, class W> auto average(E const &expr, types::none_type const &axis, W const &weights) - -> decltype(average(expr *asarray(weights) / average(asarray(weights)))) + -> decltype(average(expr * asarray(weights) / average(asarray(weights)))) { auto aweights = asarray(weights); auto weighted_expr = expr * aweights / average(aweights); return average(weighted_expr); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/base_repr.hpp b/contrib/python/pythran/pythran/pythonic/numpy/base_repr.hpp index a8e5fc6436..5c83c69b31 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/base_repr.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/base_repr.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/base_repr.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -46,7 +46,7 @@ namespace numpy return res; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/bincount.hpp b/contrib/python/pythran/pythran/pythonic/numpy/bincount.hpp index 2402d0c096..0805a71ce0 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/bincount.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/bincount.hpp @@ -42,10 +42,9 @@ namespace numpy length = std::max<long>(length, 1 + max(expr)); typename std::enable_if< std::tuple_size<pS>::value == 1, - types::ndarray<decltype(std::declval<long>() * - std::declval<typename E::dtype>()), - types::pshape<long>>>::type - out(types::pshape<long>(length), 0L); + types::ndarray< + decltype(std::declval<long>() * std::declval<typename E::dtype>()), + types::pshape<long>>>::type out(types::pshape<long>(length), 0L); auto iweight = weights.begin(); for (auto iter = expr.fbegin(), end = expr.fend(); iter != end; ++iter, ++iweight) @@ -54,7 +53,7 @@ namespace numpy } NUMPY_EXPR_TO_NDARRAY0_IMPL(bincount); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/bitwise_and.hpp b/contrib/python/pythran/pythran/pythonic/numpy/bitwise_and.hpp index 51df6420e2..a692ccdc70 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/bitwise_and.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/bitwise_and.hpp @@ -3,11 +3,11 @@ #include "pythonic/include/numpy/bitwise_and.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/operator_/and_.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic/operator_/and_.hpp" PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME bitwise_and #define NUMPY_NARY_FUNC_SYM pythonic::operator_::and_ #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/bitwise_or.hpp b/contrib/python/pythran/pythran/pythonic/numpy/bitwise_or.hpp index 17905110c2..0c737b9808 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/bitwise_or.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/bitwise_or.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/bitwise_or.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/operator_/or_.hpp" +#include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME bitwise_or #define NUMPY_NARY_FUNC_SYM pythonic::operator_::or_ #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/bitwise_xor.hpp b/contrib/python/pythran/pythran/pythonic/numpy/bitwise_xor.hpp index ee95e63557..622990436a 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/bitwise_xor.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/bitwise_xor.hpp @@ -3,11 +3,11 @@ #include "pythonic/include/numpy/bitwise_xor.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/operator_/xor_.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic/operator_/xor_.hpp" PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME bitwise_xor #define NUMPY_NARY_FUNC_SYM pythonic::operator_::xor_ #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/broadcast_to.hpp b/contrib/python/pythran/pythran/pythonic/numpy/broadcast_to.hpp index 930b1e0e94..8498a767e5 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/broadcast_to.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/broadcast_to.hpp @@ -2,9 +2,9 @@ #define PYTHONIC_NUMPY_BROADCAST_TO_HPP #include "pythonic/include/numpy/broadcast_to.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/numpy/empty.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -29,7 +29,7 @@ namespace numpy out, bexpr); return out; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/cbrt.hpp b/contrib/python/pythran/pythran/pythonic/numpy/cbrt.hpp index c8208e84c1..fc4e0b81da 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/cbrt.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/cbrt.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/cbrt.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME cbrt #define NUMPY_NARY_FUNC_SYM xsimd::cbrt #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ceil.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ceil.hpp index b157d35803..557e054088 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/ceil.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/ceil.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/ceil.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME ceil #define NUMPY_NARY_FUNC_SYM xsimd::ceil #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/clip.hpp b/contrib/python/pythran/pythran/pythonic/numpy/clip.hpp index 6a5efe4a97..94b59b3837 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/clip.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/clip.hpp @@ -36,12 +36,12 @@ namespace numpy else return v; } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME clip #define NUMPY_NARY_FUNC_SYM wrapper::clip #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/concatenate.hpp b/contrib/python/pythran/pythran/pythonic/numpy/concatenate.hpp index 9efd5cce07..9d49c83ba5 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/concatenate.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/concatenate.hpp @@ -63,11 +63,12 @@ namespace numpy std::get<I>(from).end(), out_iter), 1)...}; } else { - types::array<typename A::value_type::const_iterator, sizeof...(I)> + types::array_tuple<typename A::value_type::const_iterator, + sizeof...(I)> ifroms = {std::get<I>(from).begin()...}; for (auto &&iout : out) { - types::array< + types::array_tuple< typename std::iterator_traits< typename A::value_type::const_iterator>::value_type, sizeof...(I)> @@ -134,11 +135,11 @@ namespace numpy } // namespace details template <class... Types> - auto - concatenate(std::tuple<Types...> const &args, long axis) -> types::ndarray< - typename __combined<typename std::decay<Types>::type::dtype...>::type, - types::array<long, - std::tuple_element<0, std::tuple<Types...>>::type::value>> + auto concatenate(std::tuple<Types...> const &args, long axis) + -> types::ndarray< + typename __combined<typename std::decay<Types>::type::dtype...>::type, + types::array_tuple< + long, std::tuple_element<0, std::tuple<Types...>>::type::value>> { using T = typename __combined<typename std::decay<Types>::type::dtype...>::type; @@ -149,8 +150,8 @@ namespace numpy types::ndarray< typename __combined<typename std::decay<Types>::type::dtype...>::type, - types::array<long, - std::decay<decltype(std::get<0>(args))>::type::value>> + types::array_tuple< + long, std::decay<decltype(std::get<0>(args))>::type::value>> result{shape, types::none_type{}}; details::concatenate_helper<N>()( result, args, axis, utils::make_index_sequence<sizeof...(Types)>{}); @@ -158,7 +159,7 @@ namespace numpy } template <class E, size_t M, class V> - types::ndarray<typename E::dtype, types::array<long, E::value>> + types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> concatenate(types::array_base<E, M, V> const &args, long axis) { using T = typename E::dtype; @@ -166,7 +167,7 @@ namespace numpy auto shape = sutils::getshape(std::get<0>(args)); shape[axis] = details::concatenate_axis_size( args, axis, utils::make_index_sequence<M>{}); - types::ndarray<typename E::dtype, types::array<long, E::value>> out( + types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> out( shape, types::none_type{}); details::concatenate_helper<N>()(out, args, axis, utils::make_index_sequence<M>{}); @@ -174,11 +175,11 @@ namespace numpy } template <class E> - types::ndarray<typename E::dtype, types::array<long, E::value>> + types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> concatenate(types::list<E> const &ai, long axis) { using return_type = - types::ndarray<typename E::dtype, types::array<long, E::value>>; + types::ndarray<typename E::dtype, types::array_tuple<long, E::value>>; using T = typename return_type::dtype; auto constexpr N = return_type::value; auto shape = sutils::getshape(ai[0]); diff --git a/contrib/python/pythran/pythran/pythonic/numpy/conjugate.hpp b/contrib/python/pythran/pythran/pythonic/numpy/conjugate.hpp index 0aa3804879..dd7fbe7a49 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/conjugate.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/conjugate.hpp @@ -13,7 +13,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME conjugate #define NUMPY_NARY_FUNC_SYM wrapper::conjugate #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/convolve.hpp b/contrib/python/pythran/pythran/pythonic/numpy/convolve.hpp index 49ef2bd28e..d078d06702 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/convolve.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/convolve.hpp @@ -2,9 +2,9 @@ #define PYTHONIC_NUMPY_CONVOLVE_HPP #include "pythonic/include/numpy/convolve.hpp" +#include "pythonic/numpy/conjugate.hpp" #include "pythonic/numpy/correlate.hpp" #include "pythonic/numpy/flip.hpp" -#include "pythonic/numpy/conjugate.hpp" #include "pythonic/types/ndarray.hpp" PYTHONIC_NS_BEGIN @@ -31,7 +31,7 @@ namespace numpy } NUMPY_EXPR_TO_NDARRAY0_IMPL(convolve) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/copy.hpp b/contrib/python/pythran/pythran/pythonic/numpy/copy.hpp index 0366015030..0b29116d81 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/copy.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/copy.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/copy.hpp" +#include "pythonic/types/ndarray.hpp" #include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_conversion.hpp" -#include "pythonic/types/ndarray.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,8 @@ namespace numpy template <class E> typename std::enable_if< !types::is_array<E>::value && !types::is_dtype<E>::value, - types::ndarray<typename E::dtype, types::array<long, E::value>>>::type + types::ndarray<typename E::dtype, + types::array_tuple<long, E::value>>>::type copy(E const &v) { return {v}; @@ -52,7 +53,7 @@ namespace numpy { return a.arg.copy(); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/copysign.hpp b/contrib/python/pythran/pythran/pythonic/numpy/copysign.hpp index 35c44dafe0..6107ac20d7 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/copysign.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/copysign.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/copysign.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME copysign #define NUMPY_NARY_FUNC_SYM xsimd::copysign #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/copyto.hpp b/contrib/python/pythran/pythran/pythonic/numpy/copyto.hpp index 1a455451a0..26fcbe3d50 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/copyto.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/copyto.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_NUMPY_COPYTO_HPP #define PYTHONIC_NUMPY_COPYTO_HPP -#include "pythonic/include/numpy/copyto.hpp" #include "pythonic//numpy/asarray.hpp" +#include "pythonic/include/numpy/copyto.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -16,18 +16,21 @@ namespace numpy using out_type = types::ndarray<T, pS>; if (may_overlap(out, expr)) { auto aexpr = asarray(expr); - utils::broadcast_copy < out_type &, decltype(aexpr), out_type::value, - (int)out_type::value - (int)utils::dim_of<E>::value, - out_type::is_vectorizable && - std::is_same<typename out_type::dtype, typename types::dtype_of<E>::type>::value && - types::is_vectorizable<E>::value > (out, aexpr); - } - else { - utils::broadcast_copy < out_type &, E, out_type::value, - (int)out_type::value - (int)utils::dim_of<E>::value, - out_type::is_vectorizable && - std::is_same<typename out_type::dtype, typename types::dtype_of<E>::type>::value && - types::is_vectorizable<E>::value > (out, expr); + utils::broadcast_copy< + out_type &, decltype(aexpr), out_type::value, + (int)out_type::value - (int)utils::dim_of<E>::value, + out_type::is_vectorizable && + std::is_same<typename out_type::dtype, + typename types::dtype_of<E>::type>::value && + types::is_vectorizable<E>::value>(out, aexpr); + } else { + utils::broadcast_copy< + out_type &, E, out_type::value, + (int)out_type::value - (int)utils::dim_of<E>::value, + out_type::is_vectorizable && + std::is_same<typename out_type::dtype, + typename types::dtype_of<E>::type>::value && + types::is_vectorizable<E>::value>(out, expr); } return {}; } @@ -39,33 +42,38 @@ namespace numpy } template <class T, class pS, class E> - types::none_type copyto(types::numpy_texpr<types::ndarray<T, pS>> &out, E const &expr) + types::none_type copyto(types::numpy_texpr<types::ndarray<T, pS>> &out, + E const &expr) { using out_type = types::numpy_texpr<types::ndarray<T, pS>>; if (may_overlap(out, expr)) { auto aexpr = asarray(expr); - utils::broadcast_copy < out_type &, decltype(aexpr), out_type::value, - (int)out_type::value - (int)utils::dim_of<E>::value, - out_type::is_vectorizable && - std::is_same<typename out_type::dtype, typename types::dtype_of<E>::type>::value && - types::is_vectorizable<E>::value > (out, aexpr); - } - else { - utils::broadcast_copy < out_type &, E, out_type::value, - (int)out_type::value - (int)utils::dim_of<E>::value, - out_type::is_vectorizable && - std::is_same<typename out_type::dtype, typename types::dtype_of<E>::type>::value && - types::is_vectorizable<E>::value > (out, expr); + utils::broadcast_copy< + out_type &, decltype(aexpr), out_type::value, + (int)out_type::value - (int)utils::dim_of<E>::value, + out_type::is_vectorizable && + std::is_same<typename out_type::dtype, + typename types::dtype_of<E>::type>::value && + types::is_vectorizable<E>::value>(out, aexpr); + } else { + utils::broadcast_copy< + out_type &, E, out_type::value, + (int)out_type::value - (int)utils::dim_of<E>::value, + out_type::is_vectorizable && + std::is_same<typename out_type::dtype, + typename types::dtype_of<E>::type>::value && + types::is_vectorizable<E>::value>(out, expr); } return {}; } template <class T, class pS, class E> - types::none_type copyto(types::numpy_texpr<types::ndarray<T, pS>> &&out, E const &expr) + types::none_type copyto(types::numpy_texpr<types::ndarray<T, pS>> &&out, + E const &expr) { return copyto(out, expr); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/cos.hpp b/contrib/python/pythran/pythran/pythonic/numpy/cos.hpp index b433cfda55..401314aec4 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/cos.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/cos.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/cos.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME cos #define NUMPY_NARY_FUNC_SYM xsimd::cos #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/cosh.hpp b/contrib/python/pythran/pythran/pythonic/numpy/cosh.hpp index 92354b5560..8375d39d70 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/cosh.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/cosh.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/cosh.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" #include <xsimd/xsimd.hpp> @@ -16,7 +16,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME cosh #define NUMPY_NARY_FUNC_SYM xsimd::cosh #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/count_nonzero.hpp b/contrib/python/pythran/pythran/pythonic/numpy/count_nonzero.hpp index 95d9294899..0fe9e6a132 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/count_nonzero.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/count_nonzero.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/count_nonzero.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -45,7 +45,7 @@ namespace numpy utils::int_<E::value>()); return count; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/cross.hpp b/contrib/python/pythran/pythran/pythonic/numpy/cross.hpp index 574a87ff02..bb69d50af3 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/cross.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/cross.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/cross.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -33,7 +33,7 @@ namespace numpy auto f0 = *fbegin; ++fbegin; auto f1 = *fbegin; - *obegin = e0 *f1 - e1 *f0; + *obegin = e0 * f1 - e1 * f0; } }; template <> @@ -50,11 +50,11 @@ namespace numpy auto f1 = *fbegin; ++fbegin; auto f2 = *fbegin; - *obegin = e1 *f2 - e2 *f1; + *obegin = e1 * f2 - e2 * f1; ++obegin; - *obegin = e2 *f0 - e0 *f2; + *obegin = e2 * f0 - e0 * f2; ++obegin; - *obegin = e0 *f1 - e1 *f0; + *obegin = e0 * f1 - e1 * f0; } }; template <> @@ -72,11 +72,11 @@ namespace numpy auto f1 = *fbegin; ++fbegin; auto f2 = *fbegin; - *obegin = e1 *f2 - e2 *f1; + *obegin = e1 * f2 - e2 * f1; ++obegin; - *obegin = e2 *f0 - e0 *f2; + *obegin = e2 * f0 - e0 * f2; ++obegin; - *obegin = e0 *f1 - e1 *f0; + *obegin = e0 * f1 - e1 * f0; } }; template <> @@ -93,35 +93,35 @@ namespace numpy ++fbegin; auto f1 = *fbegin; decltype(f1) f2 = 0; - *obegin = e1 *f2 - e2 *f1; + *obegin = e1 * f2 - e2 * f1; ++obegin; - *obegin = e2 *f0 - e0 *f2; + *obegin = e2 * f0 - e0 * f2; ++obegin; - *obegin = e0 *f1 - e1 *f0; + *obegin = e0 * f1 - e1 * f0; } }; template <class E, class F> types::ndarray< typename __combined<typename E::dtype, typename F::dtype>::type, - types::array<long, E::value>> + types::array_tuple<long, E::value>> cross(E const &e, F const &f) { using dtype = typename __combined<typename E::dtype, typename F::dtype>::type; - types::array<long, E::value> out_shape; + types::array_tuple<long, E::value> out_shape; sutils::copy_shape<0, 0>(out_shape, e, utils::make_index_sequence<E::value - 1>()); if (e.template shape<E::value - 1>() == 2) { if (f.template shape<F::value - 1>() == 2) { out_shape[E::value - 1] = 1; - types::ndarray<dtype, types::array<long, E::value>> out{ + types::ndarray<dtype, types::array_tuple<long, E::value>> out{ out_shape, types::none_type{}}; _cross<E::value, 2, 2>{}(out.begin(), out.end(), e.begin(), f.begin()); return out; } else { out_shape[E::value - 1] = 3; - types::ndarray<dtype, types::array<long, E::value>> out{ + types::ndarray<dtype, types::array_tuple<long, E::value>> out{ out_shape, types::none_type{}}; _cross<E::value, 2, 3>{}(out.begin(), out.end(), e.begin(), f.begin()); return out; @@ -129,20 +129,20 @@ namespace numpy } else { if (f.template shape<F::value - 1>() == 2) { out_shape[E::value - 1] = 3; - types::ndarray<dtype, types::array<long, E::value>> out{ + types::ndarray<dtype, types::array_tuple<long, E::value>> out{ out_shape, types::none_type{}}; _cross<E::value, 3, 2>{}(out.begin(), out.end(), e.begin(), f.begin()); return out; } else { out_shape[E::value - 1] = 3; - types::ndarray<dtype, types::array<long, E::value>> out{ + types::ndarray<dtype, types::array_tuple<long, E::value>> out{ out_shape, types::none_type{}}; _cross<E::value, 3, 3>{}(out.begin(), out.end(), e.begin(), f.begin()); return out; } } } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ctypeslib/as_array.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ctypeslib/as_array.hpp index 5566ddc85b..7532bea562 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/ctypeslib/as_array.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/ctypeslib/as_array.hpp @@ -25,8 +25,8 @@ namespace numpy { return as_array(ptr, types::pshape<long>{size}); } - } -} + } // namespace ctypeslib +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/cumprod.hpp b/contrib/python/pythran/pythran/pythonic/numpy/cumprod.hpp index d8685e4096..962871b833 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/cumprod.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/cumprod.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/cumprod.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/numpy/partial_sum.hpp" #include "pythonic/operator_/imul.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -13,7 +13,7 @@ namespace numpy { template <class E, class... Opts> - auto cumprod(E &&e, Opts &&... opts) + auto cumprod(E &&e, Opts &&...opts) -> decltype(partial_sum<operator_::functor::imul>( std::forward<E>(e), std::forward<Opts>(opts)...)) { @@ -22,7 +22,7 @@ namespace numpy } NUMPY_EXPR_TO_NDARRAY0_IMPL(cumprod); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/cumsum.hpp b/contrib/python/pythran/pythran/pythonic/numpy/cumsum.hpp index 2415ff3c11..2f54a703b5 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/cumsum.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/cumsum.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/cumsum.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/numpy/partial_sum.hpp" #include "pythonic/operator_/iadd.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -13,14 +13,14 @@ namespace numpy { template <class E, class... Opts> - auto cumsum(E &&e, Opts &&... opts) + auto cumsum(E &&e, Opts &&...opts) -> decltype(partial_sum<operator_::functor::add>( std::forward<E>(e), std::forward<Opts>(opts)...)) { return partial_sum<operator_::functor::add>(std::forward<E>(e), std::forward<Opts>(opts)...); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/deg2rad.hpp b/contrib/python/pythran/pythran/pythonic/numpy/deg2rad.hpp index 6fb4e5a982..8dab2e16b9 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/deg2rad.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/deg2rad.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/deg2rad.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/numpy/pi.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic/numpy/pi.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME deg2rad #define NUMPY_NARY_FUNC_SYM wrapper::deg2rad #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/delete_.hpp b/contrib/python/pythran/pythran/pythonic/numpy/delete_.hpp index b5ac3415c0..6520eae388 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/delete_.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/delete_.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/delete_.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -43,7 +43,7 @@ namespace numpy } NUMPY_EXPR_TO_NDARRAY0_IMPL(delete_); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/diag.hpp b/contrib/python/pythran/pythran/pythonic/numpy/diag.hpp index a5e12357b7..7f4dde7d5e 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/diag.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/diag.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/diag.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/numpy/asarray.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_conversion.hpp" -#include "pythonic/numpy/asarray.hpp" PYTHONIC_NS_BEGIN @@ -37,11 +37,12 @@ namespace numpy template <class T, class pS> typename std::enable_if<std::tuple_size<pS>::value == 1, - types::ndarray<T, types::array<long, 2>>>::type + types::ndarray<T, types::array_tuple<long, 2>>>::type diag(types::ndarray<T, pS> const &a, long k) { long n = a.flat_size() + std::abs(k); - types::ndarray<T, types::array<long, 2>> out(types::make_tuple(n, n), 0); + types::ndarray<T, types::array_tuple<long, 2>> out(types::make_tuple(n, n), + 0); if (k >= 0) for (long i = 0, j = k; i < n && j < n; ++i, ++j) out[i][j] = a[i]; @@ -58,7 +59,7 @@ namespace numpy } NUMPY_EXPR_TO_NDARRAY0_IMPL(diag); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/diff.hpp b/contrib/python/pythran/pythran/pythonic/numpy/diff.hpp index 5863201ad1..763d1cefe5 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/diff.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/diff.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/diff.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/numpy/asarray.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy namespace details { template <class E> - types::ndarray<typename E::dtype, types::array<long, E::value>> + types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> diff(E const &arr, long n, long axis) { auto shape = sutils::getshape(arr); @@ -50,9 +50,9 @@ namespace numpy else return diff(out, n - 1, axis); } - } + } // namespace details template <class E> - types::ndarray<typename E::dtype, types::array<long, E::value>> + types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> diff(E const &expr, long n, long axis) { if (axis < 0) @@ -60,7 +60,7 @@ namespace numpy // that's the only allocation that should happen return details::diff(array(expr), n, axis); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/digitize.hpp b/contrib/python/pythran/pythran/pythonic/numpy/digitize.hpp index e5e374f196..65655aba63 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/digitize.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/digitize.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/digitize.hpp" -#include "pythonic/numpy/asarray.hpp" #include "pythonic/builtins/None.hpp" +#include "pythonic/numpy/asarray.hpp" #include "pythonic/operator_/gt.hpp" #include "pythonic/operator_/lt.hpp" @@ -31,7 +31,7 @@ namespace numpy _digitize((*begin).begin(), (*begin).end(), out, bins, op, utils::int_<N - 1>()); } - } + } // namespace template <class E, class F> types::ndarray<long, types::pshape<long>> digitize(E const &expr, F const &b) @@ -50,7 +50,7 @@ namespace numpy operator_::functor::gt(), utils::int_<E::value>()); return out; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/divide.hpp b/contrib/python/pythran/pythran/pythonic/numpy/divide.hpp index 2be148fb07..d212dcce78 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/divide.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/divide.hpp @@ -3,11 +3,11 @@ #include "pythonic/include/numpy/divide.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/operator_/div.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic/operator_/div.hpp" PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME divide #define NUMPY_NARY_FUNC_SYM pythonic::operator_::div #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/dot.hpp b/contrib/python/pythran/pythran/pythonic/numpy/dot.hpp index 46d93dae99..2c1f65b3d7 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/dot.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/dot.hpp @@ -3,6 +3,7 @@ #include "pythonic/include/numpy/dot.hpp" +#include "pythonic/numpy/asarray.hpp" #include "pythonic/numpy/multiply.hpp" #include "pythonic/numpy/sum.hpp" #include "pythonic/types/ndarray.hpp" @@ -12,6 +13,1286 @@ #error pythran configured without BLAS but BLAS seem needed #endif +#if defined(PYTHRAN_BLAS_SCIPY_OPENBLAS) +#define BLAS_MANGLE(s) scipy_##s##64_ + +/* FIXED VENDORED HEADER { */ +#include "openblas_config.h" +#include <stddef.h> + +extern "C" { +/* Assume C declarations for C++ */ + +/*Set the number of threads on runtime.*/ +void scipy_openblas_set_num_threads64_(int num_threads); +void scipy_goto_set_num_threads64_(int num_threads); +int scipy_openblas_set_num_threads_local64_(int num_threads); + +/*Get the number of threads on runtime.*/ +int scipy_openblas_get_num_threads64_(void); + +/*Get the number of physical processors (cores).*/ +int scipy_openblas_get_num_procs64_(void); + +/*Get the build configure on runtime.*/ +char *scipy_openblas_get_config64_(void); + +/*Get the CPU corename on runtime.*/ +char *scipy_openblas_get_corename64_(void); + +/*Set the threading backend to a custom callback.*/ +typedef void (*scipy_openblas_dojob_callback64_)(int thread_num, void *jobdata, + int dojob_data); +typedef void (*scipy_openblas_threads_callback64_)( + int sync, scipy_openblas_dojob_callback64_ dojob, int numjobs, + size_t jobdata_elsize, void *jobdata, int dojob_data); +void scipy_openblas_set_threads_callback_function64_( + scipy_openblas_threads_callback64_ callback); + +#ifdef OPENBLAS_OS_LINUX +/* Sets thread affinity for OpenBLAS threads. `thread_idx` is in [0, + * scipy_openblas_get_num_threads64_()-1]. */ +int scipy_openblas_setaffinity64_(int thread_idx, size_t cpusetsize, + cpu_set_t *cpu_set); +/* Queries thread affinity for OpenBLAS threads. `thread_idx` is in [0, + * scipy_openblas_get_num_threads64_()-1]. */ +int scipy_openblas_getaffinity64_(int thread_idx, size_t cpusetsize, + cpu_set_t *cpu_set); +#endif + +/* Get the parallelization type which is used by OpenBLAS */ +int scipy_openblas_get_parallel64_(void); +/* OpenBLAS is compiled for sequential use */ +#define OPENBLAS_SEQUENTIAL 0 +/* OpenBLAS is compiled using normal threading model */ +#define OPENBLAS_THREAD 1 +/* OpenBLAS is compiled using OpenMP threading model */ +#define OPENBLAS_OPENMP 2 + +/* + * Since all of GotoBlas was written without const, + * we disable it at build time. + */ +#ifndef OPENBLAS_CONST +#define OPENBLAS_CONST const +#endif + +#define CBLAS_INDEX size_t + +typedef enum CBLAS_ORDER { + CblasRowMajor = 101, + CblasColMajor = 102 +} CBLAS_ORDER; +typedef enum CBLAS_TRANSPOSE { + CblasNoTrans = 111, + CblasTrans = 112, + CblasConjTrans = 113, + CblasConjNoTrans = 114 +} CBLAS_TRANSPOSE; +typedef enum CBLAS_UPLO { CblasUpper = 121, CblasLower = 122 } CBLAS_UPLO; +typedef enum CBLAS_DIAG { CblasNonUnit = 131, CblasUnit = 132 } CBLAS_DIAG; +typedef enum CBLAS_SIDE { CblasLeft = 141, CblasRight = 142 } CBLAS_SIDE; +typedef CBLAS_ORDER CBLAS_LAYOUT; + +float scipy_cblas_sdsdot64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST float alpha, OPENBLAS_CONST float *x, + OPENBLAS_CONST blasint incx, + OPENBLAS_CONST float *y, + OPENBLAS_CONST blasint incy); +double scipy_cblas_dsdot64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float *x, + OPENBLAS_CONST blasint incx, + OPENBLAS_CONST float *y, + OPENBLAS_CONST blasint incy); +float scipy_cblas_sdot64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float *x, + OPENBLAS_CONST blasint incx, OPENBLAS_CONST float *y, + OPENBLAS_CONST blasint incy); +double scipy_cblas_ddot64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST double *x, + OPENBLAS_CONST blasint incx, + OPENBLAS_CONST double *y, + OPENBLAS_CONST blasint incy); + +openblas_complex_float scipy_cblas_cdotu64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx, + OPENBLAS_CONST void *y, + OPENBLAS_CONST blasint incy); +openblas_complex_float scipy_cblas_cdotc64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx, + OPENBLAS_CONST void *y, + OPENBLAS_CONST blasint incy); +openblas_complex_double scipy_cblas_zdotu64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx, + OPENBLAS_CONST void *y, + OPENBLAS_CONST blasint incy); +openblas_complex_double scipy_cblas_zdotc64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx, + OPENBLAS_CONST void *y, + OPENBLAS_CONST blasint incy); + +void scipy_cblas_cdotu_sub64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx, + OPENBLAS_CONST void *y, + OPENBLAS_CONST blasint incy, void *ret); +void scipy_cblas_cdotc_sub64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx, + OPENBLAS_CONST void *y, + OPENBLAS_CONST blasint incy, void *ret); +void scipy_cblas_zdotu_sub64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx, + OPENBLAS_CONST void *y, + OPENBLAS_CONST blasint incy, void *ret); +void scipy_cblas_zdotc_sub64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx, + OPENBLAS_CONST void *y, + OPENBLAS_CONST blasint incy, void *ret); + +float scipy_cblas_sasum64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float *x, + OPENBLAS_CONST blasint incx); +double scipy_cblas_dasum64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST double *x, + OPENBLAS_CONST blasint incx); +float scipy_cblas_scasum64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx); +double scipy_cblas_dzasum64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx); + +float scipy_cblas_ssum64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float *x, + OPENBLAS_CONST blasint incx); +double scipy_cblas_dsum64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST double *x, + OPENBLAS_CONST blasint incx); +float scipy_cblas_scsum64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx); +double scipy_cblas_dzsum64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx); + +float scipy_cblas_snrm264_(OPENBLAS_CONST blasint N, OPENBLAS_CONST float *X, + OPENBLAS_CONST blasint incX); +double scipy_cblas_dnrm264_(OPENBLAS_CONST blasint N, OPENBLAS_CONST double *X, + OPENBLAS_CONST blasint incX); +float scipy_cblas_scnrm264_(OPENBLAS_CONST blasint N, OPENBLAS_CONST void *X, + OPENBLAS_CONST blasint incX); +double scipy_cblas_dznrm264_(OPENBLAS_CONST blasint N, OPENBLAS_CONST void *X, + OPENBLAS_CONST blasint incX); + +CBLAS_INDEX scipy_cblas_isamax64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST float *x, + OPENBLAS_CONST blasint incx); +CBLAS_INDEX scipy_cblas_idamax64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST double *x, + OPENBLAS_CONST blasint incx); +CBLAS_INDEX scipy_cblas_icamax64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx); +CBLAS_INDEX scipy_cblas_izamax64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx); + +CBLAS_INDEX scipy_cblas_isamin64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST float *x, + OPENBLAS_CONST blasint incx); +CBLAS_INDEX scipy_cblas_idamin64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST double *x, + OPENBLAS_CONST blasint incx); +CBLAS_INDEX scipy_cblas_icamin64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx); +CBLAS_INDEX scipy_cblas_izamin64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx); + +float scipy_cblas_samax64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float *x, + OPENBLAS_CONST blasint incx); +double scipy_cblas_damax64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST double *x, + OPENBLAS_CONST blasint incx); +float scipy_cblas_scamax64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx); +double scipy_cblas_dzamax64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx); + +float scipy_cblas_samin64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float *x, + OPENBLAS_CONST blasint incx); +double scipy_cblas_damin64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST double *x, + OPENBLAS_CONST blasint incx); +float scipy_cblas_scamin64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx); +double scipy_cblas_dzamin64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx); + +CBLAS_INDEX scipy_cblas_ismax64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST float *x, + OPENBLAS_CONST blasint incx); +CBLAS_INDEX scipy_cblas_idmax64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST double *x, + OPENBLAS_CONST blasint incx); +CBLAS_INDEX scipy_cblas_icmax64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx); +CBLAS_INDEX scipy_cblas_izmax64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx); + +CBLAS_INDEX scipy_cblas_ismin64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST float *x, + OPENBLAS_CONST blasint incx); +CBLAS_INDEX scipy_cblas_idmin64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST double *x, + OPENBLAS_CONST blasint incx); +CBLAS_INDEX scipy_cblas_icmin64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx); +CBLAS_INDEX scipy_cblas_izmin64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx); + +void scipy_cblas_saxpy64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float alpha, + OPENBLAS_CONST float *x, OPENBLAS_CONST blasint incx, + float *y, OPENBLAS_CONST blasint incy); +void scipy_cblas_daxpy64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST double alpha, + OPENBLAS_CONST double *x, OPENBLAS_CONST blasint incx, + double *y, OPENBLAS_CONST blasint incy); +void scipy_cblas_caxpy64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *alpha, + OPENBLAS_CONST void *x, OPENBLAS_CONST blasint incx, + void *y, OPENBLAS_CONST blasint incy); +void scipy_cblas_zaxpy64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *alpha, + OPENBLAS_CONST void *x, OPENBLAS_CONST blasint incx, + void *y, OPENBLAS_CONST blasint incy); + +void scipy_cblas_caxpyc64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *alpha, + OPENBLAS_CONST void *x, OPENBLAS_CONST blasint incx, + void *y, OPENBLAS_CONST blasint incy); +void scipy_cblas_zaxpyc64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *alpha, + OPENBLAS_CONST void *x, OPENBLAS_CONST blasint incx, + void *y, OPENBLAS_CONST blasint incy); + +void scipy_cblas_scopy64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float *x, + OPENBLAS_CONST blasint incx, float *y, + OPENBLAS_CONST blasint incy); +void scipy_cblas_dcopy64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST double *x, + OPENBLAS_CONST blasint incx, double *y, + OPENBLAS_CONST blasint incy); +void scipy_cblas_ccopy64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx, void *y, + OPENBLAS_CONST blasint incy); +void scipy_cblas_zcopy64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx, void *y, + OPENBLAS_CONST blasint incy); + +void scipy_cblas_sswap64_(OPENBLAS_CONST blasint n, float *x, + OPENBLAS_CONST blasint incx, float *y, + OPENBLAS_CONST blasint incy); +void scipy_cblas_dswap64_(OPENBLAS_CONST blasint n, double *x, + OPENBLAS_CONST blasint incx, double *y, + OPENBLAS_CONST blasint incy); +void scipy_cblas_cswap64_(OPENBLAS_CONST blasint n, void *x, + OPENBLAS_CONST blasint incx, void *y, + OPENBLAS_CONST blasint incy); +void scipy_cblas_zswap64_(OPENBLAS_CONST blasint n, void *x, + OPENBLAS_CONST blasint incx, void *y, + OPENBLAS_CONST blasint incy); + +void scipy_cblas_srot64_(OPENBLAS_CONST blasint N, float *X, + OPENBLAS_CONST blasint incX, float *Y, + OPENBLAS_CONST blasint incY, OPENBLAS_CONST float c, + OPENBLAS_CONST float s); +void scipy_cblas_drot64_(OPENBLAS_CONST blasint N, double *X, + OPENBLAS_CONST blasint incX, double *Y, + OPENBLAS_CONST blasint incY, OPENBLAS_CONST double c, + OPENBLAS_CONST double s); +void scipy_cblas_csrot64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx, void *y, + OPENBLAS_CONST blasint incY, OPENBLAS_CONST float c, + OPENBLAS_CONST float s); +void scipy_cblas_zdrot64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx, void *y, + OPENBLAS_CONST blasint incY, OPENBLAS_CONST double c, + OPENBLAS_CONST double s); + +void scipy_cblas_srotg64_(float *a, float *b, float *c, float *s); +void scipy_cblas_drotg64_(double *a, double *b, double *c, double *s); +void scipy_cblas_crotg64_(void *a, void *b, float *c, void *s); +void scipy_cblas_zrotg64_(void *a, void *b, double *c, void *s); + +void scipy_cblas_srotm64_(OPENBLAS_CONST blasint N, float *X, + OPENBLAS_CONST blasint incX, float *Y, + OPENBLAS_CONST blasint incY, OPENBLAS_CONST float *P); +void scipy_cblas_drotm64_(OPENBLAS_CONST blasint N, double *X, + OPENBLAS_CONST blasint incX, double *Y, + OPENBLAS_CONST blasint incY, + OPENBLAS_CONST double *P); + +void scipy_cblas_srotmg64_(float *d1, float *d2, float *b1, + OPENBLAS_CONST float b2, float *P); +void scipy_cblas_drotmg64_(double *d1, double *d2, double *b1, + OPENBLAS_CONST double b2, double *P); + +void scipy_cblas_sscal64_(OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha, + float *X, OPENBLAS_CONST blasint incX); +void scipy_cblas_dscal64_(OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha, + double *X, OPENBLAS_CONST blasint incX); +void scipy_cblas_cscal64_(OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha, + void *X, OPENBLAS_CONST blasint incX); +void scipy_cblas_zscal64_(OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha, + void *X, OPENBLAS_CONST blasint incX); +void scipy_cblas_csscal64_(OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha, + void *X, OPENBLAS_CONST blasint incX); +void scipy_cblas_zdscal64_(OPENBLAS_CONST blasint N, + OPENBLAS_CONST double alpha, void *X, + OPENBLAS_CONST blasint incX); + +void scipy_cblas_sgemv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_TRANSPOSE trans, + OPENBLAS_CONST blasint m, OPENBLAS_CONST blasint n, + OPENBLAS_CONST float alpha, OPENBLAS_CONST float *a, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST float *x, + OPENBLAS_CONST blasint incx, + OPENBLAS_CONST float beta, float *y, + OPENBLAS_CONST blasint incy); +void scipy_cblas_dgemv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_TRANSPOSE trans, + OPENBLAS_CONST blasint m, OPENBLAS_CONST blasint n, + OPENBLAS_CONST double alpha, OPENBLAS_CONST double *a, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST double *x, + OPENBLAS_CONST blasint incx, + OPENBLAS_CONST double beta, double *y, + OPENBLAS_CONST blasint incy); +void scipy_cblas_cgemv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_TRANSPOSE trans, + OPENBLAS_CONST blasint m, OPENBLAS_CONST blasint n, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *a, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx, + OPENBLAS_CONST void *beta, void *y, + OPENBLAS_CONST blasint incy); +void scipy_cblas_zgemv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_TRANSPOSE trans, + OPENBLAS_CONST blasint m, OPENBLAS_CONST blasint n, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *a, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *x, + OPENBLAS_CONST blasint incx, + OPENBLAS_CONST void *beta, void *y, + OPENBLAS_CONST blasint incy); + +void scipy_cblas_sger64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST float alpha, OPENBLAS_CONST float *X, + OPENBLAS_CONST blasint incX, OPENBLAS_CONST float *Y, + OPENBLAS_CONST blasint incY, float *A, + OPENBLAS_CONST blasint lda); +void scipy_cblas_dger64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST double alpha, OPENBLAS_CONST double *X, + OPENBLAS_CONST blasint incX, OPENBLAS_CONST double *Y, + OPENBLAS_CONST blasint incY, double *A, + OPENBLAS_CONST blasint lda); +void scipy_cblas_cgeru64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *X, + OPENBLAS_CONST blasint incX, OPENBLAS_CONST void *Y, + OPENBLAS_CONST blasint incY, void *A, + OPENBLAS_CONST blasint lda); +void scipy_cblas_cgerc64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *X, + OPENBLAS_CONST blasint incX, OPENBLAS_CONST void *Y, + OPENBLAS_CONST blasint incY, void *A, + OPENBLAS_CONST blasint lda); +void scipy_cblas_zgeru64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *X, + OPENBLAS_CONST blasint incX, OPENBLAS_CONST void *Y, + OPENBLAS_CONST blasint incY, void *A, + OPENBLAS_CONST blasint lda); +void scipy_cblas_zgerc64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *X, + OPENBLAS_CONST blasint incX, OPENBLAS_CONST void *Y, + OPENBLAS_CONST blasint incY, void *A, + OPENBLAS_CONST blasint lda); + +void scipy_cblas_strsv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST float *A, + OPENBLAS_CONST blasint lda, float *X, + OPENBLAS_CONST blasint incX); +void scipy_cblas_dtrsv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST double *A, + OPENBLAS_CONST blasint lda, double *X, + OPENBLAS_CONST blasint incX); +void scipy_cblas_ctrsv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, void *X, + OPENBLAS_CONST blasint incX); +void scipy_cblas_ztrsv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, void *X, + OPENBLAS_CONST blasint incX); + +void scipy_cblas_strmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST float *A, + OPENBLAS_CONST blasint lda, float *X, + OPENBLAS_CONST blasint incX); +void scipy_cblas_dtrmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST double *A, + OPENBLAS_CONST blasint lda, double *X, + OPENBLAS_CONST blasint incX); +void scipy_cblas_ctrmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, void *X, + OPENBLAS_CONST blasint incX); +void scipy_cblas_ztrmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, void *X, + OPENBLAS_CONST blasint incX); + +void scipy_cblas_ssyr64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha, + OPENBLAS_CONST float *X, OPENBLAS_CONST blasint incX, + float *A, OPENBLAS_CONST blasint lda); +void scipy_cblas_dsyr64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha, + OPENBLAS_CONST double *X, OPENBLAS_CONST blasint incX, + double *A, OPENBLAS_CONST blasint lda); +void scipy_cblas_cher64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha, + OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX, + void *A, OPENBLAS_CONST blasint lda); +void scipy_cblas_zher64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha, + OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX, + void *A, OPENBLAS_CONST blasint lda); + +void scipy_cblas_ssyr264_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha, + OPENBLAS_CONST float *X, OPENBLAS_CONST blasint incX, + OPENBLAS_CONST float *Y, OPENBLAS_CONST blasint incY, + float *A, OPENBLAS_CONST blasint lda); +void scipy_cblas_dsyr264_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha, + OPENBLAS_CONST double *X, OPENBLAS_CONST blasint incX, + OPENBLAS_CONST double *Y, OPENBLAS_CONST blasint incY, + double *A, OPENBLAS_CONST blasint lda); +void scipy_cblas_cher264_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha, + OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX, + OPENBLAS_CONST void *Y, OPENBLAS_CONST blasint incY, + void *A, OPENBLAS_CONST blasint lda); +void scipy_cblas_zher264_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha, + OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX, + OPENBLAS_CONST void *Y, OPENBLAS_CONST blasint incY, + void *A, OPENBLAS_CONST blasint lda); + +void scipy_cblas_sgbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST blasint KL, OPENBLAS_CONST blasint KU, + OPENBLAS_CONST float alpha, OPENBLAS_CONST float *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST float *X, + OPENBLAS_CONST blasint incX, + OPENBLAS_CONST float beta, float *Y, + OPENBLAS_CONST blasint incY); +void scipy_cblas_dgbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST blasint KL, OPENBLAS_CONST blasint KU, + OPENBLAS_CONST double alpha, OPENBLAS_CONST double *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST double *X, + OPENBLAS_CONST blasint incX, + OPENBLAS_CONST double beta, double *Y, + OPENBLAS_CONST blasint incY); +void scipy_cblas_cgbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST blasint KL, OPENBLAS_CONST blasint KU, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *X, + OPENBLAS_CONST blasint incX, + OPENBLAS_CONST void *beta, void *Y, + OPENBLAS_CONST blasint incY); +void scipy_cblas_zgbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST blasint KL, OPENBLAS_CONST blasint KU, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *X, + OPENBLAS_CONST blasint incX, + OPENBLAS_CONST void *beta, void *Y, + OPENBLAS_CONST blasint incY); + +void scipy_cblas_ssbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST float alpha, OPENBLAS_CONST float *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST float *X, + OPENBLAS_CONST blasint incX, + OPENBLAS_CONST float beta, float *Y, + OPENBLAS_CONST blasint incY); +void scipy_cblas_dsbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST double alpha, OPENBLAS_CONST double *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST double *X, + OPENBLAS_CONST blasint incX, + OPENBLAS_CONST double beta, double *Y, + OPENBLAS_CONST blasint incY); + +void scipy_cblas_stbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST float *A, OPENBLAS_CONST blasint lda, + float *X, OPENBLAS_CONST blasint incX); +void scipy_cblas_dtbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST double *A, OPENBLAS_CONST blasint lda, + double *X, OPENBLAS_CONST blasint incX); +void scipy_cblas_ctbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda, + void *X, OPENBLAS_CONST blasint incX); +void scipy_cblas_ztbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda, + void *X, OPENBLAS_CONST blasint incX); + +void scipy_cblas_stbsv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST float *A, OPENBLAS_CONST blasint lda, + float *X, OPENBLAS_CONST blasint incX); +void scipy_cblas_dtbsv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST double *A, OPENBLAS_CONST blasint lda, + double *X, OPENBLAS_CONST blasint incX); +void scipy_cblas_ctbsv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda, + void *X, OPENBLAS_CONST blasint incX); +void scipy_cblas_ztbsv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda, + void *X, OPENBLAS_CONST blasint incX); + +void scipy_cblas_stpmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST float *Ap, + float *X, OPENBLAS_CONST blasint incX); +void scipy_cblas_dtpmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST double *Ap, + double *X, OPENBLAS_CONST blasint incX); +void scipy_cblas_ctpmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST void *Ap, + void *X, OPENBLAS_CONST blasint incX); +void scipy_cblas_ztpmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST void *Ap, + void *X, OPENBLAS_CONST blasint incX); + +void scipy_cblas_stpsv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST float *Ap, + float *X, OPENBLAS_CONST blasint incX); +void scipy_cblas_dtpsv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST double *Ap, + double *X, OPENBLAS_CONST blasint incX); +void scipy_cblas_ctpsv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST void *Ap, + void *X, OPENBLAS_CONST blasint incX); +void scipy_cblas_ztpsv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint N, OPENBLAS_CONST void *Ap, + void *X, OPENBLAS_CONST blasint incX); + +void scipy_cblas_ssymv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha, + OPENBLAS_CONST float *A, OPENBLAS_CONST blasint lda, + OPENBLAS_CONST float *X, OPENBLAS_CONST blasint incX, + OPENBLAS_CONST float beta, float *Y, + OPENBLAS_CONST blasint incY); +void scipy_cblas_dsymv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha, + OPENBLAS_CONST double *A, OPENBLAS_CONST blasint lda, + OPENBLAS_CONST double *X, OPENBLAS_CONST blasint incX, + OPENBLAS_CONST double beta, double *Y, + OPENBLAS_CONST blasint incY); +void scipy_cblas_chemv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha, + OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda, + OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX, + OPENBLAS_CONST void *beta, void *Y, + OPENBLAS_CONST blasint incY); +void scipy_cblas_zhemv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha, + OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda, + OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX, + OPENBLAS_CONST void *beta, void *Y, + OPENBLAS_CONST blasint incY); + +void scipy_cblas_sspmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha, + OPENBLAS_CONST float *Ap, OPENBLAS_CONST float *X, + OPENBLAS_CONST blasint incX, + OPENBLAS_CONST float beta, float *Y, + OPENBLAS_CONST blasint incY); +void scipy_cblas_dspmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha, + OPENBLAS_CONST double *Ap, OPENBLAS_CONST double *X, + OPENBLAS_CONST blasint incX, + OPENBLAS_CONST double beta, double *Y, + OPENBLAS_CONST blasint incY); + +void scipy_cblas_sspr64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha, + OPENBLAS_CONST float *X, OPENBLAS_CONST blasint incX, + float *Ap); +void scipy_cblas_dspr64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha, + OPENBLAS_CONST double *X, OPENBLAS_CONST blasint incX, + double *Ap); + +void scipy_cblas_chpr64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha, + OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX, + void *A); +void scipy_cblas_zhpr64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha, + OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX, + void *A); + +void scipy_cblas_sspr264_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha, + OPENBLAS_CONST float *X, OPENBLAS_CONST blasint incX, + OPENBLAS_CONST float *Y, OPENBLAS_CONST blasint incY, + float *A); +void scipy_cblas_dspr264_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha, + OPENBLAS_CONST double *X, OPENBLAS_CONST blasint incX, + OPENBLAS_CONST double *Y, OPENBLAS_CONST blasint incY, + double *A); +void scipy_cblas_chpr264_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha, + OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX, + OPENBLAS_CONST void *Y, OPENBLAS_CONST blasint incY, + void *Ap); +void scipy_cblas_zhpr264_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha, + OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX, + OPENBLAS_CONST void *Y, OPENBLAS_CONST blasint incY, + void *Ap); + +void scipy_cblas_chbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *X, + OPENBLAS_CONST blasint incX, + OPENBLAS_CONST void *beta, void *Y, + OPENBLAS_CONST blasint incY); +void scipy_cblas_zhbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *X, + OPENBLAS_CONST blasint incX, + OPENBLAS_CONST void *beta, void *Y, + OPENBLAS_CONST blasint incY); + +void scipy_cblas_chpmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha, + OPENBLAS_CONST void *Ap, OPENBLAS_CONST void *X, + OPENBLAS_CONST blasint incX, + OPENBLAS_CONST void *beta, void *Y, + OPENBLAS_CONST blasint incY); +void scipy_cblas_zhpmv64_(OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha, + OPENBLAS_CONST void *Ap, OPENBLAS_CONST void *X, + OPENBLAS_CONST blasint incX, + OPENBLAS_CONST void *beta, void *Y, + OPENBLAS_CONST blasint incY); + +void scipy_cblas_sgemm64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST blasint K, OPENBLAS_CONST float alpha, + OPENBLAS_CONST float *A, OPENBLAS_CONST blasint lda, + OPENBLAS_CONST float *B, OPENBLAS_CONST blasint ldb, + OPENBLAS_CONST float beta, float *C, + OPENBLAS_CONST blasint ldc); +void scipy_cblas_dgemm64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST blasint K, OPENBLAS_CONST double alpha, + OPENBLAS_CONST double *A, OPENBLAS_CONST blasint lda, + OPENBLAS_CONST double *B, OPENBLAS_CONST blasint ldb, + OPENBLAS_CONST double beta, double *C, + OPENBLAS_CONST blasint ldc); +void scipy_cblas_cgemm64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST blasint K, OPENBLAS_CONST void *alpha, + OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda, + OPENBLAS_CONST void *B, OPENBLAS_CONST blasint ldb, + OPENBLAS_CONST void *beta, void *C, + OPENBLAS_CONST blasint ldc); +void scipy_cblas_cgemm3m64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST blasint K, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B, + OPENBLAS_CONST blasint ldb, + OPENBLAS_CONST void *beta, void *C, + OPENBLAS_CONST blasint ldc); +void scipy_cblas_zgemm64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST blasint K, OPENBLAS_CONST void *alpha, + OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda, + OPENBLAS_CONST void *B, OPENBLAS_CONST blasint ldb, + OPENBLAS_CONST void *beta, void *C, + OPENBLAS_CONST blasint ldc); +void scipy_cblas_zgemm3m64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST blasint K, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B, + OPENBLAS_CONST blasint ldb, + OPENBLAS_CONST void *beta, void *C, + OPENBLAS_CONST blasint ldc); + +void scipy_cblas_sgemmt64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint K, + OPENBLAS_CONST float alpha, OPENBLAS_CONST float *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST float *B, + OPENBLAS_CONST blasint ldb, + OPENBLAS_CONST float beta, float *C, + OPENBLAS_CONST blasint ldc); +void scipy_cblas_dgemmt64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint K, + OPENBLAS_CONST double alpha, + OPENBLAS_CONST double *A, OPENBLAS_CONST blasint lda, + OPENBLAS_CONST double *B, OPENBLAS_CONST blasint ldb, + OPENBLAS_CONST double beta, double *C, + OPENBLAS_CONST blasint ldc); +void scipy_cblas_cgemmt64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint K, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B, + OPENBLAS_CONST blasint ldb, + OPENBLAS_CONST void *beta, void *C, + OPENBLAS_CONST blasint ldc); +void scipy_cblas_zgemmt64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint K, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B, + OPENBLAS_CONST blasint ldb, + OPENBLAS_CONST void *beta, void *C, + OPENBLAS_CONST blasint ldc); + +void scipy_cblas_ssymm64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_SIDE Side, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST float alpha, OPENBLAS_CONST float *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST float *B, + OPENBLAS_CONST blasint ldb, OPENBLAS_CONST float beta, + float *C, OPENBLAS_CONST blasint ldc); +void scipy_cblas_dsymm64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_SIDE Side, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST double alpha, OPENBLAS_CONST double *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST double *B, + OPENBLAS_CONST blasint ldb, + OPENBLAS_CONST double beta, double *C, + OPENBLAS_CONST blasint ldc); +void scipy_cblas_csymm64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_SIDE Side, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B, + OPENBLAS_CONST blasint ldb, OPENBLAS_CONST void *beta, + void *C, OPENBLAS_CONST blasint ldc); +void scipy_cblas_zsymm64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_SIDE Side, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B, + OPENBLAS_CONST blasint ldb, OPENBLAS_CONST void *beta, + void *C, OPENBLAS_CONST blasint ldc); + +void scipy_cblas_ssyrk64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST float alpha, OPENBLAS_CONST float *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST float beta, + float *C, OPENBLAS_CONST blasint ldc); +void scipy_cblas_dsyrk64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST double alpha, OPENBLAS_CONST double *A, + OPENBLAS_CONST blasint lda, + OPENBLAS_CONST double beta, double *C, + OPENBLAS_CONST blasint ldc); +void scipy_cblas_csyrk64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *beta, + void *C, OPENBLAS_CONST blasint ldc); +void scipy_cblas_zsyrk64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *beta, + void *C, OPENBLAS_CONST blasint ldc); + +void scipy_cblas_ssyr2k64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST float alpha, OPENBLAS_CONST float *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST float *B, + OPENBLAS_CONST blasint ldb, + OPENBLAS_CONST float beta, float *C, + OPENBLAS_CONST blasint ldc); +void scipy_cblas_dsyr2k64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST double alpha, + OPENBLAS_CONST double *A, OPENBLAS_CONST blasint lda, + OPENBLAS_CONST double *B, OPENBLAS_CONST blasint ldb, + OPENBLAS_CONST double beta, double *C, + OPENBLAS_CONST blasint ldc); +void scipy_cblas_csyr2k64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B, + OPENBLAS_CONST blasint ldb, + OPENBLAS_CONST void *beta, void *C, + OPENBLAS_CONST blasint ldc); +void scipy_cblas_zsyr2k64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B, + OPENBLAS_CONST blasint ldb, + OPENBLAS_CONST void *beta, void *C, + OPENBLAS_CONST blasint ldc); + +void scipy_cblas_strmm64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_SIDE Side, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST float alpha, OPENBLAS_CONST float *A, + OPENBLAS_CONST blasint lda, float *B, + OPENBLAS_CONST blasint ldb); +void scipy_cblas_dtrmm64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_SIDE Side, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST double alpha, OPENBLAS_CONST double *A, + OPENBLAS_CONST blasint lda, double *B, + OPENBLAS_CONST blasint ldb); +void scipy_cblas_ctrmm64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_SIDE Side, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, void *B, + OPENBLAS_CONST blasint ldb); +void scipy_cblas_ztrmm64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_SIDE Side, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, void *B, + OPENBLAS_CONST blasint ldb); + +void scipy_cblas_strsm64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_SIDE Side, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST float alpha, OPENBLAS_CONST float *A, + OPENBLAS_CONST blasint lda, float *B, + OPENBLAS_CONST blasint ldb); +void scipy_cblas_dtrsm64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_SIDE Side, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST double alpha, OPENBLAS_CONST double *A, + OPENBLAS_CONST blasint lda, double *B, + OPENBLAS_CONST blasint ldb); +void scipy_cblas_ctrsm64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_SIDE Side, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, void *B, + OPENBLAS_CONST blasint ldb); +void scipy_cblas_ztrsm64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_SIDE Side, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_DIAG Diag, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, void *B, + OPENBLAS_CONST blasint ldb); + +void scipy_cblas_chemm64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_SIDE Side, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B, + OPENBLAS_CONST blasint ldb, OPENBLAS_CONST void *beta, + void *C, OPENBLAS_CONST blasint ldc); +void scipy_cblas_zhemm64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_SIDE Side, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B, + OPENBLAS_CONST blasint ldb, OPENBLAS_CONST void *beta, + void *C, OPENBLAS_CONST blasint ldc); + +void scipy_cblas_cherk64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST float alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST float beta, + void *C, OPENBLAS_CONST blasint ldc); +void scipy_cblas_zherk64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST double alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, + OPENBLAS_CONST double beta, void *C, + OPENBLAS_CONST blasint ldc); + +void scipy_cblas_cher2k64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B, + OPENBLAS_CONST blasint ldb, + OPENBLAS_CONST float beta, void *C, + OPENBLAS_CONST blasint ldc); +void scipy_cblas_zher2k64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_UPLO Uplo, + OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, + OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K, + OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A, + OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B, + OPENBLAS_CONST blasint ldb, + OPENBLAS_CONST double beta, void *C, + OPENBLAS_CONST blasint ldc); + +void scipy_cblas_xerbla64_(blasint p, OPENBLAS_CONST char *rout, + OPENBLAS_CONST char *form, ...); + +/*** BLAS extensions ***/ + +void scipy_cblas_saxpby64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float alpha, + OPENBLAS_CONST float *x, OPENBLAS_CONST blasint incx, + OPENBLAS_CONST float beta, float *y, + OPENBLAS_CONST blasint incy); + +void scipy_cblas_daxpby64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST double alpha, + OPENBLAS_CONST double *x, + OPENBLAS_CONST blasint incx, + OPENBLAS_CONST double beta, double *y, + OPENBLAS_CONST blasint incy); + +void scipy_cblas_caxpby64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *alpha, + OPENBLAS_CONST void *x, OPENBLAS_CONST blasint incx, + OPENBLAS_CONST void *beta, void *y, + OPENBLAS_CONST blasint incy); + +void scipy_cblas_zaxpby64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *alpha, + OPENBLAS_CONST void *x, OPENBLAS_CONST blasint incx, + OPENBLAS_CONST void *beta, void *y, + OPENBLAS_CONST blasint incy); + +void scipy_cblas_somatcopy64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER, + OPENBLAS_CONST enum CBLAS_TRANSPOSE CTRANS, + OPENBLAS_CONST blasint crows, + OPENBLAS_CONST blasint ccols, + OPENBLAS_CONST float calpha, + OPENBLAS_CONST float *a, + OPENBLAS_CONST blasint clda, float *b, + OPENBLAS_CONST blasint cldb); +void scipy_cblas_domatcopy64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER, + OPENBLAS_CONST enum CBLAS_TRANSPOSE CTRANS, + OPENBLAS_CONST blasint crows, + OPENBLAS_CONST blasint ccols, + OPENBLAS_CONST double calpha, + OPENBLAS_CONST double *a, + OPENBLAS_CONST blasint clda, double *b, + OPENBLAS_CONST blasint cldb); +void scipy_cblas_comatcopy64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER, + OPENBLAS_CONST enum CBLAS_TRANSPOSE CTRANS, + OPENBLAS_CONST blasint crows, + OPENBLAS_CONST blasint ccols, + OPENBLAS_CONST float *calpha, + OPENBLAS_CONST float *a, + OPENBLAS_CONST blasint clda, float *b, + OPENBLAS_CONST blasint cldb); +void scipy_cblas_zomatcopy64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER, + OPENBLAS_CONST enum CBLAS_TRANSPOSE CTRANS, + OPENBLAS_CONST blasint crows, + OPENBLAS_CONST blasint ccols, + OPENBLAS_CONST double *calpha, + OPENBLAS_CONST double *a, + OPENBLAS_CONST blasint clda, double *b, + OPENBLAS_CONST blasint cldb); + +void scipy_cblas_simatcopy64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER, + OPENBLAS_CONST enum CBLAS_TRANSPOSE CTRANS, + OPENBLAS_CONST blasint crows, + OPENBLAS_CONST blasint ccols, + OPENBLAS_CONST float calpha, float *a, + OPENBLAS_CONST blasint clda, + OPENBLAS_CONST blasint cldb); +void scipy_cblas_dimatcopy64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER, + OPENBLAS_CONST enum CBLAS_TRANSPOSE CTRANS, + OPENBLAS_CONST blasint crows, + OPENBLAS_CONST blasint ccols, + OPENBLAS_CONST double calpha, double *a, + OPENBLAS_CONST blasint clda, + OPENBLAS_CONST blasint cldb); +void scipy_cblas_cimatcopy64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER, + OPENBLAS_CONST enum CBLAS_TRANSPOSE CTRANS, + OPENBLAS_CONST blasint crows, + OPENBLAS_CONST blasint ccols, + OPENBLAS_CONST float *calpha, float *a, + OPENBLAS_CONST blasint clda, + OPENBLAS_CONST blasint cldb); +void scipy_cblas_zimatcopy64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER, + OPENBLAS_CONST enum CBLAS_TRANSPOSE CTRANS, + OPENBLAS_CONST blasint crows, + OPENBLAS_CONST blasint ccols, + OPENBLAS_CONST double *calpha, double *a, + OPENBLAS_CONST blasint clda, + OPENBLAS_CONST blasint cldb); + +void scipy_cblas_sgeadd64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER, + OPENBLAS_CONST blasint crows, + OPENBLAS_CONST blasint ccols, + OPENBLAS_CONST float calpha, float *a, + OPENBLAS_CONST blasint clda, + OPENBLAS_CONST float cbeta, float *c, + OPENBLAS_CONST blasint cldc); +void scipy_cblas_dgeadd64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER, + OPENBLAS_CONST blasint crows, + OPENBLAS_CONST blasint ccols, + OPENBLAS_CONST double calpha, double *a, + OPENBLAS_CONST blasint clda, + OPENBLAS_CONST double cbeta, double *c, + OPENBLAS_CONST blasint cldc); +void scipy_cblas_cgeadd64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER, + OPENBLAS_CONST blasint crows, + OPENBLAS_CONST blasint ccols, + OPENBLAS_CONST float *calpha, float *a, + OPENBLAS_CONST blasint clda, + OPENBLAS_CONST float *cbeta, float *c, + OPENBLAS_CONST blasint cldc); +void scipy_cblas_zgeadd64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER, + OPENBLAS_CONST blasint crows, + OPENBLAS_CONST blasint ccols, + OPENBLAS_CONST double *calpha, double *a, + OPENBLAS_CONST blasint clda, + OPENBLAS_CONST double *cbeta, double *c, + OPENBLAS_CONST blasint cldc); + +/*** BFLOAT16 and INT8 extensions ***/ +/* convert float array to BFLOAT16 array by rounding */ +void scipy_cblas_sbstobf1664_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST float *in, + OPENBLAS_CONST blasint incin, bfloat16 *out, + OPENBLAS_CONST blasint incout); +/* convert double array to BFLOAT16 array by rounding */ +void scipy_cblas_sbdtobf1664_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST double *in, + OPENBLAS_CONST blasint incin, bfloat16 *out, + OPENBLAS_CONST blasint incout); +/* convert BFLOAT16 array to float array */ +void scipy_cblas_sbf16tos64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST bfloat16 *in, + OPENBLAS_CONST blasint incin, float *out, + OPENBLAS_CONST blasint incout); +/* convert BFLOAT16 array to double array */ +void scipy_cblas_dbf16tod64_(OPENBLAS_CONST blasint n, + OPENBLAS_CONST bfloat16 *in, + OPENBLAS_CONST blasint incin, double *out, + OPENBLAS_CONST blasint incout); +/* dot production of BFLOAT16 input arrays, and output as float */ +float scipy_cblas_sbdot64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST bfloat16 *x, + OPENBLAS_CONST blasint incx, + OPENBLAS_CONST bfloat16 *y, + OPENBLAS_CONST blasint incy); +void scipy_cblas_sbgemv64_( + OPENBLAS_CONST enum CBLAS_ORDER order, + OPENBLAS_CONST enum CBLAS_TRANSPOSE trans, OPENBLAS_CONST blasint m, + OPENBLAS_CONST blasint n, OPENBLAS_CONST float alpha, + OPENBLAS_CONST bfloat16 *a, OPENBLAS_CONST blasint lda, + OPENBLAS_CONST bfloat16 *x, OPENBLAS_CONST blasint incx, + OPENBLAS_CONST float beta, float *y, OPENBLAS_CONST blasint incy); + +void scipy_cblas_sbgemm64_(OPENBLAS_CONST enum CBLAS_ORDER Order, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, + OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, + OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, + OPENBLAS_CONST blasint K, OPENBLAS_CONST float alpha, + OPENBLAS_CONST bfloat16 *A, + OPENBLAS_CONST blasint lda, + OPENBLAS_CONST bfloat16 *B, + OPENBLAS_CONST blasint ldb, + OPENBLAS_CONST float beta, float *C, + OPENBLAS_CONST blasint ldc); +} +/* } VENDORED HEADER */ + +#else +#define BLAS_MANGLE(s) s #if defined(PYTHRAN_BLAS_ATLAS) || defined(PYTHRAN_BLAS_SATLAS) extern "C" { #endif @@ -19,6 +1300,7 @@ extern "C" { #if defined(PYTHRAN_BLAS_ATLAS) || defined(PYTHRAN_BLAS_SATLAS) } #endif +#endif PYTHONIC_NS_BEGIN @@ -48,8 +1330,8 @@ namespace numpy } }; template <class T, size_t N> - struct blas_buffer_t<types::array<T, N>> { - T const *operator()(types::array<T, N> const &e) const + struct blas_buffer_t<types::array_tuple<T, N>> { + T const *operator()(types::array_tuple<T, N> const &e) const { return e.data(); } @@ -61,12 +1343,18 @@ namespace numpy return blas_buffer_t<E>{}(e); } + template <class E, class... S> + typename E::dtype const *blas_buffer(types::numpy_gexpr<E, S...> const &e) + { + return e.data(); + } + template <class E, class F> typename std::enable_if< types::is_numexpr_arg<E>::value && types::is_numexpr_arg<F>::value // Arguments are array_like && E::value == 1 && F::value == 1 // It is a two vectors. - && (!is_blas_array<E>::value || !is_blas_array<F>::value || + && (!is_blas_expr<E>::value || !is_blas_expr<F>::value || !std::is_same<typename E::dtype, typename F::dtype>::value), typename __combined<typename E::dtype, typename F::dtype>::type>::type dot(E const &e, F const &f) @@ -83,7 +1371,8 @@ namespace numpy float>::type dot(E const &e, F const &f) { - return cblas_sdot(e.size(), blas_buffer(e), 1, blas_buffer(f), 1); + return BLAS_MANGLE(cblas_sdot)(e.size(), blas_buffer(e), 1, blas_buffer(f), + 1); } template <class E, class F> @@ -95,7 +1384,8 @@ namespace numpy double>::type dot(E const &e, F const &f) { - return cblas_ddot(e.size(), blas_buffer(e), 1, blas_buffer(f), 1); + return BLAS_MANGLE(cblas_ddot)(e.size(), blas_buffer(e), 1, blas_buffer(f), + 1); } template <class E, class F> @@ -108,7 +1398,8 @@ namespace numpy dot(E const &e, F const &f) { std::complex<float> out; - cblas_cdotu_sub(e.size(), blas_buffer(e), 1, blas_buffer(f), 1, &out); + BLAS_MANGLE(cblas_cdotu_sub) + (e.size(), blas_buffer(e), 1, blas_buffer(f), 1, &out); return out; } @@ -122,17 +1413,98 @@ namespace numpy dot(E const &e, F const &f) { std::complex<double> out; - cblas_zdotu_sub(e.size(), blas_buffer(e), 1, blas_buffer(f), 1, &out); + BLAS_MANGLE(cblas_zdotu_sub) + (e.size(), blas_buffer(e), 1, blas_buffer(f), 1, &out); return out; } + template <class E, class F> + typename std::enable_if< + E::value == 1 && F::value == 1 && + std::is_same<typename E::dtype, float>::value && + std::is_same<typename F::dtype, float>::value && + (is_blas_expr<E>::value && is_blas_expr<F>::value && + !(is_blas_array<E>::value && is_blas_array<F>::value)), + float>::type + dot(E const &e, F const &f) + { + if (e.template strides<0>() >= 1 && f.template strides<0>() >= 1) { + return BLAS_MANGLE(cblas_sdot)(e.size(), blas_buffer(e), + e.template strides<0>(), blas_buffer(f), + f.template strides<0>()); + } else { + return dot(asarray(e), asarray(f)); + } + } + + template <class E, class F> + typename std::enable_if< + E::value == 1 && F::value == 1 && + std::is_same<typename E::dtype, double>::value && + std::is_same<typename F::dtype, double>::value && + (is_blas_expr<E>::value && is_blas_expr<F>::value && + !(is_blas_array<E>::value && is_blas_array<F>::value)), + double>::type + dot(E const &e, F const &f) + { + if (e.template strides<0>() >= 1 && f.template strides<0>() >= 1) { + return BLAS_MANGLE(cblas_ddot)(e.size(), blas_buffer(e), + e.template strides<0>(), blas_buffer(f), + f.template strides<0>()); + } else { + return dot(asarray(e), asarray(f)); + } + } + + template <class E, class F> + typename std::enable_if< + E::value == 1 && F::value == 1 && + std::is_same<typename E::dtype, std::complex<float>>::value && + std::is_same<typename F::dtype, std::complex<float>>::value && + (is_blas_expr<E>::value && is_blas_expr<F>::value && + !(is_blas_array<E>::value && is_blas_array<F>::value)), + std::complex<float>>::type + dot(E const &e, F const &f) + { + if (e.template strides<0>() >= 1 && f.template strides<0>() >= 1) { + std::complex<float> out; + BLAS_MANGLE(cblas_cdotu_sub) + (e.size(), blas_buffer(e), e.template strides<0>(), blas_buffer(f), + f.template strides<0>(), &out); + return out; + } else { + return dot(asarray(e), asarray(f)); + } + } + + template <class E, class F> + typename std::enable_if< + E::value == 1 && F::value == 1 && + std::is_same<typename E::dtype, std::complex<double>>::value && + std::is_same<typename F::dtype, std::complex<double>>::value && + (is_blas_expr<E>::value && is_blas_expr<F>::value && + !(is_blas_array<E>::value && is_blas_array<F>::value)), + std::complex<double>>::type + dot(E const &e, F const &f) + { + if (e.template strides<0>() >= 1 && f.template strides<0>() >= 1) { + std::complex<double> out; + BLAS_MANGLE(cblas_zdotu_sub) + (e.size(), blas_buffer(e), e.template strides<0>(), blas_buffer(f), + f.template strides<0>(), &out); + return out; + } else { + return dot(asarray(e), asarray(f)); + } + } + /// Matrice / Vector multiplication #define MV_DEF(T, L) \ inline void mv(int m, int n, T *A, T *B, T *C) \ { \ - cblas_##L##gemv(CblasRowMajor, CblasNoTrans, n, m, 1, A, m, B, 1, 0, C, \ - 1); \ + BLAS_MANGLE(cblas_##L##gemv) \ + (CblasRowMajor, CblasNoTrans, n, m, 1, A, m, B, 1, 0, C, 1); \ } MV_DEF(double, d) @@ -143,7 +1515,8 @@ namespace numpy #define TV_DEF(T, L) \ inline void tv(int m, int n, T *A, T *B, T *C) \ { \ - cblas_##L##gemv(CblasRowMajor, CblasTrans, m, n, 1, A, n, B, 1, 0, C, 1); \ + BLAS_MANGLE(cblas_##L##gemv) \ + (CblasRowMajor, CblasTrans, m, n, 1, A, n, B, 1, 0, C, 1); \ } TV_DEF(double, d) @@ -155,8 +1528,9 @@ namespace numpy inline void mv(int m, int n, T *A, T *B, T *C) \ { \ T alpha = 1, beta = 0; \ - cblas_##L##gemv(CblasRowMajor, CblasNoTrans, n, m, (K *)&alpha, (K *)A, m, \ - (K *)B, 1, (K *)&beta, (K *)C, 1); \ + BLAS_MANGLE(cblas_##L##gemv) \ + (CblasRowMajor, CblasNoTrans, n, m, (K *)&alpha, (K *)A, m, (K *)B, 1, \ + (K *)&beta, (K *)C, 1); \ } MV_DEF(std::complex<float>, float, c) MV_DEF(std::complex<double>, double, z) @@ -195,7 +1569,8 @@ namespace numpy #define VM_DEF(T, L) \ inline void vm(int m, int n, T *A, T *B, T *C) \ { \ - cblas_##L##gemv(CblasRowMajor, CblasTrans, n, m, 1, A, m, B, 1, 0, C, 1); \ + BLAS_MANGLE(cblas_##L##gemv) \ + (CblasRowMajor, CblasTrans, n, m, 1, A, m, B, 1, 0, C, 1); \ } VM_DEF(double, d) @@ -205,8 +1580,8 @@ namespace numpy #define VT_DEF(T, L) \ inline void vt(int m, int n, T *A, T *B, T *C) \ { \ - cblas_##L##gemv(CblasRowMajor, CblasNoTrans, m, n, 1, A, n, B, 1, 0, C, \ - 1); \ + BLAS_MANGLE(cblas_##L##gemv) \ + (CblasRowMajor, CblasNoTrans, m, n, 1, A, n, B, 1, 0, C, 1); \ } VT_DEF(double, d) @@ -217,8 +1592,9 @@ namespace numpy inline void vm(int m, int n, T *A, T *B, T *C) \ { \ T alpha = 1, beta = 0; \ - cblas_##L##gemv(CblasRowMajor, CblasTrans, n, m, (K *)&alpha, (K *)A, m, \ - (K *)B, 1, (K *)&beta, (K *)C, 1); \ + BLAS_MANGLE(cblas_##L##gemv) \ + (CblasRowMajor, CblasTrans, n, m, (K *)&alpha, (K *)A, m, (K *)B, 1, \ + (K *)&beta, (K *)C, 1); \ } VM_DEF(std::complex<float>, float, c) VM_DEF(std::complex<double>, double, z) @@ -327,7 +1703,7 @@ namespace numpy out(types::pshape<long>{f.template shape<1>()}, 0); for (long i = 0; i < out.template shape<0>(); i++) for (long j = 0; j < f.template shape<0>(); j++) - out[i] += e[j] * f[types::array<long, 2>{{j, i}}]; + out[i] += e[j] * f[types::array_tuple<long, 2>{{j, i}}]; return out; } @@ -349,7 +1725,7 @@ namespace numpy out(types::pshape<long>{e.template shape<0>()}, 0); for (long i = 0; i < out.template shape<0>(); i++) for (long j = 0; j < f.template shape<0>(); j++) - out[i] += e[types::array<long, 2>{{i, j}}] * f[j]; + out[i] += e[types::array_tuple<long, 2>{{i, j}}] * f[j]; return out; } @@ -358,8 +1734,9 @@ namespace numpy #define MM_DEF(T, L) \ inline void mm(int m, int n, int k, T *A, T *B, T *C) \ { \ - cblas_##L##gemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, m, n, k, 1, A, \ - k, B, n, 0, C, n); \ + BLAS_MANGLE(cblas_##L##gemm) \ + (CblasRowMajor, CblasNoTrans, CblasNoTrans, m, n, k, 1, A, k, B, n, 0, C, \ + n); \ } MM_DEF(double, d) MM_DEF(float, s) @@ -368,8 +1745,9 @@ namespace numpy inline void mm(int m, int n, int k, T *A, T *B, T *C) \ { \ T alpha = 1, beta = 0; \ - cblas_##L##gemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, m, n, k, \ - (K *)&alpha, (K *)A, k, (K *)B, n, (K *)&beta, (K *)C, n); \ + BLAS_MANGLE(cblas_##L##gemm) \ + (CblasRowMajor, CblasNoTrans, CblasNoTrans, m, n, k, (K *)&alpha, (K *)A, \ + k, (K *)B, n, (K *)&beta, (K *)C, n); \ } MM_DEF(std::complex<float>, float, c) MM_DEF(std::complex<double>, double, z) @@ -379,14 +1757,14 @@ namespace numpy typename std::enable_if<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 && std::tuple_size<pS1>::value == 2, - types::ndarray<E, types::array<long, 2>>>::type + types::ndarray<E, types::array_tuple<long, 2>>>::type dot(types::ndarray<E, pS0> const &a, types::ndarray<E, pS1> const &b) { int n = b.template shape<1>(), m = a.template shape<0>(), k = b.template shape<0>(); - types::ndarray<E, types::array<long, 2>> out(types::array<long, 2>{{m, n}}, - builtins::None); + types::ndarray<E, types::array_tuple<long, 2>> out( + types::array_tuple<long, 2>{{m, n}}, builtins::None); mm(m, n, k, a.buffer, b.buffer, out.buffer); return out; } @@ -409,8 +1787,9 @@ namespace numpy #define TM_DEF(T, L) \ inline void tm(int m, int n, int k, T *A, T *B, T *C) \ { \ - cblas_##L##gemm(CblasRowMajor, CblasTrans, CblasNoTrans, m, n, k, 1, A, m, \ - B, n, 0, C, n); \ + BLAS_MANGLE(cblas_##L##gemm) \ + (CblasRowMajor, CblasTrans, CblasNoTrans, m, n, k, 1, A, m, B, n, 0, C, \ + n); \ } TM_DEF(double, d) TM_DEF(float, s) @@ -419,8 +1798,9 @@ namespace numpy inline void tm(int m, int n, int k, T *A, T *B, T *C) \ { \ T alpha = 1, beta = 0; \ - cblas_##L##gemm(CblasRowMajor, CblasTrans, CblasNoTrans, m, n, k, \ - (K *)&alpha, (K *)A, m, (K *)B, n, (K *)&beta, (K *)C, n); \ + BLAS_MANGLE(cblas_##L##gemm) \ + (CblasRowMajor, CblasTrans, CblasNoTrans, m, n, k, (K *)&alpha, (K *)A, m, \ + (K *)B, n, (K *)&beta, (K *)C, n); \ } TM_DEF(std::complex<float>, float, c) TM_DEF(std::complex<double>, double, z) @@ -430,15 +1810,15 @@ namespace numpy typename std::enable_if<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 && std::tuple_size<pS1>::value == 2, - types::ndarray<E, types::array<long, 2>>>::type + types::ndarray<E, types::array_tuple<long, 2>>>::type dot(types::numpy_texpr<types::ndarray<E, pS0>> const &a, types::ndarray<E, pS1> const &b) { int n = b.template shape<1>(), m = a.template shape<0>(), k = b.template shape<0>(); - types::ndarray<E, types::array<long, 2>> out(types::array<long, 2>{{m, n}}, - builtins::None); + types::ndarray<E, types::array_tuple<long, 2>> out( + types::array_tuple<long, 2>{{m, n}}, builtins::None); tm(m, n, k, a.arg.buffer, b.buffer, out.buffer); return out; } @@ -446,8 +1826,9 @@ namespace numpy #define MT_DEF(T, L) \ inline void mt(int m, int n, int k, T *A, T *B, T *C) \ { \ - cblas_##L##gemm(CblasRowMajor, CblasNoTrans, CblasTrans, m, n, k, 1, A, k, \ - B, k, 0, C, n); \ + BLAS_MANGLE(cblas_##L##gemm) \ + (CblasRowMajor, CblasNoTrans, CblasTrans, m, n, k, 1, A, k, B, k, 0, C, \ + n); \ } MT_DEF(double, d) MT_DEF(float, s) @@ -456,8 +1837,9 @@ namespace numpy inline void mt(int m, int n, int k, T *A, T *B, T *C) \ { \ T alpha = 1, beta = 0; \ - cblas_##L##gemm(CblasRowMajor, CblasNoTrans, CblasTrans, m, n, k, \ - (K *)&alpha, (K *)A, k, (K *)B, k, (K *)&beta, (K *)C, n); \ + BLAS_MANGLE(cblas_##L##gemm) \ + (CblasRowMajor, CblasNoTrans, CblasTrans, m, n, k, (K *)&alpha, (K *)A, k, \ + (K *)B, k, (K *)&beta, (K *)C, n); \ } MT_DEF(std::complex<float>, float, c) MT_DEF(std::complex<double>, double, z) @@ -467,15 +1849,15 @@ namespace numpy typename std::enable_if<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 && std::tuple_size<pS1>::value == 2, - types::ndarray<E, types::array<long, 2>>>::type + types::ndarray<E, types::array_tuple<long, 2>>>::type dot(types::ndarray<E, pS0> const &a, types::numpy_texpr<types::ndarray<E, pS1>> const &b) { int n = b.template shape<1>(), m = a.template shape<0>(), k = b.template shape<0>(); - types::ndarray<E, types::array<long, 2>> out(types::array<long, 2>{{m, n}}, - builtins::None); + types::ndarray<E, types::array_tuple<long, 2>> out( + types::array_tuple<long, 2>{{m, n}}, builtins::None); mt(m, n, k, a.buffer, b.arg.buffer, out.buffer); return out; } @@ -483,8 +1865,8 @@ namespace numpy #define TT_DEF(T, L) \ inline void tt(int m, int n, int k, T *A, T *B, T *C) \ { \ - cblas_##L##gemm(CblasRowMajor, CblasTrans, CblasTrans, m, n, k, 1, A, m, \ - B, k, 0, C, n); \ + BLAS_MANGLE(cblas_##L##gemm) \ + (CblasRowMajor, CblasTrans, CblasTrans, m, n, k, 1, A, m, B, k, 0, C, n); \ } TT_DEF(double, d) TT_DEF(float, s) @@ -493,8 +1875,9 @@ namespace numpy inline void tt(int m, int n, int k, T *A, T *B, T *C) \ { \ T alpha = 1, beta = 0; \ - cblas_##L##gemm(CblasRowMajor, CblasTrans, CblasTrans, m, n, k, \ - (K *)&alpha, (K *)A, m, (K *)B, k, (K *)&beta, (K *)C, n); \ + BLAS_MANGLE(cblas_##L##gemm) \ + (CblasRowMajor, CblasTrans, CblasTrans, m, n, k, (K *)&alpha, (K *)A, m, \ + (K *)B, k, (K *)&beta, (K *)C, n); \ } TT_DEF(std::complex<float>, float, c) TT_DEF(std::complex<double>, double, z) @@ -504,15 +1887,15 @@ namespace numpy typename std::enable_if<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 && std::tuple_size<pS1>::value == 2, - types::ndarray<E, types::array<long, 2>>>::type + types::ndarray<E, types::array_tuple<long, 2>>>::type dot(types::numpy_texpr<types::ndarray<E, pS0>> const &a, types::numpy_texpr<types::ndarray<E, pS1>> const &b) { int n = b.template shape<1>(), m = a.template shape<0>(), k = b.template shape<0>(); - types::ndarray<E, types::array<long, 2>> out(types::array<long, 2>{{m, n}}, - builtins::None); + types::ndarray<E, types::array_tuple<long, 2>> out( + types::array_tuple<long, 2>{{m, n}}, builtins::None); tt(m, n, k, a.arg.buffer, b.arg.buffer, out.buffer); return out; } @@ -531,7 +1914,7 @@ namespace numpy && E::value == 2 && F::value == 2, // And both are matrix types::ndarray< typename __combined<typename E::dtype, typename F::dtype>::type, - types::array<long, 2>>>::type + types::array_tuple<long, 2>>>::type dot(E const &e, F const &f) { types::ndarray< @@ -554,21 +1937,21 @@ namespace numpy E::value == 2 && F::value == 2, // And it is matrix / matrix types::ndarray< typename __combined<typename E::dtype, typename F::dtype>::type, - types::array<long, 2>>>::type + types::array_tuple<long, 2>>>::type dot(E const &e, F const &f) { types::ndarray< typename __combined<typename E::dtype, typename F::dtype>::type, - types::array<long, 2>> - out(types::array<long, 2>{{e.template shape<0>(), - f.template shape<1>()}}, + types::array_tuple<long, 2>> + out(types::array_tuple<long, 2>{{e.template shape<0>(), + f.template shape<1>()}}, 0); for (long i = 0; i < out.template shape<0>(); i++) for (long j = 0; j < out.template shape<1>(); j++) for (long k = 0; k < e.template shape<1>(); k++) - out[types::array<long, 2>{{i, j}}] += - e[types::array<long, 2>{{i, k}}] * - f[types::array<long, 2>{{k, j}}]; + out[types::array_tuple<long, 2>{{i, j}}] += + e[types::array_tuple<long, 2>{{i, k}}] * + f[types::array_tuple<long, 2>{{k, j}}]; return out; } @@ -577,12 +1960,13 @@ namespace numpy (E::value >= 3 && F::value == 1), // And it is matrix / matrix types::ndarray< typename __combined<typename E::dtype, typename F::dtype>::type, - types::array<long, E::value - 1>>>::type + types::array_tuple<long, E::value - 1>>>::type dot(E const &e, F const &f) { - auto out = dot( - e.reshape(types::array<long, 2>{{sutils::prod_head(e), f.size()}}), f); - types::array<long, E::value - 1> out_shape; + auto out = dot(e.reshape(types::array_tuple<long, 2>{ + {sutils::prod_head(e), f.size()}}), + f); + types::array_tuple<long, E::value - 1> out_shape; auto tmp = sutils::getshape(e); std::copy(tmp.begin(), tmp.end() - 1, out_shape.begin()); return out.reshape(out_shape); @@ -593,7 +1977,7 @@ namespace numpy (E::value >= 3 && F::value >= 2), types::ndarray< typename __combined<typename E::dtype, typename F::dtype>::type, - types::array<long, E::value - 1>>>::type + types::array_tuple<long, E::value - 1>>>::type dot(E const &e, F const &f) { static_assert(E::value == 0, "not implemented yet"); @@ -601,4 +1985,6 @@ namespace numpy } // namespace numpy PYTHONIC_NS_END +#undef BLAS_MANGLE + #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/double_.hpp b/contrib/python/pythran/pythran/pythonic/numpy/double_.hpp index e5fa42b3de..dd7c3dfccd 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/double_.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/double_.hpp @@ -12,7 +12,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME double_ #define NUMPY_NARY_FUNC_SYM details::float64 #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/dtype/type.hpp b/contrib/python/pythran/pythran/pythonic/numpy/dtype/type.hpp index 894286b938..7587ac5b31 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/dtype/type.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/dtype/type.hpp @@ -15,8 +15,8 @@ namespace numpy { return t(v); } - } -} + } // namespace dtype +} // namespace numpy PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ediff1d.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ediff1d.hpp index cbde610ee5..d194e4cb35 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/ediff1d.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/ediff1d.hpp @@ -28,7 +28,7 @@ namespace numpy { return ediff1d(asarray(expr)); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/empty.hpp b/contrib/python/pythran/pythran/pythonic/numpy/empty.hpp index 1005c35181..373f5f4dad 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/empty.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/empty.hpp @@ -3,16 +3,15 @@ #include "pythonic/include/numpy/empty.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class dtype> - typename dtype::type - empty(types::pshape<> const &shape, dtype) + typename dtype::type empty(types::pshape<> const &shape, dtype) { return {}; } @@ -38,7 +37,7 @@ namespace numpy { return empty(types::pshape<std::integral_constant<long, N>>({}), d); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/empty_like.hpp b/contrib/python/pythran/pythran/pythonic/numpy/empty_like.hpp index f0e742cdb4..d1776b0def 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/empty_like.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/empty_like.hpp @@ -3,16 +3,16 @@ #include "pythonic/include/numpy/empty_like.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/numpy/empty.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class E, class dtype> - auto empty_like(E const &expr, dtype d) - -> decltype(empty(sutils::getshape(expr), d)) + auto empty_like(E const &expr, + dtype d) -> decltype(empty(sutils::getshape(expr), d)) { return empty(sutils::getshape(expr), d); } @@ -24,7 +24,7 @@ namespace numpy { return empty(sutils::getshape(expr), types::dtype_t<typename E::dtype>()); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/equal.hpp b/contrib/python/pythran/pythran/pythonic/numpy/equal.hpp index ba51ed6d7d..1cf4d7cb44 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/equal.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/equal.hpp @@ -3,11 +3,11 @@ #include "pythonic/include/numpy/equal.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/operator_/eq.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic/operator_/eq.hpp" PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME equal #define NUMPY_NARY_FUNC_SYM pythonic::operator_::eq #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/exp.hpp b/contrib/python/pythran/pythran/pythonic/numpy/exp.hpp index 4c4ecc3415..72ce335fc4 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/exp.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/exp.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/exp.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME exp #define NUMPY_NARY_FUNC_SYM xsimd::exp #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/expand_dims.hpp b/contrib/python/pythran/pythran/pythonic/numpy/expand_dims.hpp index 1a7501b7a9..3dd5b25050 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/expand_dims.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/expand_dims.hpp @@ -2,22 +2,22 @@ #define PYTHONIC_NUMPY_EXPAND_DIMS_HPP #include "pythonic/include/numpy/expand_dims.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/include/utils/array_helper.hpp" #include "pythonic/numpy/asarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <typename T> - types::ndarray<typename T::dtype, types::array<long, T::value + 1>> + types::ndarray<typename T::dtype, types::array_tuple<long, T::value + 1>> expand_dims(T const &input, int axis) { const long N = T::value; if (axis == -1) axis += N + 1; - types::array<long, N + 1> dim_array; + types::array_tuple<long, N + 1> dim_array; auto in_shape = sutils::getshape(input); long ii, jj; for (ii = jj = 0; ii < N + 1; ii++) { @@ -30,7 +30,7 @@ namespace numpy return numpy::functor::asarray{}(input).reshape(dim_array); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/expm1.hpp b/contrib/python/pythran/pythran/pythonic/numpy/expm1.hpp index eee79f19ac..208d9bfc8e 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/expm1.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/expm1.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/expm1.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME expm1 #define NUMPY_NARY_FUNC_SYM xsimd::expm1 #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/eye.hpp b/contrib/python/pythran/pythran/pythonic/numpy/eye.hpp index 8bed2d4a33..816a335178 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/eye.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/eye.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/eye.hpp" -#include "pythonic/numpy/zeros.hpp" #include "pythonic/builtins/None.hpp" +#include "pythonic/numpy/zeros.hpp" PYTHONIC_NS_BEGIN @@ -12,10 +12,10 @@ namespace numpy { template <class dtype> - types::ndarray<typename dtype::type, types::array<long, 2>> + types::ndarray<typename dtype::type, types::array_tuple<long, 2>> eye(long N, long M, long k, dtype d) { - types::ndarray<typename dtype::type, types::array<long, 2>> out = + types::ndarray<typename dtype::type, types::array_tuple<long, 2>> out = zeros(types::make_tuple(N, M), d); if (k >= 0) for (int i = 0, j = k; i < N && j < M; ++i, ++j) @@ -27,12 +27,12 @@ namespace numpy } template <class dtype> - types::ndarray<typename dtype::type, types::array<long, 2>> + types::ndarray<typename dtype::type, types::array_tuple<long, 2>> eye(long N, types::none_type M, long k, dtype d) { return eye(N, N, k, d); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fft/c2c.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fft/c2c.hpp index aae6de6315..bb84da4eaa 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/fft/c2c.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/fft/c2c.hpp @@ -1,18 +1,18 @@ #ifndef PYTHONIC_NUMPY_FFT_C2C_HPP #define PYTHONIC_NUMPY_FFT_C2C_HPP +#include "pythonic/builtins/None.hpp" #include "pythonic/include/numpy/fft/c2c.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/include/utils/array_helper.hpp" -#include "pythonic/types/ndarray.hpp" -#include "pythonic/builtins/None.hpp" #include "pythonic/numpy/concatenate.hpp" -#include "pythonic/numpy/zeros.hpp" #include "pythonic/numpy/empty.hpp" +#include "pythonic/numpy/zeros.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include <array> -#include <cstring> #include <cmath> +#include <cstring> #include "pythonic/numpy/fft/pocketfft.hpp" @@ -22,8 +22,8 @@ namespace numpy { namespace fft { - using pocketfft::stride_t; using pocketfft::shape_t; + using pocketfft::stride_t; using ldbl_t = typename std::conditional<sizeof(long double) == sizeof(double), double, long double>::type; @@ -31,7 +31,7 @@ namespace numpy template <class T, class pS> types::ndarray< typename std::enable_if<std::is_integral<T>::value, double>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> _copy_to_double(types::ndarray<T, pS> const &in_array) { auto out_shape = sutils::getshape(in_array); @@ -44,7 +44,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> _copy_to_complex(types::ndarray<T, pS> const &in_array) { auto out_shape = sutils::getshape(in_array); @@ -58,7 +58,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> _copy_to_complex(types::ndarray<T, pS> const &in_array) { auto out_shape = sutils::getshape(in_array); @@ -94,7 +94,7 @@ namespace numpy case Inorm::backward: return T(1 / ldbl_t(N)); case Inorm::explicit_forward: - return T(1./N); + return T(1. / N); default: assert(false && "unreachable"); return T(0); @@ -128,16 +128,17 @@ namespace numpy } template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> _pad_in_array(types::ndarray<T, pS> const &in_array, long axis, long n) { - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> extended_array; auto tmp_shape = sutils::getshape(in_array); tmp_shape[axis] = n; auto tmp_array = zeros(tmp_shape, types::dtype_t<T>()); types::list<types::ndarray< - T, types::array<long, std::tuple_size<pS>::value>>> bi(0); + T, types::array_tuple<long, std::tuple_size<pS>::value>>> + bi(0); bi.push_back(in_array); bi.push_back(tmp_array); extended_array = concatenate(bi, axis); @@ -145,7 +146,7 @@ namespace numpy } template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> c2r(types::ndarray<std::complex<T>, pS> const &in_array, long n, long axis, types::str const &norm, bool forward) { @@ -160,11 +161,11 @@ namespace numpy auto out_shape = sutils::getshape(in_array); out_shape[axis] = n; // Create output array. - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> out_array(out_shape, builtins::None); std::complex<T> *d_in; types::ndarray<std::complex<T>, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> extended_array; stride_t in_strides; auto out_strides = create_strides(out_array); @@ -192,7 +193,7 @@ namespace numpy template <class T, class pS> types::ndarray<std::complex<T>, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> c2c(types::ndarray<std::complex<T>, pS> const &in_array, long n, long axis, types::str const &norm, bool forward) { @@ -208,11 +209,11 @@ namespace numpy out_shape[axis] = n; // Create output array. types::ndarray<std::complex<T>, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> out_array(out_shape, builtins::None); std::complex<T> *d_in; types::ndarray<std::complex<T>, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> extended_array; stride_t in_strides; if (n > npts) { @@ -242,7 +243,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> r2c(types::ndarray<T, pS> const &in_array, long n, long axis, types::str const &norm, bool forward, bool extend = true) { @@ -262,10 +263,10 @@ namespace numpy } // Create output array. types::ndarray<std::complex<T>, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> out_array(out_shape, builtins::None); T *d_in; - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> extended_array; shape_t shapes = shape_t(size_t(N)); stride_t in_strides; @@ -303,8 +304,8 @@ namespace numpy } return out_array; } - } -} + } // namespace fft +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fft/fft.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fft/fft.hpp index d8eed26b82..87d093367a 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/fft/fft.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/fft/fft.hpp @@ -1,12 +1,12 @@ #ifndef PYTHONIC_NUMPY_FFT_FFT_HPP #define PYTHONIC_NUMPY_FFT_FFT_HPP +#include "pythonic/builtins/None.hpp" #include "pythonic/include/numpy/fft/fft.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/include/utils/array_helper.hpp" -#include "pythonic/types/ndarray.hpp" -#include "pythonic/builtins/None.hpp" #include "pythonic/numpy/fft/c2c.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -36,33 +36,35 @@ namespace numpy { return n; } - } + } // namespace details template <class T, class pS, class N, class Norm> types::ndarray< typename std::enable_if<types::is_complex<T>::value, T>::type, - types::array<long, std::tuple_size<pS>::value>> - fft(types::ndarray<T, pS> const &in_array, N const& n, long axis, + types::array_tuple<long, std::tuple_size<pS>::value>> + fft(types::ndarray<T, pS> const &in_array, N const &n, long axis, Norm const &norm) { - return c2c(in_array, details::normalize_n(n), axis, details::normalize_norm(norm), true); + return c2c(in_array, details::normalize_n(n), axis, + details::normalize_norm(norm), true); } template <class T, class pS, class N, class Norm> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> - fft(types::ndarray<T, pS> const &in_array, N const & n, long axis, + types::array_tuple<long, std::tuple_size<pS>::value>> + fft(types::ndarray<T, pS> const &in_array, N const &n, long axis, Norm const &norm) { - return r2c(in_array, details::normalize_n(n), axis, details::normalize_norm(norm), true, true); + return r2c(in_array, details::normalize_n(n), axis, + details::normalize_norm(norm), true, true); } template <class T, class pS, class N, class Norm> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> - fft(types::ndarray<T, pS> const &in_array, N const& n, long axis, + types::array_tuple<long, std::tuple_size<pS>::value>> + fft(types::ndarray<T, pS> const &in_array, N const &n, long axis, Norm const &norm) { auto tmp_array = _copy_to_double(in_array); @@ -70,8 +72,8 @@ namespace numpy } NUMPY_EXPR_TO_NDARRAY0_IMPL(fft); - } -} + } // namespace fft +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fft/fftn.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fft/fftn.hpp index 37cf60a748..28ce369592 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/fft/fftn.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/fft/fftn.hpp @@ -27,12 +27,12 @@ namespace numpy } template <size_t K, size_t S> - types::array < long, + types::array_tuple < long, K<S ? K : S> normalize_axes(types::none_type const &) { if (S == 1) return {-1}; // FIXME: understand why this is needed - types::array < long, K<S ? K : S> result; + types::array_tuple < long, K<S ? K : S> result; for (size_t i = 0; i < std::min(K, S); ++i) result[i] = (long)i; return result; @@ -50,7 +50,7 @@ namespace numpy template <class T, class pS, class Axes, class Norm> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> fftn(types::ndarray<T, pS> const &in_array, types::none_type s, Axes const &axes, Norm const &norm) { @@ -61,7 +61,7 @@ namespace numpy template <class T, class pS, class Axes, class Norm> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> fftn(types::ndarray<T, pS> const &in_array, types::none_type s, Axes const &axes, Norm const &norm) { @@ -76,7 +76,7 @@ namespace numpy template <class T, class pS, class Axes, class Norm> types::ndarray< typename std::enable_if<types::is_complex<T>::value, T>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> fftn(types::ndarray<T, pS> const &in_array, types::none_type s, Axes const &axes, Norm const &norm) { @@ -93,7 +93,7 @@ namespace numpy class Norm> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> fftn(types::ndarray<T, pS> const &a, types::array_base<I, N, V> const &s, Axes const &axes, Norm const &norm) { @@ -105,7 +105,7 @@ namespace numpy class Norm> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> fftn(types::ndarray<T, pS> const &a, types::array_base<I, N, V> const &s, Axes const &axes, Norm const &norm) { @@ -123,7 +123,7 @@ namespace numpy class Norm> types::ndarray< typename std::enable_if<types::is_complex<T>::value, T>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> fftn(types::ndarray<T, pS> const &a, types::array_base<I, N, V> const &s, Axes const &axes, Norm const &norm) { diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fft/hfft.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fft/hfft.hpp index 3820ba44a1..bf230a19bf 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/fft/hfft.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/fft/hfft.hpp @@ -1,12 +1,12 @@ #ifndef PYTHONIC_NUMPY_FFT_HFFT_HPP #define PYTHONIC_NUMPY_FFT_HFFT_HPP +#include "pythonic/builtins/None.hpp" #include "pythonic/include/numpy/fft/hfft.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/include/utils/array_helper.hpp" -#include "pythonic/types/ndarray.hpp" -#include "pythonic/builtins/None.hpp" #include "pythonic/numpy/fft/c2c.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -16,7 +16,7 @@ namespace numpy { template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> hfft(types::ndarray<std::complex<T>, pS> const &in_array, types::none_type n, long axis, types::str const &norm) { @@ -24,7 +24,7 @@ namespace numpy } template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> hfft(types::ndarray<std::complex<T>, pS> const &in_array, types::none_type n, long axis, types::none_type norm) { @@ -32,7 +32,7 @@ namespace numpy } template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> hfft(types::ndarray<std::complex<T>, pS> const &in_array, long n, long axis, types::none_type norm) { @@ -40,7 +40,7 @@ namespace numpy } template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> hfft(types::ndarray<std::complex<T>, pS> const &in_array, long n, long axis, types::str const &norm) { @@ -52,7 +52,7 @@ namespace numpy !types::is_complex<T>::value, typename std::conditional<std::is_integral<T>::value, double, T>::type>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> hfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis, types::str const &norm) { @@ -65,7 +65,7 @@ namespace numpy !types::is_complex<T>::value, typename std::conditional<std::is_integral<T>::value, double, T>::type>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> hfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis, types::none_type norm) { @@ -78,7 +78,7 @@ namespace numpy !types::is_complex<T>::value, typename std::conditional<std::is_integral<T>::value, double, T>::type>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> hfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::none_type norm) { @@ -91,7 +91,7 @@ namespace numpy !types::is_complex<T>::value, typename std::conditional<std::is_integral<T>::value, double, T>::type>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> hfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::str const &norm) { @@ -100,8 +100,8 @@ namespace numpy } NUMPY_EXPR_TO_NDARRAY0_IMPL(hfft); - } -} + } // namespace fft +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fft/ifft.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fft/ifft.hpp index 23aad1d0c7..743615e992 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/fft/ifft.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/fft/ifft.hpp @@ -1,12 +1,12 @@ #ifndef PYTHONIC_NUMPY_FFT_IFFT_HPP #define PYTHONIC_NUMPY_FFT_IFFT_HPP +#include "pythonic/builtins/None.hpp" #include "pythonic/include/numpy/fft/ifft.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/include/utils/array_helper.hpp" -#include "pythonic/types/ndarray.hpp" -#include "pythonic/builtins/None.hpp" #include "pythonic/numpy/fft/c2c.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -18,7 +18,7 @@ namespace numpy template <class T, class pS> types::ndarray< typename std::enable_if<types::is_complex<T>::value, T>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis, types::str const &norm) { @@ -28,7 +28,7 @@ namespace numpy template <class T, class pS> types::ndarray< typename std::enable_if<types::is_complex<T>::value, T>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis, types::none_type norm) { @@ -38,7 +38,7 @@ namespace numpy template <class T, class pS> types::ndarray< typename std::enable_if<types::is_complex<T>::value, T>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &in_array, long n, long axis, types::none_type norm) { @@ -48,7 +48,7 @@ namespace numpy template <class T, class pS> types::ndarray< typename std::enable_if<types::is_complex<T>::value, T>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &in_array, long n, long axis, types::str const &norm) { @@ -58,7 +58,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis, types::str const &norm) { @@ -68,7 +68,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis, types::none_type norm) { @@ -78,7 +78,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &in_array, long n, long axis, types::none_type norm) { @@ -88,7 +88,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &in_array, long n, long axis, types::str const &norm) { @@ -98,7 +98,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis, types::str const &norm) { @@ -109,7 +109,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis, types::none_type norm) { @@ -120,7 +120,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &in_array, long n, long axis, types::none_type norm) { @@ -131,7 +131,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ifft(types::ndarray<T, pS> const &in_array, long n, long axis, types::str const &norm) { @@ -140,8 +140,8 @@ namespace numpy } NUMPY_EXPR_TO_NDARRAY0_IMPL(ifft); - } -} + } // namespace fft +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fft/ihfft.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fft/ihfft.hpp index 44fe008bb5..e8c1fed129 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/fft/ihfft.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/fft/ihfft.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_NUMPY_FFT_IHFFT_HPP #define PYTHONIC_NUMPY_FFT_IHFFT_HPP +#include "pythonic/builtins/None.hpp" #include "pythonic/include/numpy/fft/ihfft.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/include/utils/array_helper.hpp" -#include "pythonic/types/ndarray.hpp" -#include "pythonic/builtins/None.hpp" #include "pythonic/numpy/fft/c2c.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ihfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis, types::str const &norm) { @@ -27,7 +27,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ihfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis, types::none_type norm) { @@ -37,7 +37,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ihfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::none_type norm) { @@ -47,7 +47,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ihfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::str const &norm) { @@ -57,7 +57,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ihfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis, types::str const &norm) { @@ -68,7 +68,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ihfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis, types::none_type norm) { @@ -79,7 +79,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ihfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::none_type norm) { @@ -90,7 +90,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> ihfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::str const &norm) { @@ -99,8 +99,8 @@ namespace numpy } NUMPY_EXPR_TO_NDARRAY0_IMPL(ihfft); - } -} + } // namespace fft +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fft/irfft.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fft/irfft.hpp index acc24765e2..6d3c5a9711 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/fft/irfft.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/fft/irfft.hpp @@ -1,12 +1,12 @@ #ifndef PYTHONIC_NUMPY_FFT_IRFFT_HPP #define PYTHONIC_NUMPY_FFT_IRFFT_HPP +#include "pythonic/builtins/None.hpp" #include "pythonic/include/numpy/fft/irfft.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/include/utils/array_helper.hpp" -#include "pythonic/types/ndarray.hpp" -#include "pythonic/builtins/None.hpp" #include "pythonic/numpy/fft/c2c.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -16,7 +16,7 @@ namespace numpy { template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> irfft(types::ndarray<std::complex<T>, pS> const &in_array, types::none_type n, long axis, types::str const &norm) { @@ -24,7 +24,7 @@ namespace numpy } template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> irfft(types::ndarray<std::complex<T>, pS> const &in_array, types::none_type n, long axis, types::none_type norm) { @@ -32,7 +32,7 @@ namespace numpy } template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> irfft(types::ndarray<std::complex<T>, pS> const &in_array, long n, long axis, types::none_type norm) { @@ -40,7 +40,7 @@ namespace numpy } template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> irfft(types::ndarray<std::complex<T>, pS> const &in_array, long n, long axis, types::str const &norm) { @@ -52,7 +52,7 @@ namespace numpy !types::is_complex<T>::value, typename std::conditional<std::is_integral<T>::value, double, T>::type>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> irfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis, types::str const &norm) { @@ -65,7 +65,7 @@ namespace numpy !types::is_complex<T>::value, typename std::conditional<std::is_integral<T>::value, double, T>::type>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> irfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis, types::none_type norm) { @@ -78,7 +78,7 @@ namespace numpy !types::is_complex<T>::value, typename std::conditional<std::is_integral<T>::value, double, T>::type>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> irfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::none_type norm) { @@ -91,7 +91,7 @@ namespace numpy !types::is_complex<T>::value, typename std::conditional<std::is_integral<T>::value, double, T>::type>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> irfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::str const &norm) { @@ -100,8 +100,8 @@ namespace numpy } NUMPY_EXPR_TO_NDARRAY0_IMPL(irfft); - } -} + } // namespace fft +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fft/pocketfft.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fft/pocketfft.hpp index be696d0d3d..3ad32f425d 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/fft/pocketfft.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/fft/pocketfft.hpp @@ -53,24 +53,24 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endif #include <cmath> -#include <cstring> +#include <complex> #include <cstdlib> -#include <stdexcept> +#include <cstring> #include <memory> +#include <stdexcept> #include <vector> -#include <complex> #if POCKETFFT_CACHE_SIZE != 0 #include <array> #include <mutex> #endif #ifndef POCKETFFT_NO_MULTITHREADING -#include <mutex> -#include <condition_variable> -#include <thread> -#include <queue> #include <atomic> +#include <condition_variable> #include <functional> +#include <mutex> +#include <queue> +#include <thread> #ifdef POCKETFFT_PTHREADS #include <pthread.h> @@ -93,8 +93,8 @@ namespace pocketfft namespace detail { - using std::size_t; using std::ptrdiff_t; + using std::size_t; // Always use std:: for <cmath> functions template <typename T> @@ -145,7 +145,7 @@ namespace pocketfft struct VLEN<double> { static constexpr size_t val = 8; }; -#elif(defined(__AVX__)) +#elif (defined(__AVX__)) template <> struct VLEN<float> { static constexpr size_t val = 8; @@ -154,7 +154,7 @@ namespace pocketfft struct VLEN<double> { static constexpr size_t val = 4; }; -#elif(defined(__SSE2__)) +#elif (defined(__SSE2__)) template <> struct VLEN<float> { static constexpr size_t val = 4; @@ -163,7 +163,7 @@ namespace pocketfft struct VLEN<double> { static constexpr size_t val = 2; }; -#elif(defined(__VSX__)) +#elif (defined(__VSX__)) template <> struct VLEN<float> { static constexpr size_t val = 4; @@ -199,7 +199,7 @@ namespace pocketfft free(ptr); } // C++17 in principle has "aligned_alloc", but unfortunately not everywhere ... -#elif(__cplusplus >= 201703L) && \ +#elif (__cplusplus >= 201703L) && \ ((!defined(__MINGW32__)) || defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)) && \ (!defined(__APPLE__)) static T *ralloc(size_t num) @@ -340,31 +340,31 @@ namespace pocketfft return *this; } template <typename T2> - auto operator*(const T2 &other) const -> cmplx<decltype(r *other)> + auto operator*(const T2 &other) const -> cmplx<decltype(r * other)> { return {r * other, i * other}; } template <typename T2> - auto operator+(const cmplx<T2> &other) const - -> cmplx<decltype(r + other.r)> + auto + operator+(const cmplx<T2> &other) const -> cmplx<decltype(r + other.r)> { return {r + other.r, i + other.i}; } template <typename T2> - auto operator-(const cmplx<T2> &other) const - -> cmplx<decltype(r + other.r)> + auto + operator-(const cmplx<T2> &other) const -> cmplx<decltype(r + other.r)> { return {r - other.r, i - other.i}; } template <typename T2> - auto operator*(const cmplx<T2> &other) const - -> cmplx<decltype(r + other.r)> + auto + operator*(const cmplx<T2> &other) const -> cmplx<decltype(r + other.r)> { return {r * other.r - i * other.i, r * other.i + i * other.r}; } template <bool fwd, typename T2> - auto special_mul(const cmplx<T2> &other) const - -> cmplx<decltype(r + other.r)> + auto + special_mul(const cmplx<T2> &other) const -> cmplx<decltype(r + other.r)> { using Tres = cmplx<decltype(r + other.r)>; return fwd ? Tres(r * other.r + i * other.i, i * other.r - r * other.i) @@ -508,7 +508,7 @@ namespace pocketfft }; struct util // hack to avoid duplicate symbols - { + { static POCKETFFT_NOINLINE size_t largest_prime_factor(size_t n) { size_t res = 1; @@ -859,10 +859,11 @@ namespace pocketfft #ifdef POCKETFFT_PTHREADS static std::once_flag f; std::call_once(f, [] { - pthread_atfork(+[] { get_pool().shutdown(); }, // prepare - +[] { get_pool().restart(); }, // parent - +[] { get_pool().restart(); } // child - ); + pthread_atfork( + +[] { get_pool().shutdown(); }, // prepare + +[] { get_pool().restart(); }, // parent + +[] { get_pool().restart(); } // child + ); }); #endif @@ -904,7 +905,7 @@ namespace pocketfft } #endif - } + } // namespace threading // // complex FFTPACK transforms @@ -933,12 +934,15 @@ namespace pocketfft T *POCKETFFT_RESTRICT ch, const cmplx<T0> *POCKETFFT_RESTRICT wa) const { - auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) - -> T &{ return ch[a + ido * (b + l1 * c)]; }; - auto CC = [cc, ido](size_t a, size_t b, size_t c) - -> const T &{ return cc[a + ido * (b + 2 * c)]; }; - auto WA = - [wa, ido](size_t x, size_t i) { return wa[i - 1 + x * (ido - 1)]; }; + auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) -> T & { + return ch[a + ido * (b + l1 * c)]; + }; + auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & { + return cc[a + ido * (b + 2 * c)]; + }; + auto WA = [wa, ido](size_t x, size_t i) { + return wa[i - 1 + x * (ido - 1)]; + }; if (ido == 1) for (size_t k = 0; k < l1; ++k) { @@ -983,12 +987,15 @@ namespace pocketfft tw1i = (fwd ? -1 : 1) * T0(0.8660254037844386467637231707529362L); - auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) - -> T &{ return ch[a + ido * (b + l1 * c)]; }; - auto CC = [cc, ido](size_t a, size_t b, size_t c) - -> const T &{ return cc[a + ido * (b + 3 * c)]; }; - auto WA = - [wa, ido](size_t x, size_t i) { return wa[i - 1 + x * (ido - 1)]; }; + auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) -> T & { + return ch[a + ido * (b + l1 * c)]; + }; + auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & { + return cc[a + ido * (b + 3 * c)]; + }; + auto WA = [wa, ido](size_t x, size_t i) { + return wa[i - 1 + x * (ido - 1)]; + }; if (ido == 1) for (size_t k = 0; k < l1; ++k) { @@ -1017,12 +1024,15 @@ namespace pocketfft T *POCKETFFT_RESTRICT ch, const cmplx<T0> *POCKETFFT_RESTRICT wa) const { - auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) - -> T &{ return ch[a + ido * (b + l1 * c)]; }; - auto CC = [cc, ido](size_t a, size_t b, size_t c) - -> const T &{ return cc[a + ido * (b + 4 * c)]; }; - auto WA = - [wa, ido](size_t x, size_t i) { return wa[i - 1 + x * (ido - 1)]; }; + auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) -> T & { + return ch[a + ido * (b + l1 * c)]; + }; + auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & { + return cc[a + ido * (b + 4 * c)]; + }; + auto WA = [wa, ido](size_t x, size_t i) { + return wa[i - 1 + x * (ido - 1)]; + }; if (ido == 1) for (size_t k = 0; k < l1; ++k) { @@ -1097,12 +1107,15 @@ namespace pocketfft tw2i = (fwd ? -1 : 1) * T0(0.5877852522924731291687059546390728L); - auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) - -> T &{ return ch[a + ido * (b + l1 * c)]; }; - auto CC = [cc, ido](size_t a, size_t b, size_t c) - -> const T &{ return cc[a + ido * (b + 5 * c)]; }; - auto WA = - [wa, ido](size_t x, size_t i) { return wa[i - 1 + x * (ido - 1)]; }; + auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) -> T & { + return ch[a + ido * (b + l1 * c)]; + }; + auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & { + return cc[a + ido * (b + 5 * c)]; + }; + auto WA = [wa, ido](size_t x, size_t i) { + return wa[i - 1 + x * (ido - 1)]; + }; if (ido == 1) for (size_t k = 0; k < l1; ++k) { @@ -1172,12 +1185,15 @@ namespace pocketfft tw3i = (fwd ? -1 : 1) * T0(0.433883739117558120475768332848359L); - auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) - -> T &{ return ch[a + ido * (b + l1 * c)]; }; - auto CC = [cc, ido](size_t a, size_t b, size_t c) - -> const T &{ return cc[a + ido * (b + 7 * c)]; }; - auto WA = - [wa, ido](size_t x, size_t i) { return wa[i - 1 + x * (ido - 1)]; }; + auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) -> T & { + return ch[a + ido * (b + l1 * c)]; + }; + auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & { + return cc[a + ido * (b + 7 * c)]; + }; + auto WA = [wa, ido](size_t x, size_t i) { + return wa[i - 1 + x * (ido - 1)]; + }; if (ido == 1) for (size_t k = 0; k < l1; ++k) { @@ -1246,12 +1262,15 @@ namespace pocketfft T *POCKETFFT_RESTRICT ch, const cmplx<T0> *POCKETFFT_RESTRICT wa) const { - auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) - -> T &{ return ch[a + ido * (b + l1 * c)]; }; - auto CC = [cc, ido](size_t a, size_t b, size_t c) - -> const T &{ return cc[a + ido * (b + 8 * c)]; }; - auto WA = - [wa, ido](size_t x, size_t i) { return wa[i - 1 + x * (ido - 1)]; }; + auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) -> T & { + return ch[a + ido * (b + l1 * c)]; + }; + auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & { + return cc[a + ido * (b + 8 * c)]; + }; + auto WA = [wa, ido](size_t x, size_t i) { + return wa[i - 1 + x * (ido - 1)]; + }; if (ido == 1) for (size_t k = 0; k < l1; ++k) { @@ -1370,12 +1389,15 @@ namespace pocketfft tw5r = T0(-0.9594929736144973898903680570663277L), tw5i = (fwd ? -1 : 1) * T0(0.2817325568414296977114179153466169L); - auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) - -> T &{ return ch[a + ido * (b + l1 * c)]; }; - auto CC = [cc, ido](size_t a, size_t b, size_t c) - -> const T &{ return cc[a + ido * (b + 11 * c)]; }; - auto WA = - [wa, ido](size_t x, size_t i) { return wa[i - 1 + x * (ido - 1)]; }; + auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) -> T & { + return ch[a + ido * (b + l1 * c)]; + }; + auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & { + return cc[a + ido * (b + 11 * c)]; + }; + auto WA = [wa, ido](size_t x, size_t i) { + return wa[i - 1 + x * (ido - 1)]; + }; if (ido == 1) for (size_t k = 0; k < l1; ++k) { @@ -1441,16 +1463,21 @@ namespace pocketfft size_t ipph = (ip + 1) / 2; size_t idl1 = ido * l1; - auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) - -> T &{ return ch[a + ido * (b + l1 * c)]; }; - auto CC = [cc, ido, cdim](size_t a, size_t b, size_t c) - -> const T &{ return cc[a + ido * (b + cdim * c)]; }; - auto CX = [cc, ido, l1](size_t a, size_t b, size_t c) - -> T &{ return cc[a + ido * (b + l1 * c)]; }; - auto CX2 = - [cc, idl1](size_t a, size_t b) -> T &{ return cc[a + idl1 * b]; }; - auto CH2 = [ch, idl1](size_t a, size_t b) - -> const T &{ return ch[a + idl1 * b]; }; + auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) -> T & { + return ch[a + ido * (b + l1 * c)]; + }; + auto CC = [cc, ido, cdim](size_t a, size_t b, size_t c) -> const T & { + return cc[a + ido * (b + cdim * c)]; + }; + auto CX = [cc, ido, l1](size_t a, size_t b, size_t c) -> T & { + return cc[a + ido * (b + l1 * c)]; + }; + auto CX2 = [cc, idl1](size_t a, size_t b) -> T & { + return cc[a + idl1 * b]; + }; + auto CH2 = [ch, idl1](size_t a, size_t b) -> const T & { + return ch[a + idl1 * b]; + }; arr<cmplx<T0>> wal(ip); wal[0] = cmplx<T0>(1., 0.); @@ -1708,12 +1735,15 @@ namespace pocketfft T *POCKETFFT_RESTRICT ch, const T0 *POCKETFFT_RESTRICT wa) const { - auto WA = - [wa, ido](size_t x, size_t i) { return wa[i + x * (ido - 1)]; }; - auto CC = [cc, ido, l1](size_t a, size_t b, size_t c) - -> const T &{ return cc[a + ido * (b + l1 * c)]; }; - auto CH = [ch, ido](size_t a, size_t b, size_t c) - -> T &{ return ch[a + ido * (b + 2 * c)]; }; + auto WA = [wa, ido](size_t x, size_t i) { + return wa[i + x * (ido - 1)]; + }; + auto CC = [cc, ido, l1](size_t a, size_t b, size_t c) -> const T & { + return cc[a + ido * (b + l1 * c)]; + }; + auto CH = [ch, ido](size_t a, size_t b, size_t c) -> T & { + return ch[a + ido * (b + 2 * c)]; + }; for (size_t k = 0; k < l1; k++) PM(CH(0, 0, k), CH(ido - 1, 1, k), CC(0, k, 0), CC(0, k, 1)); @@ -1753,12 +1783,15 @@ namespace pocketfft constexpr T0 taur = -0.5, taui = T0(0.8660254037844386467637231707529362L); - auto WA = - [wa, ido](size_t x, size_t i) { return wa[i + x * (ido - 1)]; }; - auto CC = [cc, ido, l1](size_t a, size_t b, size_t c) - -> const T &{ return cc[a + ido * (b + l1 * c)]; }; - auto CH = [ch, ido](size_t a, size_t b, size_t c) - -> T &{ return ch[a + ido * (b + 3 * c)]; }; + auto WA = [wa, ido](size_t x, size_t i) { + return wa[i + x * (ido - 1)]; + }; + auto CC = [cc, ido, l1](size_t a, size_t b, size_t c) -> const T & { + return cc[a + ido * (b + l1 * c)]; + }; + auto CH = [ch, ido](size_t a, size_t b, size_t c) -> T & { + return ch[a + ido * (b + 3 * c)]; + }; for (size_t k = 0; k < l1; k++) { T cr2 = CC(0, k, 1) + CC(0, k, 2); @@ -1795,12 +1828,15 @@ namespace pocketfft { constexpr T0 hsqt2 = T0(0.707106781186547524400844362104849L); - auto WA = - [wa, ido](size_t x, size_t i) { return wa[i + x * (ido - 1)]; }; - auto CC = [cc, ido, l1](size_t a, size_t b, size_t c) - -> const T &{ return cc[a + ido * (b + l1 * c)]; }; - auto CH = [ch, ido](size_t a, size_t b, size_t c) - -> T &{ return ch[a + ido * (b + 4 * c)]; }; + auto WA = [wa, ido](size_t x, size_t i) { + return wa[i + x * (ido - 1)]; + }; + auto CC = [cc, ido, l1](size_t a, size_t b, size_t c) -> const T & { + return cc[a + ido * (b + l1 * c)]; + }; + auto CH = [ch, ido](size_t a, size_t b, size_t c) -> T & { + return ch[a + ido * (b + 4 * c)]; + }; for (size_t k = 0; k < l1; k++) { T tr1, tr2; @@ -1849,12 +1885,15 @@ namespace pocketfft tr12 = T0(-0.8090169943749474241022934171828191L), ti12 = T0(0.5877852522924731291687059546390728L); - auto WA = - [wa, ido](size_t x, size_t i) { return wa[i + x * (ido - 1)]; }; - auto CC = [cc, ido, l1](size_t a, size_t b, size_t c) - -> const T &{ return cc[a + ido * (b + l1 * c)]; }; - auto CH = [ch, ido](size_t a, size_t b, size_t c) - -> T &{ return ch[a + ido * (b + 5 * c)]; }; + auto WA = [wa, ido](size_t x, size_t i) { + return wa[i + x * (ido - 1)]; + }; + auto CC = [cc, ido, l1](size_t a, size_t b, size_t c) -> const T & { + return cc[a + ido * (b + l1 * c)]; + }; + auto CH = [ch, ido](size_t a, size_t b, size_t c) -> T & { + return ch[a + ido * (b + 5 * c)]; + }; for (size_t k = 0; k < l1; k++) { T cr2, cr3, ci4, ci5; @@ -1909,16 +1948,21 @@ namespace pocketfft size_t ipph = (ip + 1) / 2; size_t idl1 = ido * l1; - auto CC = [cc, ido, cdim](size_t a, size_t b, size_t c) - -> T &{ return cc[a + ido * (b + cdim * c)]; }; - auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) - -> const T &{ return ch[a + ido * (b + l1 * c)]; }; - auto C1 = [cc, ido, l1](size_t a, size_t b, size_t c) - -> T &{ return cc[a + ido * (b + l1 * c)]; }; - auto C2 = - [cc, idl1](size_t a, size_t b) -> T &{ return cc[a + idl1 * b]; }; - auto CH2 = - [ch, idl1](size_t a, size_t b) -> T &{ return ch[a + idl1 * b]; }; + auto CC = [cc, ido, cdim](size_t a, size_t b, size_t c) -> T & { + return cc[a + ido * (b + cdim * c)]; + }; + auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) -> const T & { + return ch[a + ido * (b + l1 * c)]; + }; + auto C1 = [cc, ido, l1](size_t a, size_t b, size_t c) -> T & { + return cc[a + ido * (b + l1 * c)]; + }; + auto C2 = [cc, idl1](size_t a, size_t b) -> T & { + return cc[a + idl1 * b]; + }; + auto CH2 = [ch, idl1](size_t a, size_t b) -> T & { + return ch[a + idl1 * b]; + }; if (ido > 1) { for (size_t j = 1, jc = ip - 1; j < ipph; ++j, --jc) // 114 @@ -2064,12 +2108,15 @@ namespace pocketfft T *POCKETFFT_RESTRICT ch, const T0 *POCKETFFT_RESTRICT wa) const { - auto WA = - [wa, ido](size_t x, size_t i) { return wa[i + x * (ido - 1)]; }; - auto CC = [cc, ido](size_t a, size_t b, size_t c) - -> const T &{ return cc[a + ido * (b + 2 * c)]; }; - auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) - -> T &{ return ch[a + ido * (b + l1 * c)]; }; + auto WA = [wa, ido](size_t x, size_t i) { + return wa[i + x * (ido - 1)]; + }; + auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & { + return cc[a + ido * (b + 2 * c)]; + }; + auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) -> T & { + return ch[a + ido * (b + l1 * c)]; + }; for (size_t k = 0; k < l1; k++) PM(CH(0, k, 0), CH(0, k, 1), CC(0, 0, k), CC(ido - 1, 1, k)); @@ -2099,12 +2146,15 @@ namespace pocketfft constexpr T0 taur = -0.5, taui = T0(0.8660254037844386467637231707529362L); - auto WA = - [wa, ido](size_t x, size_t i) { return wa[i + x * (ido - 1)]; }; - auto CC = [cc, ido](size_t a, size_t b, size_t c) - -> const T &{ return cc[a + ido * (b + 3 * c)]; }; - auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) - -> T &{ return ch[a + ido * (b + l1 * c)]; }; + auto WA = [wa, ido](size_t x, size_t i) { + return wa[i + x * (ido - 1)]; + }; + auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & { + return cc[a + ido * (b + 3 * c)]; + }; + auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) -> T & { + return ch[a + ido * (b + l1 * c)]; + }; for (size_t k = 0; k < l1; k++) { T tr2 = 2 * CC(ido - 1, 1, k); @@ -2144,12 +2194,15 @@ namespace pocketfft { constexpr T0 sqrt2 = T0(1.414213562373095048801688724209698L); - auto WA = - [wa, ido](size_t x, size_t i) { return wa[i + x * (ido - 1)]; }; - auto CC = [cc, ido](size_t a, size_t b, size_t c) - -> const T &{ return cc[a + ido * (b + 4 * c)]; }; - auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) - -> T &{ return ch[a + ido * (b + l1 * c)]; }; + auto WA = [wa, ido](size_t x, size_t i) { + return wa[i + x * (ido - 1)]; + }; + auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & { + return cc[a + ido * (b + 4 * c)]; + }; + auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) -> T & { + return ch[a + ido * (b + l1 * c)]; + }; for (size_t k = 0; k < l1; k++) { T tr1, tr2; @@ -2203,12 +2256,15 @@ namespace pocketfft tr12 = T0(-0.8090169943749474241022934171828191L), ti12 = T0(0.5877852522924731291687059546390728L); - auto WA = - [wa, ido](size_t x, size_t i) { return wa[i + x * (ido - 1)]; }; - auto CC = [cc, ido](size_t a, size_t b, size_t c) - -> const T &{ return cc[a + ido * (b + 5 * c)]; }; - auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) - -> T &{ return ch[a + ido * (b + l1 * c)]; }; + auto WA = [wa, ido](size_t x, size_t i) { + return wa[i + x * (ido - 1)]; + }; + auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & { + return cc[a + ido * (b + 5 * c)]; + }; + auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) -> T & { + return ch[a + ido * (b + l1 * c)]; + }; for (size_t k = 0; k < l1; k++) { T ti5 = CC(0, 2, k) + CC(0, 2, k); @@ -2266,16 +2322,21 @@ namespace pocketfft size_t ipph = (ip + 1) / 2; size_t idl1 = ido * l1; - auto CC = [cc, ido, cdim](size_t a, size_t b, size_t c) - -> const T &{ return cc[a + ido * (b + cdim * c)]; }; - auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) - -> T &{ return ch[a + ido * (b + l1 * c)]; }; - auto C1 = [cc, ido, l1](size_t a, size_t b, size_t c) - -> const T &{ return cc[a + ido * (b + l1 * c)]; }; - auto C2 = - [cc, idl1](size_t a, size_t b) -> T &{ return cc[a + idl1 * b]; }; - auto CH2 = - [ch, idl1](size_t a, size_t b) -> T &{ return ch[a + idl1 * b]; }; + auto CC = [cc, ido, cdim](size_t a, size_t b, size_t c) -> const T & { + return cc[a + ido * (b + cdim * c)]; + }; + auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) -> T & { + return ch[a + ido * (b + l1 * c)]; + }; + auto C1 = [cc, ido, l1](size_t a, size_t b, size_t c) -> const T & { + return cc[a + ido * (b + l1 * c)]; + }; + auto C2 = [cc, idl1](size_t a, size_t b) -> T & { + return cc[a + idl1 * b]; + }; + auto CH2 = [ch, idl1](size_t a, size_t b) -> T & { + return ch[a + idl1 * b]; + }; for (size_t k = 0; k < l1; ++k) // 102 for (size_t i = 0; i < ido; ++i) // 101 @@ -3338,8 +3399,8 @@ namespace pocketfft #ifndef POCKETFFT_NO_VECTORS template <> struct VTYPE<float> { - using type = float - __attribute__((vector_size(VLEN<float>::val * sizeof(float)))); + using type = + float __attribute__((vector_size(VLEN<float>::val * sizeof(float)))); }; template <> struct VTYPE<double> { @@ -3348,9 +3409,8 @@ namespace pocketfft }; template <> struct VTYPE<long double> { - using type = long double - __attribute__((vector_size(VLEN<long double>::val * - sizeof(long double)))); + using type = long double __attribute__(( + vector_size(VLEN<long double>::val * sizeof(long double)))); }; #endif @@ -3911,18 +3971,18 @@ namespace pocketfft } // namespace detail - using detail::FORWARD; using detail::BACKWARD; - using detail::shape_t; - using detail::stride_t; using detail::c2c; using detail::c2r; + using detail::dct; + using detail::dst; + using detail::FORWARD; using detail::r2c; using detail::r2r_fftpack; - using detail::r2r_separable_hartley; using detail::r2r_genuine_hartley; - using detail::dct; - using detail::dst; + using detail::r2r_separable_hartley; + using detail::shape_t; + using detail::stride_t; } // namespace pocketfft diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fft/rfft.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fft/rfft.hpp index 91e6fab829..84d1300c8d 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/fft/rfft.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/fft/rfft.hpp @@ -1,11 +1,11 @@ #ifndef PYTHONIC_NUMPY_FFT_RFFT_HPP #define PYTHONIC_NUMPY_FFT_RFFT_HPP +#include "pythonic/builtins/None.hpp" #include "pythonic/include/numpy/fft/rfft.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/include/utils/array_helper.hpp" -#include "pythonic/types/ndarray.hpp" -#include "pythonic/builtins/None.hpp" #include "pythonic/numpy/fft/c2c.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> rfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis, types::str const &norm) { @@ -27,7 +27,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> rfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis, types::none_type norm) { @@ -37,7 +37,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> rfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::none_type norm) { @@ -47,7 +47,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_floating_point<T>::value, std::complex<T>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> rfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::str const &norm) { @@ -57,7 +57,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> rfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis, types::str const &norm) { @@ -68,7 +68,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> rfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis, types::none_type norm) { @@ -79,7 +79,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> rfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::none_type norm) { @@ -90,7 +90,7 @@ namespace numpy template <class T, class pS> types::ndarray<typename std::enable_if<std::is_integral<T>::value, std::complex<double>>::type, - types::array<long, std::tuple_size<pS>::value>> + types::array_tuple<long, std::tuple_size<pS>::value>> rfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::str const &norm) { @@ -99,8 +99,8 @@ namespace numpy } NUMPY_EXPR_TO_NDARRAY0_IMPL(rfft); - } -} + } // namespace fft +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fill_diagonal.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fill_diagonal.hpp index 5be8b09d21..dd5bc0889b 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/fill_diagonal.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/fill_diagonal.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/fill_diagonal.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/NoneType.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -15,14 +15,14 @@ namespace numpy typename std::decay<E>::type::dtype fill_value) { constexpr auto N = std::decay<E>::type::value; - types::array<long, N> indices; + types::array_tuple<long, N> indices; for (long i = 0, n = sutils::min(expr); i < n; ++i) { std::fill(indices.begin(), indices.end(), i); expr.fast(indices) = fill_value; } return {}; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/finfo.hpp b/contrib/python/pythran/pythran/pythonic/numpy/finfo.hpp index cb9c2b10ba..cb13966269 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/finfo.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/finfo.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/finfo.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/finfo.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy { return types::finfo<typename dtype::type>(); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fix.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fix.hpp index 5b1b020dc2..84773b61cf 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/fix.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/fix.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/fix.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -13,9 +13,9 @@ namespace numpy { #define NUMPY_NARY_FUNC_NAME fix -#define NUMPY_NARY_FUNC_SYM std::trunc +#define NUMPY_NARY_FUNC_SYM wrapper::fix #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/flatnonzero.hpp b/contrib/python/pythran/pythran/pythonic/numpy/flatnonzero.hpp index 221574cb59..987a206900 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/flatnonzero.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/flatnonzero.hpp @@ -26,7 +26,7 @@ namespace numpy _flatnonzero((*begin).begin(), (*begin).end(), out, i, utils::int_<N - 1>()); } - } + } // namespace template <class E> types::ndarray<long, types::pshape<long>> flatnonzero(E const &expr) { @@ -38,7 +38,7 @@ namespace numpy types::pshape<long> shape = iter - buffer->data; return types::ndarray<long, types::pshape<long>>(std::move(buffer), shape); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/flip.hpp b/contrib/python/pythran/pythran/pythonic/numpy/flip.hpp index 27241f061d..3bcdaf7f19 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/flip.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/flip.hpp @@ -14,12 +14,12 @@ namespace numpy namespace details { template <class E, class S, size_t... I> - auto flip(E const &expr, S const &slices, utils::index_sequence<I...>) - -> decltype(expr(slices[I]...)) + auto flip(E const &expr, S const &slices, + utils::index_sequence<I...>) -> decltype(expr(slices[I]...)) { return expr(slices[I]...); } - } + } // namespace details template <class E> auto flip(E const &expr, long axis) @@ -30,7 +30,7 @@ namespace numpy slices[axis].step = -1; return details::flip(expr, slices, utils::make_index_sequence<E::value>{}); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fliplr.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fliplr.hpp index e7354ff215..d19474358f 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/fliplr.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/fliplr.hpp @@ -11,9 +11,10 @@ PYTHONIC_NS_BEGIN namespace numpy { template <class E> - auto fliplr(E &&expr) -> decltype(std::forward<E>(expr)( - types::cstride_slice<1>{builtins::None, builtins::None}, - types::slice{builtins::None, builtins::None, -1})) + auto + fliplr(E &&expr) -> decltype(std::forward<E>(expr)( + types::cstride_slice<1>{builtins::None, builtins::None}, + types::slice{builtins::None, builtins::None, -1})) { return std::forward<E>(expr)( types::cstride_slice<1>{builtins::None, builtins::None}, diff --git a/contrib/python/pythran/pythran/pythonic/numpy/flipud.hpp b/contrib/python/pythran/pythran/pythonic/numpy/flipud.hpp index 3e2799dd94..a5a0331f8a 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/flipud.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/flipud.hpp @@ -3,21 +3,22 @@ #include "pythonic/include/numpy/flipud.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class E> - auto flipud(E &&expr) -> decltype( - std::forward<E>(expr)[types::slice{builtins::None, builtins::None, -1}]) + auto + flipud(E &&expr) -> decltype(std::forward<E>( + expr)[types::slice{builtins::None, builtins::None, -1}]) { return std::forward<E>( expr)[types::slice{builtins::None, builtins::None, -1}]; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/float_.hpp b/contrib/python/pythran/pythran/pythonic/numpy/float_.hpp index 356ae7d1a8..721101c1b8 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/float_.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/float_.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_NUMPY_FLOAT_HPP #define PYTHONIC_NUMPY_FLOAT_HPP -#include "pythonic/include/numpy/float_.hpp" #include "pythonic/include/numpy/float64.hpp" +#include "pythonic/include/numpy/float_.hpp" PYTHONIC_NS_BEGIN @@ -12,7 +12,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME float_ #define NUMPY_NARY_FUNC_SYM details::float64 #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/floor.hpp b/contrib/python/pythran/pythran/pythonic/numpy/floor.hpp index 121f5c03eb..c359bc9c93 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/floor.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/floor.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/floor.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME floor #define NUMPY_NARY_FUNC_SYM xsimd::floor #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/floor_divide.hpp b/contrib/python/pythran/pythran/pythonic/numpy/floor_divide.hpp index f68d2fca1b..6f7f551e07 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/floor_divide.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/floor_divide.hpp @@ -3,11 +3,11 @@ #include "pythonic/include/numpy/floor_divide.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/numpy/floor.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic/numpy/floor.hpp" PYTHONIC_NS_BEGIN @@ -16,7 +16,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME floor_divide #define NUMPY_NARY_FUNC_SYM wrapper::divfloor #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fmod.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fmod.hpp index cfb9ecc66c..bc10249724 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/fmod.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/fmod.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/fmod.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME fmod #define NUMPY_NARY_FUNC_SYM xsimd::fmod #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/frexp.hpp b/contrib/python/pythran/pythran/pythonic/numpy/frexp.hpp index 1d9bc10243..57bf14cd1e 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/frexp.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/frexp.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/frexp.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/types/traits.hpp" #include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_conversion.hpp" -#include "pythonic/types/traits.hpp" -#include "pythonic/types/ndarray.hpp" PYTHONIC_NS_BEGIN @@ -39,7 +39,7 @@ namespace numpy _frexp((*begin).begin(), (*begin).end(), (*significands_iter).begin(), (*exps_iter).begin(), utils::int_<N - 1>()); } - } + } // namespace template <class E> typename std::enable_if< @@ -56,7 +56,7 @@ namespace numpy utils::int_<E::value>()); return std::make_tuple(significands, exps); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fromfile.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fromfile.hpp index ea8c4aa7ce..771062f49e 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/fromfile.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/fromfile.hpp @@ -45,7 +45,7 @@ namespace numpy fs.read((char *)res.buffer, sizeof(typename dtype::type) * count); return res; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fromfunction.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fromfunction.hpp index 1d60afb647..857ecf35cc 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/fromfunction.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/fromfunction.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/fromfunction.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/builtins/None.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/tags.hpp" PYTHONIC_NS_BEGIN @@ -19,12 +19,15 @@ namespace numpy template <class pS> types::ndarray<typename std::remove_cv<typename std::remove_reference< typename std::result_of<F(dtype)>::type>::type>::type, - pS> fromfunction_helper<F, 1, dtype, purity_tag>:: - operator()(F &&f, pS const &shape, dtype d) + pS> + fromfunction_helper<F, 1, dtype, purity_tag>::operator()(F &&f, + pS const &shape, + dtype d) { types::ndarray<typename std::remove_cv<typename std::remove_reference< typename std::result_of<F(dtype)>::type>::type>::type, - pS> out(shape, builtins::None); + pS> + out(shape, builtins::None); long n = out.template shape<0>(); for (long i = 0; i < n; ++i) out[i] = f(i); @@ -36,13 +39,16 @@ namespace numpy types::ndarray< typename std::remove_cv<typename std::remove_reference< typename std::result_of<F(dtype, dtype)>::type>::type>::type, - pS> fromfunction_helper<F, 2, dtype, purity_tag>:: - operator()(F &&f, pS const &shape, dtype d) + pS> + fromfunction_helper<F, 2, dtype, purity_tag>::operator()(F &&f, + pS const &shape, + dtype d) { types::ndarray< typename std::remove_cv<typename std::remove_reference< typename std::result_of<F(dtype, dtype)>::type>::type>::type, - pS> out(shape, builtins::None); + pS> + out(shape, builtins::None); long n = out.template shape<0>(); long m = out.template shape<1>(); for (long i = 0; i < n; ++i) @@ -63,7 +69,7 @@ namespace numpy } /* TODO: must specialize for higher order */ -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fromiter.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fromiter.hpp index f2b31e6f1e..7bbe112370 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/fromiter.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/fromiter.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/fromiter.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -25,11 +25,11 @@ namespace numpy } else { utils::shared_ref<types::raw_array<T>> buffer(count); std::copy_n(iterable.begin(), count, buffer->data); - types::array<long, 1> shape = {count}; + types::array_tuple<long, 1> shape = {count}; return {buffer, shape}; } } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fromstring.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fromstring.hpp index c7e548bff5..d744824deb 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/fromstring.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/fromstring.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/fromstring.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/types/list.hpp" +#include "pythonic/types/ndarray.hpp" #include "pythonic/types/str.hpp" +#include "pythonic/utils/functor.hpp" #include <limits> #include <sstream> @@ -50,7 +50,7 @@ namespace numpy return {buffer, shape}; } } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/full.hpp b/contrib/python/pythran/pythran/pythonic/numpy/full.hpp index 9153abd871..cca0749954 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/full.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/full.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/full.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -55,7 +55,7 @@ namespace numpy return full(types::pshape<std::integral_constant<long, N>>({}), fill_value, nt); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/full_like.hpp b/contrib/python/pythran/pythran/pythonic/numpy/full_like.hpp index 75421404f5..721893baa4 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/full_like.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/full_like.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/full_like.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/numpy/full.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -26,7 +26,7 @@ namespace numpy return full(sutils::getshape(expr), fill_value, types::dtype_t<typename E::dtype>()); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/greater.hpp b/contrib/python/pythran/pythran/pythonic/numpy/greater.hpp index 687d8d546f..c283d575da 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/greater.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/greater.hpp @@ -3,11 +3,11 @@ #include "pythonic/include/numpy/greater.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/operator_/gt.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic/operator_/gt.hpp" PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME greater #define NUMPY_NARY_FUNC_SYM pythonic::operator_::gt #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/greater_equal.hpp b/contrib/python/pythran/pythran/pythonic/numpy/greater_equal.hpp index d19a51054d..09cde4949f 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/greater_equal.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/greater_equal.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/greater_equal.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/operator_/ge.hpp" +#include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME greater_equal #define NUMPY_NARY_FUNC_SYM pythonic::operator_::ge #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/heaviside.hpp b/contrib/python/pythran/pythran/pythonic/numpy/heaviside.hpp index 0bec76ec7d..bb33f5381e 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/heaviside.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/heaviside.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/cos.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -26,12 +26,12 @@ namespace numpy return 1; return x0; // NaN } - } + } // namespace details #define NUMPY_NARY_FUNC_NAME heaviside #define NUMPY_NARY_FUNC_SYM details::heaviside #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/hstack.hpp b/contrib/python/pythran/pythran/pythonic/numpy/hstack.hpp index b707c41f1c..de2e6f6937 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/hstack.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/hstack.hpp @@ -18,7 +18,7 @@ namespace numpy 1); return concatenate(std::forward<ArraySequence>(seq), concatenate_axis); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/hypot.hpp b/contrib/python/pythran/pythran/pythonic/numpy/hypot.hpp index 366ab8bbbb..9ae4a9eb36 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/hypot.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/hypot.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/hypot.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME hypot #define NUMPY_NARY_FUNC_SYM xsimd::hypot #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/identity.hpp b/contrib/python/pythran/pythran/pythonic/numpy/identity.hpp index e065c30707..4f0e7e454b 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/identity.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/identity.hpp @@ -14,7 +14,7 @@ namespace numpy { return eye(n, n, 0, d); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/imag.hpp b/contrib/python/pythran/pythran/pythonic/numpy/imag.hpp index b27c313eaa..d974c4c7cd 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/imag.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/imag.hpp @@ -3,18 +3,18 @@ #include "pythonic/include/numpy/imag.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/numpy/asarray.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/types/list.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class E> - auto imag(E &&expr) - -> decltype(builtins::getattr(types::attr::IMAG{}, std::forward<E>(expr))) + auto imag(E &&expr) -> decltype(builtins::getattr(types::attr::IMAG{}, + std::forward<E>(expr))) { return builtins::getattr(types::attr::IMAG{}, std::forward<E>(expr)); } @@ -25,7 +25,7 @@ namespace numpy { return imag(numpy::functor::asarray{}(expr)); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/indices.hpp b/contrib/python/pythran/pythran/pythonic/numpy/indices.hpp index 01b6dc7994..d22b05549a 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/indices.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/indices.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/indices.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -43,7 +43,7 @@ namespace numpy } return out; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/insert.hpp b/contrib/python/pythran/pythran/pythonic/numpy/insert.hpp index ea09fade89..8b71eda74d 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/insert.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/insert.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/insert.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/builtins/None.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/traits.hpp" -#include "pythonic/builtins/None.hpp" +#include "pythonic/utils/functor.hpp" #include <algorithm> @@ -73,7 +73,7 @@ namespace numpy { throw std::runtime_error("insert only partially supported"); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/invert.hpp b/contrib/python/pythran/pythran/pythonic/numpy/invert.hpp index 0bccba8bf0..631703ef45 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/invert.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/invert.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/invert.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/operator_/invert.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic/operator_/invert.hpp" PYTHONIC_NS_BEGIN @@ -16,7 +16,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME invert #define NUMPY_NARY_FUNC_SYM operator_::invert #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/isclose.hpp b/contrib/python/pythran/pythran/pythonic/numpy/isclose.hpp index 84d5068ead..c48e000620 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/isclose.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/isclose.hpp @@ -3,11 +3,11 @@ #include "pythonic/include/numpy/isclose.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/numpy/abs.hpp" #include "pythonic/numpy/isfinite.hpp" #include "pythonic/numpy/isnan.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy @@ -26,11 +26,11 @@ namespace numpy else return (u == v); } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME isclose #define NUMPY_NARY_FUNC_SYM wrapper::isclose #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/iscomplex.hpp b/contrib/python/pythran/pythran/pythonic/numpy/iscomplex.hpp index 3d0b836191..b2b529b73f 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/iscomplex.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/iscomplex.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/iscomplex.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" -#include "pythonic/utils/numpy_traits.hpp" #include "pythonic/types/traits.hpp" +#include "pythonic/utils/functor.hpp" +#include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -28,12 +28,12 @@ namespace numpy { return false; } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME iscomplex #define NUMPY_NARY_FUNC_SYM wrapper::iscomplex #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/isfinite.hpp b/contrib/python/pythran/pythran/pythonic/numpy/isfinite.hpp index fd07a6abc7..6ed26423b9 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/isfinite.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/isfinite.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/isfinite.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME isfinite #define NUMPY_NARY_FUNC_SYM wrapper::isfinite #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/isinf.hpp b/contrib/python/pythran/pythran/pythonic/numpy/isinf.hpp index c17e9277da..eb684dc1bb 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/isinf.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/isinf.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/isinf.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -23,11 +23,11 @@ namespace numpy { return std::isinf(v.real()) || std::isinf(v.imag()); } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME isinf #define NUMPY_NARY_FUNC_SYM wrapper::isinf #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/isnan.hpp b/contrib/python/pythran/pythran/pythonic/numpy/isnan.hpp index 781907281c..a946eeeee7 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/isnan.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/isnan.hpp @@ -20,25 +20,28 @@ namespace numpy } template <class T> - auto isnan(T const &v) -> typename std::enable_if< - std::is_floating_point<typename std::decay<T>::type>::value, bool>::type + auto isnan(T const &v) -> + typename std::enable_if< + std::is_floating_point<typename std::decay<T>::type>::value, + bool>::type { return std::isnan(v); } template <class T> - auto isnan(T const &v) -> typename std::enable_if< - !std::is_floating_point<typename std::decay<T>::type>::value, - bool>::type + auto isnan(T const &v) -> + typename std::enable_if< + !std::is_floating_point<typename std::decay<T>::type>::value, + bool>::type { return false; } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME isnan #define NUMPY_NARY_FUNC_SYM wrapper::isnan #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/isneginf.hpp b/contrib/python/pythran/pythran/pythonic/numpy/isneginf.hpp index e6fdc78132..79a55fea1e 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/isneginf.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/isneginf.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/isneginf.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic//numpy/isinf.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic//numpy/isinf.hpp" PYTHONIC_NS_BEGIN @@ -19,12 +19,12 @@ namespace numpy { return functor::isinf{}(t) && (t < 0); } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME isneginf #define NUMPY_NARY_FUNC_SYM wrapper::isneginf #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/isposinf.hpp b/contrib/python/pythran/pythran/pythonic/numpy/isposinf.hpp index b1952a792e..c54dfae02f 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/isposinf.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/isposinf.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/isposinf.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" #include "pythonic/numpy/isinf.hpp" @@ -20,11 +20,11 @@ namespace numpy { return functor::isinf{}(t) && t >= 0; } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME isposinf #define NUMPY_NARY_FUNC_SYM wrapper::isposinf #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/isreal.hpp b/contrib/python/pythran/pythran/pythonic/numpy/isreal.hpp index 2e3e17d2d8..134fdc307d 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/isreal.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/isreal.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/isreal.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" -#include "pythonic/utils/numpy_traits.hpp" #include "pythonic/types/traits.hpp" +#include "pythonic/utils/functor.hpp" +#include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -28,12 +28,12 @@ namespace numpy { return true; } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME isreal #define NUMPY_NARY_FUNC_SYM wrapper::isreal #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/isrealobj.hpp b/contrib/python/pythran/pythran/pythonic/numpy/isrealobj.hpp index f8207f9a98..92a1f29ff0 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/isrealobj.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/isrealobj.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/isrealobj.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/traits.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -16,7 +16,7 @@ namespace numpy { return !types::is_complex<typename E::dtype>::value; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/isscalar.hpp b/contrib/python/pythran/pythran/pythonic/numpy/isscalar.hpp index 56b5fcc289..a06887f991 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/isscalar.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/isscalar.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/isscalar.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/traits.hpp" #include "pythonic/types/str.hpp" +#include "pythonic/types/traits.hpp" +#include "pythonic/utils/functor.hpp" #include <type_traits> @@ -18,7 +18,7 @@ namespace numpy { return types::is_dtype<E>::value || std::is_same<E, types::str>::value; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/issctype.hpp b/contrib/python/pythran/pythran/pythonic/numpy/issctype.hpp index 368fbd02d3..45fdedec58 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/issctype.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/issctype.hpp @@ -26,7 +26,7 @@ namespace numpy { return false; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ldexp.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ldexp.hpp index 3671315d6e..4764037d18 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/ldexp.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/ldexp.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/ldexp.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -16,7 +16,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME ldexp #define NUMPY_NARY_FUNC_SYM std::ldexp #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/left_shift.hpp b/contrib/python/pythran/pythran/pythonic/numpy/left_shift.hpp index c4b2c74763..078bc62af4 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/left_shift.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/left_shift.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/left_shift.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/operator_/lshift.hpp" +#include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME left_shift #define NUMPY_NARY_FUNC_SYM pythonic::operator_::lshift #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/less.hpp b/contrib/python/pythran/pythran/pythonic/numpy/less.hpp index e1ef9744f6..654b1e043d 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/less.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/less.hpp @@ -3,11 +3,11 @@ #include "pythonic/include/numpy/less.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/operator_/lt.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic/operator_/lt.hpp" PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME less #define NUMPY_NARY_FUNC_SYM pythonic::operator_::lt #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/less_equal.hpp b/contrib/python/pythran/pythran/pythonic/numpy/less_equal.hpp index 258e83108e..19b4a65d33 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/less_equal.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/less_equal.hpp @@ -3,11 +3,11 @@ #include "pythonic/include/numpy/less_equal.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/operator_/le.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic/operator_/le.hpp" PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME less_equal #define NUMPY_NARY_FUNC_SYM pythonic::operator_::le #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/lexsort.hpp b/contrib/python/pythran/pythran/pythonic/numpy/lexsort.hpp index eef50a93fd..c8b1afa04b 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/lexsort.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/lexsort.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/lexsort.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/pdqsort.hpp" PYTHONIC_NS_BEGIN @@ -48,7 +48,7 @@ namespace numpy return lexcmp_nth<std::tuple_size<K>::value>{}(keys, i0, i1); } }; - } + } // namespace details template <class pS> types::ndarray<long, types::pshape<long>> lexsort(pS const &keys) @@ -62,7 +62,7 @@ namespace numpy pdqsort(out.buffer, out.buffer + n, details::lexcmp<pS>(keys)); return out; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/linalg/matrix_power.hpp b/contrib/python/pythran/pythran/pythonic/numpy/linalg/matrix_power.hpp index 7c76b77df2..7d873ab274 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/linalg/matrix_power.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/linalg/matrix_power.hpp @@ -5,8 +5,8 @@ #include "pythonic/numpy/array.hpp" #include "pythonic/numpy/asarray.hpp" -#include "pythonic/numpy/identity.hpp" #include "pythonic/numpy/dot.hpp" +#include "pythonic/numpy/identity.hpp" #include "pythonic/builtins/NotImplementedError.hpp" PYTHONIC_NS_BEGIN @@ -40,11 +40,11 @@ namespace numpy return numpy::functor::dot{}(tmp, tmp); } } - } + } // namespace details template <class E> - auto matrix_power(E const &expr, long n) - -> decltype(numpy::functor::array{}(expr)) + auto matrix_power(E const &expr, + long n) -> decltype(numpy::functor::array{}(expr)) { if (n == 0) return numpy::functor::identity{}(expr.template shape<0>(), @@ -55,8 +55,8 @@ namespace numpy } throw pythonic::builtins::NotImplementedError("negative power"); } - } -} + } // namespace linalg +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/linalg/norm.hpp b/contrib/python/pythran/pythran/pythonic/numpy/linalg/norm.hpp index 4a9c5aa13c..1f24579776 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/linalg/norm.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/linalg/norm.hpp @@ -1,18 +1,18 @@ #ifndef PYTHONIC_NUMPY_LINALG_NORM_HPP #define PYTHONIC_NUMPY_LINALG_NORM_HPP +#include "pythonic/builtins/NotImplementedError.hpp" +#include "pythonic/builtins/pythran/abssqr.hpp" #include "pythonic/include/numpy/linalg/norm.hpp" #include "pythonic/numpy/abs.hpp" -#include "pythonic/numpy/conj.hpp" #include "pythonic/numpy/asfarray.hpp" +#include "pythonic/numpy/conj.hpp" #include "pythonic/numpy/inf.hpp" #include "pythonic/numpy/max.hpp" #include "pythonic/numpy/min.hpp" #include "pythonic/numpy/power.hpp" #include "pythonic/numpy/real.hpp" #include "pythonic/numpy/sqrt.hpp" -#include "pythonic/builtins/pythran/abssqr.hpp" #include "pythonic/numpy/sum.hpp" -#include "pythonic/builtins/NotImplementedError.hpp" PYTHONIC_NS_BEGIN namespace numpy { @@ -20,8 +20,8 @@ namespace numpy { template <class Array> auto norm(Array &&array, types::none_type ord, types::none_type axis) - -> decltype( - pythonic::numpy::functor::sqrt{}(pythonic::numpy::functor::sum{}( + -> decltype(pythonic::numpy::functor::sqrt{}( + pythonic::numpy::functor::sum{}( pythonic::builtins::pythran::functor::abssqr{}( std::forward<Array>(array))))) { @@ -38,7 +38,7 @@ namespace numpy return norm(std::forward<Array>(x), ord, 0L); case 2: return norm(std::forward<Array>(x), ord, - types::array<long, 2>{{0L, 1L}}); + types::array_tuple<long, 2>{{0L, 1L}}); default: throw pythonic::builtins::NotImplementedError( "Invalid norm order for matrices."); @@ -80,17 +80,18 @@ namespace numpy return norm(std::forward<Array>(x), 2., axis); } template <class Array> - norm_t<Array> norm(Array &&x, double ord, types::array<long, 1> axis) + norm_t<Array> norm(Array &&x, double ord, types::array_tuple<long, 1> axis) { return norm(std::forward<Array>(x), ord, axis[0]); } template <class Array> - norm_t<Array> norm(Array &&array, double ord, types::array<long, 2> axis) + norm_t<Array> norm(Array &&array, double ord, + types::array_tuple<long, 2> axis) { throw pythonic::builtins::NotImplementedError("We need more dev!"); } - } -} + } // namespace linalg +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/linspace.hpp b/contrib/python/pythran/pythran/pythonic/numpy/linspace.hpp index 9d08a98426..9ee28f1276 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/linspace.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/linspace.hpp @@ -22,7 +22,7 @@ namespace numpy else return arange(start, stop + (endpoint ? step * .5 : 0), step, d); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/log.hpp b/contrib/python/pythran/pythran/pythonic/numpy/log.hpp index c21b213e4d..e7b198c853 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/log.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/log.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/log.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME log #define NUMPY_NARY_FUNC_SYM xsimd::log #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/log10.hpp b/contrib/python/pythran/pythran/pythonic/numpy/log10.hpp index 6548a7bc39..758b861909 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/log10.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/log10.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/log10.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME log10 #define NUMPY_NARY_FUNC_SYM xsimd::log10 #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/log1p.hpp b/contrib/python/pythran/pythran/pythonic/numpy/log1p.hpp index 68622caf83..031a0506ed 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/log1p.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/log1p.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/log1p.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME log1p #define NUMPY_NARY_FUNC_SYM xsimd::log1p #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/log2.hpp b/contrib/python/pythran/pythran/pythonic/numpy/log2.hpp index ff251e7766..74c7c43ee9 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/log2.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/log2.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/log2.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME log2 #define NUMPY_NARY_FUNC_SYM xsimd::log2 #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/logaddexp.hpp b/contrib/python/pythran/pythran/pythonic/numpy/logaddexp.hpp index 6db4baa5d4..f198ee7fa2 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/logaddexp.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/logaddexp.hpp @@ -3,11 +3,11 @@ #include "pythonic/include/numpy/logaddexp.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/numpy/exp.hpp" +#include "pythonic/numpy/log.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic/numpy/log.hpp" -#include "pythonic/numpy/exp.hpp" PYTHONIC_NS_BEGIN @@ -21,12 +21,12 @@ namespace numpy { return functor::log{}(functor::exp{}(t0) + functor::exp{}(t1)); } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME logaddexp #define NUMPY_NARY_FUNC_SYM wrapper::logaddexp #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/logaddexp2.hpp b/contrib/python/pythran/pythran/pythonic/numpy/logaddexp2.hpp index 5a210edf6a..b776d5e01a 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/logaddexp2.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/logaddexp2.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/logaddexp2.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" #include "pythonic/numpy/log2.hpp" @@ -25,12 +25,12 @@ namespace numpy return functor::log2{}(functor::power{}(T0(2), t0) + functor::power{}(T1(2), t1)); } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME logaddexp2 #define NUMPY_NARY_FUNC_SYM wrapper::logaddexp2 #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/logical_and.hpp b/contrib/python/pythran/pythran/pythonic/numpy/logical_and.hpp index c9b92e52fd..1d70dca302 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/logical_and.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/logical_and.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/logical_and.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -16,16 +16,16 @@ namespace numpy namespace wrapper { template <class T0, class T1> - auto logical_and(T0 const &t0, T1 const &t1) -> decltype(t0 &&t1) + auto logical_and(T0 const &t0, T1 const &t1) -> decltype(t0 && t1) { return t0 && t1; } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME logical_and #define NUMPY_NARY_FUNC_SYM wrapper::logical_and #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/logical_not.hpp b/contrib/python/pythran/pythran/pythonic/numpy/logical_not.hpp index 00b1e63a28..efd9911616 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/logical_not.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/logical_not.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/logical_not.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/operator_/not_.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic/operator_/not_.hpp" PYTHONIC_NS_BEGIN @@ -16,7 +16,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME logical_not #define NUMPY_NARY_FUNC_SYM pythonic::operator_::not_ #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/logical_or.hpp b/contrib/python/pythran/pythran/pythonic/numpy/logical_or.hpp index 5c8614bbbd..3aa92f6b2a 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/logical_or.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/logical_or.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/logical_or.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -19,12 +19,12 @@ namespace numpy { return t0 || t1; } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME logical_or #define NUMPY_NARY_FUNC_SYM wrapper::logical_or #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/logical_xor.hpp b/contrib/python/pythran/pythran/pythonic/numpy/logical_xor.hpp index a01ac9d30e..6758609df3 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/logical_xor.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/logical_xor.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/logical_xor.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -15,17 +15,17 @@ namespace numpy namespace wrapper { template <class T0, class T1> - auto logical_xor(T0 const &t0, T1 const &t1) - -> decltype((t0 && !t1) || (t1 && !t0)) + auto logical_xor(T0 const &t0, + T1 const &t1) -> decltype((t0 && !t1) || (t1 && !t0)) { return (t0 && !t1) || (t1 && !t0); } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME logical_xor #define NUMPY_NARY_FUNC_SYM wrapper::logical_xor #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/logspace.hpp b/contrib/python/pythran/pythran/pythonic/numpy/logspace.hpp index a9e9a5e656..8f33b1c38f 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/logspace.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/logspace.hpp @@ -17,7 +17,7 @@ namespace numpy return functor::power()(base, functor::linspace()(start, stop, num, endpoint)); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/max.hpp b/contrib/python/pythran/pythran/pythonic/numpy/max.hpp index 27012a4f14..6286642752 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/max.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/max.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/max.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/numpy/reduce.hpp" #include "pythonic/operator_/imax.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -13,12 +13,12 @@ namespace numpy { template <class... Args> - auto max(Args &&... args) + auto max(Args &&...args) -> decltype(reduce<operator_::functor::imax>(std::forward<Args>(args)...)) { return reduce<operator_::functor::imax>(std::forward<Args>(args)...); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/maximum.hpp b/contrib/python/pythran/pythran/pythonic/numpy/maximum.hpp index c53d7f070f..568d2e8439 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/maximum.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/maximum.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/maximum.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME maximum #define NUMPY_NARY_FUNC_SYM xsimd::max #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/mean.hpp b/contrib/python/pythran/pythran/pythonic/numpy/mean.hpp index 5553f9e228..a4266b7633 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/mean.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/mean.hpp @@ -1,12 +1,12 @@ #ifndef PYTHONIC_NUMPY_MEAN_HPP #define PYTHONIC_NUMPY_MEAN_HPP +#include "pythonic/builtins/None.hpp" #include "pythonic/include/numpy/mean.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/numpy/asarray.hpp" #include "pythonic/numpy/expand_dims.hpp" #include "pythonic/numpy/sum.hpp" -#include "pythonic/builtins/None.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -48,7 +48,7 @@ namespace numpy { return expand_dims(mean(expr, axis, d), axis); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/median.hpp b/contrib/python/pythran/pythran/pythonic/numpy/median.hpp index f25ac303a1..939d2a3dd1 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/median.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/median.hpp @@ -85,21 +85,22 @@ namespace numpy template <class T, class pS> typename std::enable_if< std::tuple_size<pS>::value != 1, - types::ndarray<decltype(std::declval<T>() + 1.), - types::array<long, std::tuple_size<pS>::value - 1>>>::type + types::ndarray< + decltype(std::declval<T>() + 1.), + types::array_tuple<long, std::tuple_size<pS>::value - 1>>>::type median(types::ndarray<T, pS> const &arr, long axis) { constexpr auto N = std::tuple_size<pS>::value; if (axis < 0) axis += N; - types::array<long, std::tuple_size<pS>::value - 1> shp; + types::array_tuple<long, std::tuple_size<pS>::value - 1> shp; auto stmp = sutils::getshape(arr); auto next = std::copy(stmp.begin(), stmp.begin() + axis, shp.begin()); std::copy(stmp.begin() + axis + 1, stmp.end(), next); types::ndarray<decltype(std::declval<T>() + 1.), - types::array<long, std::tuple_size<pS>::value - 1>> + types::array_tuple<long, std::tuple_size<pS>::value - 1>> out(shp, types::none_type{}); _median(out.buffer, arr, axis); return out; diff --git a/contrib/python/pythran/pythran/pythonic/numpy/min.hpp b/contrib/python/pythran/pythran/pythonic/numpy/min.hpp index aef1293633..3bff120ae6 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/min.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/min.hpp @@ -13,12 +13,12 @@ namespace numpy { template <class... Args> - auto min(Args &&... args) + auto min(Args &&...args) -> decltype(reduce<operator_::functor::imin>(std::forward<Args>(args)...)) { return reduce<operator_::functor::imin>(std::forward<Args>(args)...); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/minimum.hpp b/contrib/python/pythran/pythran/pythonic/numpy/minimum.hpp index 503c7573da..851e5e8e64 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/minimum.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/minimum.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/minimum.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME minimum #define NUMPY_NARY_FUNC_SYM xsimd::min #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/multiply.hpp b/contrib/python/pythran/pythran/pythonic/numpy/multiply.hpp index a62644f9c3..10aef3f9a2 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/multiply.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/multiply.hpp @@ -3,11 +3,11 @@ #include "pythonic/include/numpy/multiply.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/operator_/mul.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic/operator_/mul.hpp" PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME multiply #define NUMPY_NARY_FUNC_SYM pythonic::operator_::mul #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/nan_to_num.hpp b/contrib/python/pythran/pythran/pythonic/numpy/nan_to_num.hpp index 0a4bbe2ba4..91bee3ecee 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/nan_to_num.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/nan_to_num.hpp @@ -3,11 +3,11 @@ #include "pythonic/include/numpy/nan_to_num.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" -#include "pythonic/utils/numpy_traits.hpp" #include "pythonic/numpy/isinf.hpp" #include "pythonic/numpy/isnan.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" +#include "pythonic/utils/numpy_traits.hpp" #include <limits> @@ -31,12 +31,12 @@ namespace numpy else return a; } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME nan_to_num #define NUMPY_NARY_FUNC_SYM wrapper::nan_to_num #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/nanargmax.hpp b/contrib/python/pythran/pythran/pythonic/numpy/nanargmax.hpp index a64f8cbb31..931e14a212 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/nanargmax.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/nanargmax.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/nanargmax.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/builtins/ValueError.hpp" #include "pythonic/numpy/isnan.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -35,7 +35,7 @@ namespace numpy _nanargmax((*begin).begin(), (*begin).end(), max, index, where, utils::int_<N - 1>()); } - } + } // namespace template <class E> long nanargmax(E const &expr) @@ -50,7 +50,7 @@ namespace numpy else throw types::ValueError("empty sequence"); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/nanargmin.hpp b/contrib/python/pythran/pythran/pythonic/numpy/nanargmin.hpp index 3ea1be2129..5a1ec07557 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/nanargmin.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/nanargmin.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/nanargmin.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/builtins/ValueError.hpp" #include "pythonic/numpy/isnan.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -36,7 +36,7 @@ namespace numpy _nanargmin((*begin).begin(), (*begin).end(), min, index, where, utils::int_<N - 1>()); } - } + } // namespace template <class E> long nanargmin(E const &expr) @@ -51,7 +51,7 @@ namespace numpy else throw types::ValueError("empty sequence"); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/nanmax.hpp b/contrib/python/pythran/pythran/pythonic/numpy/nanmax.hpp index 618fba3ae5..ed69f52f52 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/nanmax.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/nanmax.hpp @@ -37,7 +37,7 @@ namespace numpy utils::int_<N - 1>()); return found; } - } + } // namespace template <class E> typename E::dtype nanmax(E const &expr) @@ -49,7 +49,7 @@ namespace numpy max = std::numeric_limits<typename E::dtype>::quiet_NaN(); return max; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/nanmin.hpp b/contrib/python/pythran/pythran/pythonic/numpy/nanmin.hpp index f80f98086e..6f06df15ac 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/nanmin.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/nanmin.hpp @@ -37,7 +37,7 @@ namespace numpy utils::int_<N - 1>()); return found; } - } + } // namespace template <class E> typename E::dtype nanmin(E const &expr) @@ -49,7 +49,7 @@ namespace numpy min = std::numeric_limits<typename E::dtype>::quiet_NaN(); return min; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/nansum.hpp b/contrib/python/pythran/pythran/pythonic/numpy/nansum.hpp index 65b2e1508b..abd2790cb0 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/nansum.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/nansum.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/nansum.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/numpy/isnan.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -34,7 +34,7 @@ namespace numpy _nansum(expr.begin(), expr.end(), s, utils::int_<E::value>()); return s; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndarray.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndarray.hpp index 663cc823d3..cf84d27eab 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/ndarray.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/ndarray.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/ndarray.hpp" +#include "pythonic/types/ndarray.hpp" #include "pythonic/utils/functor.hpp" #include "pythonic/utils/nested_container.hpp" -#include "pythonic/types/ndarray.hpp" PYTHONIC_NS_BEGIN @@ -32,7 +32,7 @@ namespace numpy { return ndarray(types::pshape<std::integral_constant<long, N>>({}), d); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/astype.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/astype.hpp index d054f80a68..5b48d3ae0a 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/astype.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/astype.hpp @@ -16,8 +16,8 @@ namespace numpy { return asarray(std::forward<E>(e), d); } - } -} + } // namespace ndarray +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/fill.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/fill.hpp index f4690a3ffc..a69e1e84e3 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/fill.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/fill.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/ndarray/fill.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/builtins/None.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -27,8 +27,8 @@ namespace numpy std::fill(e.fbegin(), e.fend(), f); return builtins::None; } - } -} + } // namespace ndarray +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/flatten.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/flatten.hpp index 6e0afe6fb3..1c260db223 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/flatten.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/flatten.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/ndarray/flatten.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -21,8 +21,8 @@ namespace numpy } NUMPY_EXPR_TO_NDARRAY0_IMPL(flatten); - } -} + } // namespace ndarray +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/item.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/item.hpp index cb2ba3626b..e08caf0698 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/item.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/item.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/ndarray/item.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/numpy/asarray.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -24,7 +24,8 @@ namespace numpy } template <class E, size_t N> - auto item(E &&expr, types::array<long, N> const &i) -> decltype(expr[i]) + auto item(E &&expr, + types::array_tuple<long, N> const &i) -> decltype(expr[i]) { return expr[i]; } @@ -37,7 +38,7 @@ namespace numpy i += expr.flat_size(); return asarray(std::forward<E>(expr)).flat()[i]; } - } -} + } // namespace ndarray +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/reshape.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/reshape.hpp index b8b6cc68d3..9e0c29678d 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/reshape.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/reshape.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/ndarray/reshape.hpp" +#include "pythonic/builtins/ValueError.hpp" +#include "pythonic/types/ndarray.hpp" #include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_conversion.hpp" -#include "pythonic/types/ndarray.hpp" -#include "pythonic/builtins/ValueError.hpp" PYTHONIC_NS_BEGIN @@ -22,7 +22,7 @@ namespace numpy (void)std::initializer_list<bool>{ (i == Is && (sutils::assign(std::get<Is>(p), v), true))...}; } - } + } // namespace misc template <class T, class pS, class NpS> typename std::enable_if<!std::is_integral<NpS>::value, types::ndarray<T, NpS>>::type @@ -84,7 +84,7 @@ namespace numpy template <class T, class pS, class S0, class S1, class... S> auto reshape(types::ndarray<T, pS> const &expr, S0 i0, S1 i1, - S const &... indices) + S const &...indices) -> decltype(reshape(expr, types::pshape<S0, S1, S...>{i0, i1, indices...})) { @@ -92,8 +92,8 @@ namespace numpy } NUMPY_EXPR_TO_NDARRAY0_IMPL(reshape); - } -} + } // namespace ndarray +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tofile.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tofile.hpp index 8a10719f73..8c64f1cde1 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tofile.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tofile.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_NUMPY_NDARRAY_TOFILE_HPP #define PYTHONIC_NUMPY_NDARRAY_TOFILE_HPP -#include "pythonic/include/numpy/ndarray/tofile.hpp" #include "pythonic/builtins/FileNotFoundError.hpp" +#include "pythonic/include/numpy/ndarray/tofile.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/str.hpp" @@ -35,8 +35,8 @@ namespace numpy fs.write((char *)expr.buffer, sizeof(T) * expr.flat_size()); } NUMPY_EXPR_TO_NDARRAY0_IMPL(tofile); - } -} + } // namespace ndarray +} // namespace numpy PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tolist.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tolist.hpp index e7b07052f0..8731ca8754 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tolist.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tolist.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/ndarray/tolist.hpp" +#include "pythonic/types/ndarray.hpp" #include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_conversion.hpp" -#include "pythonic/types/ndarray.hpp" PYTHONIC_NS_BEGIN @@ -36,8 +36,8 @@ namespace numpy } NUMPY_EXPR_TO_NDARRAY0_IMPL(tolist); - } -} + } // namespace ndarray +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tostring.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tostring.hpp index bb04b615df..9b01099a71 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tostring.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tostring.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/ndarray/tostring.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/utils/numpy_conversion.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/str.hpp" +#include "pythonic/utils/functor.hpp" +#include "pythonic/utils/numpy_conversion.hpp" PYTHONIC_NS_BEGIN @@ -22,7 +22,7 @@ namespace numpy expr.flat_size() * sizeof(T)); } NUMPY_EXPR_TO_NDARRAY0_IMPL(tostring); - } -} + } // namespace ndarray +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndenumerate.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndenumerate.hpp index 150edfda89..5ef52f452c 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/ndenumerate.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/ndenumerate.hpp @@ -21,10 +21,10 @@ namespace numpy } template <class E> - std::tuple<types::array<long, E::value>, typename E::dtype> - ndenumerate_iterator<E>::operator*() const + std::tuple<types::array_tuple<long, E::value>, typename E::dtype> + ndenumerate_iterator<E>::operator*() const { - types::array<long, E::value> out; + types::array_tuple<long, E::value> out; auto shape = sutils::getshape(expr); long mult = 1; for (long j = E::value - 1; j > 0; j--) { @@ -32,8 +32,8 @@ namespace numpy mult *= shape[j]; } out[0] = index / mult; - return std::tuple<types::array<long, E::value>, typename E::dtype>{out, - *iter}; + return std::tuple<types::array_tuple<long, E::value>, typename E::dtype>{ + out, *iter}; } template <class E> @@ -51,22 +51,22 @@ namespace numpy } template <class E> - bool ndenumerate_iterator<E>:: - operator!=(ndenumerate_iterator<E> const &other) const + bool ndenumerate_iterator<E>::operator!=( + ndenumerate_iterator<E> const &other) const { return index != other.index; } template <class E> - bool ndenumerate_iterator<E>:: - operator<(ndenumerate_iterator<E> const &other) const + bool + ndenumerate_iterator<E>::operator<(ndenumerate_iterator<E> const &other) const { return index < other.index; } template <class E> - long ndenumerate_iterator<E>:: - operator-(ndenumerate_iterator<E> const &other) const + long + ndenumerate_iterator<E>::operator-(ndenumerate_iterator<E> const &other) const { return index - other.index; } @@ -109,7 +109,7 @@ namespace numpy } NUMPY_EXPR_TO_NDARRAY0_IMPL(ndenumerate); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndim.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndim.hpp index 1455284a57..34ddfb3d59 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/ndim.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/ndim.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/ndim.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -16,7 +16,7 @@ namespace numpy { return std::tuple_size<decltype(shape(e))>::value; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndindex.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndindex.hpp index 24010dc5b3..e32e6bab84 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/ndindex.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/ndindex.hpp @@ -17,16 +17,16 @@ namespace numpy } template <size_t N> - ndindex_iterator<N>::ndindex_iterator(types::array<long, N> const &shape, - long first) + ndindex_iterator<N>::ndindex_iterator( + types::array_tuple<long, N> const &shape, long first) : index(first), shape(shape) { } template <size_t N> - types::array<long, N> ndindex_iterator<N>::operator*() const + types::array_tuple<long, N> ndindex_iterator<N>::operator*() const { - types::array<long, N> out; + types::array_tuple<long, N> out; long mult = 1; for (long j = N - 1; j > 0; j--) { out[j] = (index / mult) % shape[j]; @@ -74,7 +74,7 @@ namespace numpy } template <size_t N> - _ndindex<N>::_ndindex(types::array<long, N> const &shape) + _ndindex<N>::_ndindex(types::array_tuple<long, N> const &shape) : ndindex_iterator<N>(shape, 0), shape(shape), end_iter(shape, std::accumulate(shape.begin(), shape.end(), 1L, std::multiplies<long>())) @@ -106,7 +106,7 @@ namespace numpy } template <size_t N> - _ndindex<N> ndindex(types::array<long, N> const &args) + _ndindex<N> ndindex(types::array_tuple<long, N> const &args) { return {args}; } @@ -115,7 +115,7 @@ namespace numpy { return {args}; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/negative.hpp b/contrib/python/pythran/pythran/pythonic/numpy/negative.hpp index bce0f54d22..f4aed3ff21 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/negative.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/negative.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/negative.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/operator_/neg.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic/operator_/neg.hpp" PYTHONIC_NS_BEGIN @@ -16,7 +16,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME negative #define NUMPY_NARY_FUNC_SYM pythonic::operator_::neg #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/nextafter.hpp b/contrib/python/pythran/pythran/pythonic/numpy/nextafter.hpp index cb2406107f..6dab2b00b5 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/nextafter.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/nextafter.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/nextafter.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME nextafter #define NUMPY_NARY_FUNC_SYM std::nextafter #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/nonzero.hpp b/contrib/python/pythran/pythran/pythonic/numpy/nonzero.hpp index 401b7ce6e2..5b22e8ba57 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/nonzero.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/nonzero.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/nonzero.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy namespace { template <class I, class O, size_t M> - void _nonzero(I begin, I end, O &out, types::array<long, M> &curr, + void _nonzero(I begin, I end, O &out, types::array_tuple<long, M> &curr, utils::int_<1>) { I start = begin; @@ -29,7 +29,7 @@ namespace numpy } template <class I, class O, size_t M, size_t N> - void _nonzero(I begin, I end, O &out, types::array<long, M> &curr, + void _nonzero(I begin, I end, O &out, types::array_tuple<long, M> &curr, utils::int_<N>) { I start = begin; @@ -39,10 +39,10 @@ namespace numpy utils::int_<N - 1>()); } } - } + } // namespace template <size_t... Is> - types::array<utils::shared_ref<types::raw_array<long>>, sizeof...(Is)> + types::array_tuple<utils::shared_ref<types::raw_array<long>>, sizeof...(Is)> init_buffers(long sz, utils::index_sequence<Is...>) { auto fwd = [](long ret, long) { return ret; }; // just to avoid a warning @@ -51,33 +51,35 @@ namespace numpy template <class E> auto nonzero(E const &expr) - -> types::array<types::ndarray<long, types::array<long, 1>>, E::value> + -> types::array_tuple<types::ndarray<long, types::array_tuple<long, 1>>, + E::value> { constexpr long N = E::value; - typedef types::array<types::ndarray<long, types::array<long, 1>>, E::value> + typedef types::array_tuple< + types::ndarray<long, types::array_tuple<long, 1>>, E::value> out_type; long sz = expr.flat_size(); - types::array<utils::shared_ref<types::raw_array<long>>, N> out_buffers = - init_buffers(sz, utils::make_index_sequence<N>()); - types::array<long *, N> out_iters; + types::array_tuple<utils::shared_ref<types::raw_array<long>>, N> + out_buffers = init_buffers(sz, utils::make_index_sequence<N>()); + types::array_tuple<long *, N> out_iters; for (size_t i = 0; i < N; ++i) out_iters[i] = out_buffers[i]->data; - types::array<long, N> indices; + types::array_tuple<long, N> indices; _nonzero(expr.begin(), expr.end(), out_iters, indices, utils::int_<N>()); - types::array<long, 1> shape = { + types::array_tuple<long, 1> shape = { {(long)(out_iters[0] - out_buffers[0]->data)}}; out_type out; for (size_t i = 0; i < N; ++i) - out[i] = types::ndarray<long, types::array<long, 1>>( + out[i] = types::ndarray<long, types::array_tuple<long, 1>>( std::move(out_buffers[i]), shape); return out; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/not_equal.hpp b/contrib/python/pythran/pythran/pythonic/numpy/not_equal.hpp index 27fafd6633..6ca0a4513a 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/not_equal.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/not_equal.hpp @@ -3,11 +3,11 @@ #include "pythonic/include/numpy/not_equal.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/operator_/ne.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic/operator_/ne.hpp" PYTHONIC_NS_BEGIN @@ -16,7 +16,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME not_equal #define NUMPY_NARY_FUNC_SYM pythonic::operator_::ne #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ones.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ones.hpp index e7db4e7c01..13a9410980 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/ones.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/ones.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/ones.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -12,8 +12,7 @@ namespace numpy { template <class dtype> - typename dtype::type - ones(std::tuple<> const &shape, dtype d) + typename dtype::type ones(std::tuple<> const &shape, dtype d) { return static_cast<typename dtype::type>(1); } @@ -39,7 +38,7 @@ namespace numpy { return ones(types::pshape<std::integral_constant<long, N>>({}), d); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ones_like.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ones_like.hpp index fff0667d25..b6070aa733 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/ones_like.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/ones_like.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/ones_like.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/numpy/ones.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -12,8 +12,8 @@ namespace numpy { template <class E, class dtype> - auto ones_like(E const &expr, dtype d) - -> decltype(ones(sutils::getshape(expr), d)) + auto ones_like(E const &expr, + dtype d) -> decltype(ones(sutils::getshape(expr), d)) { return ones(sutils::getshape(expr), d); } @@ -25,7 +25,7 @@ namespace numpy { return ones(sutils::getshape(expr), types::dtype_t<typename E::dtype>()); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/outer.hpp b/contrib/python/pythran/pythran/pythonic/numpy/outer.hpp index 53da26e133..99d9983bff 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/outer.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/outer.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/outer.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/builtins/None.hpp" #include "pythonic/numpy/asarray.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -19,8 +19,8 @@ namespace numpy { types::ndarray<decltype(std::declval<T0>() + std::declval<T1>()), types::pshape<long, long>> - out(types::pshape<long, long>{a.flat_size(), b.flat_size()}, - builtins::None); + out(types::pshape<long, long>{a.flat_size(), b.flat_size()}, + builtins::None); auto iter = out.fbegin(); for (auto iter_a = a.fbegin(), end_a = a.fend(); iter_a != end_a; ++iter_a) { @@ -32,26 +32,26 @@ namespace numpy } template <class T0, class pS0, class E1> - auto outer(types::ndarray<T0, pS0> const &a, E1 const &b) - -> decltype(outer(a, asarray(b))) + auto outer(types::ndarray<T0, pS0> const &a, + E1 const &b) -> decltype(outer(a, asarray(b))) { return outer(a, asarray(b)); } template <class E0, class T1, class pS1> - auto outer(E0 const &a, types::ndarray<T1, pS1> const &b) - -> decltype(outer(asarray(a), b)) + auto outer(E0 const &a, + types::ndarray<T1, pS1> const &b) -> decltype(outer(asarray(a), b)) { return outer(asarray(a), b); } template <class E0, class E1> - auto outer(E0 const &a, E1 const &b) - -> decltype(outer(asarray(a), asarray(b))) + auto outer(E0 const &a, + E1 const &b) -> decltype(outer(asarray(a), asarray(b))) { return outer(asarray(a), asarray(b)); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/partial_sum.hpp b/contrib/python/pythran/pythran/pythonic/numpy/partial_sum.hpp index baf029c0d1..2074d7ca0f 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/partial_sum.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/partial_sum.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/partial_sum.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/builtins/ValueError.hpp" +#include "pythonic/types/ndarray.hpp" PYTHONIC_NS_BEGIN @@ -70,7 +70,7 @@ namespace numpy return acc; } }; - } + } // namespace template <class Op, class E, class dtype> types::ndarray<typename dtype::type, types::pshape<long>> @@ -109,13 +109,13 @@ namespace numpy } else { std::transform( expr.begin(), expr.end(), the_partial_sum.begin(), - [axis, d]( - typename std::iterator_traits<typename E::iterator>::value_type + [axis, + d](typename std::iterator_traits<typename E::iterator>::value_type other) { return partial_sum<Op>(other, axis - 1, d); }); } return the_partial_sum; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/place.hpp b/contrib/python/pythran/pythran/pythonic/numpy/place.hpp index 5e21e7f8af..5cf1da62ca 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/place.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/place.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/place.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/builtins/None.hpp" #include "pythonic/numpy/asarray.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -45,7 +45,7 @@ namespace numpy { throw std::runtime_error("place only partially implemented"); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/power.hpp b/contrib/python/pythran/pythran/pythonic/numpy/power.hpp index b50a6c84a9..ef3c9e04bb 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/power.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/power.hpp @@ -15,7 +15,7 @@ namespace numpy // no need to adapt_type here, as it may turn a**2 into a**2.f #define NUMPY_NARY_RESHAPE_MODE reshape_type #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/prod.hpp b/contrib/python/pythran/pythran/pythonic/numpy/prod.hpp index 428c039daa..d6409da68f 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/prod.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/prod.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/prod.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/numpy/reduce.hpp" #include "pythonic/operator_/imul.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -13,12 +13,12 @@ namespace numpy { template <class... Args> - auto prod(Args &&... args) + auto prod(Args &&...args) -> decltype(reduce<operator_::functor::imul>(std::forward<Args>(args)...)) { return reduce<operator_::functor::imul>(std::forward<Args>(args)...); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ptp.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ptp.hpp index 572f7b2e23..5db6f7036f 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/ptp.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/ptp.hpp @@ -3,16 +3,16 @@ #include "pythonic/include/numpy/ptp.hpp" -#include "pythonic/numpy/min.hpp" #include "pythonic/numpy/max.hpp" +#include "pythonic/numpy/min.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class E> - auto ptp(E const &expr, long axis) - -> decltype(max(expr, axis) - min(expr, axis)) + auto ptp(E const &expr, + long axis) -> decltype(max(expr, axis) - min(expr, axis)) { return max(expr, axis) - min(expr, axis); } @@ -22,7 +22,7 @@ namespace numpy { return max(expr) - min(expr); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/put.hpp b/contrib/python/pythran/pythran/pythonic/numpy/put.hpp index 627c07992b..fc7b27d34a 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/put.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/put.hpp @@ -3,11 +3,11 @@ #include "pythonic/include/numpy/put.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" +#include "pythonic/builtins/ValueError.hpp" #include "pythonic/numpy/asarray.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_conversion.hpp" -#include "pythonic/builtins/ValueError.hpp" PYTHONIC_NS_BEGIN @@ -43,7 +43,7 @@ namespace numpy { throw std::runtime_error("put only partially implemented"); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/putmask.hpp b/contrib/python/pythran/pythran/pythonic/numpy/putmask.hpp index 1640cbed4a..8b9b9f14aa 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/putmask.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/putmask.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/putmask.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" -#include "pythonic/numpy/asarray.hpp" #include "pythonic/builtins/None.hpp" +#include "pythonic/numpy/asarray.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -31,7 +31,7 @@ namespace numpy { throw std::runtime_error("putmask only partially implemented"); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/rad2deg.hpp b/contrib/python/pythran/pythran/pythonic/numpy/rad2deg.hpp index 977848da0c..6eb74de1f8 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/rad2deg.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/rad2deg.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/numpy/rad2deg.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/numpy/pi.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic/numpy/pi.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME rad2deg #define NUMPY_NARY_FUNC_SYM wrapper::rad2deg #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/binomial.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/binomial.hpp index 5d9dbda7ca..b0b556bc11 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/binomial.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/binomial.hpp @@ -38,9 +38,9 @@ namespace numpy } inline auto binomial(double n, double p, long size) - -> decltype(binomial(n, p, types::array<long, 1>{{size}})) + -> decltype(binomial(n, p, types::array_tuple<long, 1>{{size}})) { - return binomial(n, p, types::array<long, 1>{{size}}); + return binomial(n, p, types::array_tuple<long, 1>{{size}}); } inline long binomial(double n, double p, types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/chisquare.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/chisquare.hpp index d66fd816ab..b2292f93bd 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/chisquare.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/chisquare.hpp @@ -29,10 +29,10 @@ namespace numpy } inline auto chisquare(double df, long size) - -> decltype(chisquare(df, types::array<long, 1>{{size}})) + -> decltype(chisquare(df, types::array_tuple<long, 1>{{size}})) { - return chisquare(df, types::array<long, 1>{{size}}); + return chisquare(df, types::array_tuple<long, 1>{{size}}); } inline double chisquare(double df, types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/choice.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/choice.hpp index 680789cde0..1027cd8113 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/choice.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/choice.hpp @@ -46,8 +46,8 @@ namespace numpy } template <class T> - auto choice(long max, T &&size) - -> decltype(randint(0, max, std::forward<T>(size))) + auto choice(long max, + T &&size) -> decltype(randint(0, max, std::forward<T>(size))) { return randint(0, max, std::forward<T>(size)); } diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/dirichlet.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/dirichlet.hpp index 0eea6cf827..dcebd4199f 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/dirichlet.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/dirichlet.hpp @@ -29,10 +29,10 @@ namespace numpy } inline auto dirichlet(double alpha, long size) - -> decltype(dirichlet(alpha, types::array<long, 1>{{size}})) + -> decltype(dirichlet(alpha, types::array_tuple<long, 1>{{size}})) { - return dirichlet(alpha, types::array<long, 1>{{size}}); + return dirichlet(alpha, types::array_tuple<long, 1>{{size}}); } inline double dirichlet(double alpha, types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/exponential.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/exponential.hpp index 37d2d019d1..ae3abd473f 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/exponential.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/exponential.hpp @@ -29,10 +29,10 @@ namespace numpy } inline auto exponential(double scale, long size) - -> decltype(exponential(scale, types::array<long, 1>{{size}})) + -> decltype(exponential(scale, types::array_tuple<long, 1>{{size}})) { - return exponential(scale, types::array<long, 1>{{size}}); + return exponential(scale, types::array_tuple<long, 1>{{size}}); } inline double exponential(double scale, types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/f.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/f.hpp index fbc4322856..d6dcf1bcd5 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/f.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/f.hpp @@ -31,10 +31,11 @@ namespace numpy return result; } - inline auto f(double dfnum, double dfden, long size) - -> decltype(f(dfnum, dfden, types::array<long, 1>{{size}})) + inline auto f(double dfnum, double dfden, + long size) -> decltype(f(dfnum, dfden, + types::array_tuple<long, 1>{{size}})) { - return f(dfnum, dfden, types::array<long, 1>{{size}}); + return f(dfnum, dfden, types::array_tuple<long, 1>{{size}}); } inline double f(double dfnum, double dfden, types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/gamma.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/gamma.hpp index 55bbe5a7a2..9d6cc1fb83 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/gamma.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/gamma.hpp @@ -30,9 +30,9 @@ namespace numpy } inline auto gamma(double shape, double scale, long size) - -> decltype(gamma(shape, scale, types::array<long, 1>{{size}})) + -> decltype(gamma(shape, scale, types::array_tuple<long, 1>{{size}})) { - return gamma(shape, scale, types::array<long, 1>{{size}}); + return gamma(shape, scale, types::array_tuple<long, 1>{{size}}); } inline double gamma(double shape, double scale, types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/geometric.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/geometric.hpp index b1f661f86e..fffb8ce8e9 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/geometric.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/geometric.hpp @@ -29,9 +29,9 @@ namespace numpy } inline auto geometric(double p, long size) - -> decltype(geometric(p, types::array<long, 1>{{size}})) + -> decltype(geometric(p, types::array_tuple<long, 1>{{size}})) { - return geometric(p, types::array<long, 1>{{size}}); + return geometric(p, types::array_tuple<long, 1>{{size}}); } inline double geometric(double p, types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/gumbel.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/gumbel.hpp index d74adeb349..666c6906f9 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/gumbel.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/gumbel.hpp @@ -28,9 +28,9 @@ namespace numpy } inline auto gumbel(double loc, double scale, long size) - -> decltype(gumbel(loc, scale, types::array<long, 1>{{size}})) + -> decltype(gumbel(loc, scale, types::array_tuple<long, 1>{{size}})) { - return gumbel(loc, scale, types::array<long, 1>{{size}}); + return gumbel(loc, scale, types::array_tuple<long, 1>{{size}}); } inline double gumbel(double loc, double scale, types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/laplace.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/laplace.hpp index ce2eac46f0..a000332971 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/laplace.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/laplace.hpp @@ -29,9 +29,9 @@ namespace numpy } inline auto laplace(double loc, double scale, long size) - -> decltype(laplace(loc, scale, types::array<long, 1>{{size}})) + -> decltype(laplace(loc, scale, types::array_tuple<long, 1>{{size}})) { - return laplace(loc, scale, types::array<long, 1>{{size}}); + return laplace(loc, scale, types::array_tuple<long, 1>{{size}}); } inline double laplace(double loc, double scale, types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/logistic.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/logistic.hpp index 6537964c3f..bb9cbb4e66 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/logistic.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/logistic.hpp @@ -29,9 +29,9 @@ namespace numpy } inline auto logistic(double loc, double scale, long size) - -> decltype(logistic(loc, scale, types::array<long, 1>{{size}})) + -> decltype(logistic(loc, scale, types::array_tuple<long, 1>{{size}})) { - return logistic(loc, scale, types::array<long, 1>{{size}}); + return logistic(loc, scale, types::array_tuple<long, 1>{{size}}); } inline double logistic(double loc, double scale, types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/lognormal.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/lognormal.hpp index 91d2843b1d..be6b570571 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/lognormal.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/lognormal.hpp @@ -30,9 +30,9 @@ namespace numpy } inline auto lognormal(double mean, double sigma, long size) - -> decltype(lognormal(mean, sigma, types::array<long, 1>{{size}})) + -> decltype(lognormal(mean, sigma, types::array_tuple<long, 1>{{size}})) { - return lognormal(mean, sigma, types::array<long, 1>{{size}}); + return lognormal(mean, sigma, types::array_tuple<long, 1>{{size}}); } inline double lognormal(double mean, double sigma, types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/logseries.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/logseries.hpp index c99fb95a63..89bf6d377b 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/logseries.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/logseries.hpp @@ -29,9 +29,9 @@ namespace numpy } inline auto logseries(double p, long size) - -> decltype(logseries(p, types::array<long, 1>{{size}})) + -> decltype(logseries(p, types::array_tuple<long, 1>{{size}})) { - return logseries(p, types::array<long, 1>{{size}}); + return logseries(p, types::array_tuple<long, 1>{{size}}); } inline double logseries(double p, types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/negative_binomial.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/negative_binomial.hpp index 3f015f3f5d..1e09660f81 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/negative_binomial.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/negative_binomial.hpp @@ -30,9 +30,10 @@ namespace numpy } inline auto negative_binomial(long n, double p, long size) - -> decltype(negative_binomial(n, p, types::array<long, 1>{{size}})) + -> decltype(negative_binomial(n, p, + types::array_tuple<long, 1>{{size}})) { - return negative_binomial(n, p, types::array<long, 1>{{size}}); + return negative_binomial(n, p, types::array_tuple<long, 1>{{size}}); } inline long negative_binomial(long n, double p, types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/normal.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/normal.hpp index 3c755d1432..962ec6c5e4 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/normal.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/normal.hpp @@ -29,9 +29,9 @@ namespace numpy } inline auto normal(double loc, double scale, long size) - -> decltype(normal(loc, scale, types::array<long, 1>{{size}})) + -> decltype(normal(loc, scale, types::array_tuple<long, 1>{{size}})) { - return normal(loc, scale, types::array<long, 1>{{size}}); + return normal(loc, scale, types::array_tuple<long, 1>{{size}}); } inline double normal(double loc, double scale, types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/pareto.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/pareto.hpp index 3cd7349d37..8900b2a5c5 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/pareto.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/pareto.hpp @@ -30,10 +30,10 @@ namespace numpy } inline auto pareto(double a, long size) - -> decltype(pareto(a, types::array<long, 1>{{size}})) + -> decltype(pareto(a, types::array_tuple<long, 1>{{size}})) { - return pareto(a, types::array<long, 1>{{size}}); + return pareto(a, types::array_tuple<long, 1>{{size}}); } inline double pareto(double a, types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/poisson.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/poisson.hpp index 27249929bd..d52671aa6b 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/poisson.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/poisson.hpp @@ -29,9 +29,9 @@ namespace numpy } inline auto poisson(double lam, long size) - -> decltype(poisson(lam, types::array<long, 1>{{size}})) + -> decltype(poisson(lam, types::array_tuple<long, 1>{{size}})) { - return poisson(lam, types::array<long, 1>{{size}}); + return poisson(lam, types::array_tuple<long, 1>{{size}}); } inline double poisson(double lam, types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/power.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/power.hpp index 8178ff4f96..36db5bcdd4 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/power.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/power.hpp @@ -29,9 +29,9 @@ namespace numpy } inline auto power(double a, long size) - -> decltype(power(a, types::array<long, 1>{{size}})) + -> decltype(power(a, types::array_tuple<long, 1>{{size}})) { - return power(a, types::array<long, 1>{{size}}); + return power(a, types::array_tuple<long, 1>{{size}}); } inline double power(double a, types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/rand.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/rand.hpp index 234e32f31a..677fd5e6ff 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/rand.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/rand.hpp @@ -15,9 +15,10 @@ namespace numpy { template <class... T> - types::ndarray<double, types::array<long, sizeof...(T)>> rand(T... shape) + types::ndarray<double, types::array_tuple<long, sizeof...(T)>> + rand(T... shape) { - return random(types::array<long, sizeof...(T)>{{shape...}}); + return random(types::array_tuple<long, sizeof...(T)>{{shape...}}); } inline double rand() diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/randint.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/randint.hpp index bed34f861c..9911415453 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/randint.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/randint.hpp @@ -37,16 +37,16 @@ namespace numpy } template <class pS> - auto randint(long max, types::none_type, pS const &shape) - -> decltype(randint(0, max, shape)) + auto randint(long max, types::none_type, + pS const &shape) -> decltype(randint(0, max, shape)) { return randint(0, max, shape); } inline auto randint(long min, long max, long size) - -> decltype(randint(min, max, types::array<long, 1>{{size}})) + -> decltype(randint(min, max, types::array_tuple<long, 1>{{size}})) { - return randint(min, max, types::array<long, 1>{{size}}); + return randint(min, max, types::array_tuple<long, 1>{{size}}); } inline long randint(long max, types::none_type) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/randn.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/randn.hpp index 75198a9c51..c732058fd3 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/randn.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/randn.hpp @@ -15,9 +15,11 @@ namespace numpy { template <class... T> - types::ndarray<double, types::array<long, sizeof...(T)>> randn(T... shape) + types::ndarray<double, types::array_tuple<long, sizeof...(T)>> + randn(T... shape) { - return standard_normal(types::array<long, sizeof...(T)>{{shape...}}); + return standard_normal( + types::array_tuple<long, sizeof...(T)>{{shape...}}); } inline double randn() diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/random.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/random.hpp index 6c131c10f7..7bd6e85e9e 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/random.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/random.hpp @@ -28,10 +28,10 @@ namespace numpy return result; } - inline auto random(long size) - -> decltype(random(types::array<long, 1>{{size}})) + inline auto + random(long size) -> decltype(random(types::array_tuple<long, 1>{{size}})) { - return random(types::array<long, 1>{{size}}); + return random(types::array_tuple<long, 1>{{size}}); } inline double random(types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/rayleigh.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/rayleigh.hpp index c8f5d44a89..659d2d66d7 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/rayleigh.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/rayleigh.hpp @@ -29,9 +29,9 @@ namespace numpy } inline auto rayleigh(double scale, long size) - -> decltype(rayleigh(scale, types::array<long, 1>{{size}})) + -> decltype(rayleigh(scale, types::array_tuple<long, 1>{{size}})) { - return rayleigh(scale, types::array<long, 1>{{size}}); + return rayleigh(scale, types::array_tuple<long, 1>{{size}}); } inline double rayleigh(double scale, types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/shuffle.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/shuffle.hpp index 13e1451b82..e42200ef61 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/shuffle.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/shuffle.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/random/shuffle.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/builtins/None.hpp" +#include "pythonic/types/ndarray.hpp" PYTHONIC_NS_BEGIN @@ -18,8 +18,8 @@ namespace numpy std::shuffle(seq.begin(), seq.end(), details::generator); return builtins::None; } - } -} + } // namespace random +} // namespace numpy PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/standard_exponential.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/standard_exponential.hpp index f7c57b4dca..7aa72c55b4 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/standard_exponential.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/standard_exponential.hpp @@ -26,9 +26,9 @@ namespace numpy } inline auto standard_exponential(long size) - -> decltype(standard_exponential(types::array<long, 1>{{size}})) + -> decltype(standard_exponential(types::array_tuple<long, 1>{{size}})) { - return standard_exponential(types::array<long, 1>{{size}}); + return standard_exponential(types::array_tuple<long, 1>{{size}}); } inline double standard_exponential(types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/standard_gamma.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/standard_gamma.hpp index 8deed136a9..ffe82446db 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/standard_gamma.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/standard_gamma.hpp @@ -26,9 +26,9 @@ namespace numpy } inline auto standard_gamma(double s, long size) - -> decltype(standard_gamma(s, types::array<long, 1>{{size}})) + -> decltype(standard_gamma(s, types::array_tuple<long, 1>{{size}})) { - return standard_gamma(s, types::array<long, 1>{{size}}); + return standard_gamma(s, types::array_tuple<long, 1>{{size}}); } inline double standard_gamma(double s, types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/standard_normal.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/standard_normal.hpp index fb7b40712e..3b983ffae1 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/standard_normal.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/standard_normal.hpp @@ -26,9 +26,9 @@ namespace numpy } inline auto standard_normal(long size) - -> decltype(standard_normal(types::array<long, 1>{{size}})) + -> decltype(standard_normal(types::array_tuple<long, 1>{{size}})) { - return standard_normal(types::array<long, 1>{{size}}); + return standard_normal(types::array_tuple<long, 1>{{size}}); } inline double standard_normal(types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/uniform.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/uniform.hpp index cedfd74eca..29df0df1b5 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/uniform.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/uniform.hpp @@ -30,9 +30,9 @@ namespace numpy } inline auto uniform(double low, double high, long size) - -> decltype(uniform(low, high, types::array<long, 1>{{size}})) + -> decltype(uniform(low, high, types::array_tuple<long, 1>{{size}})) { - return uniform(low, high, types::array<long, 1>{{size}}); + return uniform(low, high, types::array_tuple<long, 1>{{size}}); } inline double uniform(double low, double high, types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/weibull.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/weibull.hpp index ee5b603032..2a78f0fe0d 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/random/weibull.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/random/weibull.hpp @@ -29,10 +29,10 @@ namespace numpy } inline auto weibull(double a, long size) - -> decltype(weibull(a, types::array<long, 1>{{size}})) + -> decltype(weibull(a, types::array_tuple<long, 1>{{size}})) { - return weibull(a, types::array<long, 1>{{size}}); + return weibull(a, types::array_tuple<long, 1>{{size}}); } inline double weibull(double a, types::none_type d) diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ravel.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ravel.hpp index ae5b256f54..f8257fa399 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/ravel.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/ravel.hpp @@ -18,7 +18,7 @@ namespace numpy } NUMPY_EXPR_TO_NDARRAY0_IMPL(ravel); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/real.hpp b/contrib/python/pythran/pythran/pythonic/numpy/real.hpp index afa77bf773..28a4143ff8 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/real.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/real.hpp @@ -3,18 +3,18 @@ #include "pythonic/include/numpy/real.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/numpy/asarray.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/types/list.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class E> - auto real(E &&expr) - -> decltype(builtins::getattr(types::attr::REAL{}, std::forward<E>(expr))) + auto real(E &&expr) -> decltype(builtins::getattr(types::attr::REAL{}, + std::forward<E>(expr))) { return builtins::getattr(types::attr::REAL{}, std::forward<E>(expr)); } @@ -25,7 +25,7 @@ namespace numpy { return real(numpy::functor::asarray{}(expr)); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/reciprocal.hpp b/contrib/python/pythran/pythran/pythonic/numpy/reciprocal.hpp index 8d2286fc26..62c8b883b4 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/reciprocal.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/reciprocal.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/reciprocal.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME reciprocal #define NUMPY_NARY_FUNC_SYM wrapper::reciprocal #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/reduce.hpp b/contrib/python/pythran/pythran/pythonic/numpy/reduce.hpp index a42f3bc332..e1b2588f14 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/reduce.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/reduce.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/reduce.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/builtins/None.hpp" #include "pythonic/builtins/ValueError.hpp" +#include "pythonic/types/ndarray.hpp" #include "pythonic/utils/neutral.hpp" #ifdef USE_XSIMD @@ -277,7 +277,7 @@ namespace numpy axis += E::value; if (axis < 0 || size_t(axis) >= E::value) throw types::ValueError("axis out of bounds"); - types::array<long, E::value - 1> shp; + types::array_tuple<long, E::value - 1> shp; auto tmp = sutils::getshape(array); auto next = std::copy(tmp.begin(), tmp.begin() + axis, shp.begin()); std::copy(tmp.begin() + axis + 1, tmp.end(), next); @@ -315,7 +315,7 @@ namespace numpy } } } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/remainder.hpp b/contrib/python/pythran/pythran/pythonic/numpy/remainder.hpp index cd7e8b683c..ddb1e6e750 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/remainder.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/remainder.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/remainder.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME remainder #define NUMPY_NARY_FUNC_SYM wrapper::remainder #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/repeat.hpp b/contrib/python/pythran/pythran/pythonic/numpy/repeat.hpp index 5ea1085dac..a7acb2d906 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/repeat.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/repeat.hpp @@ -3,17 +3,17 @@ #include "pythonic/include/numpy/repeat.hpp" +#include "pythonic/builtins/None.hpp" +#include "pythonic/types/ndarray.hpp" #include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_conversion.hpp" -#include "pythonic/types/ndarray.hpp" -#include "pythonic/builtins/None.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> repeat(types::ndarray<T, pS> const &expr, long repeats, long axis) { constexpr auto N = std::tuple_size<pS>::value; @@ -25,7 +25,7 @@ namespace numpy 1L, std::multiplies<long>()); shape[axis] *= repeats; - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> out( + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> out( shape, builtins::None); auto out_iter = out.fbegin(); for (auto iter = expr.fbegin(), end = expr.fend(); iter != end; @@ -48,7 +48,7 @@ namespace numpy } NUMPY_EXPR_TO_NDARRAY0_IMPL(repeat); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/resize.hpp b/contrib/python/pythran/pythran/pythonic/numpy/resize.hpp index 2a247c516b..31c41e2bd8 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/resize.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/resize.hpp @@ -3,7 +3,7 @@ #include "pythonic/include/numpy/resize.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/numpy/ndarray/reshape.hpp" +#include "pythonic/utils/functor.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/right_shift.hpp b/contrib/python/pythran/pythran/pythonic/numpy/right_shift.hpp index bf81419626..554e80de7d 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/right_shift.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/right_shift.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/right_shift.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" #include "pythonic/operator_/rshift.hpp" @@ -17,7 +17,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME right_shift #define NUMPY_NARY_FUNC_SYM operator_::rshift #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/rint.hpp b/contrib/python/pythran/pythran/pythonic/numpy/rint.hpp index 8fe7e61350..b85810c9b5 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/rint.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/rint.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/rint.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -23,11 +23,11 @@ namespace numpy { return {std::nearbyint(v.real()), std::nearbyint(v.imag())}; } - } + } // namespace wrapper #define NUMPY_NARY_FUNC_NAME rint #define NUMPY_NARY_FUNC_SYM wrapper::rint #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/roll.hpp b/contrib/python/pythran/pythran/pythonic/numpy/roll.hpp index ef9d71e358..a17d1db88d 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/roll.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/roll.hpp @@ -32,7 +32,7 @@ namespace numpy { template <class To, class From, size_t N> To _roll(To to, From from, long shift, long axis, - types::array<long, N> const &shape, utils::int_<N - 1>) + types::array_tuple<long, N> const &shape, utils::int_<N - 1>) { long dim = shape[N - 1]; if (axis == N - 1) { @@ -47,7 +47,7 @@ namespace numpy template <class To, class From, size_t N, size_t M> typename std::enable_if<M != N - 1, To>::type _roll(To to, From from, long shift, long axis, - types::array<long, N> const &shape, utils::int_<M>) + types::array_tuple<long, N> const &shape, utils::int_<M>) { long dim = shape[M]; long offset = std::accumulate(shape.begin() + M + 1, shape.end(), 1L, @@ -90,7 +90,7 @@ namespace numpy { template <class To, class From, size_t N> To _rolls(To to, From from, long shifts[N], - types::array<long, N> const &shape, utils::int_<N - 1>) + types::array_tuple<long, N> const &shape, utils::int_<N - 1>) { long dim = shape[N - 1]; if (long shift = shifts[N - 1]) { @@ -104,8 +104,8 @@ namespace numpy template <class To, class From, size_t N, size_t M> typename std::enable_if<M != N - 1, To>::type - _rolls(To to, From from, long shifts[N], types::array<long, N> const &shape, - utils::int_<M>) + _rolls(To to, From from, long shifts[N], + types::array_tuple<long, N> const &shape, utils::int_<M>) { long dim = shape[M]; long offset = std::accumulate(shape.begin() + M + 1, shape.end(), 1L, @@ -128,8 +128,8 @@ namespace numpy template <class T, class pS, size_t N> types::ndarray<T, pS> roll(types::ndarray<T, pS> const &expr, - types::array<long, N> shifts, - types::array<long, N> axes) + types::array_tuple<long, N> shifts, + types::array_tuple<long, N> axes) { constexpr long ndim = types::ndarray<T, pS>::value; auto expr_shape = sutils::array(expr._shape); diff --git a/contrib/python/pythran/pythran/pythonic/numpy/rollaxis.hpp b/contrib/python/pythran/pythran/pythonic/numpy/rollaxis.hpp index 3c034b0e1b..63da505b58 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/rollaxis.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/rollaxis.hpp @@ -3,15 +3,15 @@ #include "pythonic/include/numpy/rollaxis.hpp" -#include "pythonic/numpy/transpose.hpp" #include "pythonic/numpy/copy.hpp" +#include "pythonic/numpy/transpose.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> rollaxis(types::ndarray<T, pS> const &a, long axis, long start) { long constexpr N = std::tuple_size<pS>::value; @@ -37,7 +37,7 @@ namespace numpy } NUMPY_EXPR_TO_NDARRAY0_IMPL(rollaxis); -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/rot90.hpp b/contrib/python/pythran/pythran/pythonic/numpy/rot90.hpp index 584ed5229c..6650d2d14a 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/rot90.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/rot90.hpp @@ -3,26 +3,26 @@ #include "pythonic/include/numpy/rot90.hpp" +#include "pythonic/numpy/copy.hpp" +#include "pythonic/types/ndarray.hpp" #include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_conversion.hpp" -#include "pythonic/types/ndarray.hpp" -#include "pythonic/numpy/copy.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> rot90(types::ndarray<T, pS> const &expr, int k) { auto constexpr N = std::tuple_size<pS>::value; if (k % 4 == 0) return copy(expr); - types::array<long, N> shape = sutils::getshape(expr); + types::array_tuple<long, N> shape = sutils::getshape(expr); if (k % 4 != 2) std::swap(shape[0], shape[1]); - types::ndarray<T, types::array<long, N>> out(shape, builtins::None); + types::ndarray<T, types::array_tuple<long, N>> out(shape, builtins::None); if (k % 4 == 1) { for (int i = 0; i < shape[1]; ++i) for (int j = 0; j < shape[0]; ++j) @@ -40,7 +40,7 @@ namespace numpy } NUMPY_EXPR_TO_NDARRAY0_IMPL(rot90) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/searchsorted.hpp b/contrib/python/pythran/pythran/pythonic/numpy/searchsorted.hpp index 3346ca06ce..fc88ab0f1b 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/searchsorted.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/searchsorted.hpp @@ -3,14 +3,14 @@ #include "pythonic/include/numpy/searchsorted.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/utils/numpy_conversion.hpp" -#include "pythonic/utils/int_.hpp" -#include "pythonic/types/ndarray.hpp" -#include "pythonic/types/str.hpp" #include "pythonic/builtins/None.hpp" #include "pythonic/builtins/ValueError.hpp" #include "pythonic/numpy/asarray.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/types/str.hpp" +#include "pythonic/utils/functor.hpp" +#include "pythonic/utils/int_.hpp" +#include "pythonic/utils/numpy_conversion.hpp" #include <algorithm> @@ -39,7 +39,7 @@ namespace numpy throw types::ValueError("'" + side + "' is an invalid value for keyword 'side'"); } - } + } // namespace details template <class T, class U> typename std::enable_if<!types::is_numexpr_arg<T>::value, long>::type @@ -67,25 +67,25 @@ namespace numpy _search_sorted(a, (*ibegin).begin(), (*ibegin).end(), (*obegin).begin(), left, utils::int_<N - 1>()); } - } + } // namespace template <class E, class T> typename std::enable_if< types::is_numexpr_arg<E>::value, - types::ndarray<long, types::array<long, E::value>>>::type + types::ndarray<long, types::array_tuple<long, E::value>>>::type searchsorted(T const &a, E const &v, types::str const &side) { static_assert(T::value == 1, "Not Implemented : searchsorted for dimension != 1"); bool left = details::issearchsortedleft(side); - types::ndarray<long, types::array<long, E::value>> out(asarray(v)._shape, - builtins::None); + types::ndarray<long, types::array_tuple<long, E::value>> out( + asarray(v)._shape, builtins::None); _search_sorted(a, v.begin(), v.end(), out.begin(), left, utils::int_<E::value>()); return out; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/select.hpp b/contrib/python/pythran/pythran/pythonic/numpy/select.hpp index 0d76091acd..3b00ce46ef 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/select.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/select.hpp @@ -44,17 +44,17 @@ namespace numpy utils::int_<N - 1>()); return size; } - } + } // namespace template <class C, class L> - types::ndarray<typename L::dtype, types::array<long, L::value - 1>> + types::ndarray<typename L::dtype, types::array_tuple<long, L::value - 1>> select(C const &condlist, L const &choicelist, typename L::dtype _default) { constexpr size_t N = L::value - 1; auto &&choicelist0_shape = sutils::getshape(choicelist[0]); - types::ndarray<typename L::dtype, types::array<long, N>> out( + types::ndarray<typename L::dtype, types::array_tuple<long, N>> out( choicelist0_shape, _default); - types::ndarray<typename L::dtype, types::array<long, N>> selected( + types::ndarray<typename L::dtype, types::array_tuple<long, N>> selected( choicelist0_shape, false); long size = selected.flat_size(); for (long i = 0; i < condlist.size() && size != 0; i++) @@ -117,7 +117,7 @@ namespace numpy { return select_helper(condlist, choicelist, _default); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/shape.hpp b/contrib/python/pythran/pythran/pythonic/numpy/shape.hpp index 630e53aa22..e4e73f7504 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/shape.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/shape.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/shape.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -22,7 +22,7 @@ namespace numpy { return sutils::getshape(e); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/sin.hpp b/contrib/python/pythran/pythran/pythonic/numpy/sin.hpp index 2034ed5248..00930fb9c5 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/sin.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/sin.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/sin.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME sin #define NUMPY_NARY_FUNC_SYM xsimd::sin #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/sinh.hpp b/contrib/python/pythran/pythran/pythonic/numpy/sinh.hpp index be22034ec8..c38c5833f7 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/sinh.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/sinh.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/sinh.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME sinh #define NUMPY_NARY_FUNC_SYM xsimd::sinh #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/size.hpp b/contrib/python/pythran/pythran/pythonic/numpy/size.hpp index 813bc257e3..88e288828e 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/size.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/size.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/size.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -16,7 +16,7 @@ namespace numpy { return e.flat_size(); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/sort.hpp b/contrib/python/pythran/pythran/pythonic/numpy/sort.hpp index 2f0a58b603..1fb91dccdc 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/sort.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/sort.hpp @@ -9,7 +9,7 @@ namespace numpy { template <class E> - types::ndarray<typename E::dtype, types::array<long, E::value>> + types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> sort(E const &expr, long axis) { auto out = functor::array{}(expr); @@ -18,7 +18,7 @@ namespace numpy } template <class E> - types::ndarray<typename E::dtype, types::array<long, 1>> + types::ndarray<typename E::dtype, types::array_tuple<long, 1>> sort(E const &expr, types::none_type) { auto out = functor::array{}(expr).flat(); @@ -27,14 +27,14 @@ namespace numpy } template <class E> - types::ndarray<typename E::dtype, types::array<long, E::value>> + types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> sort(E const &expr, long axis, types::str const &kind) { auto out = functor::array{}(expr); ndarray::sort(out, axis, kind); return out; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/sort_complex.hpp b/contrib/python/pythran/pythran/pythonic/numpy/sort_complex.hpp index 3bb53b2837..ad737e4cb7 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/sort_complex.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/sort_complex.hpp @@ -3,7 +3,7 @@ #include "pythonic/include/numpy/sort_complex.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/numpy/sort.hpp" +#include "pythonic/utils/functor.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/spacing.hpp b/contrib/python/pythran/pythran/pythonic/numpy/spacing.hpp index 11bb465f6a..064298d18a 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/spacing.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/spacing.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/spacing.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME spacing #define NUMPY_NARY_FUNC_SYM wrapper::spacing #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/split.hpp b/contrib/python/pythran/pythran/pythonic/numpy/split.hpp index 03436e9d7d..9e22cef39d 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/split.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/split.hpp @@ -3,15 +3,16 @@ #include "pythonic/include/numpy/split.hpp" -#include "pythonic/numpy/array_split.hpp" #include "pythonic/builtins/ValueError.hpp" +#include "pythonic/numpy/array_split.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class T, class pS> - types::list<types::ndarray<T, types::array<long, std::tuple_size<pS>::value>>> + types::list< + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>> split(types::ndarray<T, pS> const &a, long nb_split) { if (a.flat_size() % nb_split != 0) @@ -23,19 +24,20 @@ namespace numpy typename std::enable_if< types::is_iterable<I>::value, types::list<types::ndarray< - T, types::array<long, std::tuple_size<pS>::value>>>>::type + T, types::array_tuple<long, std::tuple_size<pS>::value>>>>::type split(types::ndarray<T, pS> const &a, I const &split_mask) { return array_split(a, split_mask); } template <class E, class I> - types::list<types::ndarray<typename E::dtype, types::array<long, E::value>>> + types::list< + types::ndarray<typename E::dtype, types::array_tuple<long, E::value>>> split(E const &a, I const &) { throw std::runtime_error("split only partially implemented"); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/sqrt.hpp b/contrib/python/pythran/pythran/pythonic/numpy/sqrt.hpp index fc22aac4d6..86e5c90695 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/sqrt.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/sqrt.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/sqrt.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME sqrt #define NUMPY_NARY_FUNC_SYM xsimd::sqrt #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/square.hpp b/contrib/python/pythran/pythran/pythonic/numpy/square.hpp index 1fd8c68a2b..d166285e82 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/square.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/square.hpp @@ -4,8 +4,8 @@ #include "pythonic/include/numpy/square.hpp" #include "pythonic/types/numpy_op_helper.hpp" -#include "pythonic/utils/numpy_traits.hpp" #include "pythonic/utils/functor.hpp" +#include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME square #define NUMPY_NARY_FUNC_SYM wrapper::square #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/stack.hpp b/contrib/python/pythran/pythran/pythonic/numpy/stack.hpp index f5a6b96856..2d5de6b709 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/stack.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/stack.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_NUMPY_STACK_HPP #define PYTHONIC_NUMPY_STACK_HPP -#include "pythonic/builtins/len.hpp" #include "pythonic/builtins/ValueError.hpp" +#include "pythonic/builtins/len.hpp" #include <pythonic/include/numpy/stack.hpp> #include <pythonic/numpy/concatenate.hpp> @@ -13,17 +13,18 @@ namespace numpy template <class ArraySequence> types::ndarray<typename ArraySequence::value_type::dtype, - types::array<long, ArraySequence::value_type::value + 1>> + types::array_tuple<long, ArraySequence::value_type::value + 1>> stack(ArraySequence const &args, long axis) { if (builtins::len(args) == 0) throw pythonic::types::ValueError("need at least one array to stack"); auto shape = sutils::getshape(args[0]); - constexpr long N = std::tuple_size<decltype( - shape)>::value; // The length of the shape array. + constexpr long N = + std::tuple_size<decltype(shape)>::value; // The length of the shape + // array. auto values = sutils::array( shape); // You can't do shape[i] but you can do shape.array()[i] - types::array<long, N + 1> + types::array_tuple<long, N + 1> new_shape; // A new array that's 1 element longer than shape. // Insert a "0" at the position indicated by axis. for (long i = 0; i < N + 1; i++) { @@ -38,7 +39,8 @@ namespace numpy // Create a new empty list. types::list<types::ndarray< typename ArraySequence::value_type::dtype, - types::array<long, ArraySequence::value_type::value + 1>>> bi(0); + types::array_tuple<long, ArraySequence::value_type::value + 1>>> + bi(0); // Push the resized arrays into the list. for (auto &&arg : args) { bi.push_back(arg.reshape(new_shape)); @@ -47,26 +49,29 @@ namespace numpy return concatenate(bi, axis); } template <size_t... Is, class... Tys> - types::ndarray<typename details::stack_helper_t<Tys...>::dtype, - types::array<long, details::stack_helper_t<Tys...>::value + 1>> + types::ndarray< + typename details::stack_helper_t<Tys...>::dtype, + types::array_tuple<long, details::stack_helper_t<Tys...>::value + 1>> stack(std::tuple<Tys...> const &args, long axis, utils::index_sequence<Is...>) { - types::array< + types::array_tuple< types::ndarray< typename details::stack_helper_t<Tys...>::dtype, - types::array<long, details::stack_helper_t<Tys...>::value>>, - sizeof...(Tys)> vargs{{std::get<Is>(args)...}}; + types::array_tuple<long, details::stack_helper_t<Tys...>::value>>, + sizeof...(Tys)> + vargs{{std::get<Is>(args)...}}; return stack(vargs, axis); } template <class... Tys> - types::ndarray<typename details::stack_helper_t<Tys...>::dtype, - types::array<long, details::stack_helper_t<Tys...>::value + 1>> + types::ndarray< + typename details::stack_helper_t<Tys...>::dtype, + types::array_tuple<long, details::stack_helper_t<Tys...>::value + 1>> stack(std::tuple<Tys...> const &args, long axis) { return stack(args, axis, utils::make_index_sequence<sizeof...(Tys)>()); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/std_.hpp b/contrib/python/pythran/pythran/pythonic/numpy/std_.hpp index 5ff8a402c7..76be6d48b3 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/std_.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/std_.hpp @@ -2,20 +2,20 @@ #define PYTHONIC_NUMPY_STD_HPP #include "pythonic/include/numpy/std_.hpp" -#include "pythonic/numpy/var.hpp" #include "pythonic/numpy/sqrt.hpp" +#include "pythonic/numpy/var.hpp" PYTHONIC_NS_BEGIN namespace numpy { template <class... Args> - auto std_(Args &&... args) + auto std_(Args &&...args) -> decltype(functor::sqrt{}(var(std::forward<Args>(args)...))) { return functor::sqrt{}(var(std::forward<Args>(args)...)); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/subtract.hpp b/contrib/python/pythran/pythran/pythonic/numpy/subtract.hpp index 335aff7424..dea8af22df 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/subtract.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/subtract.hpp @@ -3,11 +3,11 @@ #include "pythonic/include/numpy/subtract.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/operator_/sub.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic/operator_/sub.hpp" PYTHONIC_NS_BEGIN @@ -16,7 +16,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME subtract #define NUMPY_NARY_FUNC_SYM pythonic::operator_::sub #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/swapaxes.hpp b/contrib/python/pythran/pythran/pythonic/numpy/swapaxes.hpp index 0148bfde46..bc83a64a45 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/swapaxes.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/swapaxes.hpp @@ -10,18 +10,19 @@ PYTHONIC_NS_BEGIN namespace numpy { template <class T> - auto swapaxes(T &&a, int axis1, int axis2) -> decltype(functor::transpose{}( - std::forward<T>(a), - std::declval<types::array<long, std::decay<T>::type::value>>())) + auto swapaxes(T &&a, int axis1, int axis2) + -> decltype(functor::transpose{}( + std::forward<T>(a), + std::declval<types::array_tuple<long, std::decay<T>::type::value>>())) { constexpr long N = std::decay<T>::type::value; - types::array<long, N> t; + types::array_tuple<long, N> t; for (unsigned long i = 0; i < N; ++i) t[i] = i; std::swap(t[axis1], t[axis2]); return functor::transpose{}(std::forward<T>(a), t); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/take.hpp b/contrib/python/pythran/pythran/pythonic/numpy/take.hpp index ed39c7cc9b..7ab952f870 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/take.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/take.hpp @@ -13,7 +13,7 @@ namespace numpy { return expr[indices]; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/tan.hpp b/contrib/python/pythran/pythran/pythonic/numpy/tan.hpp index fb53ab091b..5f416f5589 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/tan.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/tan.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/tan.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME tan #define NUMPY_NARY_FUNC_SYM xsimd::tan #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/tanh.hpp b/contrib/python/pythran/pythran/pythonic/numpy/tanh.hpp index e2bb22c7fa..3332e3f866 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/tanh.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/tanh.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/tanh.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME tanh #define NUMPY_NARY_FUNC_SYM xsimd::tanh #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/tile.hpp b/contrib/python/pythran/pythran/pythonic/numpy/tile.hpp index 2eb0a52f44..a9590003a3 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/tile.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/tile.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/tile.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -25,15 +25,15 @@ namespace numpy for (; begin != end; ++begin) _tile((*begin).begin(), (*begin).end(), out, rep, utils::int_<N - 1>()); } - } + } // namespace template <class E> - types::ndarray<typename E::dtype, types::array<long, E::value>> + types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> tile(E const &expr, long reps) { size_t n = expr.flat_size(); - types::ndarray<typename E::dtype, types::array<long, E::value>> out( - types::array<long, 1>{{long(n * reps)}}, builtins::None); + types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> out( + types::array_tuple<long, 1>{{long(n * reps)}}, builtins::None); auto out_iter = out.fbegin(); _tile(expr.begin(), expr.end(), out_iter, 1, utils::int_<E::value>()); for (long i = 1; i < reps; ++i) @@ -42,27 +42,27 @@ namespace numpy } template <size_t Shift, class R, class S, size_t... Is> - types::array<long, sizeof...(Is)> + types::array_tuple<long, sizeof...(Is)> tile_init_shape(R const &reps, S const &expr_shape, utils::index_sequence<Is...>) { constexpr size_t M = S::value; return { - {(reps[Is] * ((Is < Shift) ? 1 : expr_shape.template shape < (Is < M) - ? Is - : 0 > ()))...}}; + {(reps[Is] * ((Is < Shift) ? 1 + : expr_shape.template shape < (Is < M) ? Is + : 0 > ()))...}}; } template <class E, size_t N> - types::ndarray<typename E::dtype, types::array<long, N>> - tile(E const &expr, types::array<long, N> const &reps) + types::ndarray<typename E::dtype, types::array_tuple<long, N>> + tile(E const &expr, types::array_tuple<long, N> const &reps) { size_t n = expr.flat_size(); - types::array<long, N> shape = tile_init_shape<N - E::value>( + types::array_tuple<long, N> shape = tile_init_shape<N - E::value>( reps, expr, utils::make_index_sequence<N>()); long last_rep = (E::value == N) ? std::get<N - 1>(reps) : 1; - types::ndarray<typename E::dtype, types::array<long, N>> out( + types::ndarray<typename E::dtype, types::array_tuple<long, N>> out( shape, builtins::None); auto out_iter = out.fbegin(); _tile(expr.begin(), expr.end(), out_iter, last_rep, @@ -73,7 +73,7 @@ namespace numpy out_iter = std::copy(out.fbegin(), out.fbegin() + n, out_iter); return out; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/trace.hpp b/contrib/python/pythran/pythran/pythonic/numpy/trace.hpp index 2677331529..9ec8b874a0 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/trace.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/trace.hpp @@ -31,7 +31,7 @@ namespace numpy res += expr.fast(i).fast(i); return res; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/transpose.hpp b/contrib/python/pythran/pythran/pythonic/numpy/transpose.hpp index 348cd9bddf..36f5fdba80 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/transpose.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/transpose.hpp @@ -3,11 +3,11 @@ #include "pythonic/include/numpy/transpose.hpp" +#include "pythonic/builtins/ValueError.hpp" +#include "pythonic/types/ndarray.hpp" #include "pythonic/utils/functor.hpp" -#include "pythonic/utils/numpy_conversion.hpp" #include "pythonic/utils/nested_container.hpp" -#include "pythonic/types/ndarray.hpp" -#include "pythonic/builtins/ValueError.hpp" +#include "pythonic/utils/numpy_conversion.hpp" PYTHONIC_NS_BEGIN @@ -44,35 +44,36 @@ namespace numpy return iter; } template <class T, class pS> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> _transposer(types::ndarray<T, pS> const &a, long const l[std::tuple_size<pS>::value]) { auto shape = sutils::getshape(a); - types::array<long, std::tuple_size<pS>::value> shp; + types::array_tuple<long, std::tuple_size<pS>::value> shp; for (unsigned long i = 0; i < std::tuple_size<pS>::value; ++i) shp[i] = shape[l[i]]; - types::array<long, std::tuple_size<pS>::value> perm; + types::array_tuple<long, std::tuple_size<pS>::value> perm; for (std::size_t i = 0; i < std::tuple_size<pS>::value; ++i) perm[l[i]] = i; - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> new_array(shp, builtins::None); auto const *iter = a.buffer; - types::array<long, std::tuple_size<pS>::value> indices; + types::array_tuple<long, std::tuple_size<pS>::value> indices; _transposer(new_array, iter, indices, shape, perm, utils::int_<0>{}); return new_array; } - } + } // namespace template <class T, class pS> typename std::enable_if< (std::tuple_size<pS>::value > 2), - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>>>::type - transpose(types::ndarray<T, pS> const &a) + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>>:: + type + transpose(types::ndarray<T, pS> const &a) { long t[std::tuple_size<pS>::value]; for (unsigned long i = 0; i < std::tuple_size<pS>::value; ++i) @@ -81,8 +82,9 @@ namespace numpy } template <class T, class pS, size_t M> - types::ndarray<T, types::array<long, std::tuple_size<pS>::value>> - transpose(types::ndarray<T, pS> const &a, types::array<long, M> const &t) + types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> + transpose(types::ndarray<T, pS> const &a, + types::array_tuple<long, M> const &t) { static_assert(std::tuple_size<pS>::value == M, "axes don't match array"); @@ -91,7 +93,7 @@ namespace numpy throw types::ValueError("invalid axis for this array"); return _transposer(a, &t[0]); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/tri.hpp b/contrib/python/pythran/pythran/pythonic/numpy/tri.hpp index fb39c9ca58..8e42ba0e0b 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/tri.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/tri.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/tri.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -24,7 +24,7 @@ namespace numpy out[i][j] = 1; return out; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/tril.hpp b/contrib/python/pythran/pythran/pythonic/numpy/tril.hpp index d6e9a12d5d..44d92ee972 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/tril.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/tril.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/tril.hpp" +#include "pythonic/types/ndarray.hpp" #include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_conversion.hpp" -#include "pythonic/types/ndarray.hpp" PYTHONIC_NS_BEGIN @@ -28,7 +28,7 @@ namespace numpy } NUMPY_EXPR_TO_NDARRAY0_IMPL(tril) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/triu.hpp b/contrib/python/pythran/pythran/pythonic/numpy/triu.hpp index b02116d0aa..3f6ce9b95d 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/triu.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/triu.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/numpy/triu.hpp" +#include "pythonic/types/ndarray.hpp" #include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_conversion.hpp" -#include "pythonic/types/ndarray.hpp" PYTHONIC_NS_BEGIN @@ -25,7 +25,7 @@ namespace numpy } NUMPY_EXPR_TO_NDARRAY0_IMPL(triu) -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/true_divide.hpp b/contrib/python/pythran/pythran/pythonic/numpy/true_divide.hpp index 0aedca78e1..6c78a12791 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/true_divide.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/true_divide.hpp @@ -3,11 +3,11 @@ #include "pythonic/include/numpy/true_divide.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/operator_/div.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" -#include "pythonic/operator_/div.hpp" PYTHONIC_NS_BEGIN @@ -18,7 +18,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME true_divide #define NUMPY_NARY_FUNC_SYM pythonic::operator_::div #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/trunc.hpp b/contrib/python/pythran/pythran/pythonic/numpy/trunc.hpp index d5e42e1fb4..46d7b9c595 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/trunc.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/trunc.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/trunc.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace numpy #define NUMPY_NARY_FUNC_NAME trunc #define NUMPY_NARY_FUNC_SYM xsimd::trunc #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ufunc_accumulate.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ufunc_accumulate.hpp index 295d45b9e3..601fbd9801 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/ufunc_accumulate.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/ufunc_accumulate.hpp @@ -5,8 +5,8 @@ // clang-format off #include INCLUDE_FILE(pythonic/numpy,UFUNC_NAME) // clang-format on -#include <pythonic/numpy/partial_sum.hpp> #include "pythonic/utils/functor.hpp" +#include <pythonic/numpy/partial_sum.hpp> PYTHONIC_NS_BEGIN namespace numpy @@ -21,6 +21,6 @@ namespace numpy return partial_sum<numpy::functor::UFUNC_NAME>(std::forward<T>(a), axis, d); } - } -} + } // namespace UFUNC_NAME +} // namespace numpy PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/numpy/union1d.hpp b/contrib/python/pythran/pythran/pythonic/numpy/union1d.hpp index 275d4d816b..e9e7ff6777 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/union1d.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/union1d.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/union1d.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include <set> @@ -27,7 +27,7 @@ namespace numpy for (; begin != end; ++begin) _union1d((*begin).begin(), (*begin).end(), out, utils::int_<N - 1>()); } - } + } // namespace template <class E, class F> types::ndarray< @@ -41,7 +41,7 @@ namespace numpy _union1d(f.begin(), f.end(), res, utils::int_<F::value>()); return {res}; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/unravel_index.hpp b/contrib/python/pythran/pythran/pythonic/numpy/unravel_index.hpp index e72ef8e48b..8c885aad4e 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/unravel_index.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/unravel_index.hpp @@ -1,8 +1,8 @@ #ifndef PYTHONIC_NUMPY_UNRAVEL_INDEX_HPP #define PYTHONIC_NUMPY_UNRAVEL_INDEX_HPP -#include "pythonic/include/numpy/unravel_index.hpp" #include "pythonic/builtins/ValueError.hpp" +#include "pythonic/include/numpy/unravel_index.hpp" PYTHONIC_NS_BEGIN @@ -16,20 +16,21 @@ namespace numpy while (shape_it != end_it) { auto &v = *shape_it; auto tmp = expr / v; - *ret_it = expr - v *tmp; + *ret_it = expr - v * tmp; expr = tmp; ++shape_it; ++ret_it; } } - } + } // namespace template <class E, class S> - typename std::enable_if<std::is_scalar<E>::value, - types::array<long, std::tuple_size<S>::value>>::type + typename std::enable_if< + std::is_scalar<E>::value, + types::array_tuple<long, std::tuple_size<S>::value>>::type unravel_index(E const &expr, S const &shape, types::str const &order) { - types::array<long, std::tuple_size<S>::value> ret; + types::array_tuple<long, std::tuple_size<S>::value> ret; if (order[0] == "C") { _unravel_index(expr, shape.rbegin(), shape.rend(), ret.rbegin()); } else if (order[0] == "F") { @@ -39,7 +40,7 @@ namespace numpy } return ret; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/unwrap.hpp b/contrib/python/pythran/pythran/pythonic/numpy/unwrap.hpp index 3eee207737..23da0b6a7a 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/unwrap.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/unwrap.hpp @@ -3,13 +3,13 @@ #include "pythonic/include/numpy/unwrap.hpp" +#include "pythonic/numpy/pi.hpp" +#include "pythonic/types/ndarray.hpp" #include "pythonic/utils/functor.hpp" #include "pythonic/utils/int_.hpp" -#include "pythonic/types/ndarray.hpp" -#include "pythonic/numpy/pi.hpp" -#include <pythonic/numpy/maximum.hpp> #include <pythonic/numpy/abs.hpp> +#include <pythonic/numpy/maximum.hpp> #include <pythonic/numpy/round.hpp> PYTHONIC_NS_BEGIN @@ -40,7 +40,7 @@ namespace numpy _unwrap((*ibegin).begin(), (*ibegin).end(), (*obegin).begin(), discont, utils::int_<N - 1>()); } - } + } // namespace template <class E> types::ndarray<double, typename E::shape_t> unwrap(E const &expr, @@ -53,7 +53,7 @@ namespace numpy utils::int_<E::value>()); return out; } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/var.hpp b/contrib/python/pythran/pythran/pythonic/numpy/var.hpp index fcfba97ab3..981b6678d9 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/var.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/var.hpp @@ -3,17 +3,17 @@ #include "pythonic/include/numpy/var.hpp" -#include "pythonic/utils/functor.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/builtins/None.hpp" #include "pythonic/builtins/ValueError.hpp" +#include "pythonic/builtins/pythran/abssqr.hpp" #include "pythonic/numpy/add.hpp" #include "pythonic/numpy/conjugate.hpp" -#include "pythonic/numpy/subtract.hpp" +#include "pythonic/numpy/empty_like.hpp" #include "pythonic/numpy/mean.hpp" -#include "pythonic/builtins/pythran/abssqr.hpp" +#include "pythonic/numpy/subtract.hpp" #include "pythonic/numpy/sum.hpp" -#include "pythonic/numpy/empty_like.hpp" +#include "pythonic/types/ndarray.hpp" +#include "pythonic/utils/functor.hpp" #include <algorithm> @@ -24,8 +24,8 @@ namespace numpy template <class E> auto var(E const &expr, types::none_type axis, types::none_type dtype, - types::none_type out, long ddof) - -> decltype(var_type<E>(std::real(mean(expr)))) + types::none_type out, + long ddof) -> decltype(var_type<E>(std::real(mean(expr)))) { auto m = mean(expr); auto t = pythonic::numpy::functor::subtract{}(expr, m); @@ -57,7 +57,7 @@ namespace numpy _enlarge_copy_minus(t.fast(i), e.fast(i), m.fast(j), axis, utils::int_<N - 1>()); } - } + } // namespace template <class E> auto var(E const &expr, long axis, types::none_type dtype, @@ -70,7 +70,7 @@ namespace numpy return sum(builtins::pythran::functor::abssqr{}(t), axis) /= var_type<E>(expr.template shape<0>() - ddof); } else { - types::array<long, E::value> shp = sutils::getshape(expr); + types::array_tuple<long, E::value> shp = sutils::getshape(expr); shp[axis] = 1; auto mp = m.reshape(shp); @@ -80,7 +80,7 @@ namespace numpy var_type<E>(sutils::getshape(expr)[axis] - ddof); } } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/vectorize.hpp b/contrib/python/pythran/pythran/pythonic/numpy/vectorize.hpp index 8452922d1d..4b0836a6b6 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/vectorize.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/vectorize.hpp @@ -12,9 +12,10 @@ namespace numpy { template <typename F> template <typename... T> - auto vectorized<F>::operator()(T &&...args) const -> typename std::enable_if< - !types::valid_numexpr_parameters<typename std::decay<T>::type...>::value, - decltype(F{}(std::forward<T>(args)...))>::type + auto vectorized<F>::operator()(T &&...args) const -> + typename std::enable_if<!types::valid_numexpr_parameters< + typename std::decay<T>::type...>::value, + decltype(F{}(std::forward<T>(args)...))>::type { return F{}(std::forward<T>(args)...); } diff --git a/contrib/python/pythran/pythran/pythonic/numpy/vstack.hpp b/contrib/python/pythran/pythran/pythonic/numpy/vstack.hpp index ac933cead5..3b4de4a0df 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/vstack.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/vstack.hpp @@ -19,17 +19,18 @@ namespace numpy } template <class ArraySequence> - auto vstack(ArraySequence &&seq) -> typename std::enable_if< - (impl::vstack_helper<ArraySequence>::value == 1), - decltype(std::declval<impl::vstack_helper<ArraySequence>>().reshape( - std::declval<types::array<long, 2>>()))>::type + auto vstack(ArraySequence &&seq) -> + typename std::enable_if< + (impl::vstack_helper<ArraySequence>::value == 1), + decltype(std::declval<impl::vstack_helper<ArraySequence>>().reshape( + std::declval<types::array_tuple<long, 2>>()))>::type { auto &&temp = concatenate(std::forward<ArraySequence>(seq), 0); long const seq_size = seq.size(), temp_size = temp.size(); - types::array<long, 2> new_shape{{seq_size, temp_size / seq_size}}; + types::array_tuple<long, 2> new_shape{{seq_size, temp_size / seq_size}}; return temp.reshape(new_shape); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/where.hpp b/contrib/python/pythran/pythran/pythonic/numpy/where.hpp index fd5ee99802..7d91756294 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/where.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/where.hpp @@ -4,8 +4,8 @@ #include "pythonic/include/numpy/where.hpp" #include "pythonic/numpy/asarray.hpp" -#include "pythonic/numpy/nonzero.hpp" #include "pythonic/numpy/copy.hpp" +#include "pythonic/numpy/nonzero.hpp" PYTHONIC_NS_BEGIN @@ -22,13 +22,13 @@ namespace numpy else return false_; } - } + } // namespace impl #define NUMPY_NARY_FUNC_NAME where #define NUMPY_NARY_FUNC_SYM impl::where #define NUMPY_NARY_RESHAPE_MODE reshape_type #include "pythonic/types/numpy_nary_expr.hpp" -} +} // namespace numpy namespace types { @@ -65,7 +65,7 @@ namespace types return numpy::functor::where{}(*std::get<I>(iters)...); } }; -} +} // namespace types PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/numpy/zeros_like.hpp b/contrib/python/pythran/pythran/pythonic/numpy/zeros_like.hpp index 38024b1d15..435089004c 100644 --- a/contrib/python/pythran/pythran/pythonic/numpy/zeros_like.hpp +++ b/contrib/python/pythran/pythran/pythonic/numpy/zeros_like.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/numpy/zeros_like.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/numpy/zeros.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -12,8 +12,8 @@ namespace numpy { template <class E, class dtype> - auto zeros_like(E const &expr, dtype d) - -> decltype(zeros(sutils::getshape(expr), d)) + auto zeros_like(E const &expr, + dtype d) -> decltype(zeros(sutils::getshape(expr), d)) { return zeros(sutils::getshape(expr), d); } @@ -25,7 +25,7 @@ namespace numpy { return zeros(sutils::getshape(expr), types::dtype_t<typename E::dtype>()); } -} +} // namespace numpy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/omp/get_num_threads.hpp b/contrib/python/pythran/pythran/pythonic/omp/get_num_threads.hpp index 73b81f0a9c..aea6b54d67 100644 --- a/contrib/python/pythran/pythran/pythonic/omp/get_num_threads.hpp +++ b/contrib/python/pythran/pythran/pythonic/omp/get_num_threads.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/omp/get_num_threads.hpp" -#include <omp.h> #include "pythonic/utils/functor.hpp" +#include <omp.h> PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace omp { return omp_get_num_threads(); } -} +} // namespace omp PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/omp/get_thread_num.hpp b/contrib/python/pythran/pythran/pythonic/omp/get_thread_num.hpp index 652684eafe..5598a04a70 100644 --- a/contrib/python/pythran/pythran/pythonic/omp/get_thread_num.hpp +++ b/contrib/python/pythran/pythran/pythonic/omp/get_thread_num.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/omp/get_thread_num.hpp" -#include <omp.h> #include "pythonic/utils/functor.hpp" +#include <omp.h> PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace omp { return omp_get_thread_num(); } -} +} // namespace omp PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/omp/get_wtick.hpp b/contrib/python/pythran/pythran/pythonic/omp/get_wtick.hpp index c31f1e25db..c9e4242ebd 100644 --- a/contrib/python/pythran/pythran/pythonic/omp/get_wtick.hpp +++ b/contrib/python/pythran/pythran/pythonic/omp/get_wtick.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/omp/get_wtick.hpp" -#include <omp.h> #include "pythonic/utils/functor.hpp" +#include <omp.h> PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace omp { return omp_get_wtick(); } -} +} // namespace omp PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/omp/get_wtime.hpp b/contrib/python/pythran/pythran/pythonic/omp/get_wtime.hpp index c45c7de5f6..0131962811 100644 --- a/contrib/python/pythran/pythran/pythonic/omp/get_wtime.hpp +++ b/contrib/python/pythran/pythran/pythonic/omp/get_wtime.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/omp/get_wtime.hpp" -#include <omp.h> #include "pythonic/utils/functor.hpp" +#include <omp.h> PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace omp { return omp_get_wtime(); } -} +} // namespace omp PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/omp/in_parallel.hpp b/contrib/python/pythran/pythran/pythonic/omp/in_parallel.hpp index 80f053f5d6..731da8f786 100644 --- a/contrib/python/pythran/pythran/pythonic/omp/in_parallel.hpp +++ b/contrib/python/pythran/pythran/pythonic/omp/in_parallel.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/omp/in_parallel.hpp" -#include <omp.h> #include "pythonic/utils/functor.hpp" +#include <omp.h> PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace omp { return omp_in_parallel(); } -} +} // namespace omp PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/omp/set_nested.hpp b/contrib/python/pythran/pythran/pythonic/omp/set_nested.hpp index 3d5228de05..4a246a6c3b 100644 --- a/contrib/python/pythran/pythran/pythonic/omp/set_nested.hpp +++ b/contrib/python/pythran/pythran/pythonic/omp/set_nested.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/omp/set_nested.hpp" -#include <omp.h> #include "pythonic/utils/functor.hpp" +#include <omp.h> PYTHONIC_NS_BEGIN @@ -15,7 +15,7 @@ namespace omp { return omp_set_nested(val); } -} +} // namespace omp PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/omp/set_num_threads.hpp b/contrib/python/pythran/pythran/pythonic/omp/set_num_threads.hpp index 305d88a1d3..30e41caa1f 100644 --- a/contrib/python/pythran/pythran/pythonic/omp/set_num_threads.hpp +++ b/contrib/python/pythran/pythran/pythonic/omp/set_num_threads.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/omp/set_num_threads.hpp" -#include <omp.h> #include "pythonic/utils/functor.hpp" +#include <omp.h> PYTHONIC_NS_BEGIN @@ -14,7 +14,7 @@ namespace omp { return omp_set_num_threads(num_threads); } -} +} // namespace omp PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/__abs__.hpp b/contrib/python/pythran/pythran/pythonic/operator_/__abs__.hpp index a8c386ae6b..318cfdf472 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/__abs__.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/__abs__.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_OPERATOR_ABS__HPP #define PYTHONIC_OPERATOR_ABS__HPP -#include "pythonic/include/operator_/__abs__.hpp" #include "pythonic/builtins/abs.hpp" +#include "pythonic/include/operator_/__abs__.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/__xor__.hpp b/contrib/python/pythran/pythran/pythonic/operator_/__xor__.hpp index 0bc39c59af..f875024a0a 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/__xor__.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/__xor__.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_OPERATOR_XOR__HPP #define PYTHONIC_OPERATOR_XOR__HPP -#include "pythonic/include/operator_/__xor__.hpp" #include "pythonic//operator_/xor_.hpp" +#include "pythonic/include/operator_/__xor__.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/abs.hpp b/contrib/python/pythran/pythran/pythonic/operator_/abs.hpp index 47ee998c25..b800208785 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/abs.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/abs.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_OPERATOR_ABS_HPP #define PYTHONIC_OPERATOR_ABS_HPP -#include "pythonic/include/operator_/abs.hpp" #include "pythonic/builtins/abs.hpp" +#include "pythonic/include/operator_/abs.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/add.hpp b/contrib/python/pythran/pythran/pythonic/operator_/add.hpp index d234f366fa..1e594a143a 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/add.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/add.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/operator_/add.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/operator_/overloads.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -17,9 +17,10 @@ namespace operator_ } DEFINE_ALL_OPERATOR_OVERLOADS_IMPL( - add, +, (((b >= 0) ? (a <= std::numeric_limits<decltype(b)>::max() - b) - : (std::numeric_limits<decltype(b)>::min() - b <= a)))) -} + add, +, + (((b >= 0) ? (a <= std::numeric_limits<decltype(b)>::max() - b) + : (std::numeric_limits<decltype(b)>::min() - b <= a)))) +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/and_.hpp b/contrib/python/pythran/pythran/pythonic/operator_/and_.hpp index f81e104c16..77da5249f7 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/and_.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/and_.hpp @@ -17,7 +17,7 @@ namespace operator_ } DEFINE_ALL_OPERATOR_OVERLOADS_IMPL(and_, &, true) -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/concat.hpp b/contrib/python/pythran/pythran/pythonic/operator_/concat.hpp index 17e8e81778..3df3c7163c 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/concat.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/concat.hpp @@ -15,7 +15,7 @@ namespace operator_ { return std::forward<A>(a) + std::forward<B>(b); } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/contains.hpp b/contrib/python/pythran/pythran/pythonic/operator_/contains.hpp index 9da329f31e..d1f739c7de 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/contains.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/contains.hpp @@ -3,20 +3,20 @@ #include "pythonic/include/operator_/contains.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/builtins/in.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace operator_ { template <class A, class B> - auto contains(A &&a, B &&b) - -> decltype(in(std::forward<A>(a), std::forward<B>(b))) + auto contains(A &&a, + B &&b) -> decltype(in(std::forward<A>(a), std::forward<B>(b))) { return in(std::forward<A>(a), std::forward<B>(b)); } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/countOf.hpp b/contrib/python/pythran/pythran/pythonic/operator_/countOf.hpp index a3f4203bd6..718416c921 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/countOf.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/countOf.hpp @@ -15,7 +15,7 @@ namespace operator_ { return std::count(a.begin(), a.end(), std::forward<B>(b)); } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/delitem.hpp b/contrib/python/pythran/pythran/pythonic/operator_/delitem.hpp index 0a44fa1c82..daf5c2cffb 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/delitem.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/delitem.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/operator_/delitem.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/builtins/None.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace operator_ std::forward<A>(a).remove(std::forward<B>(b)); return builtins::None; } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/getitem.hpp b/contrib/python/pythran/pythran/pythonic/operator_/getitem.hpp index 1d5b21347e..f3362b0328 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/getitem.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/getitem.hpp @@ -14,7 +14,7 @@ namespace operator_ { return std::forward<A>(a)[std::forward<B>(b)]; } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/iadd.hpp b/contrib/python/pythran/pythran/pythonic/operator_/iadd.hpp index 6e77849ebd..564fd9b450 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/iadd.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/iadd.hpp @@ -9,9 +9,9 @@ #include "pythonic/operator_/icommon.hpp" +#include "pythonic/types/dict.hpp" #include "pythonic/types/list.hpp" #include "pythonic/types/set.hpp" -#include "pythonic/types/dict.hpp" PYTHONIC_NS_BEGIN @@ -35,7 +35,7 @@ namespace operator_ { return b; } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/icommon.hpp b/contrib/python/pythran/pythran/pythonic/operator_/icommon.hpp index d7b4140fa3..bff2016246 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/icommon.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/icommon.hpp @@ -21,8 +21,9 @@ namespace operator_ { template <class A, class B> - auto OPERATOR_NAME(bool, A &&a, B &&b, ...) - -> decltype(std::forward<A>(a) OPERATOR_SYMBOL std::forward<B>(b)) + auto OPERATOR_NAME(bool, A &&a, B &&b, + ...) -> decltype(std::forward<A>(a) + OPERATOR_SYMBOL std::forward<B>(b)) { return std::forward<A>(a) OPERATOR_SYMBOL std::forward<B>(b); } @@ -32,7 +33,7 @@ namespace operator_ { return std::forward<A>(a) OPERATOR_ISYMBOL std::forward<B>(b); } -} +} // namespace operator_ PYTHONIC_NS_END #undef OPERATOR_NAME #undef OPERATOR_SYMBOL diff --git a/contrib/python/pythran/pythran/pythonic/operator_/iconcat.hpp b/contrib/python/pythran/pythran/pythonic/operator_/iconcat.hpp index ea80f1ee60..adad2d0900 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/iconcat.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/iconcat.hpp @@ -3,10 +3,10 @@ #include "pythonic/include/operator_/iconcat.hpp" -#include "pythonic/utils/functor.hpp" +#include "pythonic/types/dict.hpp" #include "pythonic/types/list.hpp" #include "pythonic/types/set.hpp" -#include "pythonic/types/dict.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -35,7 +35,7 @@ namespace operator_ { return b; } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/ifloordiv.hpp b/contrib/python/pythran/pythran/pythonic/operator_/ifloordiv.hpp index d10087483e..caea2ca547 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/ifloordiv.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/ifloordiv.hpp @@ -23,7 +23,7 @@ namespace operator_ { return (a - mod(a, b)) / b; } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/imax.hpp b/contrib/python/pythran/pythran/pythonic/operator_/imax.hpp index 63d6f0b53d..4412792872 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/imax.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/imax.hpp @@ -3,31 +3,33 @@ #include "pythonic/include/operator_/imax.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/numpy/maximum.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN namespace operator_ { template <class A, class B> - auto imax(A &&a, B &&b) -> typename std::enable_if< - std::is_const<A>::value || !std::is_assignable<A, B>::value, - decltype(numpy::functor::maximum{}(std::forward<A>(a), - std::forward<B>(b)))>::type + auto imax(A &&a, B &&b) -> + typename std::enable_if< + std::is_const<A>::value || !std::is_assignable<A, B>::value, + decltype(numpy::functor::maximum{}(std::forward<A>(a), + std::forward<B>(b)))>::type { return numpy::functor::maximum{}(std::forward<A>(a), std::forward<B>(b)); } template <class A, class B> - auto imax(A &&a, B &&b) -> typename std::enable_if< - !std::is_const<A>::value && std::is_assignable<A, B>::value, - decltype(a = numpy::functor::maximum{}(std::forward<A>(a), - std::forward<B>(b)))>::type + auto imax(A &&a, B &&b) -> + typename std::enable_if< + !std::is_const<A>::value && std::is_assignable<A, B>::value, + decltype(a = numpy::functor::maximum{}(std::forward<A>(a), + std::forward<B>(b)))>::type { return a = numpy::functor::maximum{}(a, std::forward<B>(b)); } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/imin.hpp b/contrib/python/pythran/pythran/pythonic/operator_/imin.hpp index 8405872a69..e1f32ea152 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/imin.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/imin.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/operator_/imin.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/numpy/minimum.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -12,23 +12,25 @@ namespace operator_ { template <class A, class B> - auto imin(A &&a, B &&b) -> typename std::enable_if< - std::is_const<A>::value || !std::is_assignable<A, B>::value, - decltype(numpy::functor::minimum{}(std::forward<A>(a), - std::forward<B>(b)))>::type + auto imin(A &&a, B &&b) -> + typename std::enable_if< + std::is_const<A>::value || !std::is_assignable<A, B>::value, + decltype(numpy::functor::minimum{}(std::forward<A>(a), + std::forward<B>(b)))>::type { return numpy::functor::minimum{}(std::forward<A>(a), std::forward<B>(b)); } template <class A, class B> - auto imin(A &&a, B &&b) -> typename std::enable_if< - !std::is_const<A>::value && std::is_assignable<A, B>::value, - decltype(a = numpy::functor::minimum{}(std::forward<A>(a), - std::forward<B>(b)))>::type + auto imin(A &&a, B &&b) -> + typename std::enable_if< + !std::is_const<A>::value && std::is_assignable<A, B>::value, + decltype(a = numpy::functor::minimum{}(std::forward<A>(a), + std::forward<B>(b)))>::type { return a = numpy::functor::minimum{}(a, std::forward<B>(b)); } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/imod.hpp b/contrib/python/pythran/pythran/pythonic/operator_/imod.hpp index 60378e768e..6825f2ddbe 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/imod.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/imod.hpp @@ -20,7 +20,7 @@ namespace operator_ { return a %= std::forward<B>(b); } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/indexOf.hpp b/contrib/python/pythran/pythran/pythonic/operator_/indexOf.hpp index d007553e12..28def8bff8 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/indexOf.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/indexOf.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/operator_/indexOf.hpp" -#include "pythonic/builtins/str.hpp" #include "pythonic/builtins/ValueError.hpp" +#include "pythonic/builtins/str.hpp" #include "pythonic/utils/functor.hpp" #include <algorithm> @@ -23,7 +23,7 @@ namespace operator_ " is not in this sequence"); return where - a.begin(); } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/invert.hpp b/contrib/python/pythran/pythran/pythonic/operator_/invert.hpp index 6985d3e36c..def3cff64c 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/invert.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/invert.hpp @@ -15,7 +15,7 @@ namespace operator_ { return ~std::forward<A>(a); } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/ipow.hpp b/contrib/python/pythran/pythran/pythonic/operator_/ipow.hpp index 0a69cf7b9e..708985ef59 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/ipow.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/ipow.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/operator_/ipow.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/builtins/pow.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -21,7 +21,7 @@ namespace operator_ { return a = builtins::pow(a, std::forward<B>(b)); } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/is_.hpp b/contrib/python/pythran/pythran/pythonic/operator_/is_.hpp index f15fd01be0..b9eff92b60 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/is_.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/is_.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/operator_/is_.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/builtins/id.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace operator_ { return builtins::id(std::forward<A>(a)) == builtins::id(std::forward<B>(b)); } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/is_not.hpp b/contrib/python/pythran/pythran/pythonic/operator_/is_not.hpp index a2fbb1a98d..63c4c9839d 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/is_not.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/is_not.hpp @@ -16,7 +16,7 @@ namespace operator_ { return builtins::id(std::forward<A>(a)) != builtins::id(std::forward<B>(b)); } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/itruediv.hpp b/contrib/python/pythran/pythran/pythonic/operator_/itruediv.hpp index a52ac09edd..ad6feb5b9c 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/itruediv.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/itruediv.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/operator_/itruediv.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/operator_/truediv.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -16,20 +16,22 @@ namespace operator_ return truediv(a, std::forward<B>(b)); } template <class A, class B> - auto itruediv(A &a, B &&b) -> typename std::enable_if< - std::is_same<A, decltype(truediv(a, std::forward<B>(b)))>::value, - A &>::type + auto itruediv(A &a, B &&b) -> + typename std::enable_if< + std::is_same<A, decltype(truediv(a, std::forward<B>(b)))>::value, + A &>::type { return a = truediv(a, std::forward<B>(b)); } template <class A, class B> - auto itruediv(A &a, B &&b) -> typename std::enable_if< - !std::is_same<A, decltype(truediv(a, std::forward<B>(b)))>::value, - decltype(truediv(a, std::forward<B>(b)))>::type + auto itruediv(A &a, B &&b) -> + typename std::enable_if< + !std::is_same<A, decltype(truediv(a, std::forward<B>(b)))>::value, + decltype(truediv(a, std::forward<B>(b)))>::type { return truediv(a, std::forward<B>(b)); } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/lshift.hpp b/contrib/python/pythran/pythran/pythonic/operator_/lshift.hpp index 995340125d..a758fc9afd 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/lshift.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/lshift.hpp @@ -12,8 +12,8 @@ namespace operator_ { template <class A, class B> - auto lshift(A &&a, B &&b) - -> decltype(std::forward<A>(a) << std::forward<B>(b)) + auto lshift(A &&a, B &&b) -> decltype(std::forward<A>(a) + << std::forward<B>(b)) { return std::forward<A>(a) << std::forward<B>(b); } diff --git a/contrib/python/pythran/pythran/pythonic/operator_/matmul.hpp b/contrib/python/pythran/pythran/pythonic/operator_/matmul.hpp index 3a0ed65f72..49bbbea3ba 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/matmul.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/matmul.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/operator_/matmul.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/numpy/dot.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace operator_ { return numpy::functor::dot{}(std::forward<A>(a), std::forward<B>(b)); } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/mod.hpp b/contrib/python/pythran/pythran/pythonic/operator_/mod.hpp index 7cc333ce3a..60f0047e8d 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/mod.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/mod.hpp @@ -11,10 +11,11 @@ namespace operator_ { template <class A, class B> - auto mod(A &&a, B &&b) -> typename std::enable_if< - std::is_fundamental<typename std::decay<A>::type>::value && - std::is_fundamental<typename std::decay<B>::type>::value, - decltype(std::forward<A>(a) % std::forward<B>(b))>::type + auto mod(A &&a, B &&b) -> + typename std::enable_if< + std::is_fundamental<typename std::decay<A>::type>::value && + std::is_fundamental<typename std::decay<B>::type>::value, + decltype(std::forward<A>(a) % std::forward<B>(b))>::type { auto t = std::forward<A>(a) % b; return t < 0 ? (t + b) : t; @@ -41,7 +42,7 @@ namespace operator_ { return std::forward<A>(a) % std::forward<B>(b); } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/neg.hpp b/contrib/python/pythran/pythran/pythonic/operator_/neg.hpp index e20b49a2cd..326460282b 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/neg.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/neg.hpp @@ -15,7 +15,7 @@ namespace operator_ { return -std::forward<A>(a); } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/not_.hpp b/contrib/python/pythran/pythran/pythonic/operator_/not_.hpp index dca674fbec..76602f2c5e 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/not_.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/not_.hpp @@ -19,7 +19,7 @@ namespace operator_ { return !a.real() && !a.imag(); } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/or_.hpp b/contrib/python/pythran/pythran/pythonic/operator_/or_.hpp index 7a7a0f453d..69092b4c5b 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/or_.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/or_.hpp @@ -18,7 +18,7 @@ namespace operator_ } DEFINE_ALL_OPERATOR_OVERLOADS_IMPL(or_, |, true) -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/pos.hpp b/contrib/python/pythran/pythran/pythonic/operator_/pos.hpp index fa72eb61d7..239294a142 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/pos.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/pos.hpp @@ -15,7 +15,7 @@ namespace operator_ { return a; } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/pow.hpp b/contrib/python/pythran/pythran/pythonic/operator_/pow.hpp index fb18687f08..7f801d6e17 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/pow.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/pow.hpp @@ -1,7 +1,7 @@ #ifndef PYTHONIC_OPERATOR_POW_HPP #define PYTHONIC_OPERATOR_POW_HPP -#include "pythonic/include/operator_/pow.hpp" #include "pythonic/builtins/pow.hpp" +#include "pythonic/include/operator_/pow.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/rshift.hpp b/contrib/python/pythran/pythran/pythonic/operator_/rshift.hpp index ee335f9c9a..b656ae28af 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/rshift.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/rshift.hpp @@ -11,14 +11,14 @@ PYTHONIC_NS_BEGIN namespace operator_ { template <class A, class B> - auto rshift(A &&a, B &&b) - -> decltype(std::forward<A>(a) >> std::forward<B>(b)) + auto rshift(A &&a, + B &&b) -> decltype(std::forward<A>(a) >> std::forward<B>(b)) { return std::forward<A>(a) >> std::forward<B>(b); } DEFINE_ALL_OPERATOR_OVERLOADS_IMPL(rshift, >>, true) -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/sub.hpp b/contrib/python/pythran/pythran/pythonic/operator_/sub.hpp index cb07f36a41..a91e394200 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/sub.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/sub.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/operator_/sub.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/operator_/overloads.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -18,9 +18,10 @@ namespace operator_ } DEFINE_ALL_OPERATOR_OVERLOADS_IMPL( - sub, -, (((b < 0) ? (a <= std::numeric_limits<decltype(b)>::max() + b) - : (std::numeric_limits<decltype(b)>::min() + b <= a)))) -} + sub, -, + (((b < 0) ? (a <= std::numeric_limits<decltype(b)>::max() + b) + : (std::numeric_limits<decltype(b)>::min() + b <= a)))) +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/truediv.hpp b/contrib/python/pythran/pythran/pythonic/operator_/truediv.hpp index e9e5c144fe..285da27489 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/truediv.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/truediv.hpp @@ -10,12 +10,12 @@ PYTHONIC_NS_BEGIN namespace operator_ { template <class A, class B> - auto truediv(A &&a, B &&b) - -> decltype(std::forward<A>(a) / (double)std::forward<B>(b)) + auto truediv(A &&a, B &&b) -> decltype(std::forward<A>(a) / + (double)std::forward<B>(b)) { return std::forward<A>(a) / ((double)std::forward<B>(b)); } -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/operator_/xor_.hpp b/contrib/python/pythran/pythran/pythonic/operator_/xor_.hpp index d37bb64e32..a25137ad5b 100644 --- a/contrib/python/pythran/pythran/pythonic/operator_/xor_.hpp +++ b/contrib/python/pythran/pythran/pythonic/operator_/xor_.hpp @@ -17,7 +17,7 @@ namespace operator_ } DEFINE_ALL_OPERATOR_OVERLOADS_IMPL(xor_, ^, true) -} +} // namespace operator_ PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/random/shuffle.hpp b/contrib/python/pythran/pythran/pythonic/random/shuffle.hpp index 19b74344fd..43f0366a79 100644 --- a/contrib/python/pythran/pythran/pythonic/random/shuffle.hpp +++ b/contrib/python/pythran/pythran/pythonic/random/shuffle.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/random/shuffle.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/builtins/None.hpp" #include "pythonic/random/random.hpp" +#include "pythonic/utils/functor.hpp" #include <limits> @@ -47,7 +47,7 @@ namespace random function randf; }; - } + } // namespace details template <class T, class function> types::none_type shuffle(T &seq, function &&randf) @@ -56,7 +56,7 @@ namespace random details::URG<function>(std::forward<function>(randf))); return builtins::None; } -} +} // namespace random PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/binom.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/binom.hpp index 47204a7399..e9182c797a 100644 --- a/contrib/python/pythran/pythran/pythonic/scipy/special/binom.hpp +++ b/contrib/python/pythran/pythran/pythonic/scipy/special/binom.hpp @@ -28,13 +28,13 @@ namespace scipy return boost::math::binomial_coefficient<double>( n, k, make_policy(promote_double<true>())); } - } + } // namespace details #define NUMPY_NARY_FUNC_NAME binom #define NUMPY_NARY_FUNC_SYM details::binom #include "pythonic/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/chbevl.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/chbevl.hpp index 2e3b5b68f9..6d1c06a412 100644 --- a/contrib/python/pythran/pythran/pythonic/scipy/special/chbevl.hpp +++ b/contrib/python/pythran/pythran/pythonic/scipy/special/chbevl.hpp @@ -14,7 +14,7 @@ namespace scipy namespace special { template <size_t N> - double chbevl(double x, const double(&array)[N]) + double chbevl(double x, const double (&array)[N]) { const double *p = &array[0]; double b0 = *p++; @@ -32,7 +32,7 @@ namespace scipy } } // namespace special -} +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/gamma.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/gamma.hpp index 2ee3b2b96d..2353157b96 100644 --- a/contrib/python/pythran/pythran/pythonic/scipy/special/gamma.hpp +++ b/contrib/python/pythran/pythran/pythonic/scipy/special/gamma.hpp @@ -17,8 +17,8 @@ namespace scipy #define NUMPY_NARY_FUNC_NAME gamma #define NUMPY_NARY_FUNC_SYM xsimd::tgamma #include "pythonic/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/gammaincinv.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/gammaincinv.hpp index 63eb790b05..f972ed8d9b 100644 --- a/contrib/python/pythran/pythran/pythonic/scipy/special/gammaincinv.hpp +++ b/contrib/python/pythran/pythran/pythonic/scipy/special/gammaincinv.hpp @@ -23,15 +23,15 @@ namespace scipy { using namespace boost::math::policies; return boost::math::gamma_p_inv(a, p, - make_policy(promote_double<true>())); + make_policy(promote_double<true>())); } - } + } // namespace details #define NUMPY_NARY_FUNC_NAME gammaincinv #define NUMPY_NARY_FUNC_SYM details::gammaincinv #include "pythonic/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/gammaln.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/gammaln.hpp index 82ad0f6553..5dc55a84c7 100644 --- a/contrib/python/pythran/pythran/pythonic/scipy/special/gammaln.hpp +++ b/contrib/python/pythran/pythran/pythonic/scipy/special/gammaln.hpp @@ -17,8 +17,8 @@ namespace scipy #define NUMPY_NARY_FUNC_NAME gammaln #define NUMPY_NARY_FUNC_SYM xsimd::lgamma #include "pythonic/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/hankel1.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/hankel1.hpp index 0f20cd37b7..1fa9a83ad2 100644 --- a/contrib/python/pythran/pythran/pythonic/scipy/special/hankel1.hpp +++ b/contrib/python/pythran/pythran/pythonic/scipy/special/hankel1.hpp @@ -24,13 +24,13 @@ namespace scipy { return boost::math::cyl_hankel_1(x, y); } - } + } // namespace details #define NUMPY_NARY_FUNC_NAME hankel1 #define NUMPY_NARY_FUNC_SYM details::hankel1 #include "pythonic/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/hankel2.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/hankel2.hpp index ddce9a019d..518c3d8968 100644 --- a/contrib/python/pythran/pythran/pythonic/scipy/special/hankel2.hpp +++ b/contrib/python/pythran/pythran/pythonic/scipy/special/hankel2.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/scipy/special/hankel2.hpp" -#include "pythonic/types/ndarray.hpp" #include "pythonic/types/complex.hpp" +#include "pythonic/types/ndarray.hpp" #include "pythonic/utils/functor.hpp" #include "pythonic/utils/numpy_traits.hpp" @@ -24,13 +24,13 @@ namespace scipy { return boost::math::cyl_hankel_2(x, y); } - } + } // namespace details #define NUMPY_NARY_FUNC_NAME hankel2 #define NUMPY_NARY_FUNC_SYM details::hankel2 #include "pythonic/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/i0.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/i0.hpp index e32de34b68..7a365e60a8 100644 --- a/contrib/python/pythran/pythran/pythonic/scipy/special/i0.hpp +++ b/contrib/python/pythran/pythran/pythonic/scipy/special/i0.hpp @@ -31,13 +31,13 @@ namespace scipy return (exp(x) * chbevl(32.0 / x - 2.0, B) / sqrt(x)); } - } + } // namespace details #define NUMPY_NARY_FUNC_NAME i0 #define NUMPY_NARY_FUNC_SYM details::i0 #include "pythonic/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/i0e.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/i0e.hpp index f1ee8428f2..702f5d974e 100644 --- a/contrib/python/pythran/pythran/pythonic/scipy/special/i0e.hpp +++ b/contrib/python/pythran/pythran/pythonic/scipy/special/i0e.hpp @@ -30,13 +30,13 @@ namespace scipy return (chbevl(32.0 / x - 2.0, B) / sqrt(x)); } - } + } // namespace details #define NUMPY_NARY_FUNC_NAME i0e #define NUMPY_NARY_FUNC_SYM details::i0e #include "pythonic/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/iv.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/iv.hpp index 06a9283609..658a3f3010 100644 --- a/contrib/python/pythran/pythran/pythonic/scipy/special/iv.hpp +++ b/contrib/python/pythran/pythran/pythonic/scipy/special/iv.hpp @@ -25,13 +25,13 @@ namespace scipy return boost::math::cyl_bessel_i(x, y, make_policy(promote_double<true>())); } - } + } // namespace details #define NUMPY_NARY_FUNC_NAME iv #define NUMPY_NARY_FUNC_SYM details::iv #include "pythonic/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/ivp.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/ivp.hpp index 3834f54355..db689f1500 100644 --- a/contrib/python/pythran/pythran/pythonic/scipy/special/ivp.hpp +++ b/contrib/python/pythran/pythran/pythonic/scipy/special/ivp.hpp @@ -25,13 +25,13 @@ namespace scipy return boost::math::cyl_bessel_i_prime( x, y, make_policy(promote_double<true>())); } - } + } // namespace details #define NUMPY_NARY_FUNC_NAME ivp #define NUMPY_NARY_FUNC_SYM details::ivp #include "pythonic/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/jv.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/jv.hpp index 944228be94..8485907ac9 100644 --- a/contrib/python/pythran/pythran/pythonic/scipy/special/jv.hpp +++ b/contrib/python/pythran/pythran/pythonic/scipy/special/jv.hpp @@ -25,13 +25,13 @@ namespace scipy return boost::math::cyl_bessel_j(x, y, make_policy(promote_double<true>())); } - } + } // namespace details #define NUMPY_NARY_FUNC_NAME jv #define NUMPY_NARY_FUNC_SYM details::jv #include "pythonic/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/jvp.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/jvp.hpp index 99ad7974c1..c9a674c2a7 100644 --- a/contrib/python/pythran/pythran/pythonic/scipy/special/jvp.hpp +++ b/contrib/python/pythran/pythran/pythonic/scipy/special/jvp.hpp @@ -25,13 +25,13 @@ namespace scipy return boost::math::cyl_bessel_j_prime( x, y, make_policy(promote_double<true>())); } - } + } // namespace details #define NUMPY_NARY_FUNC_NAME jvp #define NUMPY_NARY_FUNC_SYM details::jvp #include "pythonic/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/kv.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/kv.hpp index 151acd0bb5..406bb1a96d 100644 --- a/contrib/python/pythran/pythran/pythonic/scipy/special/kv.hpp +++ b/contrib/python/pythran/pythran/pythonic/scipy/special/kv.hpp @@ -25,13 +25,13 @@ namespace scipy return boost::math::cyl_bessel_k(x, y, make_policy(promote_double<true>())); } - } + } // namespace details #define NUMPY_NARY_FUNC_NAME kv #define NUMPY_NARY_FUNC_SYM details::kv #include "pythonic/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/kvp.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/kvp.hpp index dcfc6d3791..3f916ef362 100644 --- a/contrib/python/pythran/pythran/pythonic/scipy/special/kvp.hpp +++ b/contrib/python/pythran/pythran/pythonic/scipy/special/kvp.hpp @@ -25,13 +25,13 @@ namespace scipy return boost::math::cyl_bessel_k_prime( x, y, make_policy(promote_double<true>())); } - } + } // namespace details #define NUMPY_NARY_FUNC_NAME kvp #define NUMPY_NARY_FUNC_SYM details::kvp #include "pythonic/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/ndtr.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/ndtr.hpp index 4245fbf4e7..1316b49eda 100644 --- a/contrib/python/pythran/pythran/pythonic/scipy/special/ndtr.hpp +++ b/contrib/python/pythran/pythran/pythonic/scipy/special/ndtr.hpp @@ -25,13 +25,13 @@ namespace scipy boost::math::normal dist(0.0, 1.0); return cdf(dist, x); } - } + } // namespace details #define NUMPY_NARY_FUNC_NAME ndtr #define NUMPY_NARY_FUNC_SYM details::ndtr #include "pythonic/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/ndtri.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/ndtri.hpp index f19df22856..bde9632328 100644 --- a/contrib/python/pythran/pythran/pythonic/scipy/special/ndtri.hpp +++ b/contrib/python/pythran/pythran/pythonic/scipy/special/ndtri.hpp @@ -25,13 +25,13 @@ namespace scipy boost::math::normal dist(0.0, 1.0); return quantile(dist, x); } - } + } // namespace details #define NUMPY_NARY_FUNC_NAME ndtri #define NUMPY_NARY_FUNC_SYM details::ndtri #include "pythonic/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/spherical_jn.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/spherical_jn.hpp index 643847c53a..da92301c2c 100644 --- a/contrib/python/pythran/pythran/pythonic/scipy/special/spherical_jn.hpp +++ b/contrib/python/pythran/pythran/pythonic/scipy/special/spherical_jn.hpp @@ -33,13 +33,13 @@ namespace scipy make_policy(promote_double<true>())); } } - } + } // namespace details #define NUMPY_NARY_FUNC_NAME spherical_jn #define NUMPY_NARY_FUNC_SYM details::spherical_jn #include "pythonic/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/spherical_yn.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/spherical_yn.hpp index cde3816dff..952587984a 100644 --- a/contrib/python/pythran/pythran/pythonic/scipy/special/spherical_yn.hpp +++ b/contrib/python/pythran/pythran/pythonic/scipy/special/spherical_yn.hpp @@ -33,13 +33,13 @@ namespace scipy make_policy(promote_double<true>())); } } - } + } // namespace details #define NUMPY_NARY_FUNC_NAME spherical_yn #define NUMPY_NARY_FUNC_SYM details::spherical_yn #include "pythonic/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/yv.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/yv.hpp index 7367ea69ef..42462a1edb 100644 --- a/contrib/python/pythran/pythran/pythonic/scipy/special/yv.hpp +++ b/contrib/python/pythran/pythran/pythonic/scipy/special/yv.hpp @@ -25,13 +25,13 @@ namespace scipy return boost::math::cyl_neumann(x, y, make_policy(promote_double<true>())); } - } + } // namespace details #define NUMPY_NARY_FUNC_NAME yv #define NUMPY_NARY_FUNC_SYM details::yv #include "pythonic/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/yvp.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/yvp.hpp index f08bf1fd95..b8cb59ab67 100644 --- a/contrib/python/pythran/pythran/pythonic/scipy/special/yvp.hpp +++ b/contrib/python/pythran/pythran/pythonic/scipy/special/yvp.hpp @@ -25,13 +25,13 @@ namespace scipy return boost::math::cyl_neumann_prime( x, y, make_policy(promote_double<true>())); } - } + } // namespace details #define NUMPY_NARY_FUNC_NAME yvp #define NUMPY_NARY_FUNC_SYM details::yvp #include "pythonic/types/numpy_nary_expr.hpp" - } -} + } // namespace special +} // namespace scipy PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/string/find.hpp b/contrib/python/pythran/pythran/pythonic/string/find.hpp index da093eed90..a787184055 100644 --- a/contrib/python/pythran/pythran/pythonic/string/find.hpp +++ b/contrib/python/pythran/pythran/pythonic/string/find.hpp @@ -3,8 +3,8 @@ #include "pythonic/include/string/find.hpp" -#include "pythonic/utils/functor.hpp" #include "pythonic/types/str.hpp" +#include "pythonic/utils/functor.hpp" PYTHONIC_NS_BEGIN @@ -16,7 +16,7 @@ namespace string { return s.find(std::forward<T>(val)); } -} +} // namespace string PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/time/sleep.hpp b/contrib/python/pythran/pythran/pythonic/time/sleep.hpp index 7da71a0292..605bc8b634 100644 --- a/contrib/python/pythran/pythran/pythonic/time/sleep.hpp +++ b/contrib/python/pythran/pythran/pythonic/time/sleep.hpp @@ -1,12 +1,12 @@ #ifndef PYTHONIC_TIME_SLEEP_HPP #define PYTHONIC_TIME_SLEEP_HPP +#include "pythonic/builtins/None.hpp" #include "pythonic/include/time/sleep.hpp" #include "pythonic/utils/functor.hpp" -#include "pythonic/builtins/None.hpp" -#include <thread> #include <chrono> +#include <thread> PYTHONIC_NS_BEGIN @@ -18,7 +18,7 @@ namespace time std::this_thread::sleep_for(std::chrono::duration<double>(value)); return builtins::None; } -} +} // namespace time PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/time/time.hpp b/contrib/python/pythran/pythran/pythonic/time/time.hpp index 44ed54c76e..3dac449d7d 100644 --- a/contrib/python/pythran/pythran/pythonic/time/time.hpp +++ b/contrib/python/pythran/pythran/pythonic/time/time.hpp @@ -16,10 +16,11 @@ namespace time std::chrono::time_point<std::chrono::steady_clock> tp = std::chrono::steady_clock::now(); return std::chrono::duration_cast<std::chrono::milliseconds>( - tp.time_since_epoch()).count() / + tp.time_since_epoch()) + .count() / 1000.; } -} +} // namespace time PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/types/array.hpp b/contrib/python/pythran/pythran/pythonic/types/array.hpp new file mode 100644 index 0000000000..e7b3966793 --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/types/array.hpp @@ -0,0 +1,755 @@ +#ifndef PYTHONIC_TYPES_ARRAY_HPP +#define PYTHONIC_TYPES_ARRAY_HPP + +#include "pythonic/include/types/array.hpp" +#include "pythonic/types/nditerator.hpp" + +#include "pythonic/builtins/len.hpp" +#include "pythonic/types/bool.hpp" +#include "pythonic/types/slice.hpp" +#include "pythonic/types/tuple.hpp" +#include "pythonic/utils/allocate.hpp" +#include "pythonic/utils/reserve.hpp" +#include "pythonic/utils/shared_ref.hpp" + +#include "pythonic/builtins/NotImplementedError.hpp" + +#include <algorithm> +#include <cassert> + +PYTHONIC_NS_BEGIN + +namespace types +{ + + /// Sliced array + + // Constructors + template <class T, class S> + sliced_array<T, S>::sliced_array() : _data(utils::no_memory()) + { + } + template <class T, class S> + sliced_array<T, S>::sliced_array(sliced_array<T, S> const &s) + : _data(s._data), slicing(s.slicing) + { + } + template <class T, class S> + sliced_array<T, S>::sliced_array(array<T> const &other, S const &s) + : _data(other._data), slicing(s.normalize(other.size())) + { + } + template <class T, class S> + template <class Sn> + sliced_array<T, S>::sliced_array( + utils::shared_ref<container_type> const &other, Sn const &s) + : _data(other), slicing(s) + { + } + + // iterators + template <class T, class S> + typename sliced_array<T, S>::iterator sliced_array<T, S>::begin() + { + return {*this, 0}; + } + template <class T, class S> + typename sliced_array<T, S>::const_iterator sliced_array<T, S>::begin() const + { + return {*this, 0}; + } + template <class T, class S> + typename sliced_array<T, S>::iterator sliced_array<T, S>::end() + { + return {*this, size()}; + } + template <class T, class S> + typename sliced_array<T, S>::const_iterator sliced_array<T, S>::end() const + { + return {*this, size()}; + } + + // size + template <class T, class S> + long sliced_array<T, S>::size() const + { + return slicing.size(); + } + template <class T, class S> + sliced_array<T, S>::operator bool() const + { + return slicing.size(); + } + + // accessor + template <class T, class S> + typename sliced_array<T, S>::const_reference + sliced_array<T, S>::fast(long i) const + { + assert(0 <= i && i < size()); + auto const index = slicing.get(i); + assert(0 <= index && index < (long)_data->size()); + return (*_data)[index]; + } + template <class T, class S> + typename sliced_array<T, S>::reference sliced_array<T, S>::fast(long i) + { + assert(0 <= i && i < size()); + auto const index = slicing.get(i); + assert(0 <= index && index < (long)_data->size()); + return (*_data)[index]; + } + template <class T, class S> + typename sliced_array<T, S>::const_reference + sliced_array<T, S>::operator[](long i) const + { + assert(i < size()); + auto const index = slicing.get(i); + assert(0 <= index && index < (long)_data->size()); + return (*_data)[index]; + } + template <class T, class S> + typename sliced_array<T, S>::reference sliced_array<T, S>::operator[](long i) + { + assert(i < size()); + auto const index = slicing.get(i); + assert(0 <= index && index < (long)_data->size()); + return (*_data)[index]; + } + + template <class T, class S> + template <class Sp> + typename std::enable_if< + is_slice<Sp>::value, + sliced_array<T, decltype(std::declval<S>() * std::declval<Sp>())>>::type + sliced_array<T, S>::operator[](Sp s) const + { + return {_data, slicing * s.normalize(this->size())}; + } + + // io + template <class Tp, class Sp> + std::ostream &operator<<(std::ostream &os, sliced_array<Tp, Sp> const &v) + { + os << '['; + auto iter = v.begin(); + if (iter != v.end()) { + while (iter + 1 != v.end()) { + os << *iter << ", "; + ++iter; + } + os << *iter; + } + return os << ']'; + } + + // comparison + template <class T, class S> + template <class K> + bool sliced_array<T, S>::operator==(array<K> const &other) const + { + if (size() != other.size()) + return false; + return std::equal(begin(), end(), other.begin()); + } + template <class T, class S> + inline sliced_array<T, S> & + sliced_array<T, S>::operator=(sliced_array<T, S> const &s) + { + if (slicing.step == 1) { + // inserting before erasing in case of self-copy + auto insert_pt = _data->begin() + slicing.lower; + _data->insert(insert_pt, s.begin(), s.end()); + auto erase_pt = _data->begin() + s.size(); + _data->erase(erase_pt + slicing.lower, erase_pt + slicing.upper); + } else + assert(!"not implemented yet"); + return *this; + } + template <class T, class S> + sliced_array<T, S> &sliced_array<T, S>::operator=(array<T> const &seq) + { + if (slicing.step == 1) { + // inserting before erasing in case of self-copy + auto insert_pt = _data->begin() + slicing.lower; + _data->insert(insert_pt, seq.begin(), seq.end()); + auto erase_pt = _data->begin() + seq.size(); + _data->erase(erase_pt + slicing.lower, erase_pt + slicing.upper); + } else + assert(!"not implemented yet"); + return *this; + } + template <class T, class S> + array<T> sliced_array<T, S>::operator+(array<T> const &s) const + { + array<T> out(size() + s.size()); + std::copy(s.begin(), s.end(), std::copy(begin(), end(), out.begin())); + return out; + } + template <class T, class S> + template <size_t N, class V> + array<T> sliced_array<T, S>::operator+(array_base<T, N, V> const &s) const + { + array<T> out(size() + s.size()); + std::copy(s.begin(), s.end(), std::copy(begin(), end(), out.begin())); + return out; + } + template <class T, class S> + template <class Tp, class Sp> + array<typename __combined<T, Tp>::type> + sliced_array<T, S>::operator+(sliced_array<Tp, Sp> const &s) const + { + array<typename __combined<T, Tp>::type> out(size() + s.size()); + std::copy(s.begin(), s.end(), std::copy(begin(), end(), out.begin())); + return out; + } + template <class N, class T> + array<T> operator*(N n, array<T> const &l) + { + return l * n; + } +#ifdef USE_XSIMD + template <class T, class S> + template <class vectorizer> + typename sliced_array<T, S>::simd_iterator + sliced_array<T, S>::vbegin(vectorizer) const + { + return {_data->data() + slicing.lower}; + } + + template <class T, class S> + template <class vectorizer> + typename sliced_array<T, S>::simd_iterator + sliced_array<T, S>::vend(vectorizer) const + { + using vector_type = typename xsimd::batch<dtype>; + static const std::size_t vector_size = vector_type::size; + return {_data->data() + slicing.lower + + long(size() / vector_size * vector_size)}; + } + +#endif + + // other operations + template <class T, class S> + template <class V> + bool sliced_array<T, S>::contains(V const &v) const + { + return std::find(_data->begin(), _data->end(), v) != _data->end(); + } + template <class T, class S> + intptr_t sliced_array<T, S>::id() const + { + // sharing is not implemented for sliced array + return reinterpret_cast<intptr_t>(this); + } + + template <class T, class S> + long sliced_array<T, S>::count(T const &x) const + { + return std::count(begin(), end(), x); + } + + /// List + + // constructors + template <class T> + array<T>::array() : _data(utils::no_memory()) + { + } + template <class T> + template <class InputIterator> + array<T>::array(InputIterator start, InputIterator stop) : _data() + { + if (std::is_same< + typename std::iterator_traits<InputIterator>::iterator_category, + std::random_access_iterator_tag>::value) + _data->reserve(std::distance(start, stop)); + else + _data->reserve(DEFAULT_CAPACITY); + std::copy(start, stop, std::back_inserter(*_data)); + } + template <class T> + array<T>::array(size_type sz) : _data(sz) + { + } + template <class T> + array<T>::array(array<T> &&other) : _data(std::move(other._data)) + { + } + template <class T> + array<T>::array(array<T> const &other) : _data(other._data) + { + } + template <class T> + template <class F> + array<T>::array(array<F> const &other) : _data(other.size()) + { + std::copy(other.begin(), other.end(), begin()); + } + template <class T> + template <class Tp, class S> + array<T>::array(sliced_array<Tp, S> const &other) + : _data(other.begin(), other.end()) + { + } + + // operators + template <class T> + array<T> &array<T>::operator=(array<T> &&other) + { + _data = std::move(other._data); + return *this; + } + template <class T> + template <class F> + array<T> &array<T>::operator=(array<F> const &other) + { + _data = utils::shared_ref<container_type>{other.size()}; + std::copy(other.begin(), other.end(), begin()); + return *this; + } + template <class T> + array<T> &array<T>::operator=(array<T> const &other) + { + _data = other._data; + return *this; + } + template <class T> + template <class Tp, size_t N, class V> + array<T> &array<T>::operator=(array_base<Tp, N, V> const &other) + { + _data = utils::shared_ref<container_type>(other.begin(), other.end()); + return *this; + } + template <class T> + template <class Tp, class S> + array<T> &array<T>::operator=(sliced_array<Tp, S> const &other) + { + if (other._data == _data) { + auto it = std::copy(other.begin(), other.end(), _data->begin()); + _data->resize(it - _data->begin()); + } else + _data = utils::shared_ref<container_type>(other.begin(), other.end()); + return *this; + } + + template <class T> + template <class S> + array<T> &array<T>::operator+=(sliced_array<T, S> const &other) + { + _data->resize(size() + other.size()); + std::copy(other.begin(), other.end(), _data->begin()); + return *this; + } + + template <class T> + template <class S> + array<T> array<T>::operator+(sliced_array<T, S> const &other) const + { + array<T> new_array(begin(), end()); + new_array.reserve(size() + other.size()); + std::copy(other.begin(), other.end(), std::back_inserter(new_array)); + return new_array; + } + + template <class T> + template <size_t N, class V> + array<T> array<T>::operator+(array_base<T, N, V> const &other) const + { + array<T> new_array(begin(), end()); + new_array.reserve(size() + other.size()); + std::copy(other.begin(), other.end(), std::back_inserter(new_array)); + return new_array; + } + + // io + template <class T> + std::ostream &operator<<(std::ostream &os, array<T> const &v) + { + os << '['; + auto iter = v.begin(); + if (iter != v.end()) { + while (iter + 1 != v.end()) + os << *iter++ << ", "; + os << *iter; + } + return os << ']'; + } + + // comparison + template <class T> + template <class K> + bool array<T>::operator==(array<K> const &other) const + { + if (size() != other.size()) + return false; + return std::equal(begin(), end(), other.begin()); + } + template <class T> + template <class K> + bool array<T>::operator!=(array<K> const &other) const + { + return !operator==(other); + } + + // iterators + template <class T> + typename array<T>::iterator array<T>::begin() + { + return {*this, 0}; + } + template <class T> + typename array<T>::const_iterator array<T>::begin() const + { + return {*this, 0}; + } + template <class T> + typename array<T>::iterator array<T>::end() + { + return {*this, size()}; + } + template <class T> + typename array<T>::const_iterator array<T>::end() const + { + return {*this, size()}; + } + + // comparison + template <class T> + bool array<T>::operator<(array<T> const &other) const + { + return std::lexicographical_compare(begin(), end(), other.begin(), + other.end()); + } + template <class T> + bool array<T>::operator>(array<T> const &other) const + { + return std::lexicographical_compare(other.begin(), other.end(), begin(), + end()); + } + template <class T> + bool array<T>::operator<=(array<T> const &other) const + { + return !(*this > other); + } + template <class T> + bool array<T>::operator>=(array<T> const &other) const + { + return !(*this < other); + } + +// element access +#ifdef USE_XSIMD + template <class T> + template <class vectorizer> + typename array<T>::simd_iterator array<T>::vbegin(vectorizer) const + { + return {_data->data()}; + } + + template <class T> + template <class vectorizer> + typename array<T>::simd_iterator array<T>::vend(vectorizer) const + { + using vector_type = typename xsimd::batch<dtype>; + static const std::size_t vector_size = vector_type::size; + return {_data->data() + long(size() / vector_size * vector_size)}; + } + +#endif + template <class T> + typename array<T>::reference array<T>::fast(long n) + { + return (*_data)[n]; + } + template <class T> + typename array<T>::reference array<T>::operator[](long n) + { + if (n < 0) + n += size(); + assert(0 <= n && n < size()); + return fast(n); + } + template <class T> + typename array<T>::const_reference array<T>::fast(long n) const + { + assert(n < size()); + return (*_data)[n]; + } + template <class T> + typename array<T>::const_reference array<T>::operator[](long n) const + { + if (n < 0) + n += size(); + assert(0 <= n && n < size()); + return fast(n); + } + + template <class T> + template <class Sp> + typename std::enable_if<is_slice<Sp>::value, sliced_array<T, Sp>>::type + array<T>::operator[](Sp const &s) const + { + return {*this, s}; + } + + // modifiers + template <class T> + template <class Tp> + void array<T>::push_back(Tp &&x) + { + // FIXME: clang-3.4 doesn't support emplace_back for vector of bool + _data->push_back(std::forward<Tp>(x)); + } + template <class T> + template <class Tp> + void array<T>::insert(long i, Tp &&x) + { + if (i == size()) + _data->emplace_back(std::forward<Tp>(x)); + else + _data->insert(_data->begin() + i, std::forward<Tp>(x)); + } + template <class T> + void array<T>::reserve(size_t n) + { + if (n > _data->capacity()) + _data->reserve((n / 2) * 3); + } + template <class T> + void array<T>::resize(size_t n) + { + _data->resize(n); + } + template <class T> + void array<T>::erase(size_t n) + { + _data->erase(_data->begin() + n); + } + template <class T> + T array<T>::pop(long x) + { + long sz = size(); + x = x % sz; + if (x < 0) + x += sz; + T res = fast(x); + erase(x); + return res; + } + template <class T> + void array<T>::clear() + { + _data->clear(); + } + + // TODO: have to raise a valueError + template <class T> + none_type array<T>::remove(T const &x) + { + erase(index(x)); + return {}; + } + + // Misc + template <class T> + long array<T>::index(T const &x) const + { + return std::find(begin(), end(), x) - begin(); + } + + // array interface + template <class T> + array<T>::operator bool() const + { + return !_data->empty(); + } + + template <class T> + template <class F> + array<typename __combined<T, F>::type> + array<T>::operator+(array<F> const &s) const + { + array<typename __combined<T, F>::type> clone(size() + s.size()); + std::copy(s.begin(), s.end(), std::copy(begin(), end(), clone.begin())); + return clone; + } + + template <class T> + template <class F, class S> + array<decltype(std::declval<T>() + + std::declval<typename sliced_array<F, S>::value_type>())> + array<T>::operator+(sliced_array<F, S> const &s) const + { + array<decltype(std::declval<T>() + + std::declval<typename sliced_array<F, S>::value_type>())> + clone(size() + len(s)); + std::copy(s.begin(), s.end(), std::copy(begin(), end(), clone.begin())); + return clone; + } + + template <class T> + array<T> array<T>::operator*(long n) const + { + if (size() == 1) { + return array<T>(fast(0), single_value{}, n); + } else { + array<T> r(size() * n); + auto start = r.begin(); + while (start != r.end()) + start = std::copy(this->begin(), this->end(), start); + return r; + } + } + template <class T> + array<T> const &array<T>::operator*=(long n) + { + if (size() == 1) { + resize(n); + std::fill(begin() + 1, end(), fast(0)); + } else { + auto const initial_size = size(); + resize(n * initial_size); + // FIXME: could use less calls to std::copy + auto tgt = begin() + initial_size; + for (long i = 1; i < n; ++i) + tgt = std::copy(begin(), begin() + initial_size, tgt); + } + return *this; + } + + template <class T> + template <class F> + array<T> &array<T>::operator+=(F const &s) + { + reserve(size() + s.size()); + std::copy(s.begin(), s.end(), std::back_inserter(*this)); + return *this; + } + + template <class T> + long array<T>::size() const + { + return _data->size(); + } + template <class T> + template <class E> + long array<T>::_flat_size(E const &e, utils::int_<1>) const + { + return std::distance(e.begin(), e.end()); + } + template <class T> + template <class E, size_t L> + long array<T>::_flat_size(E const &e, utils::int_<L>) const + { + return std::distance(e.begin(), e.end()) * + _flat_size(e[0], utils::int_<L - 1>{}); + } + template <class T> + long array<T>::flat_size() const + { + return _flat_size(*this, utils::int_<value>{}); + } + + template <class T> + template <class V> + bool array<T>::contains(V const &v) const + { + return std::find(_data->begin(), _data->end(), v) != _data->end(); + } + template <class T> + intptr_t array<T>::id() const + { + return reinterpret_cast<intptr_t>(&(*_data)); + } + + template <class T> + long array<T>::count(T const &x) const + { + return std::count(begin(), end(), x); + } + +} // namespace types + +namespace utils +{ + + template <class T, class From> + void reserve(types::array<T> &l, From const &f, + typename From::const_iterator *) + { + l.reserve(builtins::len(f)); + } +} // namespace utils +PYTHONIC_NS_END + +/* overload std::get */ +namespace std +{ + template <size_t I, class T> + typename pythonic::types::array<T>::reference + get(pythonic::types::array<T> &t) + { + return t[I]; + } + + template <size_t I, class T> + typename pythonic::types::array<T>::const_reference + get(pythonic::types::array<T> const &t) + { + return t[I]; + } + + template <size_t I, class T> + typename pythonic::types::array<T>::value_type + get(pythonic::types::array<T> &&t) + { + return std::move(t)[I]; + } + + template <size_t I, class T, class S> + typename pythonic::types::sliced_array<T, S>::reference + get(pythonic::types::sliced_array<T, S> &t) + { + return t[I]; + } + + template <size_t I, class T, class S> + typename pythonic::types::sliced_array<T, S>::const_reference + get(pythonic::types::sliced_array<T, S> const &t) + { + return t[I]; + } + + template <size_t I, class T, class S> + typename pythonic::types::sliced_array<T, S>::value_type + get(pythonic::types::sliced_array<T, S> &&t) + { + return std::move(t)[I]; + } +} // namespace std + +#ifdef ENABLE_PYTHON_MODULE + +PYTHONIC_NS_BEGIN + +template <class T> +PyObject *to_python<types::array<T>>::convert(types::array<T> const &v) +{ + throw types::NotImplementedError( + "Pythran cannot efficiently convert array::array values"); +} +template <class T, class S> +PyObject *to_python<types::sliced_array<T, S>>::convert( + types::sliced_array<T, S> const &v) +{ + throw types::NotImplementedError( + "Pythran cannot efficiently convert array::array values"); +} + +PYTHONIC_NS_END + +#endif + +#endif diff --git a/contrib/python/pythran/pythran/pythonic/types/bool.hpp b/contrib/python/pythran/pythran/pythonic/types/bool.hpp index 21456be410..35ac01d37d 100644 --- a/contrib/python/pythran/pythran/pythonic/types/bool.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/bool.hpp @@ -18,13 +18,17 @@ inline PyObject *to_python<bool>::convert(bool b) inline bool from_python<bool>::is_convertible(PyObject *obj) { - return obj == Py_True || obj == Py_False || PyObject_TypeCheck(obj, &PyBoolArrType_Type); + return obj == Py_True || obj == Py_False || + PyObject_TypeCheck(obj, &PyBoolArrType_Type); } inline bool from_python<bool>::convert(PyObject *obj) { - if(obj == Py_True) return true; - else if(obj == Py_False) return false; - else return PyInt_AsLong(obj); + if (obj == Py_True) + return true; + else if (obj == Py_False) + return false; + else + return PyInt_AsLong(obj); } PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/types/cfun.hpp b/contrib/python/pythran/pythran/pythonic/types/cfun.hpp index f5b355a258..058f7080ed 100644 --- a/contrib/python/pythran/pythran/pythonic/types/cfun.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/cfun.hpp @@ -8,8 +8,7 @@ PYTHONIC_NS_BEGIN namespace types { template <class ReturnType, class... ArgsType> - cfun<ReturnType(ArgsType...)>::cfun(ReturnType (*fun)(ArgsType...)) - : ptr(fun) + cfun<ReturnType(ArgsType...)>::cfun(ReturnType (*fun)(ArgsType...)) : ptr(fun) { } @@ -18,7 +17,7 @@ namespace types { return (*ptr)(args...); } -} +} // namespace types PYTHONIC_NS_END #ifdef ENABLE_PYTHON_MODULE diff --git a/contrib/python/pythran/pythran/pythonic/types/dynamic_tuple.hpp b/contrib/python/pythran/pythran/pythonic/types/dynamic_tuple.hpp index e20f08c03f..9e516b43f0 100644 --- a/contrib/python/pythran/pythran/pythonic/types/dynamic_tuple.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/dynamic_tuple.hpp @@ -4,12 +4,12 @@ #include "pythonic/include/types/dynamic_tuple.hpp" #include "pythonic/types/assignable.hpp" -#include "pythonic/types/traits.hpp" #include "pythonic/types/nditerator.hpp" +#include "pythonic/types/traits.hpp" #include "pythonic/utils/int_.hpp" +#include "pythonic/utils/nested_container.hpp" #include "pythonic/utils/seq.hpp" #include "pythonic/utils/shared_ref.hpp" -#include "pythonic/utils/nested_container.hpp" #include <algorithm> #include <functional> @@ -86,22 +86,22 @@ namespace types } template <typename T> - dynamic_tuple<T> dynamic_tuple<T>:: - operator+(dynamic_tuple<T> const &other) const + dynamic_tuple<T> + dynamic_tuple<T>::operator+(dynamic_tuple<T> const &other) const { dynamic_tuple<T> result(begin(), end()); result.data->resize(size() + other.size()); std::copy(other.begin(), other.end(), result.data->begin() + size()); return result; } -} +} // namespace types PYTHONIC_NS_END namespace std { template <class T> - size_t hash<pythonic::types::dynamic_tuple<T>>:: - operator()(pythonic::types::dynamic_tuple<T> const &l) const + size_t hash<pythonic::types::dynamic_tuple<T>>::operator()( + pythonic::types::dynamic_tuple<T> const &l) const { std::hash<T> hasher; size_t seed = 0x9e3779b9; @@ -109,12 +109,12 @@ namespace std seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2); return seed; } -} +} // namespace std #ifdef ENABLE_PYTHON_MODULE -#include "pythonic/include/utils/seq.hpp" #include "pythonic/include/utils/fwd.hpp" +#include "pythonic/include/utils/seq.hpp" #include "pythonic/python/core.hpp" PYTHONIC_NS_BEGIN diff --git a/contrib/python/pythran/pythran/pythonic/types/file.hpp b/contrib/python/pythran/pythran/pythonic/types/file.hpp index 04c72d4603..70c9bf2954 100644 --- a/contrib/python/pythran/pythran/pythonic/types/file.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/file.hpp @@ -173,6 +173,14 @@ namespace types return res; } + template <class T> + inline void file::read_as(long n, T *buffer) + { + if (fread(buffer, sizeof(T), n, **data) < size_t(n)) { + throw EOFError("read() didn't return enough bytes"); + } + } + inline types::str file::readline(long size) { if (!is_open) @@ -266,7 +274,7 @@ namespace types inline file_iterator::file_iterator() : f(nullptr), set(false), curr(), - position(std::numeric_limits<long>::max()){}; + position(std::numeric_limits<long>::max()) {}; inline bool file_iterator::operator==(file_iterator const &f2) const { diff --git a/contrib/python/pythran/pythran/pythonic/types/finfo.hpp b/contrib/python/pythran/pythran/pythonic/types/finfo.hpp index e3c3d7d278..348d3299be 100644 --- a/contrib/python/pythran/pythran/pythonic/types/finfo.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/finfo.hpp @@ -22,7 +22,7 @@ namespace types { return std::numeric_limits<T>::epsilon(); } -} +} // namespace types PYTHONIC_NS_END /* pythran attribute system { */ @@ -30,12 +30,12 @@ PYTHONIC_NS_BEGIN namespace builtins { template <class T> - auto getattr(types::attr::EPS, pythonic::types::finfo<T> const &f) - -> decltype(f.eps()) + auto getattr(types::attr::EPS, + pythonic::types::finfo<T> const &f) -> decltype(f.eps()) { return f.eps(); } -} +} // namespace builtins PYTHONIC_NS_END /* } */ #endif diff --git a/contrib/python/pythran/pythran/pythonic/types/generator.hpp b/contrib/python/pythran/pythran/pythonic/types/generator.hpp index 19f8efb53e..4a3ef67e74 100644 --- a/contrib/python/pythran/pythran/pythonic/types/generator.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/generator.hpp @@ -11,8 +11,7 @@ PYTHONIC_NS_BEGIN namespace types { template <class T> - generator_iterator<T>::generator_iterator() - : the_generator() + generator_iterator<T>::generator_iterator() : the_generator() { the_generator.__generator_state = -1; } // this represents the end @@ -41,8 +40,8 @@ namespace types } template <class T> - bool generator_iterator<T>:: - operator!=(generator_iterator<T> const &other) const + bool + generator_iterator<T>::operator!=(generator_iterator<T> const &other) const { assert(other.the_generator.__generator_state == -1 || the_generator.__generator_state == -1); @@ -51,8 +50,8 @@ namespace types } template <class T> - bool generator_iterator<T>:: - operator==(generator_iterator<T> const &other) const + bool + generator_iterator<T>::operator==(generator_iterator<T> const &other) const { assert(other.the_generator.__generator_state == -1 || the_generator.__generator_state == -1); @@ -61,15 +60,15 @@ namespace types } template <class T> - bool generator_iterator<T>:: - operator<(generator_iterator<T> const &other) const + bool + generator_iterator<T>::operator<(generator_iterator<T> const &other) const { assert(other.the_generator.__generator_state == -1 || the_generator.__generator_state == -1); return the_generator.__generator_state != other.the_generator.__generator_state; } -} +} // namespace types PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/types/list.hpp b/contrib/python/pythran/pythran/pythonic/types/list.hpp index 7f1de3c499..9c346b0705 100644 --- a/contrib/python/pythran/pythran/pythonic/types/list.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/list.hpp @@ -261,7 +261,7 @@ namespace types std::random_access_iterator_tag>::value) _data->reserve(std::distance(start, stop)); else - _data->reserve(DEFAULT_LIST_CAPACITY); + _data->reserve(DEFAULT_CAPACITY); std::copy(start, stop, std::back_inserter(*_data)); } template <class T> diff --git a/contrib/python/pythran/pythran/pythonic/types/ndarray.hpp b/contrib/python/pythran/pythran/pythonic/types/ndarray.hpp index 191933ccd6..d3fecbed70 100644 --- a/contrib/python/pythran/pythran/pythonic/types/ndarray.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/ndarray.hpp @@ -73,10 +73,10 @@ PYTHONIC_NS_BEGIN namespace types { template <class pS, size_t... Is> - array<long, std::tuple_size<pS>::value> + array_tuple<long, std::tuple_size<pS>::value> make_strides(pS const &shape, utils::index_sequence<Is...>) { - array<long, std::tuple_size<pS>::value> out; + array_tuple<long, std::tuple_size<pS>::value> out; out[std::tuple_size<pS>::value - 1] = 1; (void)std::initializer_list<long>{ (out[std::tuple_size<pS>::value - Is - 2] = @@ -86,7 +86,7 @@ namespace types } template <class pS> - array<long, std::tuple_size<pS>::value> make_strides(pS const &shape) + array_tuple<long, std::tuple_size<pS>::value> make_strides(pS const &shape) { return make_strides( shape, utils::make_index_sequence<std::tuple_size<pS>::value - 1>()); @@ -226,24 +226,24 @@ namespace types } template <class T, class pS> - typename type_helper<ndarray<T, array<pS, 1>>>::iterator - type_helper<ndarray<T, array<pS, 1>>>::make_iterator( - ndarray<T, array<pS, 1>> &n, long i) + typename type_helper<ndarray<T, array_tuple<pS, 1>>>::iterator + type_helper<ndarray<T, array_tuple<pS, 1>>>::make_iterator( + ndarray<T, array_tuple<pS, 1>> &n, long i) { return n.buffer + i; } template <class T, class pS> - typename type_helper<ndarray<T, array<pS, 1>>>::const_iterator - type_helper<ndarray<T, array<pS, 1>>>::make_iterator( - ndarray<T, array<pS, 1>> const &n, long i) + typename type_helper<ndarray<T, array_tuple<pS, 1>>>::const_iterator + type_helper<ndarray<T, array_tuple<pS, 1>>>::make_iterator( + ndarray<T, array_tuple<pS, 1>> const &n, long i) { return n.buffer + i; } template <class T, class pS> template <class S, class Iter> - T *type_helper<ndarray<T, array<pS, 1>>>::initialize_from_iterable( + T *type_helper<ndarray<T, array_tuple<pS, 1>>>::initialize_from_iterable( S &shape, T *from, Iter &&iter) { sutils::assign(std::get<std::tuple_size<S>::value - 1>(shape), iter.size()); @@ -251,41 +251,41 @@ namespace types } template <class T, class pS> - typename type_helper<ndarray<T, array<pS, 1>>>::type - type_helper<ndarray<T, array<pS, 1>>>::get(ndarray<T, array<pS, 1>> &&self, - long i) + typename type_helper<ndarray<T, array_tuple<pS, 1>>>::type + type_helper<ndarray<T, array_tuple<pS, 1>>>::get( + ndarray<T, array_tuple<pS, 1>> &&self, long i) { return self.buffer[i]; } template <class T, class pS> - typename type_helper<ndarray<T, array<pS, 1>> const &>::iterator - type_helper<ndarray<T, array<pS, 1>> const &>::make_iterator( - ndarray<T, array<pS, 1>> &n, long i) + typename type_helper<ndarray<T, array_tuple<pS, 1>> const &>::iterator + type_helper<ndarray<T, array_tuple<pS, 1>> const &>::make_iterator( + ndarray<T, array_tuple<pS, 1>> &n, long i) { return n.buffer + i; } template <class T, class pS> - typename type_helper<ndarray<T, array<pS, 1>> const &>::const_iterator - make_iterator(ndarray<T, array<pS, 1>> const &n, long i) + typename type_helper<ndarray<T, array_tuple<pS, 1>> const &>::const_iterator + make_iterator(ndarray<T, array_tuple<pS, 1>> const &n, long i) { return n.buffer + i; } template <class T, class pS> template <class S, class Iter> - T *type_helper<ndarray<T, array<pS, 1>> const &>::initialize_from_iterable( - S &shape, T *from, Iter &&iter) + T *type_helper<ndarray<T, array_tuple<pS, 1>> const &>:: + initialize_from_iterable(S &shape, T *from, Iter &&iter) { sutils::assign(std::get<std::tuple_size<S>::value - 1>(shape), iter.size()); return std::copy(iter.begin(), iter.end(), from); } template <class T, class pS> - typename type_helper<ndarray<T, array<pS, 1>> const &>::type & - type_helper<ndarray<T, array<pS, 1>> const &>::get( - ndarray<T, array<pS, 1>> const &self, long i) + typename type_helper<ndarray<T, array_tuple<pS, 1>> const &>::type & + type_helper<ndarray<T, array_tuple<pS, 1>> const &>::get( + ndarray<T, array_tuple<pS, 1>> const &self, long i) { return self.buffer[i]; } @@ -303,7 +303,7 @@ namespace types template <size_t L> template <class S, class Ty, size_t M> long noffset<L>::operator()(S const &strides, - array<Ty, M> const &indices) const + array_tuple<Ty, M> const &indices) const { auto index = patch_index( indices[M - L], @@ -315,7 +315,8 @@ namespace types template <size_t L> template <class S, class Ty, size_t M, class pS> - long noffset<L>::operator()(S const &strides, array<Ty, M> const &indices, + long noffset<L>::operator()(S const &strides, + array_tuple<Ty, M> const &indices, pS const &shape) const { auto index = patch_index( @@ -332,7 +333,7 @@ namespace types template <> template <class S, class Ty, size_t M> long noffset<1>::operator()(S const &strides, - array<Ty, M> const &indices) const + array_tuple<Ty, M> const &indices) const { auto index = patch_index( indices[M - 1], @@ -342,7 +343,8 @@ namespace types template <> template <class S, class Ty, size_t M, class pS> - long noffset<1>::operator()(S const &strides, array<Ty, M> const &indices, + long noffset<1>::operator()(S const &strides, + array_tuple<Ty, M> const &indices, pS const &shape) const { auto index = patch_index( @@ -603,7 +605,7 @@ namespace types template <class T, class pS> template <class Ty> typename std::enable_if<std::is_integral<Ty>::value, T &>::type - ndarray<T, pS>::fast(array<Ty, value> const &indices) + ndarray<T, pS>::fast(array_tuple<Ty, value> const &indices) { assert(inbound_indices(indices)); return *(buffer + noffset<std::tuple_size<pS>::value>{}(*this, indices)); @@ -612,7 +614,7 @@ namespace types template <class T, class pS> template <class Ty> typename std::enable_if<std::is_integral<Ty>::value, T>::type - ndarray<T, pS>::fast(array<Ty, value> const &indices) const + ndarray<T, pS>::fast(array_tuple<Ty, value> const &indices) const { assert(inbound_indices(indices)); return *(buffer + noffset<std::tuple_size<pS>::value>{}(*this, indices)); @@ -620,7 +622,7 @@ namespace types template <class T, class pS> template <class Ty, size_t M> - auto ndarray<T, pS>::fast(array<Ty, M> const &indices) const & -> + auto ndarray<T, pS>::fast(array_tuple<Ty, M> const &indices) const & -> typename std::enable_if<std::is_integral<Ty>::value, decltype(nget<M - 1>().fast(*this, indices))>::type @@ -630,7 +632,7 @@ namespace types template <class T, class pS> template <class Ty, size_t M> - auto ndarray<T, pS>::fast(array<Ty, M> const &indices) && -> + auto ndarray<T, pS>::fast(array_tuple<Ty, M> const &indices) && -> typename std::enable_if<std::is_integral<Ty>::value, decltype(nget<M - 1>().fast(std::move(*this), indices))>::type @@ -641,7 +643,7 @@ namespace types template <class T, class pS> template <class Ty> typename std::enable_if<std::is_integral<Ty>::value, T const &>::type - ndarray<T, pS>::operator[](array<Ty, value> const &indices) const + ndarray<T, pS>::operator[](array_tuple<Ty, value> const &indices) const { return *(buffer + noffset<std::tuple_size<pS>::value>{}(*this, indices, _shape)); @@ -650,7 +652,7 @@ namespace types template <class T, class pS> template <class Ty> typename std::enable_if<std::is_integral<Ty>::value, T &>::type - ndarray<T, pS>::operator[](array<Ty, value> const &indices) + ndarray<T, pS>::operator[](array_tuple<Ty, value> const &indices) { return *(buffer + noffset<std::tuple_size<pS>::value>{}(*this, indices, _shape)); @@ -658,7 +660,7 @@ namespace types template <class T, class pS> template <class Ty, size_t M> - auto ndarray<T, pS>::operator[](array<Ty, M> const &indices) const & -> + auto ndarray<T, pS>::operator[](array_tuple<Ty, M> const &indices) const & -> typename std::enable_if<std::is_integral<Ty>::value, decltype(nget<M - 1>()(*this, indices))>::type { @@ -667,7 +669,7 @@ namespace types template <class T, class pS> template <class Ty, size_t M> - auto ndarray<T, pS>::operator[](array<Ty, M> const &indices) && -> + auto ndarray<T, pS>::operator[](array_tuple<Ty, M> const &indices) && -> typename std::enable_if<std::is_integral<Ty>::value, decltype(nget<M - 1>()(std::move(*this), indices))>::type @@ -755,7 +757,7 @@ namespace types template <class S0, class... S> auto ndarray<T, pS>::operator()(S0 const &s0, S const &...s) && -> decltype(extended_slice<count_new_axis<S0, S...>::value>{}( - std::move(*this), s0, s...)) + std::move(*this), s0, s...)) { return extended_slice<count_new_axis<S0, S...>::value>{}(std::move(*this), s0, s...); @@ -844,9 +846,9 @@ namespace types template <class T, class pS> template <class Ty0, class Ty1, class... Tys, class _> - auto - ndarray<T, pS>::operator[](std::tuple<Ty0, Ty1, Tys...> const &indices) const - -> typename std::enable_if< + auto ndarray<T, pS>::operator[]( + std::tuple<Ty0, Ty1, Tys...> const &indices) const -> + typename std::enable_if< is_numexpr_arg<Ty0>::value, decltype(this->_fwdindex( indices, utils::make_index_sequence<2 + sizeof...(Tys)>()))>::type @@ -1068,10 +1070,11 @@ namespace std { template <size_t I, class E> - auto get(E &&a) -> typename std::enable_if< - pythonic::types::is_array<typename std::remove_cv< - typename std::remove_reference<E>::type>::type>::value, - decltype(std::forward<E>(a)[I])>::type + auto get(E &&a) -> + typename std::enable_if< + pythonic::types::is_array<typename std::remove_cv< + typename std::remove_reference<E>::type>::type>::value, + decltype(std::forward<E>(a)[I])>::type { return std::forward<E>(a)[I]; } @@ -1095,9 +1098,8 @@ namespace builtins } template <class E, class... S> - auto - _build_gexpr<1>::operator()(E const &a, S const &...slices) - -> decltype(E(a)(slices...)) + auto _build_gexpr<1>::operator()(E const &a, S const &...slices) + -> decltype(E(a)(slices...)) { return E(a)(slices...); } @@ -1112,7 +1114,7 @@ namespace builtins auto _make_real(E const &a, utils::int_<1>) -> decltype(_build_gexpr<E::value>{}( types::ndarray<typename types::is_complex<typename E::dtype>::type, - types::array<long, E::value>>{}, + types::array_tuple<long, E::value>>{}, types::slice())) { using stype = typename types::is_complex<typename E::dtype>::type; @@ -1122,7 +1124,7 @@ namespace builtins auto translated_mem = reinterpret_cast<utils::shared_ref<types::raw_array<stype>> const &>( a.mem); - types::ndarray<stype, types::array<long, E::value>> translated{ + types::ndarray<stype, types::array_tuple<long, E::value>> translated{ translated_mem, new_shape}; return _build_gexpr<E::value>{}( translated, types::slice{0, std::get<E::value - 1>(new_shape), 2}); @@ -1144,19 +1146,22 @@ namespace builtins template <class E> auto _make_real(types::numpy_iexpr<E> const &a, utils::int_<1>) -> decltype(_build_gexpr<types::numpy_iexpr<E>::value>{}( - std::declval<types::ndarray<typename types::is_complex<typename types::numpy_iexpr<E>::dtype>::type, - types::array<long, types::numpy_iexpr<E>::value + 1>>>(), + std::declval<types::ndarray< + typename types::is_complex< + typename types::numpy_iexpr<E>::dtype>::type, + types::array_tuple<long, types::numpy_iexpr<E>::value + 1>>>(), long(), types::slice())) { constexpr size_t value = types::numpy_iexpr<E>::value; - using stype = typename types::is_complex<typename types::numpy_iexpr<E>::dtype>::type; + using stype = typename types::is_complex< + typename types::numpy_iexpr<E>::dtype>::type; auto new_shape = sutils::getshape(a.arg); std::get<value>(new_shape) *= 2; // this is tricky and dangerous! auto translated_mem = reinterpret_cast<utils::shared_ref<types::raw_array<stype>> const &>( a.arg.mem); - types::ndarray<stype, types::array<long, value + 1>> translated{ + types::ndarray<stype, types::array_tuple<long, value + 1>> translated{ translated_mem, new_shape}; long offset = (a.buffer - a.arg.buffer) / a.arg.template strides<0>(); return _build_gexpr<value>{}( @@ -1188,19 +1193,22 @@ namespace builtins template <class E> auto _make_imag(types::numpy_iexpr<E> const &a, utils::int_<1>) -> decltype(_build_gexpr<types::numpy_iexpr<E>::value>{}( - std::declval<types::ndarray<typename types::is_complex<typename types::numpy_iexpr<E>::dtype>::type, - types::array<long, types::numpy_iexpr<E>::value + 1>>>(), + std::declval<types::ndarray< + typename types::is_complex< + typename types::numpy_iexpr<E>::dtype>::type, + types::array_tuple<long, types::numpy_iexpr<E>::value + 1>>>(), long(), types::slice())) { constexpr size_t value = types::numpy_iexpr<E>::value; - using stype = typename types::is_complex<typename types::numpy_iexpr<E>::dtype>::type; + using stype = typename types::is_complex< + typename types::numpy_iexpr<E>::dtype>::type; auto new_shape = sutils::getshape(a.arg); std::get<types::numpy_iexpr<E>::value>(new_shape) *= 2; // this is tricky and dangerous! auto translated_mem = reinterpret_cast<utils::shared_ref<types::raw_array<stype>> const &>( a.arg.mem); - types::ndarray<stype, types::array<long, value + 1>> translated{ + types::ndarray<stype, types::array_tuple<long, value + 1>> translated{ translated_mem, new_shape}; long offset = (a.buffer - a.arg.buffer) / a.arg.template strides<0>(); return _build_gexpr<value>{}( @@ -1211,7 +1219,7 @@ namespace builtins auto _make_imag(E const &a, utils::int_<1>) -> decltype(_build_gexpr<E::value>{}( types::ndarray<typename types::is_complex<typename E::dtype>::type, - types::array<long, E::value>>{}, + types::array_tuple<long, E::value>>{}, types::slice())) { using stype = typename types::is_complex<typename E::dtype>::type; @@ -1221,7 +1229,7 @@ namespace builtins auto translated_mem = reinterpret_cast<utils::shared_ref<types::raw_array<stype>> const &>( a.mem); - types::ndarray<stype, types::array<long, E::value>> translated{ + types::ndarray<stype, types::array_tuple<long, E::value>> translated{ translated_mem, new_shape}; return _build_gexpr<E::value>{}( translated, types::slice{1, std::get<E::value - 1>(new_shape), 2}); @@ -1229,7 +1237,7 @@ namespace builtins } // namespace details template <class E> - types::array<long, E::value> getattr(types::attr::SHAPE, E const &a) + types::array_tuple<long, E::value> getattr(types::attr::SHAPE, E const &a) { return sutils::getshape(a); } @@ -1247,9 +1255,9 @@ namespace builtins } template <class E> - types::array<long, E::value> getattr(types::attr::STRIDES, E const &a) + types::array_tuple<long, E::value> getattr(types::attr::STRIDES, E const &a) { - types::array<long, E::value> strides; + types::array_tuple<long, E::value> strides; strides[E::value - 1] = sizeof(typename E::dtype); auto shape = sutils::getshape(a); std::transform(strides.rbegin(), strides.rend() - 1, shape.rbegin(), @@ -1303,8 +1311,9 @@ namespace builtins typename types::numpy_iexpr<E>::dtype>::value>{})) { return details::_make_real( - e, utils::int_<types::is_complex< - typename types::numpy_iexpr<E>::dtype>::value>{}); + e, + utils::int_< + types::is_complex<typename types::numpy_iexpr<E>::dtype>::value>{}); } template <class Op, class... Args> @@ -1554,7 +1563,7 @@ namespace impl template <class pS, class T, size_t... Is> bool check_shape(T const *dims, utils::index_sequence<Is...>) { - types::array<bool, sizeof...(Is)> dims_match = { + types::array_tuple<bool, sizeof...(Is)> dims_match = { (is_integral_constant<typename std::tuple_element<Is, pS>::type>::value ? (dims[Is] == std::conditional< diff --git a/contrib/python/pythran/pythran/pythonic/types/nditerator.hpp b/contrib/python/pythran/pythran/pythonic/types/nditerator.hpp index e809776c0e..2cb2b90479 100644 --- a/contrib/python/pythran/pythran/pythonic/types/nditerator.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/nditerator.hpp @@ -13,8 +13,7 @@ namespace types /* Iterator over whatever provides a fast(long) method to access its element */ template <class E> - nditerator<E>::nditerator(E &data, long index) - : data(data), index(index) + nditerator<E>::nditerator(E &data, long index) : data(data), index(index) { } @@ -190,8 +189,8 @@ namespace types } template <class E> - const_nditerator<E> &const_nditerator<E>:: - operator=(const_nditerator const &other) + const_nditerator<E> & + const_nditerator<E>::operator=(const_nditerator const &other) { index = other.index; return *this; @@ -245,36 +244,36 @@ namespace types } template <class E> - long const_simd_nditerator<E>:: - operator-(const_simd_nditerator<E> const &other) const + long const_simd_nditerator<E>::operator-( + const_simd_nditerator<E> const &other) const { return (data - other.data) / vector_size; } template <class E> - bool const_simd_nditerator<E>:: - operator!=(const_simd_nditerator<E> const &other) const + bool const_simd_nditerator<E>::operator!=( + const_simd_nditerator<E> const &other) const { return data != other.data; } template <class E> - bool const_simd_nditerator<E>:: - operator==(const_simd_nditerator<E> const &other) const + bool const_simd_nditerator<E>::operator==( + const_simd_nditerator<E> const &other) const { return data == other.data; } template <class E> - bool const_simd_nditerator<E>:: - operator<(const_simd_nditerator<E> const &other) const + bool const_simd_nditerator<E>::operator<( + const_simd_nditerator<E> const &other) const { return data < other.data; } template <class E> - const_simd_nditerator<E> &const_simd_nditerator<E>:: - operator=(const_simd_nditerator const &other) + const_simd_nditerator<E> & + const_simd_nditerator<E>::operator=(const_simd_nditerator const &other) { data = other.data; return *this; @@ -305,12 +304,12 @@ namespace types } template <class T> - typename T::dtype const *make_const_nditerator<false>:: - operator()(T const &self, long i) const + typename T::dtype const * + make_const_nditerator<false>::operator()(T const &self, long i) const { return self.buffer + i; } -} +} // namespace types PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/types/numpy_broadcast.hpp b/contrib/python/pythran/pythran/pythonic/types/numpy_broadcast.hpp index 31b1cd8be0..6f63445a09 100644 --- a/contrib/python/pythran/pythran/pythonic/types/numpy_broadcast.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/numpy_broadcast.hpp @@ -97,7 +97,7 @@ namespace types template <class T, class B> template <size_t N> typename broadcast<T, B>::dtype - broadcast<T, B>::operator[](array<long, N>) const + broadcast<T, B>::operator[](array_tuple<long, N>) const { return _base._value; } diff --git a/contrib/python/pythran/pythran/pythonic/types/numpy_expr.hpp b/contrib/python/pythran/pythran/pythonic/types/numpy_expr.hpp index 9f139ffe08..20331cd9a9 100644 --- a/contrib/python/pythran/pythran/pythonic/types/numpy_expr.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/numpy_expr.hpp @@ -205,17 +205,17 @@ namespace types template <class... Indices> auto numpy_expr<Op, Args...>::map_fast(Indices... indices) const -> decltype(this->_map_fast( - array<long, sizeof...(Indices)>{{indices...}}, + array_tuple<long, sizeof...(Indices)>{{indices...}}, utils::make_index_sequence<sizeof...(Args)>{})) { static_assert(sizeof...(Indices) == sizeof...(Args), "compatible call"); - return _map_fast(array<long, sizeof...(Indices)>{{indices...}}, + return _map_fast(array_tuple<long, sizeof...(Indices)>{{indices...}}, utils::make_index_sequence<sizeof...(Args)>{}); } template <class Op, class... Args> - auto numpy_expr<Op, Args...>::operator[](long i) const - -> decltype(this->fast(i)) + auto + numpy_expr<Op, Args...>::operator[](long i) const -> decltype(this->fast(i)) { if (i < 0) i += size(); @@ -367,7 +367,7 @@ namespace types if (sutils::any_of(*this, [](long n) { return n != 1; })) throw ValueError("The truth value of an array with more than one element " "is ambiguous. Use a.any() or a.all()"); - array<long, value> first = {0}; + array_tuple<long, value> first = {0}; return operator[](first); } diff --git a/contrib/python/pythran/pythran/pythonic/types/numpy_gexpr.hpp b/contrib/python/pythran/pythran/pythonic/types/numpy_gexpr.hpp index 88afc93f7f..f5b61fdf4a 100644 --- a/contrib/python/pythran/pythran/pythonic/types/numpy_gexpr.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/numpy_gexpr.hpp @@ -472,6 +472,13 @@ namespace types numpy_gexpr<Arg, S...> &>::type numpy_gexpr<Arg, S...>::_copy(E const &expr) { + return _copy_restrict(expr); + } + + template <class Arg, class... S> + template <class E> + numpy_gexpr<Arg, S...> &numpy_gexpr<Arg, S...>::_copy_restrict(E const &expr) + { constexpr bool vectorize = is_vectorizable && std::is_same<dtype, typename dtype_of<E>::type>::value && @@ -727,8 +734,8 @@ namespace types #endif template <class Arg, class... S> - auto numpy_gexpr<Arg, S...>::operator[](long i) const - -> decltype(this->fast(i)) + auto + numpy_gexpr<Arg, S...>::operator[](long i) const -> decltype(this->fast(i)) { if (i < 0) i += std::get<0>(_shape); @@ -762,7 +769,7 @@ namespace types template <class Arg, class... S> template <size_t M> - auto numpy_gexpr<Arg, S...>::fast(array<long, M> const &indices) + auto numpy_gexpr<Arg, S...>::fast(array_tuple<long, M> const &indices) const & -> decltype(nget<M - 1>().fast(*this, indices)) { return nget<M - 1>().fast(*this, indices); @@ -770,7 +777,7 @@ namespace types template <class Arg, class... S> template <size_t M> - auto numpy_gexpr<Arg, S...>::fast(array<long, M> const &indices) + auto numpy_gexpr<Arg, S...>::fast(array_tuple<long, M> const &indices) && -> decltype(nget<M - 1>().fast(std::move(*this), indices)) { return nget<M - 1>().fast(std::move(*this), indices); @@ -778,7 +785,7 @@ namespace types template <class Arg, class... S> template <size_t M> - auto numpy_gexpr<Arg, S...>::operator[](array<long, M> const &indices) + auto numpy_gexpr<Arg, S...>::operator[](array_tuple<long, M> const &indices) const & -> decltype(nget<M - 1>()(*this, indices)) { return nget<M - 1>()(*this, indices); @@ -786,7 +793,7 @@ namespace types template <class Arg, class... S> template <size_t M> - auto numpy_gexpr<Arg, S...>::operator[](array<long, M> const &indices) + auto numpy_gexpr<Arg, S...>::operator[](array_tuple<long, M> const &indices) && -> decltype(nget<M - 1>()(std::move(*this), indices)) { return nget<M - 1>()(std::move(*this), indices); diff --git a/contrib/python/pythran/pythran/pythonic/types/numpy_iexpr.hpp b/contrib/python/pythran/pythran/pythonic/types/numpy_iexpr.hpp index 7489974e8d..d4faef6489 100644 --- a/contrib/python/pythran/pythran/pythonic/types/numpy_iexpr.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/numpy_iexpr.hpp @@ -283,7 +283,7 @@ namespace types template <class Arg> typename numpy_iexpr<Arg>::dtype const & - numpy_iexpr<Arg>::fast(array<long, value> const &indices) const + numpy_iexpr<Arg>::fast(array_tuple<long, value> const &indices) const { return buffer[compute_fast_offset( indices[value - 1], arg.template shape<value>(), indices, arg, @@ -292,7 +292,7 @@ namespace types template <class Arg> typename numpy_iexpr<Arg>::dtype & - numpy_iexpr<Arg>::fast(array<long, value> const &indices) + numpy_iexpr<Arg>::fast(array_tuple<long, value> const &indices) { return const_cast<dtype &>( const_cast<numpy_iexpr const &>(*this).fast(indices)); @@ -413,7 +413,7 @@ namespace types template <class Arg> typename numpy_iexpr<Arg>::dtype const & - numpy_iexpr<Arg>::operator[](array<long, value> const &indices) const + numpy_iexpr<Arg>::operator[](array_tuple<long, value> const &indices) const { return buffer[compute_offset(indices[value - 1] < 0 ? indices[value - 1] + @@ -425,7 +425,7 @@ namespace types template <class Arg> typename numpy_iexpr<Arg>::dtype & - numpy_iexpr<Arg>::operator[](array<long, value> const &indices) + numpy_iexpr<Arg>::operator[](array_tuple<long, value> const &indices) { return const_cast<dtype &>(const_cast<numpy_iexpr const &>(*this)[indices]); } diff --git a/contrib/python/pythran/pythran/pythonic/types/numpy_nary_expr.hpp b/contrib/python/pythran/pythran/pythonic/types/numpy_nary_expr.hpp index 6a8724b35f..66644875fc 100644 --- a/contrib/python/pythran/pythran/pythonic/types/numpy_nary_expr.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/numpy_nary_expr.hpp @@ -18,10 +18,11 @@ namespace functor { template <typename... T> - auto NUMPY_NARY_FUNC_NAME:: - operator()(T &&... args) const -> typename std::enable_if< - !types::valid_numexpr_parameters<typename std::decay<T>::type...>::value, - decltype(NUMPY_NARY_FUNC_SYM(std::forward<T>(args)...))>::type + auto NUMPY_NARY_FUNC_NAME::operator()(T &&...args) const -> + typename std::enable_if< + !types::valid_numexpr_parameters< + typename std::decay<T>::type...>::value, + decltype(NUMPY_NARY_FUNC_SYM(std::forward<T>(args)...))>::type { return NUMPY_NARY_FUNC_SYM(std::forward<T>(args)...); } @@ -32,12 +33,11 @@ namespace functor types::numpy_expr< NUMPY_NARY_FUNC_NAME, typename types::NUMPY_NARY_RESHAPE_MODE<E, E...>::type...>>::type - NUMPY_NARY_FUNC_NAME:: - operator()(E &&... args) const + NUMPY_NARY_FUNC_NAME::operator()(E &&...args) const { return {std::forward<E>(args)...}; } -} +} // namespace functor #undef NUMPY_NARY_FUNC_NAME #undef NUMPY_NARY_FUNC_SYM diff --git a/contrib/python/pythran/pythran/pythonic/types/numpy_operators.hpp b/contrib/python/pythran/pythran/pythonic/types/numpy_operators.hpp index 2da2315945..836613246a 100644 --- a/contrib/python/pythran/pythran/pythonic/types/numpy_operators.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/numpy_operators.hpp @@ -3,27 +3,27 @@ #include "pythonic/include/types/numpy_operators.hpp" -#include "pythonic/types/numpy_broadcast.hpp" +#include "pythonic/numpy/bitwise_not.hpp" +#include "pythonic/numpy/mod.hpp" #include "pythonic/operator_/add.hpp" #include "pythonic/operator_/and_.hpp" -#include "pythonic/operator_/or_.hpp" -#include "pythonic/operator_/xor_.hpp" #include "pythonic/operator_/div.hpp" #include "pythonic/operator_/eq.hpp" -#include "pythonic/operator_/gt.hpp" #include "pythonic/operator_/ge.hpp" +#include "pythonic/operator_/gt.hpp" +#include "pythonic/operator_/le.hpp" #include "pythonic/operator_/lshift.hpp" #include "pythonic/operator_/lt.hpp" -#include "pythonic/operator_/le.hpp" #include "pythonic/operator_/mul.hpp" +#include "pythonic/operator_/ne.hpp" #include "pythonic/operator_/neg.hpp" #include "pythonic/operator_/not_.hpp" -#include "pythonic/operator_/ne.hpp" +#include "pythonic/operator_/or_.hpp" #include "pythonic/operator_/pos.hpp" #include "pythonic/operator_/rshift.hpp" #include "pythonic/operator_/sub.hpp" -#include "pythonic/numpy/mod.hpp" -#include "pythonic/numpy/bitwise_not.hpp" +#include "pythonic/operator_/xor_.hpp" +#include "pythonic/types/numpy_broadcast.hpp" #include "pythonic/types/numpy_op_helper.hpp" PYTHONIC_NS_BEGIN @@ -109,7 +109,7 @@ namespace types #define NUMPY_BINARY_FUNC_NAME operator- #define NUMPY_BINARY_FUNC_SYM operator_::functor::sub #include "pythonic/types/numpy_binary_op.hpp" -} +} // namespace types PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/types/numpy_texpr.hpp b/contrib/python/pythran/pythran/pythonic/types/numpy_texpr.hpp index 5de28bf7a5..47c47881b6 100644 --- a/contrib/python/pythran/pythran/pythonic/types/numpy_texpr.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/numpy_texpr.hpp @@ -113,10 +113,11 @@ namespace types template <class E> template <class S> - auto numpy_texpr_2<E>::operator[](S const &s0) const -> numpy_texpr< - decltype(this->arg(fast_contiguous_slice(pythonic::builtins::None, - pythonic::builtins::None), - (s0.step, s0)))> + auto numpy_texpr_2<E>::operator[](S const &s0) const + -> numpy_texpr< + decltype(this->arg(fast_contiguous_slice(pythonic::builtins::None, + pythonic::builtins::None), + (s0.step, s0)))> { return {arg(fast_contiguous_slice(pythonic::builtins::None, pythonic::builtins::None), @@ -125,10 +126,11 @@ namespace types template <class E> template <class S> - auto - numpy_texpr_2<E>::operator[](S const &s0) -> numpy_texpr<decltype(this->arg( - fast_contiguous_slice(pythonic::builtins::None, pythonic::builtins::None), - (s0.step, s0)))> + auto numpy_texpr_2<E>::operator[](S const &s0) + -> numpy_texpr< + decltype(this->arg(fast_contiguous_slice(pythonic::builtins::None, + pythonic::builtins::None), + (s0.step, s0)))> { return {arg(fast_contiguous_slice(pythonic::builtins::None, pythonic::builtins::None), @@ -360,9 +362,9 @@ namespace types } template <class T> - numpy_texpr<ndarray<T, array<long, 2>>>::numpy_texpr( - ndarray<T, array<long, 2>> const &arg) - : numpy_texpr_2<ndarray<T, array<long, 2>>>{arg} + numpy_texpr<ndarray<T, array_tuple<long, 2>>>::numpy_texpr( + ndarray<T, array_tuple<long, 2>> const &arg) + : numpy_texpr_2<ndarray<T, array_tuple<long, 2>>>{arg} { } diff --git a/contrib/python/pythran/pythran/pythonic/types/numpy_vexpr.hpp b/contrib/python/pythran/pythran/pythonic/types/numpy_vexpr.hpp index 889420b93c..9bb66b6e17 100644 --- a/contrib/python/pythran/pythran/pythonic/types/numpy_vexpr.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/numpy_vexpr.hpp @@ -61,9 +61,9 @@ namespace types template <class T, class F> template <class... S> auto numpy_vexpr<T, F>::operator()(S const &...slices) const - -> decltype(ndarray<dtype, array<long, value>>{*this}(slices...)) + -> decltype(ndarray<dtype, array_tuple<long, value>>{*this}(slices...)) { - return ndarray<dtype, array<long, value>>{*this}(slices...); + return ndarray<dtype, array_tuple<long, value>>{*this}(slices...); } #ifdef USE_XSIMD template <class T, class F> diff --git a/contrib/python/pythran/pythran/pythonic/types/pointer.hpp b/contrib/python/pythran/pythran/pythonic/types/pointer.hpp index 7cca903197..b55efcdf57 100644 --- a/contrib/python/pythran/pythran/pythonic/types/pointer.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/pointer.hpp @@ -31,7 +31,7 @@ namespace types { return data[i]; } -} +} // namespace types PYTHONIC_NS_END namespace std @@ -56,7 +56,7 @@ namespace std { return t[I]; } -} +} // namespace std #ifdef ENABLE_PYTHON_MODULE diff --git a/contrib/python/pythran/pythran/pythonic/types/str.hpp b/contrib/python/pythran/pythran/pythonic/types/str.hpp index 1f7a9816a3..e5dbe6083b 100644 --- a/contrib/python/pythran/pythran/pythonic/types/str.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/str.hpp @@ -689,8 +689,8 @@ namespace operator_ { template <size_t N, class Arg> - auto mod(const char (&fmt)[N], Arg &&arg) - -> decltype(types::str(fmt) % std::forward<Arg>(arg)) + auto mod(const char (&fmt)[N], + Arg &&arg) -> decltype(types::str(fmt) % std::forward<Arg>(arg)) { return types::str(fmt) % std::forward<Arg>(arg); } diff --git a/contrib/python/pythran/pythran/pythonic/types/tuple.hpp b/contrib/python/pythran/pythran/pythonic/types/tuple.hpp index 0316b52c87..a91670a2f1 100644 --- a/contrib/python/pythran/pythran/pythonic/types/tuple.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/tuple.hpp @@ -403,25 +403,25 @@ namespace types } template <class T, size_t N> - dynamic_tuple<T> array_base_slicer::operator()(array<T, N> const &b, + dynamic_tuple<T> array_base_slicer::operator()(array_tuple<T, N> const &b, slice const &s) { normalized_slice ns = s.normalize(b.size()); - array<T, N> tmp; + array_tuple<T, N> tmp; for (long j = 0; j < ns.size(); ++j) tmp[j] = b[ns.lower + j * ns.step]; return {&tmp[0], &tmp[ns.size()]}; } template <class T, size_t N, long stride> - dynamic_tuple<T> array_base_slicer::operator()(array<T, N> const &b, + dynamic_tuple<T> array_base_slicer::operator()(array_tuple<T, N> const &b, cstride_slice<stride> const &s) { auto ns = s.normalize(b.size()); if (stride == 1) { return {&b[ns.lower], &b[ns.upper]}; } else { - array<T, N> tmp; + array_tuple<T, N> tmp; for (long j = 0; j < ns.size(); ++j) tmp[j] = b[ns.lower + j * ns.step]; return {&tmp[0], &tmp[ns.size()]}; @@ -429,7 +429,7 @@ namespace types } template <class T, size_t N> - dynamic_tuple<T> array_base_slicer::operator()(array<T, N> const &b, + dynamic_tuple<T> array_base_slicer::operator()(array_tuple<T, N> const &b, fast_contiguous_slice const &s) { auto cns = s.normalize(b.size()); @@ -569,8 +569,8 @@ to_python<std::tuple<Types...>>::convert(std::tuple<Types...> const &t) template <typename T, size_t N> template <size_t... S> -PyObject *to_python<types::array<T, N>>::do_convert(types::array<T, N> const &t, - utils::index_sequence<S...>) +PyObject *to_python<types::array_tuple<T, N>>::do_convert( + types::array_tuple<T, N> const &t, utils::index_sequence<S...>) { PyObject *out = PyTuple_New(N); (void)std::initializer_list<bool>{ @@ -590,7 +590,8 @@ PyObject *to_python<types::static_list<T, N>>::do_convert( } template <typename T, size_t N> -PyObject *to_python<types::array<T, N>>::convert(types::array<T, N> const &t) +PyObject * +to_python<types::array_tuple<T, N>>::convert(types::array_tuple<T, N> const &t) { return do_convert(t, utils::make_index_sequence<N>()); } @@ -644,7 +645,7 @@ std::tuple<Types...> from_python<std::tuple<Types...>>::convert(PyObject *obj) } template <typename T, size_t N> -bool from_python<types::array<T, N>>:: +bool from_python<types::array_tuple<T, N>>:: is_convertible(PyObject *obj) { @@ -659,13 +660,13 @@ bool from_python<types::array<T, N>>:: template <typename T, size_t N> template <size_t... S> -types::array<T, N> from_python<types::array<T, N>>::do_convert( +types::array_tuple<T, N> from_python<types::array_tuple<T, N>>::do_convert( PyObject *obj, typename utils::index_sequence<S...>) { return {::from_python<T>(PyTuple_GET_ITEM(obj, S))...}; } template <typename T, size_t N> -types::array<T, N> from_python<types::array<T, N>>:: +types::array_tuple<T, N> from_python<types::array_tuple<T, N>>:: convert(PyObject *obj) { diff --git a/contrib/python/pythran/pythran/pythonic/types/variant_functor.hpp b/contrib/python/pythran/pythran/pythonic/types/variant_functor.hpp index b777fad2cc..75dfcd11f1 100644 --- a/contrib/python/pythran/pythran/pythonic/types/variant_functor.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/variant_functor.hpp @@ -4,8 +4,8 @@ #include "pythonic/include/types/variant_functor.hpp" #include "pythonic/utils/meta.hpp" -#include <utility> #include <cassert> +#include <utility> PYTHONIC_NS_BEGIN @@ -17,7 +17,7 @@ namespace types template <class Type> variant_functor_impl<Type>::variant_functor_impl(char mem[], Type const &t) - : fun(new (mem) Type(t)) + : fun(new(mem) Type(t)) { } @@ -32,7 +32,7 @@ namespace types template <class Type> variant_functor_impl<Type>::variant_functor_impl( char mem[], variant_functor_impl<Type> const &t) - : fun(t.fun ? new (mem) Type(*t.fun) : nullptr) + : fun(t.fun ? new(mem) Type(*t.fun) : nullptr) { } @@ -126,7 +126,7 @@ namespace types template <class Type> template <class... Args> - auto variant_functor_impl<Type>::operator()(Args &&... args) + auto variant_functor_impl<Type>::operator()(Args &&...args) -> decltype(std::declval<Type>()(std::forward<Args>(args)...)) { assert(fun && "handler defined"); @@ -135,7 +135,7 @@ namespace types template <class Type> template <class... Args> - auto variant_functor_impl<Type>::operator()(Args &&... args) const + auto variant_functor_impl<Type>::operator()(Args &&...args) const -> decltype(std::declval<Type>()(std::forward<Args>(args)...)) { assert(fun && "handler defined"); @@ -145,7 +145,7 @@ namespace types template <class Type, class... Types> template <class... OtherTypes> variant_functor_impl<Type, Types...>::variant_functor_impl( - char mem[], OtherTypes const &... t) + char mem[], OtherTypes const &...t) : head(mem, t...), tail(mem, t...) { } @@ -177,9 +177,11 @@ namespace types template <class Type, class... Types> template <class... Args> - auto variant_functor_impl<Type, Types...>::operator()(Args &&... args) -> - typename __combined<decltype(std::declval<Type>()(std::forward<Args>(args)...)), - decltype(std::declval<Types>()(std::forward<Args>(args)...))...>::type + auto variant_functor_impl<Type, Types...>::operator()(Args &&...args) -> + typename __combined< + decltype(std::declval<Type>()(std::forward<Args>(args)...)), + decltype(std::declval<Types>()( + std::forward<Args>(args)...))...>::type { if (head.fun) return head(std::forward<Args>(args)...); @@ -189,17 +191,19 @@ namespace types template <class Type, class... Types> template <class... Args> - auto variant_functor_impl<Type, Types...>::operator()(Args &&... args) const - -> - typename __combined<decltype(std::declval<Type>()(std::forward<Args>(args)...)), - decltype(std::declval<Types>()(std::forward<Args>(args)...))...>::type + auto + variant_functor_impl<Type, Types...>::operator()(Args &&...args) const -> + typename __combined< + decltype(std::declval<Type>()(std::forward<Args>(args)...)), + decltype(std::declval<Types>()( + std::forward<Args>(args)...))...>::type { if (head.fun) return head(std::forward<Args>(args)...); else return tail(std::forward<Args>(args)...); } - } + } // namespace details template <class... Types> variant_functor<Types...>::variant_functor(variant_functor const &other) @@ -210,8 +214,8 @@ namespace types } template <class... Types> - variant_functor<Types...> &variant_functor<Types...>:: - operator=(variant_functor<Types...> const &other) + variant_functor<Types...> & + variant_functor<Types...>::operator=(variant_functor<Types...> const &other) { details::variant_functor_impl<Types...>::assign(mem, other); return *this; @@ -219,8 +223,8 @@ namespace types template <class... Types> template <class... OtherTypes> - variant_functor<Types...> &variant_functor<Types...>:: - operator=(variant_functor<OtherTypes...> const &other) + variant_functor<Types...> &variant_functor<Types...>::operator=( + variant_functor<OtherTypes...> const &other) { details::variant_functor_impl<Types...>::assign(mem, other); return *this; @@ -228,8 +232,8 @@ namespace types template <class... Types> template <class OtherType> - variant_functor<Types...> &variant_functor<Types...>:: - operator=(OtherType const &other) + variant_functor<Types...> & + variant_functor<Types...>::operator=(OtherType const &other) { static_assert( utils::any_of<std::is_same<OtherType, Types>::value...>::value, @@ -240,7 +244,7 @@ namespace types template <class... Types> template <class... OtherTypes> - variant_functor<Types...>::variant_functor(OtherTypes const &... t) + variant_functor<Types...>::variant_functor(OtherTypes const &...t) : details::variant_functor_impl<Types...>(mem, t...) { } @@ -255,6 +259,6 @@ namespace types t)) { } -} +} // namespace types PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/types/vectorizable_type.hpp b/contrib/python/pythran/pythran/pythonic/types/vectorizable_type.hpp index 81e0d90432..01f61e462c 100644 --- a/contrib/python/pythran/pythran/pythonic/types/vectorizable_type.hpp +++ b/contrib/python/pythran/pythran/pythonic/types/vectorizable_type.hpp @@ -4,16 +4,16 @@ #include "pythonic/include/types/vectorizable_type.hpp" #include "pythonic/include/numpy/bool_.hpp" -#include "pythonic/include/numpy/uint8.hpp" +#include "pythonic/include/numpy/float32.hpp" +#include "pythonic/include/numpy/float64.hpp" +#include "pythonic/include/numpy/int16.hpp" +#include "pythonic/include/numpy/int32.hpp" +#include "pythonic/include/numpy/int64.hpp" #include "pythonic/include/numpy/int8.hpp" #include "pythonic/include/numpy/uint16.hpp" -#include "pythonic/include/numpy/int16.hpp" #include "pythonic/include/numpy/uint32.hpp" -#include "pythonic/include/numpy/int32.hpp" #include "pythonic/include/numpy/uint64.hpp" -#include "pythonic/include/numpy/int64.hpp" -#include "pythonic/include/numpy/float32.hpp" -#include "pythonic/include/numpy/float64.hpp" +#include "pythonic/include/numpy/uint8.hpp" PYTHONIC_NS_BEGIN namespace operator_ @@ -22,8 +22,8 @@ namespace operator_ { struct mod; struct div; - } -} + } // namespace functor +} // namespace operator_ namespace builtins { @@ -33,8 +33,8 @@ namespace builtins { struct abssqr; } - } -} + } // namespace pythran +} // namespace builtins namespace numpy { @@ -69,8 +69,8 @@ namespace numpy struct spacing; struct true_divide; struct where; - } -} + } // namespace functor +} // namespace numpy namespace scipy { namespace special @@ -95,9 +95,9 @@ namespace scipy struct ndtri; struct spherical_jn; struct spherical_yn; - } - } -} + } // namespace functor + } // namespace special +} // namespace scipy namespace types { template <class O, class... Args> @@ -185,7 +185,7 @@ namespace types // true; }; -} +} // namespace types PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/utils/allocate.hpp b/contrib/python/pythran/pythran/pythonic/utils/allocate.hpp index a09cda14e2..f9247a85f9 100644 --- a/contrib/python/pythran/pythran/pythonic/utils/allocate.hpp +++ b/contrib/python/pythran/pythran/pythonic/utils/allocate.hpp @@ -9,7 +9,7 @@ namespace utils #ifdef PYTHRAN_TRACE_ALLOCATION size_t pythran_allocation_site; #endif -} +} // namespace utils PYTHONIC_NS_END diff --git a/contrib/python/pythran/pythran/pythonic/utils/array_helper.hpp b/contrib/python/pythran/pythran/pythonic/utils/array_helper.hpp index fa8722533c..35d5352c9e 100644 --- a/contrib/python/pythran/pythran/pythonic/utils/array_helper.hpp +++ b/contrib/python/pythran/pythran/pythonic/utils/array_helper.hpp @@ -13,7 +13,7 @@ PYTHONIC_NS_BEGIN */ template <size_t L> template <class A, size_t M> -auto nget<L>::operator()(A &&self, types::array<long, M> const &indices) +auto nget<L>::operator()(A &&self, types::array_tuple<long, M> const &indices) -> decltype(nget<L - 1>()(std::forward<A>(self)[0], indices)) { return nget<L - 1>()(std::forward<A>(self)[indices[M - L - 1]], indices); @@ -21,7 +21,7 @@ auto nget<L>::operator()(A &&self, types::array<long, M> const &indices) template <size_t L> template <class A, size_t M> -auto nget<L>::fast(A &&self, types::array<long, M> const &indices) +auto nget<L>::fast(A &&self, types::array_tuple<long, M> const &indices) -> decltype(nget<L - 1>().fast(std::forward<A>(self).fast(0), indices)) { return nget<L - 1>().fast(std::forward<A>(self).fast(indices[M - L - 1]), @@ -29,14 +29,14 @@ auto nget<L>::fast(A &&self, types::array<long, M> const &indices) } template <class A, size_t M> -auto nget<0>::operator()(A &&self, types::array<long, M> const &indices) +auto nget<0>::operator()(A &&self, types::array_tuple<long, M> const &indices) -> decltype(std::forward<A>(self)[indices[M - 1]]) { return std::forward<A>(self)[indices[M - 1]]; } template <class A, size_t M> -auto nget<0>::fast(A &&self, types::array<long, M> const &indices) +auto nget<0>::fast(A &&self, types::array_tuple<long, M> const &indices) -> decltype(std::forward<A>(self).fast(indices[M - 1])) { return std::forward<A>(self).fast(indices[M - 1]); diff --git a/contrib/python/pythran/pythran/pythonic/utils/broadcast_copy.hpp b/contrib/python/pythran/pythran/pythonic/utils/broadcast_copy.hpp index d44ef84bd0..d892e4d580 100644 --- a/contrib/python/pythran/pythran/pythonic/utils/broadcast_copy.hpp +++ b/contrib/python/pythran/pythran/pythonic/utils/broadcast_copy.hpp @@ -252,7 +252,8 @@ namespace utils #ifdef USE_XSIMD constexpr bool vectorize = vector_form; #else - constexpr bool vectorize = false;; + constexpr bool vectorize = false; + ; #endif broadcast_copy_dispatcher<E, F, N, (size_t)D, vectorize>{}(self, other); } @@ -264,11 +265,10 @@ namespace utils std::integral_constant<bool, true>, std::integral_constant<bool, true>) { - if(D==0) { + if (D == 0) { std::copy(other.data(), other.data() + other.flat_size(), self.data()); return self; - } - else { + } else { return broadcast_copy_helper<E, F, N, D, vector_form>( self, other, std::integral_constant<bool, true>(), std::integral_constant<bool, false>{}); @@ -285,11 +285,11 @@ namespace utils self, reshaped, std::true_type(), is_plain); } - template<class T, bool = types::is_dtype<T>::value> + template <class T, bool = types::is_dtype<T>::value> struct is_flat { static const bool value = T::is_flat; }; - template<class T> + template <class T> struct is_flat<T, true> { static const bool value = false; }; @@ -299,7 +299,9 @@ namespace utils { return broadcast_copy_helper<E, F, N, D, vector_form>( self, other, std::integral_constant<bool, (D >= 0)>(), - std::integral_constant<bool, std::decay<E>::type::is_flat && is_flat<typename std::decay<F>::type>::value>{}); + std::integral_constant < bool, + std::decay<E>::type::is_flat + &&is_flat<typename std::decay<F>::type>::value > {}); } /* update diff --git a/contrib/python/pythran/pythran/pythonic/utils/fwd.hpp b/contrib/python/pythran/pythran/pythonic/utils/fwd.hpp index 66438d6561..f3c460d219 100644 --- a/contrib/python/pythran/pythran/pythonic/utils/fwd.hpp +++ b/contrib/python/pythran/pythran/pythonic/utils/fwd.hpp @@ -9,10 +9,10 @@ namespace utils { template <typename... Types> - void fwd(Types const &... types) + void fwd(Types const &...types) { } -} +} // namespace utils PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/utils/iterator.hpp b/contrib/python/pythran/pythran/pythonic/utils/iterator.hpp index 5ab35a95ef..cda0e6b2e1 100644 --- a/contrib/python/pythran/pythran/pythonic/utils/iterator.hpp +++ b/contrib/python/pythran/pythran/pythonic/utils/iterator.hpp @@ -9,14 +9,12 @@ namespace utils { template <class T> - comparable_iterator<T>::comparable_iterator() - : T() + comparable_iterator<T>::comparable_iterator() : T() { } template <class T> - comparable_iterator<T>::comparable_iterator(T const &t) - : T(t) + comparable_iterator<T>::comparable_iterator(T const &t) : T(t) { } @@ -27,24 +25,22 @@ namespace utils } template <class T> - iterator_reminder<false, T>::iterator_reminder(T const &v) - : values(v) + iterator_reminder<false, T>::iterator_reminder(T const &v) : values(v) { } template <class T> - iterator_reminder<true, T>::iterator_reminder(T const &v) - : values(v) + iterator_reminder<true, T>::iterator_reminder(T const &v) : values(v) { } template <class T, class... Others> iterator_reminder<true, T, Others...>::iterator_reminder( - T const &v, Others const &... others) + T const &v, Others const &...others) : values(v, others...) { } -} +} // namespace utils PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/utils/nested_container.hpp b/contrib/python/pythran/pythran/pythonic/utils/nested_container.hpp index f11bc73b40..2996e4e2e1 100644 --- a/contrib/python/pythran/pythran/pythonic/utils/nested_container.hpp +++ b/contrib/python/pythran/pythran/pythonic/utils/nested_container.hpp @@ -3,9 +3,9 @@ #include "pythonic/include/utils/nested_container.hpp" -#include <limits> #include "pythonic/types/traits.hpp" #include "pythonic/utils/numpy_traits.hpp" +#include <limits> PYTHONIC_NS_BEGIN namespace utils @@ -16,10 +16,11 @@ namespace utils { auto n = t.size(); return n ? n * nested_container_size<typename std::conditional< - // If we have a scalar or a complex, we want to stop - // recursion, and then dispatch to bool specialization - types::is_dtype<typename Type::value_type>::value, bool, - typename Type::value_type>::type>::flat_size(*t.begin()) : 0; + // If we have a scalar or a complex, we want to stop + // recursion, and then dispatch to bool specialization + types::is_dtype<typename Type::value_type>::value, bool, + typename Type::value_type>::type>::flat_size(*t.begin()) + : 0; } /* Recursion stops on bool */ @@ -28,7 +29,7 @@ namespace utils { return 1; } -} +} // namespace utils PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythonic/utils/neutral.hpp b/contrib/python/pythran/pythran/pythonic/utils/neutral.hpp index 62b1d7d6d7..ab1f206107 100644 --- a/contrib/python/pythran/pythran/pythonic/utils/neutral.hpp +++ b/contrib/python/pythran/pythran/pythonic/utils/neutral.hpp @@ -4,10 +4,10 @@ #include "pythonic/include/utils/neutral.hpp" #include "pythonic/operator_/iadd.hpp" #include "pythonic/operator_/iand.hpp" -#include "pythonic/operator_/ior.hpp" -#include "pythonic/operator_/imul.hpp" #include "pythonic/operator_/imax.hpp" #include "pythonic/operator_/imin.hpp" +#include "pythonic/operator_/imul.hpp" +#include "pythonic/operator_/ior.hpp" #include "pythonic/operator_/ixor.hpp" #endif diff --git a/contrib/python/pythran/pythran/pythonic/utils/numpy_conversion.hpp b/contrib/python/pythran/pythran/pythonic/utils/numpy_conversion.hpp index 05382b7e74..82c1638b11 100644 --- a/contrib/python/pythran/pythran/pythonic/utils/numpy_conversion.hpp +++ b/contrib/python/pythran/pythran/pythonic/utils/numpy_conversion.hpp @@ -18,8 +18,8 @@ #else #define NUMPY_EXPR_TO_NDARRAY0_IMPL(fname) \ template <class E, class... Types> \ - auto fname(E const &expr, Types &&...others) \ - ->typename std::enable_if< \ + auto fname(E const &expr, Types &&...others) -> \ + typename std::enable_if< \ !types::is_ndarray<E>::value && types::is_numexpr_arg<E>::value, \ decltype(fname( \ types::ndarray<typename E::dtype, typename E::shape_t>{expr}, \ diff --git a/contrib/python/pythran/pythran/pythonic/utils/pdqsort.hpp b/contrib/python/pythran/pythran/pythonic/utils/pdqsort.hpp index 384f5c6f1c..7fce8403d8 100644 --- a/contrib/python/pythran/pythran/pythonic/utils/pdqsort.hpp +++ b/contrib/python/pythran/pythran/pythonic/utils/pdqsort.hpp @@ -32,8 +32,8 @@ #include <algorithm> #include <cstddef> #include <functional> -#include <utility> #include <iterator> +#include <utility> #if __cplusplus >= 201103L #include <cstdint> @@ -641,7 +641,7 @@ namespace pdqsort_detail leftmost = false; } } -} +} // namespace pdqsort_detail template <class Iter, class Compare> inline void pdqsort(Iter begin, Iter end, Compare comp) @@ -651,10 +651,11 @@ inline void pdqsort(Iter begin, Iter end, Compare comp) #if __cplusplus >= 201103L pdqsort_detail::pdqsort_loop< - Iter, Compare, pdqsort_detail::is_default_compare< - typename std::decay<Compare>::type>::value && - std::is_arithmetic<typename std::iterator_traits< - Iter>::value_type>::value>( + Iter, Compare, + pdqsort_detail::is_default_compare< + typename std::decay<Compare>::type>::value && + std::is_arithmetic< + typename std::iterator_traits<Iter>::value_type>::value>( begin, end, comp, pdqsort_detail::log2(end - begin)); #else pdqsort_detail::pdqsort_loop<Iter, Compare, false>( diff --git a/contrib/python/pythran/pythran/pythonic/utils/reserve.hpp b/contrib/python/pythran/pythran/pythonic/utils/reserve.hpp index 564457467a..44bd765e1b 100644 --- a/contrib/python/pythran/pythran/pythonic/utils/reserve.hpp +++ b/contrib/python/pythran/pythran/pythonic/utils/reserve.hpp @@ -12,7 +12,7 @@ namespace utils void reserve(Container &, From &&) // do nothing unless specialized { } -} +} // namespace utils PYTHONIC_NS_END #endif diff --git a/contrib/python/pythran/pythran/pythran.cfg b/contrib/python/pythran/pythran/pythran.cfg index e967159832..677677657a 100644 --- a/contrib/python/pythran/pythran/pythran.cfg +++ b/contrib/python/pythran/pythran/pythran.cfg @@ -18,6 +18,7 @@ optimizations = pythran.optimizations.InlineBuiltins pythran.optimizations.PatternTransform pythran.optimizations.Square pythran.optimizations.CopyTo + pythran.optimizations.FastGExpr pythran.optimizations.RangeLoopUnfolding pythran.optimizations.RangeBasedSimplify pythran.optimizations.ListToTuple diff --git a/contrib/python/pythran/pythran/run.py b/contrib/python/pythran/pythran/run.py index b5c26f0f3a..e11ca6e527 100644 --- a/contrib/python/pythran/pythran/run.py +++ b/contrib/python/pythran/pythran/run.py @@ -199,6 +199,9 @@ def run(): "E: " + str(e)) sys.exit(1) except ValueError as e: + from traceback import format_exception + msg = "".join(format_exception(type(e), e, e.__traceback__)) + logger.info(msg) logger.critical("Chair to keyboard interface error\n" "E: " + str(e)) sys.exit(1) @@ -214,6 +217,17 @@ def run(): logger.critical("Cover me Jack. Jack? Jaaaaack!!!!\n" "E: " + str(e)) sys.exit(1) + except SyntaxError as se: + # pythran syntax error formatter is just nicer + pse = PythranSyntaxError(se.args[0]) + pse.filename, pse.lineno, pse.offset = se.args[1][:3] + if pse.filename == '<unknown>': + pse.filename = args.input_file + pse.offset -= 1 + + logger.critical("I think in all humility that your input code is not valid Python, " + "that's a bit too much for me :-/\n" + str(pse)) + sys.exit(1) except NotImplementedError: logger.critical("MAYDAY, MAYDAY, MAYDAY; pythran compiler; " "code area out of control\n" diff --git a/contrib/python/pythran/pythran/tables.py b/contrib/python/pythran/pythran/tables.py index 60fac63ee3..d62abe11c0 100644 --- a/contrib/python/pythran/pythran/tables.py +++ b/contrib/python/pythran/pythran/tables.py @@ -179,6 +179,21 @@ CLASSES = { "dtype": { "type": MethodIntr(), }, + "array": { + # array have fixed type, no need for signature + "append": MethodIntr(), + "buffer_info": ConstMethodIntr(), + "byteswap": MethodIntr(), + "count": ConstMethodIntr(), + "extend": MethodIntr(), + "fromfile": MethodIntr(), + "fromlist": MethodIntr(), + "frombytes": MethodIntr(), + "insert": MethodIntr(), + "pop": MethodIntr(), + "remove": MethodIntr(), + "reverse": MethodIntr(), + }, "list": { "append": MethodIntr(signature=Fun[[List[T0], T0], None]), "extend": MethodIntr(update_effects), @@ -800,30 +815,6 @@ CLASSES = { ] ), "T": AttributeIntr(signature=Fun[[NDArray[T0, :]], NDArray[T0, :]]), - "tolist": ConstMethodIntr( - signature=Union[ - # 1d - Fun[[NDArray[bool, :]], List[bool]], - Fun[[NDArray[int, :]], List[int]], - Fun[[NDArray[float, :]], List[float]], - Fun[[NDArray[complex, :]], List[complex]], - # 2d - Fun[[NDArray[bool, :, :]], List[bool]], - Fun[[NDArray[int, :, :]], List[int]], - Fun[[NDArray[float, :, :]], List[float]], - Fun[[NDArray[complex, :, :]], List[complex]], - # 3d - Fun[[NDArray[bool, :, :, :]], List[bool]], - Fun[[NDArray[int, :, :, :]], List[int]], - Fun[[NDArray[float, :, :, :]], List[float]], - Fun[[NDArray[complex, :, :, :]], List[complex]], - # 4d - Fun[[NDArray[bool, :, :, :, :]], List[bool]], - Fun[[NDArray[int, :, :, :, :]], List[int]], - Fun[[NDArray[float, :, :, :, :]], List[float]], - Fun[[NDArray[complex, :, :, :, :]], List[complex]], - ] - ), "tofile": ConstMethodIntr(signature=Fun[[NDArray[T0, :]], str, str], global_effects=True), "tostring": ConstMethodIntr(signature=Fun[[NDArray[T0, :]], str]), "view": MethodIntr(), @@ -2569,6 +2560,7 @@ MODULES = { "kwonly": ConstFunctionIntr(), "len_set": ConstFunctionIntr(signature=Fun[[Iterable[T0]], int]), "make_shape": ConstFunctionIntr(), + "restrict_assign": FunctionIntr(), "static_if": ConstFunctionIntr(), "StaticIfBreak": ConstFunctionIntr(), "StaticIfCont": ConstFunctionIntr(), @@ -2835,6 +2827,12 @@ MODULES = { return_range=lambda _: interval.Range(1, 1) ), }, + "array": { + "typecodes": ConstantIntr(signature=str), + "array": ClassWithReadOnceConstructor( + CLASSES['array'], + immediate_arguments=[0]), + }, "scipy": { "special": { "binom": ConstFunctionIntr( @@ -4510,6 +4508,7 @@ MODULES = { }, # conflicting method names must be listed here "__dispatch__": { + "append": MethodIntr(signature=Fun[[List[T0], T0], None]), "clear": MethodIntr(signature=Fun[[T0], None]), "conjugate": ConstMethodIntr(), "copy": ConstMethodIntr(signature=Fun[[T0], T0]), @@ -4521,6 +4520,7 @@ MODULES = { ], return_range=interval.positive_values ), + "extend": MethodIntr(signature=Fun[[List[T0], Iterable[T0]], None]), "index": ConstMethodIntr( signature=Union[ Fun[[Iterable[T0], T0], int], @@ -4529,13 +4529,19 @@ MODULES = { ], return_range=interval.positive_values ), + "insert": MethodIntr(signature=Fun[[List[T0], int, T0], None]), "pop": MethodIntr(), "remove": MethodIntr(), + "reverse": MethodIntr(), "sort": MethodIntr(), + "tolist": ConstMethodIntr(), "update": MethodIntr(update_effects), }, } +# PyPy doesn't seem to provide this. +if sys.implementation.name == 'pypy': + del MODULES['array']['typecodes'] if sys.version_info < (3, 5): del MODULES['operator']['matmul'] diff --git a/contrib/python/pythran/pythran/toolchain.py b/contrib/python/pythran/pythran/toolchain.py index fde2902601..ba6a9aafe9 100644 --- a/contrib/python/pythran/pythran/toolchain.py +++ b/contrib/python/pythran/pythran/toolchain.py @@ -8,7 +8,6 @@ from pythran.config import cfg from pythran.cxxgen import PythonModule, Include, Line, Statement from pythran.cxxgen import FunctionBody, FunctionDeclaration, Value, Block from pythran.cxxgen import ReturnStatement -from pythran.dist import PythranExtension, PythranBuildExt from pythran.errors import PythranCompileError from pythran.middlend import refine, mark_unexported_functions from pythran.passmanager import PassManager @@ -24,12 +23,6 @@ import pythran.frontend as frontend import sysconfig -try: - # `numpy.distutils is deprecated, may not be present, or broken - from numpy.distutils.core import setup -except Exception: - from setuptools import setup - from tempfile import mkdtemp, NamedTemporaryFile import gast as ast import importlib @@ -335,6 +328,14 @@ def compile_cxxfile(module_name, cxxfile, output_binary=None, **kwargs): Raises PythranCompileError on failure ''' + # local import so that we don't depend on setuptools for the code generation + # part + from pythran.dist import PythranExtension, PythranBuildExt + try: + # `numpy.distutils is deprecated, may not be present, or broken + from numpy.distutils.core import setup + except Exception: + from setuptools import setup builddir = mkdtemp() buildtmp = mkdtemp() diff --git a/contrib/python/pythran/pythran/transformations/expand_builtins.py b/contrib/python/pythran/pythran/transformations/expand_builtins.py index 648b16ab45..8ce5c63c15 100644 --- a/contrib/python/pythran/pythran/transformations/expand_builtins.py +++ b/contrib/python/pythran/pythran/transformations/expand_builtins.py @@ -32,7 +32,6 @@ class ExpandBuiltins(Transformation): if s in ('None', 'True', 'False'): self.update = True return ast.Constant(getattr(builtins, s), None) - if(isinstance(node.ctx, ast.Load) and s not in self.locals[node] and s not in self.globals and diff --git a/contrib/python/pythran/pythran/transformations/expand_imports.py b/contrib/python/pythran/pythran/transformations/expand_imports.py index 62107b22bc..718feadbff 100644 --- a/contrib/python/pythran/pythran/transformations/expand_imports.py +++ b/contrib/python/pythran/pythran/transformations/expand_imports.py @@ -116,20 +116,23 @@ class ExpandImports(Transformation): In this case, foo can't be used after assign. """ + targets = node.targets if isinstance(node, ast.Assign) else (node.target,) if isinstance(node.value, ast.Name) and node.value.id in self.symbols: symbol = path_to_node(self.symbols[node.value.id]) if not getattr(symbol, 'isliteral', lambda: False)(): - for target in node.targets: + for target in targets: if not isinstance(target, ast.Name): err = "Unsupported module aliasing" raise PythranSyntaxError(err, target) self.symbols[target.id] = self.symbols[node.value.id] return None # this assignment is no longer needed new_node = self.generic_visit(node) + ntargets = new_node.targets if isinstance(node, ast.Assign) else (new_node.target,) # no problem if targets contains a subscript, it is not a new assign. [self.symbols.pop(t.id, None) - for t in new_node.targets if isinstance(t, ast.Name)] + for t in ntargets if isinstance(t, ast.Name)] return new_node + visit_AnnAssign = visit_Assign def visit_Name(self, node): """ diff --git a/contrib/python/pythran/pythran/transformations/handle_import.py b/contrib/python/pythran/pythran/transformations/handle_import.py index 2e90d63874..13ace61130 100644 --- a/contrib/python/pythran/pythran/transformations/handle_import.py +++ b/contrib/python/pythran/pythran/transformations/handle_import.py @@ -136,8 +136,10 @@ class HandleImport(Transformation): return node def visit_assign(self, node): - self.visit(node.value) - for target in node.targets: + targets = node.targets if isinstance(node, ast.Assign) else (node.target,) + if node.value: + self.visit(node.value) + for target in targets: self.visit(target) return node @@ -152,10 +154,12 @@ class HandleImport(Transformation): if not is_mangled_module(renaming): return self.visit_assign(node) - if any(not isinstance(target, ast.Name) for target in node.targets): + targets = node.targets if isinstance(node, ast.Assign) else (node.target,) + if any(not isinstance(target, ast.Name) for target in targets): raise PythranSyntaxError("Invalid module assignment", node) return node + visit_AnnAssign = visit_Assign def visit_Call(self, node): if isinstance(node.func, ast.Name): diff --git a/contrib/python/pythran/pythran/transformations/normalize_method_calls.py b/contrib/python/pythran/pythran/transformations/normalize_method_calls.py index 4af1e47d10..9aea96e39f 100644 --- a/contrib/python/pythran/pythran/transformations/normalize_method_calls.py +++ b/contrib/python/pythran/pythran/transformations/normalize_method_calls.py @@ -22,7 +22,8 @@ class NormalizeMethodCalls(Transformation): >>> pm = passmanager.PassManager("test") >>> _, node = pm.apply(NormalizeMethodCalls, node) >>> print(pm.dump(backend.Python, node)) - builtins.list.append([], 12) + import __dispatch__ as __pythran_import___dispatch__ + __pythran_import___dispatch__.append([], 12) ''' def __init__(self): @@ -83,10 +84,12 @@ class NormalizeMethodCalls(Transformation): return None else: n = self.generic_visit(node) - for t in node.targets: + targets = node.targets if isinstance(node, ast.Assign) else (node.target,) + for t in targets: if isinstance(t, ast.Name): self.imports.pop(t.id, None) return n + visit_AnnAssign = visit_Assign def visit_For(self, node): node.iter = self.visit(node.iter) @@ -198,7 +201,11 @@ class NormalizeMethodCalls(Transformation): # the only situation where this arises is for real/imag of # a ndarray. As a call is not valid for a store, add a slice # to ends up with a valid lhs - assert node.attr in ('real', 'imag'), "only store to imag/real" + if node.attr not in ('real', 'imag'): + raise PythranSyntaxError( + "Unsupported store to attribute {}".format(node.attr), + node) + return ast.Subscript(call, ast.Slice(None, None, None), node.ctx) diff --git a/contrib/python/pythran/pythran/transformations/normalize_tuples.py b/contrib/python/pythran/pythran/transformations/normalize_tuples.py index cb47ba91c0..0cd5ba5c80 100644 --- a/contrib/python/pythran/pythran/transformations/normalize_tuples.py +++ b/contrib/python/pythran/pythran/transformations/normalize_tuples.py @@ -125,6 +125,37 @@ class NormalizeTuples(Transformation): node.body = ConvertToTuple(nname, renamings).visit(node.body) return node + def visit_assign_target(self, t, value, extra_assign, no_tmp): + if isinstance(t, ast.Tuple) or isinstance(t, ast.List): + renamings = OrderedDict() + self.traverse_tuples(t, (), renamings) + if renamings: + if no_tmp: + gstore = deepcopy(value) + else: + gstore = ast.Name(self.get_new_id(), + ast.Store(), None, None) + gload = deepcopy(gstore) + gload.ctx = ast.Load() + for rename, state in renamings.items(): + nnode = reduce( + lambda x, y: ast.Subscript( + x, + ast.Constant(y, None), + ast.Load()), + state, + gload) + if isinstance(rename, str): + extra_assign.append( + ast.Assign( + [ast.Name(rename, ast.Store(), + None, None)], + nnode, None)) + else: + extra_assign.append(ast.Assign([rename], + nnode, None)) + return gstore + def visit_Assign(self, node): self.generic_visit(node) # if the rhs is an identifier, we don't need to duplicate it @@ -132,37 +163,27 @@ class NormalizeTuples(Transformation): no_tmp = isinstance(node.value, (ast.Name, ast.Attribute)) extra_assign = [] if no_tmp else [node] for i, t in enumerate(node.targets): - if isinstance(t, ast.Tuple) or isinstance(t, ast.List): - renamings = OrderedDict() - self.traverse_tuples(t, (), renamings) - if renamings: - if no_tmp: - gstore = deepcopy(node.value) - else: - gstore = ast.Name(self.get_new_id(), - ast.Store(), None, None) - gload = deepcopy(gstore) - gload.ctx = ast.Load() - node.targets[i] = gstore - for rename, state in renamings.items(): - nnode = reduce( - lambda x, y: ast.Subscript( - x, - ast.Constant(y, None), - ast.Load()), - state, - gload) - if isinstance(rename, str): - extra_assign.append( - ast.Assign( - [ast.Name(rename, ast.Store(), - None, None)], - nnode, None)) - else: - extra_assign.append(ast.Assign([rename], - nnode, None)) + updated = self.visit_assign_target(t, node.value, extra_assign, + no_tmp) + if updated is not None: + node.targets[i] = updated return extra_assign or node + def visit_AnnAssign(self, node): + self.generic_visit(node) + # if the rhs is an identifier, we don't need to duplicate it + # otherwise, better duplicate it... + if not node.value: + return node + no_tmp = isinstance(node.value, (ast.Name, ast.Attribute)) + extra_assign = [] if no_tmp else [node] + updated = self.visit_assign_target(node.target, node.value, + extra_assign, no_tmp) + if updated is not None: + node.target = updated + return extra_assign or node + + def visit_For(self, node): target = node.target if isinstance(target, ast.Tuple) or isinstance(target, ast.List): diff --git a/contrib/python/pythran/pythran/transformations/unshadow_parameters.py b/contrib/python/pythran/pythran/transformations/unshadow_parameters.py index 2f29eebdae..e61e90c695 100644 --- a/contrib/python/pythran/pythran/transformations/unshadow_parameters.py +++ b/contrib/python/pythran/pythran/transformations/unshadow_parameters.py @@ -52,13 +52,15 @@ class UnshadowParameters(Transformation): self.renaming[node.id] = new_name def visit_Assign(self, node): - for target in node.targets: + targets = node.targets if isinstance(node, ast.Assign) else (node.target,) + for target in targets: self.update_name(target) try: self.generic_visit(node) except AttributeError: pass return node + visit_AnnAssign = visit_Assign def visit_AugAssign(self, node): self.update_name(node.target) diff --git a/contrib/python/pythran/pythran/types/type_dependencies.py b/contrib/python/pythran/pythran/types/type_dependencies.py index ba3b0a1b25..a7fe47a9c8 100644 --- a/contrib/python/pythran/pythran/types/type_dependencies.py +++ b/contrib/python/pythran/pythran/types/type_dependencies.py @@ -334,11 +334,15 @@ class TypeDependencies(ModuleAnalysis): It is valid for subscript, `a[i] = foo()` means `a` type depend on `foo` return type. """ + if not node.value: + return value_deps = self.visit(node.value) - for target in node.targets: + targets = node.targets if isinstance(node, ast.Assign) else (node.target,) + for target in targets: name = get_variable(target) if isinstance(name, ast.Name): self.naming[name.id] = value_deps + visit_AnnAssign = visit_Assign def visit_AugAssign(self, node): """ diff --git a/contrib/python/pythran/pythran/types/types.py b/contrib/python/pythran/pythran/types/types.py index e58664c04b..e2774616e0 100644 --- a/contrib/python/pythran/pythran/types/types.py +++ b/contrib/python/pythran/pythran/types/types.py @@ -264,7 +264,7 @@ class Types(ModuleAnalysis): self.result[node] = self.combined(curr_ty, ty) def visit_FunctionDef(self, node): - self.delayed_types = set() + self.delayed_nodes = set() self.curr_locals_declaration = self.gather( LocalNodeDeclarations, node) @@ -278,7 +278,7 @@ class Types(ModuleAnalysis): self.generic_visit(node) - for delayed_node in self.delayed_types: + for delayed_node in self.delayed_nodes: delayed_type = self.result[delayed_node] all_types = ordered_set(self.result[ty] for ty in self.name_to_nodes[delayed_node.id]) @@ -290,7 +290,7 @@ class Types(ModuleAnalysis): all_types = ordered_set(self.result[ty] for ty in nodes) final_type = self.combined(*all_types) for n in nodes: - if n not in self.delayed_types: + if n not in self.delayed_nodes: self.result[n] = final_type self.current_global_declarations[node.name] = node @@ -336,6 +336,23 @@ class Types(ModuleAnalysis): fake = ast.Subscript(alias, t.slice, ast.Store()) self.combine(fake, None, node.value) + def visit_AnnAssign(self, node): + if not node.value: + # FIXME: replace this by actually setting the node type from the + # annotation + self.curr_locals_declaration.remove(node.target) + return + self.visit(node.value) + t = node.target + self.combine(t, None, node.value) + if t in self.curr_locals_declaration: + self.result[t] = self.get_qualifier(t)(self.result[t]) + if isinstance(t, ast.Subscript): + if self.visit_AssignedSubscript(t): + for alias in self.strict_aliases[t.value]: + fake = ast.Subscript(alias, t.slice, ast.Store()) + self.combine(fake, None, node.value) + def visit_AugAssign(self, node): self.visit(node.value) @@ -461,8 +478,11 @@ class Types(ModuleAnalysis): else: sty = pytype_to_ctype(ty) if node in self.immediates: - sty = "std::integral_constant<%s, %s>" % (sty, - str(node.value).lower()) + if sty == 'pythonic::types::chr': + sty = "std::integral_constant<char, '%s'>" % (node.value) + else: + sty = "std::integral_constant<%s, %s>" % (sty, + str(node.value).lower()) self.result[node] = self.builder.NamedType(sty) def visit_Attribute(self, node): @@ -554,7 +574,7 @@ class Types(ModuleAnalysis): def delayed(self, node): fallback_type = self.combined(*[self.result[n] for n in self.name_to_nodes[node.id]]) - self.delayed_types.add(node) + self.delayed_nodes.add(node) return self.builder.LType(fallback_type, node) def visit_Name(self, node): diff --git a/contrib/python/pythran/pythran/unparse.py b/contrib/python/pythran/pythran/unparse.py index 25f10d7197..058aa004ac 100644 --- a/contrib/python/pythran/pythran/unparse.py +++ b/contrib/python/pythran/pythran/unparse.py @@ -142,6 +142,15 @@ class Unparser: self.write(" = ") self.dispatch(t.value) + def _AnnAssign(self, t): + self.fill() + self.dispatch(t.target) + self.write(": ") + self.dispatch(t.annotation) + if t.value: + self.write(" = ") + self.dispatch(t.value) + def _AugAssign(self, t): self.fill() self.dispatch(t.target) diff --git a/contrib/python/pythran/pythran/utils.py b/contrib/python/pythran/pythran/utils.py index 2d7a673274..55a7e8ad6f 100644 --- a/contrib/python/pythran/pythran/utils.py +++ b/contrib/python/pythran/pythran/utils.py @@ -106,7 +106,7 @@ def get_variable(assignable): ... slice=ast.Name('j', ast.Load(), None, None), ... ctx=ast.Load()) >>> ast.dump(get_variable(ref)) - "Name(id='a', ctx=Load(), annotation=None, type_comment=None)" + "Name(id='a', ctx=Load())" """ msg = "Only name and subscript can be assigned." assert isinstance(assignable, (ast.Name, ast.Subscript)), msg diff --git a/contrib/python/pythran/pythran/version.py b/contrib/python/pythran/pythran/version.py index 14da714e45..7aca4f8ffe 100644 --- a/contrib/python/pythran/pythran/version.py +++ b/contrib/python/pythran/pythran/version.py @@ -1,2 +1,2 @@ -__version__ = '0.16.1' +__version__ = '0.17.0' __descr__ = 'Ahead of Time compiler for numeric kernels' diff --git a/contrib/python/pythran/ya.make b/contrib/python/pythran/ya.make index 59e472063c..96bb399620 100644 --- a/contrib/python/pythran/ya.make +++ b/contrib/python/pythran/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(0.16.1) +VERSION(0.17.0) LICENSE(BSD-3-Clause) @@ -86,6 +86,7 @@ PY_SRCS( pythran/optimizations/constant_folding.py pythran/optimizations/copyto.py pythran/optimizations/dead_code_elimination.py + pythran/optimizations/fast_gexpr.py pythran/optimizations/forward_substitution.py pythran/optimizations/inline_builtins.py pythran/optimizations/inlining.py diff --git a/contrib/python/scipy/py3/ya.make b/contrib/python/scipy/py3/ya.make index bbf87b9b5e..fa45814788 100644 --- a/contrib/python/scipy/py3/ya.make +++ b/contrib/python/scipy/py3/ya.make @@ -2069,6 +2069,7 @@ RUN_PROGRAM( pythonic/builtins/float_.hpp pythonic/builtins/getattr.hpp pythonic/builtins/pythran/make_shape.hpp + pythonic/builtins/pythran/restrict_assign.hpp pythonic/builtins/range.hpp pythonic/builtins/tuple.hpp pythonic/core.hpp @@ -2077,6 +2078,7 @@ RUN_PROGRAM( pythonic/include/builtins/float_.hpp pythonic/include/builtins/getattr.hpp pythonic/include/builtins/pythran/make_shape.hpp + pythonic/include/builtins/pythran/restrict_assign.hpp pythonic/include/builtins/range.hpp pythonic/include/builtins/tuple.hpp pythonic/include/numpy/empty.hpp @@ -2338,23 +2340,25 @@ RUN_PROGRAM( IN scipy/stats/_stats_pythran.py OUT scipy/stats/_stats_pythran.cpp OUTPUT_INCLUDES + pythonic/__dispatch__/append.hpp pythonic/builtins/getattr.hpp pythonic/builtins/int_.hpp pythonic/builtins/len.hpp pythonic/builtins/list.hpp - pythonic/builtins/list/append.hpp pythonic/builtins/max.hpp pythonic/builtins/min.hpp + pythonic/builtins/pythran/restrict_assign.hpp pythonic/builtins/range.hpp pythonic/builtins/tuple.hpp pythonic/core.hpp + pythonic/include/__dispatch__/append.hpp pythonic/include/builtins/getattr.hpp pythonic/include/builtins/int_.hpp pythonic/include/builtins/len.hpp pythonic/include/builtins/list.hpp - pythonic/include/builtins/list/append.hpp pythonic/include/builtins/max.hpp pythonic/include/builtins/min.hpp + pythonic/include/builtins/pythran/restrict_assign.hpp pythonic/include/builtins/range.hpp pythonic/include/builtins/tuple.hpp pythonic/include/numpy/asarray.hpp diff --git a/contrib/python/types-protobuf/.dist-info/METADATA b/contrib/python/types-protobuf/.dist-info/METADATA index d4c7134a6a..1b139c962d 100644 --- a/contrib/python/types-protobuf/.dist-info/METADATA +++ b/contrib/python/types-protobuf/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: types-protobuf -Version: 5.27.0.20240920 +Version: 5.28.3.20241030 Summary: Typing stubs for protobuf Home-page: https://github.com/python/typeshed License: Apache-2.0 @@ -22,23 +22,27 @@ It can be used by type-checking tools like [mypy](https://github.com/python/mypy/), [pyright](https://github.com/microsoft/pyright), [pytype](https://github.com/google/pytype/), -PyCharm, etc. to check code that uses -`protobuf`. +[Pyre](https://pyre-check.org/), +PyCharm, etc. to check code that uses `protobuf`. This version of +`types-protobuf` aims to provide accurate annotations for +`protobuf~=5.28.3`. -This version of `types-protobuf` aims to provide accurate annotations -for `protobuf==5.27.*`. -The source for this package can be found at -https://github.com/python/typeshed/tree/main/stubs/protobuf. All fixes for -types and metadata should be contributed there. - -Partially generated using [mypy-protobuf==3.6.0](https://github.com/nipunn1313/mypy-protobuf/tree/v3.6.0) and libprotoc 26.1 on [protobuf v27.1](https://github.com/protocolbuffers/protobuf/releases/tag/v27.1) (python `protobuf==5.27.1`). +Partially generated using [mypy-protobuf==3.6.0](https://github.com/nipunn1313/mypy-protobuf/tree/v3.6.0) and libprotoc 27.2 on [protobuf v28.3](https://github.com/protocolbuffers/protobuf/releases/tag/v28.3) (python `protobuf==5.28.3`). This stub package is marked as [partial](https://peps.python.org/pep-0561/#partial-stub-packages). If you find that annotations are missing, feel free to contribute and help complete them. -See https://github.com/python/typeshed/blob/main/README.md for more details. -This package was generated from typeshed commit -[`c025e37bbb67f99f9d83c2eecb79e7405f77359b`](https://github.com/python/typeshed/commit/c025e37bbb67f99f9d83c2eecb79e7405f77359b) and was tested -with mypy 1.11.1, pyright 1.1.381, and -pytype 2024.9.13. +This package is part of the [typeshed project](https://github.com/python/typeshed). +All fixes for types and metadata should be contributed there. +See [the README](https://github.com/python/typeshed/blob/main/README.md) +for more details. The source for this package can be found in the +[`stubs/protobuf`](https://github.com/python/typeshed/tree/main/stubs/protobuf) +directory. + +This package was tested with +mypy 1.13.0, +pyright 1.1.386, +and pytype 2024.10.11. +It was generated from typeshed commit +[`6029bf18192fba492a9d82d88238a4e1929e1c43`](https://github.com/python/typeshed/commit/6029bf18192fba492a9d82d88238a4e1929e1c43). diff --git a/contrib/python/types-protobuf/google-stubs/METADATA.toml b/contrib/python/types-protobuf/google-stubs/METADATA.toml index f08d51e7fc..8349e2ea04 100644 --- a/contrib/python/types-protobuf/google-stubs/METADATA.toml +++ b/contrib/python/types-protobuf/google-stubs/METADATA.toml @@ -1,8 +1,7 @@ -# Whenever you update version here, PACKAGE_VERSION should be updated -# in scripts/sync_proto/google_protobuf.py and vice-versa. -version = "5.27.*" +# Using an exact number in the specifier for scripts/sync_protobuf/google_protobuf.py +version = "~=5.28.3" upstream_repository = "https://github.com/protocolbuffers/protobuf" -extra_description = "Partially generated using [mypy-protobuf==3.6.0](https://github.com/nipunn1313/mypy-protobuf/tree/v3.6.0) and libprotoc 26.1 on [protobuf v27.1](https://github.com/protocolbuffers/protobuf/releases/tag/v27.1) (python `protobuf==5.27.1`)." +extra_description = "Partially generated using [mypy-protobuf==3.6.0](https://github.com/nipunn1313/mypy-protobuf/tree/v3.6.0) and libprotoc 27.2 on [protobuf v28.3](https://github.com/protocolbuffers/protobuf/releases/tag/v28.3) (python `protobuf==5.28.3`)." partial_stub = true [tool.stubtest] diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/internal/well_known_types.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/internal/well_known_types.pyi index 6192d64ae1..5013ea53fc 100644 --- a/contrib/python/types-protobuf/google-stubs/protobuf/internal/well_known_types.pyi +++ b/contrib/python/types-protobuf/google-stubs/protobuf/internal/well_known_types.pyi @@ -73,7 +73,6 @@ _StructValueArg: TypeAlias = _StructValue | Mapping[str, _StructValueArg] | Sequ class Struct: def __getitem__(self, key: str) -> _StructValue: ... - def __contains__(self, item: object) -> bool: ... def __setitem__(self, key: str, value: _StructValueArg) -> None: ... def __delitem__(self, key: str) -> None: ... def __len__(self) -> int: ... diff --git a/contrib/python/types-protobuf/ya.make b/contrib/python/types-protobuf/ya.make index d817e8af94..802f4b6155 100644 --- a/contrib/python/types-protobuf/ya.make +++ b/contrib/python/types-protobuf/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(5.27.0.20240920) +VERSION(5.28.3.20241030) LICENSE(Apache-2.0) diff --git a/contrib/tools/cython/patches/DEVTOOLSSUPPORT-52386.patch b/contrib/tools/cython/patches/DEVTOOLSSUPPORT-52386.patch new file mode 100644 index 0000000000..51509ebc7d --- /dev/null +++ b/contrib/tools/cython/patches/DEVTOOLSSUPPORT-52386.patch @@ -0,0 +1,47 @@ +commit 3bb34c7656f9f425d9f9dbe140340f1d5b57586f +merge: 78a88b4da152acc232b549f8a7415d3f8a67bd31 b694ac6e026f3dd205118ad0f939efc45e985a69 +author: pg +date: 2024-10-11T10:22:30+03:00 +revision: 15073732 + + DEVTOOLSSUPPORT-52386 + + REVIEW: 6974995 + +--- contrib/tools/cython/Cython/Utility/ImportExport.c (78a88b4da152acc232b549f8a7415d3f8a67bd31) ++++ contrib/tools/cython/Cython/Utility/ImportExport.c (3bb34c7656f9f425d9f9dbe140340f1d5b57586f) +@@ -331,7 +331,7 @@ static PyTypeObject *__Pyx_ImportType_$cyversion(PyObject *module, const char *m + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_$cyversion check_size) + { + PyObject *result = 0; +- char warning[200]; ++ //char warning[200]; + Py_ssize_t basicsize; + Py_ssize_t itemsize; + #ifdef Py_LIMITED_API +@@ -382,25 +382,10 @@ static PyTypeObject *__Pyx_ImportType_$cyversion(PyObject *module, const char *m + itemsize = (Py_ssize_t)alignment; + } + if ((size_t)(basicsize + itemsize) < size) { +- PyErr_Format(PyExc_ValueError, +- "%.200s.%.200s size changed, may indicate binary incompatibility. " +- "Expected %zd from C header, got %zd from PyObject", +- module_name, class_name, size, basicsize); +- goto bad; + } + if (check_size == __Pyx_ImportType_CheckSize_Error_$cyversion && (size_t)basicsize != size) { +- PyErr_Format(PyExc_ValueError, +- "%.200s.%.200s size changed, may indicate binary incompatibility. " +- "Expected %zd from C header, got %zd from PyObject", +- module_name, class_name, size, basicsize); +- goto bad; + } + else if (check_size == __Pyx_ImportType_CheckSize_Warn_$cyversion && (size_t)basicsize > size) { +- PyOS_snprintf(warning, sizeof(warning), +- "%s.%s size changed, may indicate binary incompatibility. " +- "Expected %zd from C header, got %zd from PyObject", +- module_name, class_name, size, basicsize); +- if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + } + /* check_size == __Pyx_ImportType_CheckSize_Ignore does not warn nor error */ + return (PyTypeObject *)result; diff --git a/library/cpp/getopt/small/last_getopt_parse_result.h b/library/cpp/getopt/small/last_getopt_parse_result.h index c6e768c461..f9ffaf0ab3 100644 --- a/library/cpp/getopt/small/last_getopt_parse_result.h +++ b/library/cpp/getopt/small/last_getopt_parse_result.h @@ -192,7 +192,7 @@ namespace NLastGetopt { bool Has(const TOpt* opt, bool includeDefault = false) const; /** - * @return nil terminated string on the last fetched argument of givne option + * @return nil terminated string on the last fetched argument of given option * * @param opt ptr on required object * @param includeDefault search in results obtained from default values @@ -200,7 +200,7 @@ namespace NLastGetopt { const char* Get(const TOpt* opt, bool includeDefault = true) const; /** - * @return nil terminated string on the last fetched argument of givne option + * @return nil terminated string on the last fetched argument of given option * if option haven't been fetched, given defaultValue will be returned * * @param opt ptr on required object @@ -218,7 +218,7 @@ namespace NLastGetopt { bool Has(const TString& name, bool includeDefault = false) const; /** - * @return nil terminated string on the last fetched argument of givne option + * @return nil terminated string on the last fetched argument of given option * * @param name long name of required object * @param includeDefault search in results obtained from default values @@ -226,7 +226,7 @@ namespace NLastGetopt { const char* Get(const TString& name, bool includeDefault = true) const; /** - * @return nil terminated string on the last fetched argument of givne option + * @return nil terminated string on the last fetched argument of given option * if option haven't been fetched, given defaultValue will be returned * * @param name long name of required object @@ -244,7 +244,7 @@ namespace NLastGetopt { bool Has(char name, bool includeDefault = false) const; /** - * @return nil terminated string on the last fetched argument of givne option + * @return nil terminated string on the last fetched argument of given option * * @param c short name of required object * @param includeDefault search in results obtained from default values @@ -252,7 +252,7 @@ namespace NLastGetopt { const char* Get(char name, bool includeDefault = true) const; /** - * @return nil terminated string on the last fetched argument of givne option + * @return nil terminated string on the last fetched argument of given option * if option haven't been fetched, given defaultValue will be returned * * @param c short name of required object @@ -261,7 +261,7 @@ namespace NLastGetopt { const char* GetOrElse(char name, const char* defaultValue) const; /** - * for givne option return parsed value of the last fetched argument + * for given option return parsed value of the last fetched argument * if option haven't been fetched, HandleError action is called * * @param opt required option (one of: ptr, short name, long name). @@ -280,7 +280,7 @@ namespace NLastGetopt { } /** - * for givne option return parsed value of the last fetched argument + * for given option return parsed value of the last fetched argument * if option haven't been fetched, given defaultValue will be returned * * @param opt required option (one of: ptr, short name, long name). diff --git a/library/cpp/getopt/small/last_getopt_parser.cpp b/library/cpp/getopt/small/last_getopt_parser.cpp index 911c76f342..98c3951a1c 100644 --- a/library/cpp/getopt/small/last_getopt_parser.cpp +++ b/library/cpp/getopt/small/last_getopt_parser.cpp @@ -170,9 +170,14 @@ namespace NLastGetopt { bool TOptsParser::ParseOptParam(const TOpt* opt, size_t pos) { Y_ASSERT(opt); - if (opt->GetHasArg() == NO_ARGUMENT || opt->IsEqParseOnly()) { + if (opt->GetHasArg() == NO_ARGUMENT || + opt->GetHasArg() == OPTIONAL_ARGUMENT && opt->IsEqParseOnly()) { return Commit(opt, nullptr, pos, 0); } + if (opt->IsEqParseOnly()) { + Y_ASSERT(opt->GetHasArg() == REQUIRED_ARGUMENT); + throw TUsageException() << "option " << opt->ToShortString() << " requires an argument but only accepts it over ="; + } if (pos == Argc_) { if (opt->GetHasArg() == REQUIRED_ARGUMENT) throw TUsageException() << "option " << opt->ToShortString() << " must have arg"; diff --git a/library/cpp/getopt/ut/last_getopt_ut.cpp b/library/cpp/getopt/ut/last_getopt_ut.cpp index b517ea359d..8fc9b7ef16 100644 --- a/library/cpp/getopt/ut/last_getopt_ut.cpp +++ b/library/cpp/getopt/ut/last_getopt_ut.cpp @@ -449,6 +449,19 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { tester.AcceptEndOfFreeArgs(); } + Y_UNIT_TEST(TestEqParseOnlyRequiredArgument) { + TOptsNoDefault opts; + + opts.AddLongOption("eq-only").RequiredArgument().DisableSpaceParse(); + + TOptsParseResultTestWrapper res(&opts, V({"cmd", "--eq-only=value"})); + UNIT_ASSERT_EQUAL(res.Get("eq-only"), "value"sv); + + UNIT_ASSERT_EXCEPTION( + TOptsParseResultTestWrapper(&opts, V({"cmd", "--eq-only", "value"})), + TUsageException); + } + Y_UNIT_TEST(TestStoreResult) { TOptsNoDefault opts; TString data; diff --git a/util/generic/fwd.h b/util/generic/fwd.h index 9bed19bdaf..906203d60e 100644 --- a/util/generic/fwd.h +++ b/util/generic/fwd.h @@ -45,12 +45,6 @@ class TIntrusiveListWithAutoDelete; template <class T, class Tag = TIntrusiveListDefaultTag> class TIntrusiveSList; -template <class T, class C> -class TAvlTree; - -template <class TValue, class TCmp> -class TRbTree; - // containers template <class T, class A = std::allocator<T>> class TVector; diff --git a/yql/essentials/core/common_opt/yql_co_flow2.cpp b/yql/essentials/core/common_opt/yql_co_flow2.cpp index bc25d612db..ace0141cb2 100644 --- a/yql/essentials/core/common_opt/yql_co_flow2.cpp +++ b/yql/essentials/core/common_opt/yql_co_flow2.cpp @@ -31,16 +31,7 @@ bool AllowComplexFiltersOverAggregatePushdown(const TOptimizeContext& optCtx) { optCtx.Types->MaxAggPushdownPredicates > 0; } -TExprNode::TPtr AggregateSubsetFieldsAnalyzer(const TCoAggregate& node, TExprContext& ctx, const TParentsMap& parentsMap) { - auto inputType = node.Input().Ref().GetTypeAnn(); - auto structType = inputType->GetKind() == ETypeAnnotationKind::List - ? inputType->Cast<TListExprType>()->GetItemType()->Cast<TStructExprType>() - : inputType->Cast<TStreamExprType>()->GetItemType()->Cast<TStructExprType>(); - - if (structType->GetSize() == 0) { - return node.Ptr(); - } - +THashSet<TStringBuf> GetAggregationInputKeys(const TCoAggregate& node) { TMaybe<TStringBuf> sessionColumn; const auto sessionSetting = GetSetting(node.Settings().Ref(), "session"); if (sessionSetting) { @@ -58,13 +49,28 @@ TExprNode::TPtr AggregateSubsetFieldsAnalyzer(const TCoAggregate& node, TExprCon } } - TSet<TStringBuf> usedFields; + THashSet<TStringBuf> result; for (const auto& x : node.Keys()) { if (x.Value() != sessionColumn && x.Value() != hoppingColumn) { - usedFields.insert(x.Value()); + result.insert(x.Value()); } } + return result; +} + +TExprNode::TPtr AggregateSubsetFieldsAnalyzer(const TCoAggregate& node, TExprContext& ctx, const TParentsMap& parentsMap) { + auto inputType = node.Input().Ref().GetTypeAnn(); + auto structType = inputType->GetKind() == ETypeAnnotationKind::List + ? inputType->Cast<TListExprType>()->GetItemType()->Cast<TStructExprType>() + : inputType->Cast<TStreamExprType>()->GetItemType()->Cast<TStructExprType>(); + + if (structType->GetSize() == 0) { + return node.Ptr(); + } + + THashSet<TStringBuf> usedFields = GetAggregationInputKeys(node); + if (usedFields.size() == structType->GetSize()) { return node.Ptr(); } @@ -96,7 +102,7 @@ TExprNode::TPtr AggregateSubsetFieldsAnalyzer(const TCoAggregate& node, TExprCon } } - if (hoppingSetting) { + if (auto hoppingSetting = GetSetting(node.Settings().Ref(), "hopping")) { auto traitsNode = hoppingSetting->ChildPtr(1); if (traitsNode->IsList()) { traitsNode = traitsNode->ChildPtr(1); @@ -120,7 +126,7 @@ TExprNode::TPtr AggregateSubsetFieldsAnalyzer(const TCoAggregate& node, TExprCon } } - if (sessionSetting) { + if (auto sessionSetting = GetSetting(node.Settings().Ref(), "session")) { TCoSessionWindowTraits traits(sessionSetting->Child(1)->ChildPtr(1)); auto usedType = traits.ListType().Ref().GetTypeAnn()->Cast<TTypeExprType>()->GetType()->Cast<TListExprType>()-> @@ -1326,10 +1332,7 @@ TExprBase FilterOverAggregate(const TCoFlatMapBase& node, TExprContext& ctx, TOp TCoConditionalValueBase body = node.Lambda().Body().Cast<TCoConditionalValueBase>(); const TCoAggregate agg = node.Input().Cast<TCoAggregate>(); - THashSet<TStringBuf> keyColumns; - for (auto key : agg.Keys()) { - keyColumns.insert(key.Value()); - } + const THashSet<TStringBuf> keyColumns = GetAggregationInputKeys(agg); TExprNodeList andComponents; if (auto maybeAnd = body.Predicate().Maybe<TCoAnd>()) { diff --git a/yql/essentials/core/common_opt/yql_co_simple1.cpp b/yql/essentials/core/common_opt/yql_co_simple1.cpp index be5a98c0c5..00432ffc5b 100644 --- a/yql/essentials/core/common_opt/yql_co_simple1.cpp +++ b/yql/essentials/core/common_opt/yql_co_simple1.cpp @@ -3675,6 +3675,28 @@ bool IsEarlyExpandOfSkipNullAllowed(const TOptimizeContext& optCtx) { return optCtx.Types->OptimizerFlags.contains(skipNullFlags); } +TExprNode::TPtr ReplaceFuncWithImpl(const TExprNode::TPtr& node, TExprContext& ctx, TOptimizeContext& optCtx) { + auto exportsPtr = optCtx.Types->Modules->GetModule("/lib/yql/core.yql"); + YQL_ENSURE(exportsPtr); + const auto& exports = exportsPtr->Symbols(); + const auto ex = exports.find(TString(node->Content()) + "Impl"); + YQL_ENSURE(exports.cend() != ex); + TNodeOnNodeOwnedMap deepClones; + auto lambda = ctx.DeepCopy(*ex->second, exportsPtr->ExprCtx(), deepClones, true, false); + + YQL_CLOG(DEBUG, Core) << "Replace " << node->Content() << " with implementation"; + return ctx.Builder(node->Pos()) + .Apply(lambda) + .Do([&node](TExprNodeReplaceBuilder& builder) -> TExprNodeReplaceBuilder& { + for (size_t i = 0; i < node->ChildrenSize(); i++) { + builder.With(i, node->ChildPtr(i)); + } + return builder; + }) + .Seal() + .Build(); +} + } // namespace void RegisterCoSimpleCallables1(TCallableOptimizerMap& map) { @@ -4897,6 +4919,65 @@ void RegisterCoSimpleCallables1(TCallableOptimizerMap& map) { return node; }; + map["ListSample"] = map["ListSampleN"] = [](const TExprNode::TPtr& node, TExprContext& ctx, TOptimizeContext& optCtx) { + if (node->Child(0)->GetTypeAnn()->GetKind() == ETypeAnnotationKind::Optional) { + YQL_CLOG(DEBUG, Core) << "Handle optional list in " << node->Content(); + return ctx.Builder(node->Pos()) + .Callable("Map") + .Add(0, node->Child(0)) + .Lambda(1) + .Param("list") + .Callable(node->Content()) + .Arg(0, "list") + .Add(1, node->Child(1)) + .Add(2, node->Child(2)) + .Seal() + .Seal() + .Seal() + .Build(); + } + + if (node->Child(1)->GetTypeAnn()->GetKind() == ETypeAnnotationKind::Optional) { + YQL_CLOG(DEBUG, Core) << "Handle optional prob arg in " << node->Content(); + return ctx.Builder(node->Pos()) + .Callable("IfPresent") + .Add(0, node->Child(1)) + .Lambda(1) + .Param("probArg") + .Callable(node->Content()) + .Add(0, node->Child(0)) + .Arg(1, "probArg") + .Add(2, node->Child(2)) + .Seal() + .Seal() + .Add(2, node->Child(0)) + .Seal() + .Build(); + } + + return ReplaceFuncWithImpl(node, ctx, optCtx); + }; + + map["ListShuffle"] = [](const TExprNode::TPtr& node, TExprContext& ctx, TOptimizeContext& optCtx) { + if (node->Head().GetTypeAnn()->GetKind() == ETypeAnnotationKind::Optional) { + YQL_CLOG(DEBUG, Core) << "Handle optionals args in " << node->Content(); + return ctx.Builder(node->Pos()) + .Callable("Map") + .Add(0, node->Child(0)) + .Lambda(1) + .Param("list") + .Callable(node->Content()) + .Arg(0, "list") + .Add(1, node->Child(1)) + .Seal() + .Seal() + .Seal() + .Build(); + } + + return ReplaceFuncWithImpl(node, ctx, optCtx); + }; + map["OptionalReduce"] = std::bind(&RemoveOptionalReduceOverData, _1, _2); map["Fold"] = [](const TExprNode::TPtr& node, TExprContext& ctx, TOptimizeContext& /*optCtx*/) { diff --git a/yql/essentials/core/type_ann/type_ann_core.cpp b/yql/essentials/core/type_ann/type_ann_core.cpp index ea068f3f4a..810f5f70be 100644 --- a/yql/essentials/core/type_ann/type_ann_core.cpp +++ b/yql/essentials/core/type_ann/type_ann_core.cpp @@ -12594,6 +12594,9 @@ template <NKikimr::NUdf::EDataSlot DataSlot> Functions["ListTopSort"] = &ListTopSortWrapper; Functions["ListTopSortAsc"] = &ListTopSortWrapper; Functions["ListTopSortDesc"] = &ListTopSortWrapper; + Functions["ListSample"] = &ListSampleWrapper; + Functions["ListSampleN"] = &ListSampleNWrapper; + Functions["ListShuffle"] = &ListShuffleWrapper; Functions["ExpandMap"] = &ExpandMapWrapper; Functions["WideMap"] = &WideMapWrapper; diff --git a/yql/essentials/core/type_ann/type_ann_list.cpp b/yql/essentials/core/type_ann/type_ann_list.cpp index 2dcc8c83da..674260bf35 100644 --- a/yql/essentials/core/type_ann/type_ann_list.cpp +++ b/yql/essentials/core/type_ann/type_ann_list.cpp @@ -1524,6 +1524,115 @@ namespace { return OptListWrapperImpl<1U>(input, output, ctx, "Collect"); } + IGraphTransformer::TStatus ListSampleWrapperCommon(const TExprNode::TPtr& input, TExprNode::TPtr& output, NUdf::EDataSlot probArgDataType, TContext& ctx) { + if (!EnsureMinMaxArgsCount(*input, 2, 3, ctx.Expr)) { + return IGraphTransformer::TStatus::Error; + } + + if (IsNull(input->Head())) { + output = input->HeadPtr(); + return IGraphTransformer::TStatus::Repeat; + } + + if (!EnsureComputable(input->Head(), ctx.Expr)) { + return IGraphTransformer::TStatus::Error; + } + + auto type = input->Head().GetTypeAnn(); + if (type->GetKind() == ETypeAnnotationKind::Optional) { + type = type->Cast<TOptionalExprType>()->GetItemType(); + } + + if (type->GetKind() != ETypeAnnotationKind::List && type->GetKind() != ETypeAnnotationKind::EmptyList) { + ctx.Expr.AddError(TIssue(ctx.Expr.GetPosition(input->Head().Pos()), TStringBuilder() + << "Expected (empty) list or optional of (empty) list, but got: " << *input->Head().GetTypeAnn())); + return IGraphTransformer::TStatus::Error; + } + + if (type->GetKind() == ETypeAnnotationKind::EmptyList) { + output = input->HeadPtr(); + return IGraphTransformer::TStatus::Repeat; + } + + if (IsNull(*input->Child(1))) { + output = input->HeadPtr(); + return IGraphTransformer::TStatus::Repeat; + } + + if (!EnsureSpecificDataType(*input->Child(1), probArgDataType, ctx.Expr, true)) { + return IGraphTransformer::TStatus::Error; + } + + if (input->ChildrenSize() == 2) { + auto children = input->ChildrenList(); + children.push_back(ctx.Expr.NewCallable(input->Pos(), "Null", {})); + output = ctx.Expr.ChangeChildren(*input, std::move(children)); + return IGraphTransformer::TStatus::Repeat; + } + YQL_ENSURE(input->ChildrenSize() == 3); + + if (!EnsureComputable(*input->Child(2), ctx.Expr)) { + return IGraphTransformer::TStatus::Error; + } + + input->SetTypeAnn(input->Head().GetTypeAnn()); + return IGraphTransformer::TStatus::Ok; + } + + IGraphTransformer::TStatus ListSampleWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx) { + return ListSampleWrapperCommon(input, output, NUdf::EDataSlot::Double, ctx); + } + + IGraphTransformer::TStatus ListSampleNWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx) { + return ListSampleWrapperCommon(input, output, NUdf::EDataSlot::Uint64, ctx); + } + + IGraphTransformer::TStatus ListShuffleWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx) { + if (!EnsureMinMaxArgsCount(*input, 1, 2, ctx.Expr)) { + return IGraphTransformer::TStatus::Error; + } + + if (IsNull(input->Head())) { + output = input->HeadPtr(); + return IGraphTransformer::TStatus::Repeat; + } + + if (!EnsureComputable(input->Head(), ctx.Expr)) { + return IGraphTransformer::TStatus::Error; + } + + auto type = input->Head().GetTypeAnn(); + if (type->GetKind() == ETypeAnnotationKind::Optional) { + type = type->Cast<TOptionalExprType>()->GetItemType(); + } + + if (type->GetKind() != ETypeAnnotationKind::List && type->GetKind() != ETypeAnnotationKind::EmptyList) { + ctx.Expr.AddError(TIssue(ctx.Expr.GetPosition(input->Head().Pos()), TStringBuilder() + << "Expected (empty) list or optional of (empty) list, but got: " << *input->Head().GetTypeAnn())); + return IGraphTransformer::TStatus::Error; + } + + if (type->GetKind() == ETypeAnnotationKind::EmptyList) { + output = input->HeadPtr(); + return IGraphTransformer::TStatus::Repeat; + } + + if (input->ChildrenSize() == 1) { + auto children = input->ChildrenList(); + children.push_back(ctx.Expr.NewCallable(input->Pos(), "Null", {})); + output = ctx.Expr.ChangeChildren(*input, std::move(children)); + return IGraphTransformer::TStatus::Repeat; + } + YQL_ENSURE(input->ChildrenSize() == 2); + + if (!EnsureComputable(*input->Child(1), ctx.Expr)) { + return IGraphTransformer::TStatus::Error; + } + + input->SetTypeAnn(input->Head().GetTypeAnn()); + return IGraphTransformer::TStatus::Ok; + } + IGraphTransformer::TStatus OptListFold1WrapperImpl(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx, TExprNode::TPtr&& updateLambda) { if (IsNull(input->Head())) { output = input->HeadPtr(); diff --git a/yql/essentials/core/type_ann/type_ann_list.h b/yql/essentials/core/type_ann/type_ann_list.h index 6b15965d62..7071b67461 100644 --- a/yql/essentials/core/type_ann/type_ann_list.h +++ b/yql/essentials/core/type_ann/type_ann_list.h @@ -41,6 +41,9 @@ namespace NTypeAnnImpl { IGraphTransformer::TStatus ListTopSortWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx); IGraphTransformer::TStatus ListExtractWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx); IGraphTransformer::TStatus ListCollectWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx); + IGraphTransformer::TStatus ListSampleWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx); + IGraphTransformer::TStatus ListSampleNWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx); + IGraphTransformer::TStatus ListShuffleWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx); IGraphTransformer::TStatus FoldMapWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx); IGraphTransformer::TStatus Fold1MapWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx); IGraphTransformer::TStatus Chain1MapWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx); diff --git a/yql/essentials/minikql/computation/mkql_computation_node_pack.h b/yql/essentials/minikql/computation/mkql_computation_node_pack.h index 5dc47ada2d..6e79b1a1a3 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_pack.h +++ b/yql/essentials/minikql/computation/mkql_computation_node_pack.h @@ -90,6 +90,10 @@ public: return !ItemCount_; } + bool IsBlock() const { + return IsBlock_; + } + void Clear(); NYql::TChunkedBuffer Finish(); diff --git a/yql/essentials/mount/lib/yql/core.yql b/yql/essentials/mount/lib/yql/core.yql index 88aeb0e7df..be99a7f87e 100755 --- a/yql/essentials/mount/lib/yql/core.yql +++ b/yql/essentials/mount/lib/yql/core.yql @@ -479,6 +479,56 @@ def signature(script, name): (lambda '() (Apply ListToTupleImpl list n))) )) +(let ListSampleImpl (lambda '(list probability dependsOn) + (Filter list (lambda '(x) (< (Random (DependsOn '(x probability dependsOn))) probability))) +)) + +(let ListSampleNImpl (lambda '(list count dependsOn) (block '( + (let value_type (ListItemType (TypeOf list))) + + (let UdfVectorCreate (Udf 'Vector.Create (Void) (TupleType (TupleType value_type (DataType 'Uint64)) (StructType) value_type))) + + (let resource_type (TypeOf (Apply UdfVectorCreate (Uint32 '0)))) + + (let UdfVectorEmplace (Udf 'Vector.Emplace (Void) (TupleType (TupleType resource_type (DataType 'Uint64) value_type) (StructType) value_type))) + (let UdfVectorSwap (Udf 'Vector.Swap (Void) (TupleType (TupleType resource_type (DataType 'Uint64) (DataType 'Uint64)) (StructType) value_type))) + (let UdfVectorGetResult (Udf 'Vector.GetResult (Void) (TupleType (TupleType resource_type) (StructType) value_type))) + + (return (Apply UdfVectorGetResult (Fold + (Skip (Enumerate list) count) + (Fold + (Take list count) + (NamedApply UdfVectorCreate '(count) (AsStruct) (DependsOn '(list dependsOn))) + (lambda '(x y) (Apply UdfVectorEmplace y count x)) + ) + (lambda '(x y) (block '( + (let pos (Coalesce (% (RandomNumber (DependsOn '(x count dependsOn))) (+ (Nth x '0) (Uint64 '1))) (Uint64 '0))) + (return (If (< pos count) (Apply UdfVectorEmplace y pos (Nth x '1)) y)) + ))) + ))) +)))) + +(let ListShuffleImpl (lambda '(list dependsOn) (block '( + (let value_type (ListItemType (TypeOf list))) + + (let UdfVectorCreate (Udf 'Vector.Create (Void) (TupleType (TupleType value_type (DataType 'Uint64)) (StructType) value_type))) + + (let resource_type (TypeOf (Apply UdfVectorCreate (Uint32 '0)))) + + (let UdfVectorEmplace (Udf 'Vector.Emplace (Void) (TupleType (TupleType resource_type (DataType 'Uint64) value_type) (StructType) value_type))) + (let UdfVectorSwap (Udf 'Vector.Swap (Void) (TupleType (TupleType resource_type (DataType 'Uint64) (DataType 'Uint64)) (StructType) value_type))) + (let UdfVectorGetResult (Udf 'Vector.GetResult (Void) (TupleType (TupleType resource_type) (StructType) value_type))) + + (return (Apply UdfVectorGetResult (Fold + (Enumerate list) + (NamedApply UdfVectorCreate '((Uint32 '1)) (AsStruct) (DependsOn '(list dependsOn))) + (lambda '(x y) (block '( + (let pos (Coalesce (% (RandomNumber (DependsOn '(x dependsOn))) (+ (Nth x '0) (Uint64 '1))) (Uint64 '0))) + (return (Apply UdfVectorSwap (Apply UdfVectorEmplace y (Nth x '0) (Nth x '1)) pos (Nth x '0))) + ))) + ))) +)))) + (export Equals) (export Unequals) (export FindIndex) @@ -516,4 +566,7 @@ def signature(script, name): (export ForceSpreadMembers) (export ListFromTuple) (export ListToTuple) +(export ListSampleImpl) +(export ListSampleNImpl) +(export ListShuffleImpl) ) diff --git a/yql/essentials/sql/v1/SQLv1.g.in b/yql/essentials/sql/v1/SQLv1.g.in index 9369b111a9..1b645f0b89 100644 --- a/yql/essentials/sql/v1/SQLv1.g.in +++ b/yql/essentials/sql/v1/SQLv1.g.in @@ -75,6 +75,7 @@ sql_stmt_core: | drop_resource_pool_classifier_stmt | backup_stmt | restore_stmt + | alter_sequence_stmt ; expr: @@ -791,10 +792,16 @@ table_setting_value: | STRING_VALUE | integer | split_boundaries - | expr ON an_id (AS (SECONDS | MILLISECONDS | MICROSECONDS | NANOSECONDS))? + | ttl_tier_list ON an_id (AS (SECONDS | MILLISECONDS | MICROSECONDS | NANOSECONDS))? | bool_value ; +ttl_tier_list: expr (ttl_tier_action (COMMA expr ttl_tier_action)*)?; +ttl_tier_action: + TO EXTERNAL DATA SOURCE an_id + | DELETE +; + family_entry: FAMILY an_id family_settings; family_settings: LPAREN (family_settings_entry (COMMA family_settings_entry)*)? RPAREN; family_settings_entry: an_id EQUALS family_setting_value; @@ -1048,6 +1055,14 @@ analyze_table: simple_table_ref (LPAREN column_list RPAREN)?; analyze_table_list: analyze_table (COMMA analyze_table)* COMMA?; analyze_stmt: ANALYZE analyze_table_list; +alter_sequence_stmt: ALTER SEQUENCE (IF EXISTS)? object_ref alter_sequence_action+; +alter_sequence_action: + START WITH? integer + | RESTART WITH? integer + | RESTART + | INCREMENT BY? integer +; + // Special rules that allow to use certain keywords as identifiers. identifier: ID_PLAIN | ID_QUOTED; id: identifier | keyword; @@ -1333,6 +1348,7 @@ keyword_as_compat: | IMMEDIATE | IMPORT | IN + | INCREMENT | INCREMENTAL | INDEX | INDEXED @@ -1407,6 +1423,7 @@ keyword_as_compat: | REPLICATION | RESET | RESPECT + | RESTART | RESTORE | RESTRICT // | RESULT @@ -1424,7 +1441,9 @@ keyword_as_compat: | SETS | SHOW | SKIP + | SEQUENCE | SOURCE + | START | SUBQUERY | SUBSET | SYMBOLS @@ -1551,6 +1570,7 @@ keyword_compat: ( | IMMEDIATE | IMPORT | IN + | INCREMENT | INCREMENTAL | INDEX | INDEXED @@ -1625,6 +1645,7 @@ keyword_compat: ( | REPLICATION | RESET | RESPECT + | RESTART | RESTORE | RESTRICT | RESULT @@ -1642,7 +1663,9 @@ keyword_compat: ( | SETS | SHOW | SKIP + | SEQUENCE | SOURCE + | START | SUBQUERY | SUBSET | SYMBOLS @@ -1897,6 +1920,7 @@ ILIKE: I L I K E; IMMEDIATE: I M M E D I A T E; IMPORT: I M P O R T; IN: I N; +INCREMENT: I N C R E M E N T; INCREMENTAL: I N C R E M E N T A L; INDEX: I N D E X; INDEXED: I N D E X E D; @@ -1986,6 +2010,7 @@ REPLICATION: R E P L I C A T I O N; RESET: R E S E T; RESOURCE: R E S O U R C E; RESPECT: R E S P E C T; +RESTART: R E S T A R T; RESTORE: R E S T O R E; RESTRICT: R E S T R I C T; RESULT: R E S U L T; @@ -2010,7 +2035,9 @@ SET: S E T; SETS: S E T S; SHOW: S H O W; SKIP: S K I P; +SEQUENCE: S E Q U E N C E; SOURCE: S O U R C E; +START: S T A R T; STREAM: S T R E A M; STRUCT: S T R U C T; SUBQUERY: S U B Q U E R Y; diff --git a/yql/essentials/sql/v1/SQLv1Antlr4.g.in b/yql/essentials/sql/v1/SQLv1Antlr4.g.in index 229b15dfae..5435535336 100644 --- a/yql/essentials/sql/v1/SQLv1Antlr4.g.in +++ b/yql/essentials/sql/v1/SQLv1Antlr4.g.in @@ -74,6 +74,7 @@ sql_stmt_core: | drop_resource_pool_classifier_stmt | backup_stmt | restore_stmt + | alter_sequence_stmt ; expr: @@ -790,10 +791,16 @@ table_setting_value: | STRING_VALUE | integer | split_boundaries - | expr ON an_id (AS (SECONDS | MILLISECONDS | MICROSECONDS | NANOSECONDS))? + | ttl_tier_list ON an_id (AS (SECONDS | MILLISECONDS | MICROSECONDS | NANOSECONDS))? | bool_value ; +ttl_tier_list: expr (ttl_tier_action (COMMA expr ttl_tier_action)*)?; +ttl_tier_action: + TO EXTERNAL DATA SOURCE an_id + | DELETE +; + family_entry: FAMILY an_id family_settings; family_settings: LPAREN (family_settings_entry (COMMA family_settings_entry)*)? RPAREN; family_settings_entry: an_id EQUALS family_setting_value; @@ -1047,6 +1054,14 @@ analyze_table: simple_table_ref (LPAREN column_list RPAREN)?; analyze_table_list: analyze_table (COMMA analyze_table)* COMMA?; analyze_stmt: ANALYZE analyze_table_list; +alter_sequence_stmt: ALTER SEQUENCE (IF EXISTS)? object_ref alter_sequence_action+; +alter_sequence_action: + START WITH? integer + | RESTART WITH? integer + | RESTART + | INCREMENT BY? integer +; + // Special rules that allow to use certain keywords as identifiers. identifier: ID_PLAIN | ID_QUOTED; id: identifier | keyword; @@ -1332,6 +1347,7 @@ keyword_as_compat: | IMMEDIATE | IMPORT | IN + | INCREMENT | INCREMENTAL | INDEX | INDEXED @@ -1406,6 +1422,7 @@ keyword_as_compat: | REPLICATION | RESET | RESPECT + | RESTART | RESTORE | RESTRICT // | RESULT @@ -1423,7 +1440,9 @@ keyword_as_compat: | SETS | SHOW | TSKIP + | SEQUENCE | SOURCE + | START | SUBQUERY | SUBSET | SYMBOLS @@ -1550,6 +1569,7 @@ keyword_compat: ( | IMMEDIATE | IMPORT | IN + | INCREMENT | INCREMENTAL | INDEX | INDEXED @@ -1624,6 +1644,7 @@ keyword_compat: ( | REPLICATION | RESET | RESPECT + | RESTART | RESTORE | RESTRICT | RESULT @@ -1641,7 +1662,9 @@ keyword_compat: ( | SETS | SHOW | TSKIP + | SEQUENCE | SOURCE + | START | SUBQUERY | SUBSET | SYMBOLS @@ -1896,6 +1919,7 @@ ILIKE: I L I K E; IMMEDIATE: I M M E D I A T E; IMPORT: I M P O R T; IN: I N; +INCREMENT: I N C R E M E N T; INCREMENTAL: I N C R E M E N T A L; INDEX: I N D E X; INDEXED: I N D E X E D; @@ -1985,6 +2009,7 @@ REPLICATION: R E P L I C A T I O N; RESET: R E S E T; RESOURCE: R E S O U R C E; RESPECT: R E S P E C T; +RESTART: R E S T A R T; RESTORE: R E S T O R E; RESTRICT: R E S T R I C T; RESULT: R E S U L T; @@ -2009,7 +2034,9 @@ SET: S E T; SETS: S E T S; SHOW: S H O W; TSKIP: S K I P; +SEQUENCE: S E Q U E N C E; SOURCE: S O U R C E; +START: S T A R T; STREAM: S T R E A M; STRUCT: S T R U C T; SUBQUERY: S U B Q U E R Y; diff --git a/yql/essentials/sql/v1/builtin.cpp b/yql/essentials/sql/v1/builtin.cpp index e327c2d2ea..94d8a3bc16 100644 --- a/yql/essentials/sql/v1/builtin.cpp +++ b/yql/essentials/sql/v1/builtin.cpp @@ -2916,6 +2916,9 @@ struct TBuiltinFuncData { {"listtopsort", BuildNamedArgcBuiltinFactoryCallback<TCallNodeImpl>("ListTopSort", 2, 3)}, {"listtopsortasc", BuildNamedArgcBuiltinFactoryCallback<TCallNodeImpl>("ListTopSortAsc", 2, 3)}, {"listtopsortdesc", BuildNamedArgcBuiltinFactoryCallback<TCallNodeImpl>("ListTopSortDesc", 2, 3)}, + {"listsample", BuildNamedArgcBuiltinFactoryCallback<TCallNodeImpl>("ListSample", 2, 3)}, + {"listsamplen", BuildNamedArgcBuiltinFactoryCallback<TCallNodeImpl>("ListSampleN", 2, 3)}, + {"listshuffle", BuildNamedArgcBuiltinFactoryCallback<TCallNodeImpl>("ListShuffle", 1, 2)}, // Dict builtins {"dictlength", BuildNamedArgcBuiltinFactoryCallback<TCallNodeImpl>("Length", 1, 1)}, diff --git a/yql/essentials/sql/v1/format/sql_format.cpp b/yql/essentials/sql/v1/format/sql_format.cpp index 80ce5d139e..3cc18b141b 100644 --- a/yql/essentials/sql/v1/format/sql_format.cpp +++ b/yql/essentials/sql/v1/format/sql_format.cpp @@ -962,6 +962,12 @@ private: VisitAllFields(TRule_use_stmt::GetDescriptor(), msg); } + void VisitAlterSequence(const TRule_alter_sequence_stmt& msg) { + PosFromToken(msg.GetToken1()); + NewLine(); + VisitAllFields(TRule_alter_sequence_stmt::GetDescriptor(), msg); + } + void VisitIntoTable(const TRule_into_table_stmt& msg) { switch (msg.GetBlock1().Alt_case()) { case TRule_into_table_stmt_TBlock1::AltCase::kAlt1: @@ -2495,6 +2501,66 @@ private: Visit(msg.GetToken5()); } + void VisitTableSettingValue(const TRule_table_setting_value& msg) { + switch (msg.GetAltCase()) { + case TRule_table_setting_value::kAltTableSettingValue5: { + // | ttl_tier_list ON an_id (AS (SECONDS | MILLISECONDS | MICROSECONDS | NANOSECONDS))? + const auto& ttlSettings = msg.GetAlt_table_setting_value5(); + const auto& tierList = ttlSettings.GetRule_ttl_tier_list1(); + const bool needIndent = tierList.HasBlock2() && tierList.GetBlock2().Block2Size() > 0; // more then one tier + if (needIndent) { + NewLine(); + PushCurrentIndent(); + Visit(tierList.GetRule_expr1()); + VisitTtlTierAction(tierList.GetBlock2().GetRule_ttl_tier_action1()); + + for (const auto& tierEntry : tierList.GetBlock2().GetBlock2()) { + Visit(tierEntry.GetToken1()); // comma + NewLine(); + Visit(tierEntry.GetRule_expr2()); + VisitTtlTierAction(tierEntry.GetRule_ttl_tier_action3()); + } + + PopCurrentIndent(); + NewLine(); + } else { + Visit(tierList.GetRule_expr1()); + if (tierList.HasBlock2()) { + VisitTtlTierAction(tierList.GetBlock2().GetRule_ttl_tier_action1()); + } + } + + VisitKeyword(ttlSettings.GetToken2()); + Visit(ttlSettings.GetRule_an_id3()); + if (ttlSettings.HasBlock4()) { + VisitKeyword(ttlSettings.GetBlock4().GetToken1()); + VisitKeyword(ttlSettings.GetBlock4().GetToken2()); + } + } break; + default: + VisitAllFields(TRule_table_setting_value::GetDescriptor(), msg); + } + } + + void VisitTtlTierAction(const TRule_ttl_tier_action& msg) { + switch (msg.GetAltCase()) { + case TRule_ttl_tier_action::kAltTtlTierAction1: + // | TO EXTERNAL DATA SOURCE an_id + VisitKeyword(msg.GetAlt_ttl_tier_action1().GetToken1()); + VisitKeyword(msg.GetAlt_ttl_tier_action1().GetToken2()); + VisitKeyword(msg.GetAlt_ttl_tier_action1().GetToken3()); + VisitKeyword(msg.GetAlt_ttl_tier_action1().GetToken4()); + Visit(msg.GetAlt_ttl_tier_action1().GetRule_an_id5()); + break; + case TRule_ttl_tier_action::kAltTtlTierAction2: + // | DELETE + VisitKeyword(msg.GetAlt_ttl_tier_action2().GetToken1()); + break; + case TRule_ttl_tier_action::ALT_NOT_SET: + break; + } + } + void VisitExpr(const TRule_expr& msg) { if (msg.HasAlt_expr2()) { Visit(msg.GetAlt_expr2()); @@ -2783,6 +2849,8 @@ TStaticData::TStaticData() {TRule_case_expr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCaseExpr)}, {TRule_when_expr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitWhenExpr)}, {TRule_with_table_settings::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitWithTableSettingsExpr)}, + {TRule_table_setting_value::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitTableSettingValue)}, + {TRule_ttl_tier_action::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitTtlTierAction)}, {TRule_expr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitExpr)}, {TRule_or_subexpr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitOrSubexpr)}, @@ -2853,6 +2921,7 @@ TStaticData::TStaticData() {TRule_drop_resource_pool_classifier_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropResourcePoolClassifier)}, {TRule_backup_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitBackup)}, {TRule_restore_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitRestore)}, + {TRule_alter_sequence_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterSequence)}, }) , ObfuscatingVisitDispatch({ {TToken::GetDescriptor(), MakeObfuscatingFunctor(&TObfuscatingVisitor::VisitToken)}, diff --git a/yql/essentials/sql/v1/format/sql_format_ut.h b/yql/essentials/sql/v1/format/sql_format_ut.h index 6d92bd29eb..fc919b38c4 100644 --- a/yql/essentials/sql/v1/format/sql_format_ut.h +++ b/yql/essentials/sql/v1/format/sql_format_ut.h @@ -115,6 +115,17 @@ Y_UNIT_TEST(AlterGroup) { setup.Run(cases); } +Y_UNIT_TEST(AlterSequence) { + TCases cases = { + {"use plato;alter sequence sequence start with 10 increment 2 restart with 5;","USE plato;\n\nALTER SEQUENCE sequence START WITH 10 INCREMENT 2 RESTART WITH 5;\n"}, + {"use plato;alter sequence if exists sequence increment 1000 start 100 restart;","USE plato;\n\nALTER SEQUENCE IF EXISTS sequence INCREMENT 1000 START 100 RESTART;\n"}, + }; + + TSetup setup; + setup.Run(cases); +} + + Y_UNIT_TEST(Use) { TCases cases = { {"use user;","USE user;\n"}, @@ -226,6 +237,16 @@ Y_UNIT_TEST(CreateTable) { "CREATE TABLE user (\n\tuser int32\n)\nWITH (ttl = interval('P1D') ON user AS MICROSECONDS);\n"}, {"create table user(user int32) with (ttl=interval('P1D') on user as nAnOsEcOnDs)", "CREATE TABLE user (\n\tuser int32\n)\nWITH (ttl = interval('P1D') ON user AS NANOSECONDS);\n"}, + {"create table user(user int32) with (ttl=interval('P1D') delete on user as nAnOsEcOnDs)", + "CREATE TABLE user (\n\tuser int32\n)\nWITH (ttl = interval('P1D') DELETE ON user AS NANOSECONDS);\n"}, + {"create table user(user int32) with (ttl=interval('P1D')to external data source tier1 ,interval('P10D')delete on user as seconds)", + "CREATE TABLE user (\n" + "\tuser int32\n" + ")\n" + "WITH (ttl =\n" + "\tinterval('P1D') TO EXTERNAL DATA SOURCE tier1,\n" + "\tinterval('P10D') DELETE\n" + "ON user AS SECONDS);\n"}, {"create table user(index user global unique sync on (user,user) with (user=user,user=user))", "CREATE TABLE user (\n\tINDEX user GLOBAL UNIQUE SYNC ON (user, user) WITH (user = user, user = user)\n);\n"}, {"create table user(index user global async on (user) with (user=user,))", diff --git a/yql/essentials/sql/v1/node.cpp b/yql/essentials/sql/v1/node.cpp index c7cafda7a5..b285142909 100644 --- a/yql/essentials/sql/v1/node.cpp +++ b/yql/essentials/sql/v1/node.cpp @@ -1894,9 +1894,14 @@ TMaybe<TStringContent> StringContentOrIdContent(TContext& ctx, TPosition pos, co (ctx.AnsiQuotedIdentifiers && input.StartsWith('"'))? EStringContentMode::AnsiIdent : EStringContentMode::Default); } -TTtlSettings::TTtlSettings(const TIdentifier& columnName, const TNodePtr& expr, const TMaybe<EUnit>& columnUnit) +TTtlSettings::TTierSettings::TTierSettings(const TNodePtr& evictionDelay, const std::optional<TIdentifier>& storageName) + : EvictionDelay(evictionDelay) + , StorageName(storageName) { +} + +TTtlSettings::TTtlSettings(const TIdentifier& columnName, const std::vector<TTierSettings>& tiers, const TMaybe<EUnit>& columnUnit) : ColumnName(columnName) - , Expr(expr) + , Tiers(tiers) , ColumnUnit(columnUnit) { } @@ -3131,10 +3136,10 @@ public: Y_DEBUG_ABORT_UNLESS(FuncNode); FuncNode->VisitTree(func, visited); } - + void CollectPreaggregateExprs(TContext& ctx, ISource& src, TVector<INode::TPtr>& exprs) override { if (ctx.DistinctOverWindow) { - FuncNode->CollectPreaggregateExprs(ctx, src, exprs); + FuncNode->CollectPreaggregateExprs(ctx, src, exprs); } else { INode::CollectPreaggregateExprs(ctx, src, exprs); } @@ -3274,7 +3279,7 @@ TSourcePtr TryMakeSourceFromExpression(TPosition pos, TContext& ctx, const TStri return nullptr; } - auto wrappedNode = new TAstListNodeImpl(pos, { + auto wrappedNode = new TAstListNodeImpl(pos, { new TAstAtomNodeImpl(pos, "EvaluateAtom", TNodeFlags::Default), node }); @@ -3303,7 +3308,7 @@ void MakeTableFromExpression(TPosition pos, TContext& ctx, TNodePtr node, TDefer node = node->Y("Concat", node->Y("String", node->Q(prefix)), node); } - auto wrappedNode = new TAstListNodeImpl(pos, { + auto wrappedNode = new TAstListNodeImpl(pos, { new TAstAtomNodeImpl(pos, "EvaluateAtom", TNodeFlags::Default), node }); @@ -3320,7 +3325,7 @@ TDeferredAtom MakeAtomFromExpression(TPosition pos, TContext& ctx, TNodePtr node node = node->Y("Concat", node->Y("String", node->Q(prefix)), node); } - auto wrappedNode = new TAstListNodeImpl(pos, { + auto wrappedNode = new TAstListNodeImpl(pos, { new TAstAtomNodeImpl(pos, "EvaluateAtom", TNodeFlags::Default), node }); @@ -3462,7 +3467,7 @@ bool TVectorIndexSettings::Validate(TContext& ctx) const { if (!Distance && !Similarity) { ctx.Error() << "either distance or similarity should be set"; return false; - } + } if (!VectorType) { ctx.Error() << "vector_type should be set"; return false; diff --git a/yql/essentials/sql/v1/node.h b/yql/essentials/sql/v1/node.h index 5805f92042..99f42f353c 100644 --- a/yql/essentials/sql/v1/node.h +++ b/yql/essentials/sql/v1/node.h @@ -1112,11 +1112,18 @@ namespace NSQLTranslationV1 { Nanoseconds /* "nanoseconds" */, }; + struct TTierSettings { + TNodePtr EvictionDelay; + std::optional<TIdentifier> StorageName; + + TTierSettings(const TNodePtr& evictionDelay, const std::optional<TIdentifier>& storageName = std::nullopt); + }; + TIdentifier ColumnName; - TNodePtr Expr; + std::vector<TTierSettings> Tiers; TMaybe<EUnit> ColumnUnit; - TTtlSettings(const TIdentifier& columnName, const TNodePtr& expr, const TMaybe<EUnit>& columnUnit = {}); + TTtlSettings(const TIdentifier& columnName, const std::vector<TTierSettings>& tiers, const TMaybe<EUnit>& columnUnit = {}); }; struct TTableSettings { @@ -1293,6 +1300,14 @@ namespace NSQLTranslationV1 { TVector<TDeferredAtom> Roles; }; + struct TSequenceParameters { + bool MissingOk = false; + TMaybe<TDeferredAtom> StartValue; + bool IsRestart = false; + TMaybe<TDeferredAtom> RestartValue; + TMaybe<TDeferredAtom> Increment; + }; + struct TTopicConsumerSettings { struct TLocalSinkSettings { // no special settings diff --git a/yql/essentials/sql/v1/query.cpp b/yql/essentials/sql/v1/query.cpp index 56dd8bd63d..8e71da3146 100644 --- a/yql/essentials/sql/v1/query.cpp +++ b/yql/essentials/sql/v1/query.cpp @@ -240,7 +240,17 @@ static INode::TPtr CreateTableSettings(const TTableSettings& tableSettings, ETab auto opts = Y(); opts = L(opts, Q(Y(Q("columnName"), BuildQuotedAtom(ttlSettings.ColumnName.Pos, ttlSettings.ColumnName.Name)))); - opts = L(opts, Q(Y(Q("expireAfter"), ttlSettings.Expr))); + + auto tiersDesc = Y(); + for (const auto& tier : ttlSettings.Tiers) { + auto tierDesc = Y(); + tierDesc = L(tierDesc, Q(Y(Q("evictionDelay"), tier.EvictionDelay))); + if (tier.StorageName) { + tierDesc = L(tierDesc, Q(Y(Q("storageName"), BuildQuotedAtom(tier.StorageName->Pos, tier.StorageName->Name)))); + } + tiersDesc = L(tiersDesc, Q(tierDesc)); + } + opts = L(opts, Q(Y(Q("tiers"), Q(tiersDesc)))); if (ttlSettings.ColumnUnit) { opts = L(opts, Q(Y(Q("columnUnit"), Q(ToString(*ttlSettings.ColumnUnit))))); @@ -2039,6 +2049,110 @@ TNodePtr BuildAlterUser(TPosition pos, const TString& service, const TDeferredAt return new TAlterUser(pos, service, cluster, name, params, scoped); } +class TAlterSequence final: public TAstListNode { +public: + TAlterSequence(TPosition pos, const TString& service, const TDeferredAtom& cluster, const TString& id, const TSequenceParameters& params, TScopedStatePtr scoped) + : TAstListNode(pos) + , Service(service) + , Cluster(cluster) + , Id(id) + , Params(params) + , Scoped(scoped) + { + FakeSource = BuildFakeSource(pos); + scoped->UseCluster(service, cluster); + } + + bool DoInit(TContext& ctx, ISource* src) override { + Y_UNUSED(src); + + TNodePtr cluster = Scoped->WrapCluster(Cluster, ctx); + + if (!cluster->Init(ctx, FakeSource.Get())) { + return false; + } + + auto options = Y(); + TString mode = Params.MissingOk ? "alter_if_exists" : "alter"; + options = L(options, Q(Y(Q("mode"), Q(mode)))); + + if (Params.IsRestart) { + if (Params.RestartValue) { + TString strValue = Params.RestartValue->Build()->GetLiteralValue(); + ui64 value = FromString<ui64>(strValue); + ui64 maxValue = ui64(std::numeric_limits<i64>::max()); + ui64 minValue = 1; + if (value > maxValue) { + ctx.Error(Pos) << "Restart value: " << value << " cannot be greater than max value: " << maxValue; + return false; + } + if (value < minValue) { + ctx.Error(Pos) << "Restart value: " << value << " cannot be less than min value: " << minValue; + return false; + } + options = L(options, Q(Y(Q("restart"), Q(ToString(value))))); + } else { + options = L(options, Q(Y(Q("restart"), Q(TString())))); + } + } + if (Params.StartValue) { + TString strValue = Params.StartValue->Build()->GetLiteralValue(); + ui64 value = FromString<ui64>(strValue); + ui64 maxValue = ui64(std::numeric_limits<i64>::max()); + ui64 minValue = 1; + if (value > maxValue) { + ctx.Error(Pos) << "Start value: " << value << " cannot be greater than max value: " << maxValue; + return false; + } + if (value < minValue) { + ctx.Error(Pos) << "Start value: " << value << " cannot be less than min value: " << minValue; + return false; + } + options = L(options, Q(Y(Q("start"), Q(ToString(value))))); + } + + if (Params.Increment) { + TString strValue = Params.Increment->Build()->GetLiteralValue(); + ui64 value = FromString<ui64>(strValue); + ui64 maxValue = ui64(std::numeric_limits<i64>::max()); + if (value > maxValue) { + ctx.Error(Pos) << "Increment: " << value << " cannot be greater than max value: " << maxValue; + return false; + } + if (value == 0) { + ctx.Error(Pos) << "Increment must not be zero"; + return false; + } + options = L(options, Q(Y(Q("increment"), Q(ToString(value))))); + } + + Add("block", Q(Y( + Y("let", "sink", Y("DataSink", BuildQuotedAtom(Pos, TString(KikimrProviderName)), + Scoped->WrapCluster(Cluster, ctx))), + Y("let", "world", Y(TString(WriteName), "world", "sink", Y("Key", Q(Y(Q("sequence"), Y("String", BuildQuotedAtom(Pos, Id))))), Y("Void"), Q(options))), + Y("return", ctx.PragmaAutoCommit ? Y(TString(CommitName), "world", "sink") : AstNode("world")) + ))); + + return TAstListNode::DoInit(ctx, src); + } + + TPtr DoClone() const final { + return {}; + } +private: + const TString Service; + TDeferredAtom Cluster; + TString Id; + const TSequenceParameters Params; + + TScopedStatePtr Scoped; + TSourcePtr FakeSource; +}; + +TNodePtr BuildAlterSequence(TPosition pos, const TString& service, const TDeferredAtom& cluster, const TString& id, const TSequenceParameters& params, TScopedStatePtr scoped) { + return new TAlterSequence(pos, service, cluster, id, params, scoped); +} + class TRenameRole final: public TAstListNode { public: TRenameRole(TPosition pos, bool isUser, const TString& service, const TDeferredAtom& cluster, const TDeferredAtom& name, const TDeferredAtom& newName, TScopedStatePtr scoped) diff --git a/yql/essentials/sql/v1/source.h b/yql/essentials/sql/v1/source.h index 35129fffbb..ba904d6c21 100644 --- a/yql/essentials/sql/v1/source.h +++ b/yql/essentials/sql/v1/source.h @@ -312,6 +312,7 @@ namespace NSQLTranslationV1 { TNodePtr BuildWriteTable(TPosition pos, const TString& label, const TTableRef& table, EWriteColumnMode mode, TNodePtr options, TScopedStatePtr scoped); TNodePtr BuildAnalyze(TPosition pos, const TString& service, const TDeferredAtom& cluster, const TAnalyzeParams& params, TScopedStatePtr scoped); + TNodePtr BuildAlterSequence(TPosition pos, const TString& service, const TDeferredAtom& cluster, const TString& id, const TSequenceParameters& params, TScopedStatePtr scoped); TSourcePtr TryMakeSourceFromExpression(TPosition pos, TContext& ctx, const TString& currService, const TDeferredAtom& currCluster, TNodePtr node, const TString& view = {}); void MakeTableFromExpression(TPosition pos, TContext& ctx, TNodePtr node, TDeferredAtom& table, const TString& prefix = {}); diff --git a/yql/essentials/sql/v1/sql.cpp b/yql/essentials/sql/v1/sql.cpp index 506b3950d5..3e5dba78f3 100644 --- a/yql/essentials/sql/v1/sql.cpp +++ b/yql/essentials/sql/v1/sql.cpp @@ -140,22 +140,22 @@ bool NeedUseForAllStatements(const TRule_sql_stmt_core::AltCase& subquery) { case TRule_sql_stmt_core::kAltSqlStmtCore17: // do case TRule_sql_stmt_core::kAltSqlStmtCore19: // if case TRule_sql_stmt_core::kAltSqlStmtCore20: // for - case TRule_sql_stmt_core::kAltSqlStmtCore21: // values + case TRule_sql_stmt_core::kAltSqlStmtCore21: // values case TRule_sql_stmt_core::kAltSqlStmtCore22: // create user case TRule_sql_stmt_core::kAltSqlStmtCore23: // alter user case TRule_sql_stmt_core::kAltSqlStmtCore24: // create group - case TRule_sql_stmt_core::kAltSqlStmtCore25: // alter group - case TRule_sql_stmt_core::kAltSqlStmtCore26: // drop role - case TRule_sql_stmt_core::kAltSqlStmtCore27: // create object - case TRule_sql_stmt_core::kAltSqlStmtCore28: // alter object - case TRule_sql_stmt_core::kAltSqlStmtCore29: // drop object - case TRule_sql_stmt_core::kAltSqlStmtCore30: // create external data source - case TRule_sql_stmt_core::kAltSqlStmtCore31: // alter external data source - case TRule_sql_stmt_core::kAltSqlStmtCore32: // drop external data source - case TRule_sql_stmt_core::kAltSqlStmtCore33: // create replication - case TRule_sql_stmt_core::kAltSqlStmtCore34: // drop replication - case TRule_sql_stmt_core::kAltSqlStmtCore35: // create topic - case TRule_sql_stmt_core::kAltSqlStmtCore36: // alter topic + case TRule_sql_stmt_core::kAltSqlStmtCore25: // alter group + case TRule_sql_stmt_core::kAltSqlStmtCore26: // drop role + case TRule_sql_stmt_core::kAltSqlStmtCore27: // create object + case TRule_sql_stmt_core::kAltSqlStmtCore28: // alter object + case TRule_sql_stmt_core::kAltSqlStmtCore29: // drop object + case TRule_sql_stmt_core::kAltSqlStmtCore30: // create external data source + case TRule_sql_stmt_core::kAltSqlStmtCore31: // alter external data source + case TRule_sql_stmt_core::kAltSqlStmtCore32: // drop external data source + case TRule_sql_stmt_core::kAltSqlStmtCore33: // create replication + case TRule_sql_stmt_core::kAltSqlStmtCore34: // drop replication + case TRule_sql_stmt_core::kAltSqlStmtCore35: // create topic + case TRule_sql_stmt_core::kAltSqlStmtCore36: // alter topic case TRule_sql_stmt_core::kAltSqlStmtCore37: // drop topic case TRule_sql_stmt_core::kAltSqlStmtCore38: // grant permissions case TRule_sql_stmt_core::kAltSqlStmtCore39: // revoke permissions @@ -176,6 +176,7 @@ bool NeedUseForAllStatements(const TRule_sql_stmt_core::AltCase& subquery) { case TRule_sql_stmt_core::kAltSqlStmtCore54: // drop resource pool classifier case TRule_sql_stmt_core::kAltSqlStmtCore55: // backup case TRule_sql_stmt_core::kAltSqlStmtCore56: // restore + case TRule_sql_stmt_core::kAltSqlStmtCore57: // alter sequence return false; } } diff --git a/yql/essentials/sql/v1/sql_query.cpp b/yql/essentials/sql/v1/sql_query.cpp index 5f2f31d776..4d9f30a452 100644 --- a/yql/essentials/sql/v1/sql_query.cpp +++ b/yql/essentials/sql/v1/sql_query.cpp @@ -1674,6 +1674,50 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core& context)); break; } + case TRule_sql_stmt_core::kAltSqlStmtCore57: { + // alter_sequence_stmt: ALTER SEQUENCE (IF EXISTS)? object_ref alter_sequence_action (COMMA alter_sequence_action)*; + Ctx.BodyPart(); + auto& node = core.GetAlt_sql_stmt_core57().GetRule_alter_sequence_stmt1(); + + Ctx.Token(node.GetToken1()); + const TPosition pos = Ctx.Pos(); + + TString service = Ctx.Scoped->CurrService; + TDeferredAtom cluster = Ctx.Scoped->CurrCluster; + if (cluster.Empty()) { + Error() << "USE statement is missing - no default cluster is selected"; + return false; + } + TObjectOperatorContext context(Ctx.Scoped); + + if (node.GetRule_object_ref4().HasBlock1()) { + if (!ClusterExpr(node.GetRule_object_ref4().GetBlock1().GetRule_cluster_expr1(), + false, context.ServiceId, context.Cluster)) { + return false; + } + } + + const TString id = Id(node.GetRule_object_ref4().GetRule_id_or_at2(), *this).second; + + TSequenceParameters params; + + if (node.HasBlock3()) { // IF EXISTS + params.MissingOk = true; + Y_DEBUG_ABORT_UNLESS( + IS_TOKEN(node.GetBlock3().GetToken1().GetId(), IF) && + IS_TOKEN(node.GetBlock3().GetToken2().GetId(), EXISTS) + ); + } + + for (const auto& block : node.GetBlock5()) { + if (!AlterSequenceAction(block.GetRule_alter_sequence_action1(), params)) { + return false; + } + } + + AddStatementToBlocks(blocks, BuildAlterSequence(pos, service, cluster, id, params, Ctx.Scoped)); + break; + } case TRule_sql_stmt_core::ALT_NOT_SET: Ctx.IncrementMonCounter("sql_errors", "UnknownStatement" + internalStatementName); AltNotImplemented("sql_stmt_core", core); @@ -2177,6 +2221,63 @@ bool TSqlQuery::AlterTableAlterIndex(const TRule_alter_table_alter_index& node, return true; } +bool TSqlQuery::AlterSequenceAction(const TRule_alter_sequence_action& node, TSequenceParameters& params) { + switch (node.Alt_case()) { + case TRule_alter_sequence_action::kAltAlterSequenceAction1: { + if (params.StartValue) { + Ctx.Error(Ctx.Pos()) << "Start value defined more than once"; + return false; + } + auto literalNumber = LiteralNumber(Ctx, node.GetAlt_alter_sequence_action1().GetRule_integer3()); + if (literalNumber) { + params.StartValue = TDeferredAtom(literalNumber, Ctx); + } else { + return false; + } + break; + } + case TRule_alter_sequence_action::kAltAlterSequenceAction2: { + if (params.IsRestart) { + Ctx.Error(Ctx.Pos()) << "Restart value defined more than once"; + return false; + } + auto literalNumber = LiteralNumber(Ctx, node.GetAlt_alter_sequence_action2().GetRule_integer3()); + if (literalNumber) { + params.IsRestart = true; + params.RestartValue = TDeferredAtom(literalNumber, Ctx); + } else { + return false; + } + break; + } + case TRule_alter_sequence_action::kAltAlterSequenceAction3: { + if (params.IsRestart) { + Ctx.Error(Ctx.Pos()) << "Restart value defined more than once"; + return false; + } + params.IsRestart = true; + break; + } + case TRule_alter_sequence_action::kAltAlterSequenceAction4: { + if (params.Increment) { + Ctx.Error(Ctx.Pos()) << "Increment defined more than once"; + return false; + } + auto literalNumber = LiteralNumber(Ctx, node.GetAlt_alter_sequence_action4().GetRule_integer3()); + if (literalNumber) { + params.Increment = TDeferredAtom(literalNumber, Ctx); + } else { + return false; + } + break; + } + case TRule_alter_sequence_action::ALT_NOT_SET: + Y_ABORT("You should change implementation according to grammar changes"); + } + + return true; +} + bool TSqlQuery::AlterTableAlterColumnDropNotNull(const TRule_alter_table_alter_column_drop_not_null& node, TAlterTableParameters& params) { TString name = Id(node.GetRule_an_id3(), *this); const TPosition pos(Context().Pos()); diff --git a/yql/essentials/sql/v1/sql_query.h b/yql/essentials/sql/v1/sql_query.h index 99e1a9c4ef..03fd85df6b 100644 --- a/yql/essentials/sql/v1/sql_query.h +++ b/yql/essentials/sql/v1/sql_query.h @@ -42,6 +42,7 @@ private: void AlterTableDropChangefeed(const TRule_alter_table_drop_changefeed& node, TAlterTableParameters& params); void AlterTableRenameIndexTo(const TRule_alter_table_rename_index_to& node, TAlterTableParameters& params); bool AlterTableAlterIndex(const TRule_alter_table_alter_index& node, TAlterTableParameters& params); + bool AlterSequenceAction(const TRule_alter_sequence_action& node, TSequenceParameters& params); TNodePtr PragmaStatement(const TRule_pragma_stmt& stmt, bool& success); void AddStatementToBlocks(TVector<TNodePtr>& blocks, TNodePtr node); bool ParseTableStoreFeatures(std::map<TString, TDeferredAtom> & result, const TRule_alter_table_store_action & actions); @@ -64,7 +65,7 @@ private: if (!Ctx.Settings.Antlr4Parser) { const auto pos = descr.find(": "); Y_DEBUG_ABORT_UNLESS(pos != TString::npos); - Split(TString(descr.begin() + pos + 2, descr.end()), "_", parts); + Split(TString(descr.begin() + pos + 2, descr.end()), "_", parts); } else { Split(descr, "_", parts); } diff --git a/yql/essentials/sql/v1/sql_translation.cpp b/yql/essentials/sql/v1/sql_translation.cpp index b298eb8abb..61a273b260 100644 --- a/yql/essentials/sql/v1/sql_translation.cpp +++ b/yql/essentials/sql/v1/sql_translation.cpp @@ -1963,19 +1963,68 @@ namespace { return true; } - bool StoreTtlSettings(const TRule_table_setting_value& from, TResetableSetting<TTtlSettings, void>& to, - TSqlExpression& expr, TContext& ctx, TTranslation& txc) { + bool FillTieringInterval(const TRule_expr& from, TNodePtr& tieringInterval, TSqlExpression& expr, TContext& ctx) { + auto exprNode = expr.Build(from); + if (!exprNode) { + return false; + } + + if (exprNode->GetOpName() != "Interval") { + ctx.Error() << "Literal of Interval type is expected for TTL"; + return false; + } + + tieringInterval = exprNode; + return true; + } + + bool FillTierAction(const TRule_ttl_tier_action& from, std::optional<TIdentifier>& storageName, TTranslation& txc) { + switch (from.GetAltCase()) { + case TRule_ttl_tier_action::kAltTtlTierAction1: + storageName = IdEx(from.GetAlt_ttl_tier_action1().GetRule_an_id5(), txc); + break; + case TRule_ttl_tier_action::kAltTtlTierAction2: + storageName.reset(); + break; + case TRule_ttl_tier_action::ALT_NOT_SET: + Y_ABORT("You should change implementation according to grammar changes"); + } + return true; + } + + bool StoreTtlSettings(const TRule_table_setting_value& from, TResetableSetting<TTtlSettings, void>& to, TSqlExpression& expr, TContext& ctx, + TTranslation& txc) { switch (from.Alt_case()) { case TRule_table_setting_value::kAltTableSettingValue5: { auto columnName = IdEx(from.GetAlt_table_setting_value5().GetRule_an_id3(), txc); - auto exprNode = expr.Build(from.GetAlt_table_setting_value5().GetRule_expr1()); - if (!exprNode) { + auto tiersLiteral = from.GetAlt_table_setting_value5().GetRule_ttl_tier_list1(); + + TNodePtr firstInterval; + if (!FillTieringInterval(tiersLiteral.GetRule_expr1(), firstInterval, expr, ctx)) { return false; } - if (exprNode->GetOpName() != "Interval") { - ctx.Error() << "Literal of Interval type is expected for TTL"; - return false; + std::vector<TTtlSettings::TTierSettings> tiers; + if (!tiersLiteral.HasBlock2()) { + tiers.emplace_back(firstInterval); + } else { + std::optional<TIdentifier> firstStorageName; + if (!FillTierAction(tiersLiteral.GetBlock2().GetRule_ttl_tier_action1(), firstStorageName, txc)) { + return false; + } + tiers.emplace_back(firstInterval, firstStorageName); + + for (const auto& tierLiteral : tiersLiteral.GetBlock2().GetBlock2()) { + TNodePtr intervalExpr; + if (!FillTieringInterval(tierLiteral.GetRule_expr2(), intervalExpr, expr, ctx)) { + return false; + } + std::optional<TIdentifier> storageName; + if (!FillTierAction(tierLiteral.GetRule_ttl_tier_action3(), storageName, txc)) { + return false; + } + tiers.emplace_back(intervalExpr, storageName); + } } TMaybe<TTtlSettings::EUnit> columnUnit; @@ -1988,7 +2037,7 @@ namespace { } } - to.Set(TTtlSettings(columnName, exprNode, columnUnit)); + to.Set(TTtlSettings(columnName, tiers, columnUnit)); break; } default: diff --git a/yql/essentials/sql/v1/sql_ut.cpp b/yql/essentials/sql/v1/sql_ut.cpp index 65ec39af2c..45272879c0 100644 --- a/yql/essentials/sql/v1/sql_ut.cpp +++ b/yql/essentials/sql/v1/sql_ut.cpp @@ -2053,7 +2053,8 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Write") { UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("setTtlSettings")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("expireAfter")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("tiers")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("evictionDelay")); UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("86400000")); } }; @@ -2075,7 +2076,8 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Write") { UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("setTtlSettings")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("expireAfter")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("tiers")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("evictionDelay")); UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("86400000")); UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("columnUnit")); UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("seconds")); @@ -2088,6 +2090,80 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); } + Y_UNIT_TEST(TtlTieringParseCorrect) { + NYql::TAstParseResult res = SqlToYql( + R"( USE plato; + CREATE TABLE tableName (Key Uint32, CreatedAt Uint32, PRIMARY KEY (Key)) + WITH (TTL = + Interval("P1D") TO EXTERNAL DATA SOURCE Tier1, + Interval("P2D") TO EXTERNAL DATA SOURCE Tier2, + Interval("P30D") DELETE + ON CreatedAt AS SECONDS);)" + ); + UNIT_ASSERT(res.Root); + + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + if (word == "Write") { + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("setTtlSettings")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("tiers")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("evictionDelay")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("storageName")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("Tier1")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("Tier2")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("86400000")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("172800000")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("2592000000")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("columnUnit")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("seconds")); + } + }; + + TWordCountHive elementStat = { {TString("Write"), 0} }; + VerifyProgram(res, elementStat, verifyLine); + + UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); + } + + Y_UNIT_TEST(TtlTieringWithOtherActionsParseCorrect) { + NYql::TAstParseResult res = SqlToYql( + R"( USE plato; + ALTER TABLE tableName + ADD FAMILY cold (DATA = "rot"), + SET TTL + Interval("P1D") TO EXTERNAL DATA SOURCE Tier1, + Interval("P2D") TO EXTERNAL DATA SOURCE Tier2, + Interval("P30D") DELETE + ON CreatedAt, + ALTER COLUMN payload_v2 SET FAMILY cold, + ALTER FAMILY default SET DATA "ssd" + ;)" + ); + UNIT_ASSERT(res.Root); + + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + if (word == "Write") { + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("addColumnFamilies")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("cold")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("alterColumnFamilies")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("default")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("setTtlSettings")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("tiers")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("evictionDelay")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("storageName")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("Tier1")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("Tier2")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("86400000")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("172800000")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("2592000000")); + } + }; + + TWordCountHive elementStat = { {TString("Write"), 0} }; + VerifyProgram(res, elementStat, verifyLine); + + UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); + } + Y_UNIT_TEST(TieringParseCorrect) { NYql::TAstParseResult res = SqlToYql( R"( USE plato; @@ -2614,6 +2690,153 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { UNIT_ASSERT_VALUES_EQUAL(1, elementStat["\'mode \'alter"]); } + Y_UNIT_TEST(AlterSequence) { + UNIT_ASSERT(SqlToYql(R"( + USE plato; + ALTER SEQUENCE sequence START WITH 10 INCREMENT 2 RESTART WITH 5; + )").IsOk()); + UNIT_ASSERT(SqlToYql(R"( + USE plato; + ALTER SEQUENCE sequence INCREMENT 2; + )").IsOk()); + UNIT_ASSERT(SqlToYql(R"( + USE plato; + ALTER SEQUENCE sequence INCREMENT 2 START 1000; + )").IsOk()); + UNIT_ASSERT(SqlToYql(R"( + USE plato; + ALTER SEQUENCE sequence RESTART START 1000; + )").IsOk()); + UNIT_ASSERT(SqlToYql(R"( + USE plato; + ALTER SEQUENCE IF EXISTS sequence INCREMENT 1000 START 100 RESTART; + )").IsOk()); + UNIT_ASSERT(SqlToYql(R"( + USE plato; + ALTER SEQUENCE IF EXISTS sequence RESTART 1000 START WITH 100 INCREMENT BY 7; + )").IsOk()); + } + + Y_UNIT_TEST(AlterSequenceIncorrect) { + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence START WITH 10 INCREMENT 2 RESTART WITH 5 RESTART;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:75: Error: Restart value defined more than once\n"); + } + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence START WITH 10 INCREMENT 2 START 100 RESTART WITH 5;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:60: Error: Start value defined more than once\n"); + } + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence INCREMENT BY 7 START WITH 10 INCREMENT 2 RESTART WITH 5 RESTART;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:62: Error: Increment defined more than once\n"); + } + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence RESTART WITH 100 START WITH 10 INCREMENT 2 RESTART WITH 5;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:77: Error: Restart value defined more than once\n"); + } + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence RESTART WITH 1234234543563435151456 START WITH 10 INCREMENT 2;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:49: Error: Failed to parse number from string: 1234234543563435151456, number limit overflow\n"); + } + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence RESTART WITH 1 START WITH 9223372036854775817 INCREMENT 4;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:12: Error: Start value: 9223372036854775817 cannot be greater than max value: 9223372036854775807\n"); + } + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence RESTART WITH 9223372036854775827 START WITH 5 INCREMENT 4;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:12: Error: Restart value: 9223372036854775827 cannot be greater than max value: 9223372036854775807\n"); + } + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence RESTART WITH 1 START WITH 4 INCREMENT 0;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:12: Error: Increment must not be zero\n"); + } + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence RESTART WITH 0 START WITH 4 INCREMENT 1;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:12: Error: Restart value: 0 cannot be less than min value: 1\n"); + } + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence RESTART WITH 1 START WITH 0 INCREMENT 1;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:12: Error: Start value: 0 cannot be less than min value: 1\n"); + } + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence RESTART WITH 1 START WITH 1 INCREMENT 9223372036854775837;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:12: Error: Increment: 9223372036854775837 cannot be greater than max value: 9223372036854775807\n"); + } + } + + Y_UNIT_TEST(AlterSequenceCorrect) { + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence START WITH 10 INCREMENT 2 RESTART WITH 5;"); + UNIT_ASSERT(res.Root); + + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + if (word == "Write") { + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("sequence")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("alter")); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("alter_if_exists")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("start")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("increment")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("restart")); + } + }; + + TWordCountHive elementStat = { {TString("Write"), 0}}; + VerifyProgram(res, elementStat, verifyLine); + + UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); + } + + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE IF EXISTS sequence INCREMENT 2 RESTART;"); + UNIT_ASSERT(res.Root); + + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + if (word == "Write") { + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("sequence")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("alter_if_exists")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("increment")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("restart")); + } + }; + + TWordCountHive elementStat = { {TString("Write"), 0}}; + VerifyProgram(res, elementStat, verifyLine); + + UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); + } + + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE IF EXISTS sequence START 10 INCREMENT BY 2;"); + UNIT_ASSERT(res.Root); + + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + if (word == "Write") { + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("sequence")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("alter_if_exists")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("start")); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("restart")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("increment")); + } + }; + + TWordCountHive elementStat = { {TString("Write"), 0}}; + VerifyProgram(res, elementStat, verifyLine); + + UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); + } + } + Y_UNIT_TEST(OptionalAliases) { UNIT_ASSERT(SqlToYql("USE plato; SELECT foo FROM (SELECT key foo FROM Input);").IsOk()); UNIT_ASSERT(SqlToYql("USE plato; SELECT a.x FROM Input1 a JOIN Input2 b ON a.key = b.key;").IsOk()); diff --git a/yql/essentials/sql/v1/sql_ut_antlr4.cpp b/yql/essentials/sql/v1/sql_ut_antlr4.cpp index e2a05cc229..91b85e92e8 100644 --- a/yql/essentials/sql/v1/sql_ut_antlr4.cpp +++ b/yql/essentials/sql/v1/sql_ut_antlr4.cpp @@ -2053,7 +2053,8 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Write") { UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("setTtlSettings")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("expireAfter")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("tiers")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("evictionDelay")); UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("86400000")); } }; @@ -2075,7 +2076,8 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Write") { UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("setTtlSettings")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("expireAfter")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("tiers")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("evictionDelay")); UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("86400000")); UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("columnUnit")); UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("seconds")); @@ -2088,6 +2090,80 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); } + Y_UNIT_TEST(TtlTieringParseCorrect) { + NYql::TAstParseResult res = SqlToYql( + R"( USE plato; + CREATE TABLE tableName (Key Uint32, CreatedAt Uint32, PRIMARY KEY (Key)) + WITH (TTL = + Interval("P1D") TO EXTERNAL DATA SOURCE Tier1, + Interval("P2D") TO EXTERNAL DATA SOURCE Tier2, + Interval("P30D") DELETE + On CreatedAt AS SECONDS);)" + ); + UNIT_ASSERT(res.Root); + + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + if (word == "Write") { + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("setTtlSettings")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("tiers")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("evictionDelay")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("storageName")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("Tier1")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("Tier2")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("86400000")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("172800000")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("2592000000")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("columnUnit")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("seconds")); + } + }; + + TWordCountHive elementStat = { {TString("Write"), 0} }; + VerifyProgram(res, elementStat, verifyLine); + + UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); + } + + Y_UNIT_TEST(TtlTieringWithOtherActionsParseCorrect) { + NYql::TAstParseResult res = SqlToYql( + R"( USE plato; + ALTER TABLE tableName + ADD FAMILY cold (DATA = "rot"), + SET TTL + Interval("P1D") TO EXTERNAL DATA SOURCE Tier1, + Interval("P2D") TO EXTERNAL DATA SOURCE Tier2, + Interval("P30D") DELETE + ON CreatedAt, + ALTER COLUMN payload_v2 SET FAMILY cold, + ALTER FAMILY default SET DATA "ssd" + ;)" + ); + UNIT_ASSERT(res.Root); + + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + if (word == "Write") { + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("addColumnFamilies")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("cold")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("alterColumnFamilies")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("default")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("setTtlSettings")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("tiers")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("evictionDelay")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("storageName")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("Tier1")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("Tier2")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("86400000")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("172800000")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("2592000000")); + } + }; + + TWordCountHive elementStat = { {TString("Write"), 0} }; + VerifyProgram(res, elementStat, verifyLine); + + UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); + } + Y_UNIT_TEST(TieringParseCorrect) { NYql::TAstParseResult res = SqlToYql( R"( USE plato; @@ -2614,6 +2690,153 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { UNIT_ASSERT_VALUES_EQUAL(1, elementStat["\'mode \'alter"]); } + Y_UNIT_TEST(AlterSequence) { + UNIT_ASSERT(SqlToYql(R"( + USE plato; + ALTER SEQUENCE sequence START WITH 10 INCREMENT 2 RESTART WITH 5; + )").IsOk()); + UNIT_ASSERT(SqlToYql(R"( + USE plato; + ALTER SEQUENCE sequence INCREMENT 2; + )").IsOk()); + UNIT_ASSERT(SqlToYql(R"( + USE plato; + ALTER SEQUENCE sequence INCREMENT 2 START 1000; + )").IsOk()); + UNIT_ASSERT(SqlToYql(R"( + USE plato; + ALTER SEQUENCE sequence RESTART START 1000; + )").IsOk()); + UNIT_ASSERT(SqlToYql(R"( + USE plato; + ALTER SEQUENCE IF EXISTS sequence INCREMENT 1000 START 100 RESTART; + )").IsOk()); + UNIT_ASSERT(SqlToYql(R"( + USE plato; + ALTER SEQUENCE IF EXISTS sequence RESTART 1000 START WITH 100 INCREMENT BY 7; + )").IsOk()); + } + + Y_UNIT_TEST(AlterSequenceIncorrect) { + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence START WITH 10 INCREMENT 2 RESTART WITH 5 RESTART;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:75: Error: Restart value defined more than once\n"); + } + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence START WITH 10 INCREMENT 2 START 100 RESTART WITH 5;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:60: Error: Start value defined more than once\n"); + } + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence INCREMENT BY 7 START WITH 10 INCREMENT 2 RESTART WITH 5 RESTART;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:62: Error: Increment defined more than once\n"); + } + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence RESTART WITH 100 START WITH 10 INCREMENT 2 RESTART WITH 5;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:77: Error: Restart value defined more than once\n"); + } + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence RESTART WITH 1234234543563435151456 START WITH 10 INCREMENT 2;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:49: Error: Failed to parse number from string: 1234234543563435151456, number limit overflow\n"); + } + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence RESTART WITH 1 START WITH 9223372036854775817 INCREMENT 4;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:12: Error: Start value: 9223372036854775817 cannot be greater than max value: 9223372036854775807\n"); + } + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence RESTART WITH 9223372036854775827 START WITH 5 INCREMENT 4;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:12: Error: Restart value: 9223372036854775827 cannot be greater than max value: 9223372036854775807\n"); + } + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence RESTART WITH 1 START WITH 4 INCREMENT 0;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:12: Error: Increment must not be zero\n"); + } + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence RESTART WITH 0 START WITH 4 INCREMENT 1;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:12: Error: Restart value: 0 cannot be less than min value: 1\n"); + } + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence RESTART WITH 1 START WITH 0 INCREMENT 1;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:12: Error: Start value: 0 cannot be less than min value: 1\n"); + } + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence RESTART WITH 1 START WITH 1 INCREMENT 9223372036854775837;"); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:12: Error: Increment: 9223372036854775837 cannot be greater than max value: 9223372036854775807\n"); + } + } + + Y_UNIT_TEST(AlterSequenceCorrect) { + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE sequence START WITH 10 INCREMENT 2 RESTART WITH 5;"); + UNIT_ASSERT(res.Root); + + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + if (word == "Write") { + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("sequence")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("alter")); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("alter_if_exists")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("start")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("increment")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("restart")); + } + }; + + TWordCountHive elementStat = { {TString("Write"), 0}}; + VerifyProgram(res, elementStat, verifyLine); + + UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); + } + + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE IF EXISTS sequence INCREMENT 2 RESTART;"); + UNIT_ASSERT(res.Root); + + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + if (word == "Write") { + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("sequence")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("alter_if_exists")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("increment")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("restart")); + } + }; + + TWordCountHive elementStat = { {TString("Write"), 0}}; + VerifyProgram(res, elementStat, verifyLine); + + UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); + } + + { + NYql::TAstParseResult res = SqlToYql("USE plato; ALTER SEQUENCE IF EXISTS sequence START 10 INCREMENT BY 2;"); + UNIT_ASSERT(res.Root); + + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + if (word == "Write") { + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("sequence")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("alter_if_exists")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("start")); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("restart")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("increment")); + } + }; + + TWordCountHive elementStat = { {TString("Write"), 0}}; + VerifyProgram(res, elementStat, verifyLine); + + UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); + } + } + Y_UNIT_TEST(OptionalAliases) { UNIT_ASSERT(SqlToYql("USE plato; SELECT foo FROM (SELECT key foo FROM Input);").IsOk()); UNIT_ASSERT(SqlToYql("USE plato; SELECT a.x FROM Input1 a JOIN Input2 b ON a.key = b.key;").IsOk()); diff --git a/yql/essentials/tests/common/test_framework/udfs_deps/ya.make b/yql/essentials/tests/common/test_framework/udfs_deps/ya.make index 16b320bc3b..7eddcac827 100644 --- a/yql/essentials/tests/common/test_framework/udfs_deps/ya.make +++ b/yql/essentials/tests/common/test_framework/udfs_deps/ya.make @@ -19,6 +19,7 @@ SET( yql/essentials/udfs/common/url_base yql/essentials/udfs/common/unicode_base yql/essentials/udfs/common/streaming + yql/essentials/udfs/common/vector yql/essentials/udfs/examples/callables yql/essentials/udfs/examples/dicts yql/essentials/udfs/examples/dummylog diff --git a/yql/essentials/tests/sql/sql2yql/canondata/result.json b/yql/essentials/tests/sql/sql2yql/canondata/result.json index ef8ca7ee6c..c178530713 100644 --- a/yql/essentials/tests/sql/sql2yql/canondata/result.json +++ b/yql/essentials/tests/sql/sql2yql/canondata/result.json @@ -2463,6 +2463,13 @@ "uri": "https://{canondata_backend}/1924537/1ab444909086b08bd4fe21c5a43f5e183c647e0a/resource.tar.gz#test_sql2yql.test_aggregate-group_by_session_extended_tuple_/sql.yql" } ], + "test_sql2yql.test[aggregate-group_by_session_nopush]": [ + { + "checksum": "09f9e4a178067f6aaa81b9e9959b4cec", + "size": 3177, + "uri": "https://{canondata_backend}/212715/fe819b0081800cfcbf6e2512d273e760949a6cc7/resource.tar.gz#test_sql2yql.test_aggregate-group_by_session_nopush_/sql.yql" + } + ], "test_sql2yql.test[aggregate-group_by_session_only]": [ { "checksum": "0c22dd1ef887ea533c6e0621c0937ffa", @@ -6446,6 +6453,27 @@ "uri": "https://{canondata_backend}/1784117/d56ae82ad9d30397a41490647be1bd2124718f98/resource.tar.gz#test_sql2yql.test_expr-list_replicate_fail_/sql.yql" } ], + "test_sql2yql.test[expr-list_sample]": [ + { + "checksum": "922f4c9c5a2fe848f40272dd15cfde42", + "size": 10843, + "uri": "https://{canondata_backend}/1924537/278b77accb7596bd976e3e218425469d4b97dcf9/resource.tar.gz#test_sql2yql.test_expr-list_sample_/sql.yql" + } + ], + "test_sql2yql.test[expr-list_sample_n]": [ + { + "checksum": "5ce08b8b61ef8b2863f931bc1b986679", + "size": 7573, + "uri": "https://{canondata_backend}/1924537/278b77accb7596bd976e3e218425469d4b97dcf9/resource.tar.gz#test_sql2yql.test_expr-list_sample_n_/sql.yql" + } + ], + "test_sql2yql.test[expr-list_shuffle]": [ + { + "checksum": "3cd4f632706daf9ac8962369e7d0eac3", + "size": 4413, + "uri": "https://{canondata_backend}/1777230/f0ec95d2b2a3a38fc99b00afc1f2d60d2b3e8548/resource.tar.gz#test_sql2yql.test_expr-list_shuffle_/sql.yql" + } + ], "test_sql2yql.test[expr-list_takeskipwhile]": [ { "checksum": "827d6c45ccb33ccc641531600fa839ce", @@ -22322,6 +22350,13 @@ "uri": "https://{canondata_backend}/1880306/64654158d6bfb1289c66c626a8162239289559d0/resource.tar.gz#test_sql_format.test_aggregate-group_by_session_extended_tuple_/formatted.sql" } ], + "test_sql_format.test[aggregate-group_by_session_nopush]": [ + { + "checksum": "382f93f1c899dd2d1d5ea6b04575cfef", + "size": 372, + "uri": "https://{canondata_backend}/212715/fe819b0081800cfcbf6e2512d273e760949a6cc7/resource.tar.gz#test_sql_format.test_aggregate-group_by_session_nopush_/formatted.sql" + } + ], "test_sql_format.test[aggregate-group_by_session_only]": [ { "checksum": "531ee77369e54e2a1616411e89c86bb7", @@ -26305,6 +26340,27 @@ "uri": "https://{canondata_backend}/1880306/64654158d6bfb1289c66c626a8162239289559d0/resource.tar.gz#test_sql_format.test_expr-list_replicate_fail_/formatted.sql" } ], + "test_sql_format.test[expr-list_sample]": [ + { + "checksum": "a642f47aa5488ecfa6450c114a85903d", + "size": 1235, + "uri": "https://{canondata_backend}/1942525/0302d8428323e9211161c4db74348074ea0aab49/resource.tar.gz#test_sql_format.test_expr-list_sample_/formatted.sql" + } + ], + "test_sql_format.test[expr-list_sample_n]": [ + { + "checksum": "4b04a240db2a66eab919da4fbbf3cdea", + "size": 1128, + "uri": "https://{canondata_backend}/1942525/0302d8428323e9211161c4db74348074ea0aab49/resource.tar.gz#test_sql_format.test_expr-list_sample_n_/formatted.sql" + } + ], + "test_sql_format.test[expr-list_shuffle]": [ + { + "checksum": "73822288846e1fc180736baa4a9548c7", + "size": 612, + "uri": "https://{canondata_backend}/1942525/0302d8428323e9211161c4db74348074ea0aab49/resource.tar.gz#test_sql_format.test_expr-list_shuffle_/formatted.sql" + } + ], "test_sql_format.test[expr-list_takeskipwhile]": [ { "checksum": "fe413941b62655034d49cd2674f2c947", diff --git a/yql/essentials/tests/sql/suites/aggregate/group_by_session_nopush.cfg b/yql/essentials/tests/sql/suites/aggregate/group_by_session_nopush.cfg new file mode 100644 index 0000000000..9e0b837318 --- /dev/null +++ b/yql/essentials/tests/sql/suites/aggregate/group_by_session_nopush.cfg @@ -0,0 +1,2 @@ +in Input session1.txt +providers yt diff --git a/yql/essentials/tests/sql/suites/aggregate/group_by_session_nopush.sql b/yql/essentials/tests/sql/suites/aggregate/group_by_session_nopush.sql new file mode 100644 index 0000000000..fd8e46a071 --- /dev/null +++ b/yql/essentials/tests/sql/suites/aggregate/group_by_session_nopush.sql @@ -0,0 +1,14 @@ +/* syntax version 1 */ +/* postgres can not */ +/* yt can not */ + +SELECT * FROM ( + SELECT + user, + cast(session_start as Int64) as ss, + ListSort(AGGREGATE_LIST(ts)) as session, + COUNT(1) as session_len + FROM plato.Input + GROUP BY SessionWindow(ts, 10) as session_start, user +) +WHERE ss != 100500; -- should not push down diff --git a/yql/essentials/tests/sql/suites/expr/list_sample.cfg b/yql/essentials/tests/sql/suites/expr/list_sample.cfg new file mode 100644 index 0000000000..bb349dd8ab --- /dev/null +++ b/yql/essentials/tests/sql/suites/expr/list_sample.cfg @@ -0,0 +1 @@ +providers yt diff --git a/yql/essentials/tests/sql/suites/expr/list_sample.sql b/yql/essentials/tests/sql/suites/expr/list_sample.sql new file mode 100644 index 0000000000..fecd4febfa --- /dev/null +++ b/yql/essentials/tests/sql/suites/expr/list_sample.sql @@ -0,0 +1,36 @@ +/* yt can not */ +$list = ListFromRange(1, 101); +$test = ($probability, $dependsOn) -> { + $sample = ListCollect(ListSample($list, $probability, $dependsOn)); + RETURN + ( + ListSort(DictKeys(ToSet($sample))) == ListSort($sample), + (ListLength($sample), $probability * 100), + SetIncludes(ToSet($list), $sample) + ); +}; + +SELECT + ListSample(NULL , 1.0) IS NULL AS mustBeTrue1, + ListSample(Nothing(OptionalType(ListType(DataType("Uint64")))), 1.0) IS NULL AS mustBeTrue2, + ListSample([] , 1.0) == [] AS mustBeTrue3, + + ListSample($list, NULL ) == $list AS mustBeTrue4, + ListSample($list, Nothing(OptionalType(DataType("Double")))) == $list AS mustBeTrue5, + + ListSample($list, 0.5, 123) == ListSample($list, 0.5, 123) AS mustBeTrue6, + + $test(0.2, 1) AS result1, + $test(0.2, 2) AS result2, + $test(0.2, 3) AS result3, + $test(0.2, 4) AS result4, + $test(0.2, 5) AS result5, + $test(0.5, 6) AS result6, + $test(0.8, 7) AS result7, + $test(1.0, 8) AS result8, + $test(0.0, 9) AS result9, + + ListSample($list , 0.1 , 10) AS result10, + ListSample(Just($list), 0.1 , 11) AS result11, + ListSample($list , Just(0.1), 12) AS result12, + ListSample(Just($list), Just(0.1), 13) AS result13; diff --git a/yql/essentials/tests/sql/suites/expr/list_sample_n.cfg b/yql/essentials/tests/sql/suites/expr/list_sample_n.cfg new file mode 100644 index 0000000000..bb349dd8ab --- /dev/null +++ b/yql/essentials/tests/sql/suites/expr/list_sample_n.cfg @@ -0,0 +1 @@ +providers yt diff --git a/yql/essentials/tests/sql/suites/expr/list_sample_n.sql b/yql/essentials/tests/sql/suites/expr/list_sample_n.sql new file mode 100644 index 0000000000..5ab48e52ab --- /dev/null +++ b/yql/essentials/tests/sql/suites/expr/list_sample_n.sql @@ -0,0 +1,32 @@ +/* yt can not */ +$list = ListFromRange(1, 40); +$test = ($n, $dependsOn) -> { + $sample = ListCollect(ListSampleN($list, $n, $dependsOn)); + RETURN + ( + ListSort(DictKeys(ToSet($sample))) == ListSort($sample), + ListLength($sample) == ListMin(AsList($n, ListLength($list))), + SetIncludes(ToSet($list), $sample) + ); +}; + +SELECT + ListSampleN(NULL , 1ul) IS NULL AS mustBeTrue1, + ListSampleN(Nothing(OptionalType(ListType(DataType("Uint64")))), 1ul) IS NULL AS mustBeTrue2, + ListSampleN([] , 1ul) == [] AS mustBeTrue3, + + ListSampleN($list, NULL ) == $list AS mustBeTrue4, + ListSampleN($list, Nothing(OptionalType(DataType("Uint64")))) == $list AS mustBeTrue5, + + ListSampleN($list, 25ul, 123) == ListSampleN($list, 25ul, 123) AS mustBeTrue6, + + $test(5ul, 1) AS result1, + $test(10ul, 2) AS result2, + $test(20ul, 3) AS result3, + $test(0ul, 4) AS result4, + $test(100ul, 5) AS result5, + + ListSampleN($list , 10ul , 6) AS result6, + ListSampleN(Just($list), 10ul , 7) AS result7, + ListSampleN($list , Just(10ul), 8) AS result8, + ListSampleN(Just($list), Just(10ul), 9) AS result9; diff --git a/yql/essentials/tests/sql/suites/expr/list_shuffle.cfg b/yql/essentials/tests/sql/suites/expr/list_shuffle.cfg new file mode 100644 index 0000000000..bb349dd8ab --- /dev/null +++ b/yql/essentials/tests/sql/suites/expr/list_shuffle.cfg @@ -0,0 +1 @@ +providers yt diff --git a/yql/essentials/tests/sql/suites/expr/list_shuffle.sql b/yql/essentials/tests/sql/suites/expr/list_shuffle.sql new file mode 100644 index 0000000000..8051e76ad3 --- /dev/null +++ b/yql/essentials/tests/sql/suites/expr/list_shuffle.sql @@ -0,0 +1,21 @@ +/* yt can not */ +$list = ListFromRange(1, 40); +$test = ($c) -> { + $shuffle = ListCollect(ListShuffle($list, $c)); + RETURN ListSort($shuffle) == ListSort($list); +}; + +SELECT + ListShuffle(NULL ) IS NULL AS mustBeTrue1, + ListShuffle(Nothing(OptionalType(ListType(DataType("Uint64"))))) IS NULL AS mustBeTrue2, + ListShuffle([] ) == [] AS mustBeTrue3, + + ListShuffle($list, 123) == ListShuffle($list, 123) AS mustBeTrue4, + + $test(1) AS result1, + $test(2) AS result2, + $test(3) AS result3, + $test(4) AS result4, + + ListShuffle($list , 5) AS result5, + ListShuffle(Just($list), 6) AS result6; diff --git a/yql/essentials/udfs/common/python/bindings/py_cast.cpp b/yql/essentials/udfs/common/python/bindings/py_cast.cpp index 3aa5537b21..078239962e 100644 --- a/yql/essentials/udfs/common/python/bindings/py_cast.cpp +++ b/yql/essentials/udfs/common/python/bindings/py_cast.cpp @@ -814,6 +814,27 @@ NUdf::TUnboxedValue FromPyDict( throw yexception() << "Can't cast "<< PyObjectRepr(value) << " to dict."; } +TPyObjectPtr ToPyNull( + const TPyCastContext::TPtr& ctx, + const NUdf::TType* type, + const NUdf::TUnboxedValuePod& value) +{ + if (!value.HasValue()) { + return TPyObjectPtr(Py_None, TPyObjectPtr::ADD_REF); + } + throw yexception() << "Value is not null"; +} + +NUdf::TUnboxedValue FromPyNull( + const TPyCastContext::TPtr& ctx, + const NUdf::TType* type, PyObject* value) +{ + if (value == Py_None) { + return NYql::NUdf::TUnboxedValuePod(); + } + throw yexception() << "Can't cast " << PyObjectRepr(value) << " to null."; +} + } // namespace TPyObjectPtr ToPyObject( @@ -832,6 +853,7 @@ TPyObjectPtr ToPyObject( case NUdf::ETypeKind::Void: return ToPyVoid(ctx, type, value); case NUdf::ETypeKind::Stream: return ToPyStream(ctx, type, value); case NUdf::ETypeKind::Variant: return ToPyVariant(ctx, type, value); + case NUdf::ETypeKind::Null: return ToPyNull(ctx, type, value); default: { ::TStringBuilder sb; sb << "Failed to export: "; @@ -857,6 +879,7 @@ NUdf::TUnboxedValue FromPyObject( case NUdf::ETypeKind::Void: return FromPyVoid(ctx, type, value); case NUdf::ETypeKind::Stream: return FromPyStream(ctx, type, TPyObjectPtr(value, TPyObjectPtr::ADD_REF), nullptr, nullptr, nullptr); case NUdf::ETypeKind::Variant: return FromPyVariant(ctx, type, value); + case NUdf::ETypeKind::Null: return FromPyNull(ctx, type, value); default: { ::TStringBuilder sb; sb << "Failed to import: "; diff --git a/yql/essentials/udfs/common/vector/test/canondata/result.json b/yql/essentials/udfs/common/vector/test/canondata/result.json new file mode 100644 index 0000000000..9d8010bca3 --- /dev/null +++ b/yql/essentials/udfs/common/vector/test/canondata/result.json @@ -0,0 +1,7 @@ +{ + "test.test[Vector]": [ + { + "uri": "file://test.test_Vector_/results.txt" + } + ] +} diff --git a/yql/essentials/udfs/common/vector/test/canondata/test.test_Vector_/results.txt b/yql/essentials/udfs/common/vector/test/canondata/test.test_Vector_/results.txt new file mode 100644 index 0000000000..f7bb0dbd8c --- /dev/null +++ b/yql/essentials/udfs/common/vector/test/canondata/test.test_Vector_/results.txt @@ -0,0 +1,65 @@ +[ + { + "Write" = [ + { + "Type" = [ + "ListType"; + [ + "StructType"; + [ + [ + "column0"; + [ + "ListType"; + [ + "DataType"; + "String" + ] + ] + ]; + [ + "column1"; + [ + "ListType"; + [ + "DataType"; + "String" + ] + ] + ]; + [ + "column2"; + [ + "ListType"; + [ + "DataType"; + "String" + ] + ] + ] + ] + ] + ]; + "Data" = [ + [ + [ + "test1"; + "test2"; + "test3" + ]; + [ + "test1"; + "test22"; + "test3" + ]; + [ + "test3"; + "test22"; + "test1" + ] + ] + ] + } + ] + } +]
\ No newline at end of file diff --git a/yql/essentials/udfs/common/vector/test/cases/Vector.sql b/yql/essentials/udfs/common/vector/test/cases/Vector.sql new file mode 100644 index 0000000000..d25c654420 --- /dev/null +++ b/yql/essentials/udfs/common/vector/test/cases/Vector.sql @@ -0,0 +1,23 @@ +/* syntax version 1 */ + +$typing = TupleType(VoidType(), VoidType(), String); + +$vectorCreate = YQL::Udf(AsAtom("Vector.Create"), Void(), $typing); +$vectorEmplace = YQL::Udf(AsAtom("Vector.Emplace"), Void(), $typing); +$vectorSwap = YQL::Udf(AsAtom("Vector.Swap"), Void(), $typing); +$vectorGetResult = YQL::Udf(AsAtom("Vector.GetResult"), Void(), $typing); + +$a = $vectorCreate(0); + +$a = $vectorEmplace($a, 0, "test1"); +$a = $vectorEmplace($a, 1, "test2"); +$a = $vectorEmplace($a, 2, "test3"); +$state1 = $vectorGetResult($a); + +$a = $vectorEmplace($a, 1, "test22"); +$state2 = $vectorGetResult($a); + +$a = $vectorSwap($a, 0, 2); +$state3 = $vectorGetResult($a); + +SELECT $state1, $state2, $state3; diff --git a/yql/essentials/udfs/common/vector/test/ya.make b/yql/essentials/udfs/common/vector/test/ya.make new file mode 100644 index 0000000000..0c80f4ea67 --- /dev/null +++ b/yql/essentials/udfs/common/vector/test/ya.make @@ -0,0 +1,13 @@ +YQL_UDF_TEST_CONTRIB() + +DEPENDS(yql/essentials/udfs/common/vector) + +TIMEOUT(300) + +SIZE(MEDIUM) + +IF (SANITIZER_TYPE == "memory") + TAG(ya:not_autocheck) # YQL-15385 +ENDIF() + +END() diff --git a/yql/essentials/udfs/common/vector/vector_udf.cpp b/yql/essentials/udfs/common/vector/vector_udf.cpp new file mode 100644 index 0000000000..e8b01e5a05 --- /dev/null +++ b/yql/essentials/udfs/common/vector/vector_udf.cpp @@ -0,0 +1,192 @@ +#include <yql/essentials/public/udf/udf_type_ops.h> +#include <yql/essentials/public/udf/udf_helpers.h> + +#include <vector> + +using namespace NKikimr; +using namespace NUdf; + +namespace { + +class TVector { +private: + std::vector<TUnboxedValue, TUnboxedValue::TAllocator> Vector; + +public: + TVector() + : Vector() + {} + + TUnboxedValue GetResult(const IValueBuilder* builder) { + TUnboxedValue* values = nullptr; + auto list = builder->NewArray(Vector.size(), values); + std::copy(Vector.begin(), Vector.end(), values); + + return list; + } + + void Emplace(const ui64 index, const TUnboxedValuePod& value) { + if (index < Vector.size()) { + Vector[index] = value; + } else { + Vector.push_back(value); + } + } + + void Swap(const ui64 a, const ui64 b) { + if (a < Vector.size() && b < Vector.size()) { + std::swap(Vector[a], Vector[b]); + } + } + + void Reserve(ui64 expectedSize) { + Vector.reserve(expectedSize); + } +}; + +extern const char VectorResourceName[] = "Vector.VectorResource"; +class TVectorResource: + public TBoxedResource<TVector, VectorResourceName> +{ +public: + template <typename... Args> + inline TVectorResource(Args&&... args) + : TBoxedResource(std::forward<Args>(args)...) + {} +}; + +TVectorResource* GetVectorResource(const TUnboxedValuePod& arg) { + TVectorResource::Validate(arg); + return static_cast<TVectorResource*>(arg.AsBoxed().Get()); +} + +class TVectorCreate: public TBoxedValue { +private: + TUnboxedValue Run(const IValueBuilder*, const TUnboxedValuePod* args) const override { + auto resource = new TVectorResource; + resource->Get()->Reserve(args[0].Get<ui64>()); + return TUnboxedValuePod(resource); + } +}; + +class TVectorEmplace: public TBoxedValue { +private: + TUnboxedValue Run(const IValueBuilder*, const TUnboxedValuePod* args) const override { + auto resource = GetVectorResource(args[0]); + resource->Get()->Emplace(args[1].Get<ui64>(), args[2]); + return TUnboxedValuePod(resource); + } +}; + +class TVectorSwap: public TBoxedValue { +private: + TUnboxedValue Run(const IValueBuilder*, const TUnboxedValuePod* args) const override { + auto resource = GetVectorResource(args[0]); + resource->Get()->Swap(args[1].Get<ui64>(), args[2].Get<ui64>()); + return TUnboxedValuePod(resource); + } +}; + +class TVectorGetResult: public TBoxedValue { +private: + TUnboxedValue Run(const IValueBuilder* valueBuilder, const TUnboxedValuePod* args) const override { + return GetVectorResource(args[0])->Get()->GetResult(valueBuilder); + } +}; + +static const auto CreateName = TStringRef::Of("Create"); +static const auto EmplaceName = TStringRef::Of("Emplace"); +static const auto SwapName = TStringRef::Of("Swap"); +static const auto GetResultName = TStringRef::Of("GetResult"); + +class TVectorModule: public IUdfModule { +public: + TStringRef Name() const { + return TStringRef::Of("Vector"); + } + + void CleanupOnTerminate() const final { + } + + void GetAllFunctions(IFunctionsSink& sink) const final { + sink.Add(CreateName)->SetTypeAwareness(); + sink.Add(EmplaceName)->SetTypeAwareness(); + sink.Add(SwapName)->SetTypeAwareness(); + sink.Add(GetResultName)->SetTypeAwareness(); + } + + void BuildFunctionTypeInfo( + const TStringRef& name, + TType* userType, + const TStringRef& typeConfig, + ui32 flags, + IFunctionTypeInfoBuilder& builder) const final + { + Y_UNUSED(typeConfig); + + try { + const bool typesOnly = (flags & TFlags::TypesOnly); + builder.UserType(userType); + + auto typeHelper = builder.TypeInfoHelper(); + + auto userTypeInspector = TTupleTypeInspector(*typeHelper, userType); + if (!userTypeInspector || userTypeInspector.GetElementsCount() != 3) { + builder.SetError("User type is not a 3-tuple"); + return; + } + + auto valueType = userTypeInspector.GetElementType(2); + TType* vectorType = builder.Resource(VectorResourceName); + + if (name == CreateName) { + builder.IsStrict(); + + builder.Args()->Add<ui64>().Done().Returns(vectorType); + + if (!typesOnly) { + builder.Implementation(new TVectorCreate); + } + } + + if (name == EmplaceName) { + builder.IsStrict(); + + builder.Args()->Add(vectorType).Add<ui64>().Add(valueType).Done().Returns(vectorType); + + if (!typesOnly) { + builder.Implementation(new TVectorEmplace); + } + } + + if (name == SwapName) { + builder.IsStrict(); + + builder.Args()->Add(vectorType).Add<ui64>().Add<ui64>().Done().Returns(vectorType); + + if (!typesOnly) { + builder.Implementation(new TVectorSwap); + } + } + + if (name == GetResultName) { + auto resultType = builder.List()->Item(valueType).Build(); + + builder.IsStrict(); + + builder.Args()->Add(vectorType).Done().Returns(resultType); + + if (!typesOnly) { + builder.Implementation(new TVectorGetResult); + } + } + + } catch (const std::exception& e) { + builder.SetError(CurrentExceptionMessage()); + } + } +}; + +} // namespace + +REGISTER_MODULES(TVectorModule) diff --git a/yql/essentials/udfs/common/vector/ya.make b/yql/essentials/udfs/common/vector/ya.make new file mode 100644 index 0000000000..a1403f62a6 --- /dev/null +++ b/yql/essentials/udfs/common/vector/ya.make @@ -0,0 +1,17 @@ +YQL_UDF_CONTRIB(vector_udf) + +YQL_ABI_VERSION( + 2 + 35 + 0 +) + +SRCS( + vector_udf.cpp +) + +END() + +RECURSE_FOR_TESTS( + test +) diff --git a/yql/essentials/udfs/common/ya.make b/yql/essentials/udfs/common/ya.make index 29266857ed..415f9f9b38 100644 --- a/yql/essentials/udfs/common/ya.make +++ b/yql/essentials/udfs/common/ya.make @@ -21,6 +21,7 @@ RECURSE( topfreq unicode_base url_base + vector yson2 ) diff --git a/yt/cpp/mapreduce/interface/common.h b/yt/cpp/mapreduce/interface/common.h index d8365c32c0..76df343e68 100644 --- a/yt/cpp/mapreduce/interface/common.h +++ b/yt/cpp/mapreduce/interface/common.h @@ -1129,6 +1129,9 @@ struct TRichYPath /// Specifies columnar mapping which will be applied to columns before transfer to job. FLUENT_FIELD_OPTION(TRenameColumnsDescriptor, RenameColumns); + /// Specifies cluster for the YPath + FLUENT_FIELD_OPTION(TString, Cluster); + /// Create empty path with no attributes TRichYPath() { } diff --git a/yt/cpp/mapreduce/interface/serialize.cpp b/yt/cpp/mapreduce/interface/serialize.cpp index 99f6f46b93..519439d879 100644 --- a/yt/cpp/mapreduce/interface/serialize.cpp +++ b/yt/cpp/mapreduce/interface/serialize.cpp @@ -468,6 +468,9 @@ void Serialize(const TRichYPath& path, NYson::IYsonConsumer* consumer) .DoIf(path.BypassArtifactCache_.Defined(), [&] (TFluentAttributes fluent) { fluent.Item("bypass_artifact_cache").Value(*path.BypassArtifactCache_); }) + .DoIf(path.Cluster_.Defined(), [&] (TFluentAttributes fluent) { + fluent.Item("cluster").Value(*path.Cluster_); + }) .EndAttributes() .Value(path.Path_); } @@ -499,6 +502,7 @@ void Deserialize(TRichYPath& path, const TNode& node) DESERIALIZE_ATTR("transaction_id", path.TransactionId_); DESERIALIZE_ATTR("rename_columns", path.RenameColumns_); DESERIALIZE_ATTR("bypass_artifact_cache", path.BypassArtifactCache_); + DESERIALIZE_ATTR("cluster", path.Cluster_); Deserialize(path.Path_, node); } diff --git a/yt/yt/client/api/delegating_client.h b/yt/yt/client/api/delegating_client.h index df4059188b..62048663c3 100644 --- a/yt/yt/client/api/delegating_client.h +++ b/yt/yt/client/api/delegating_client.h @@ -863,7 +863,7 @@ public: // Shuffle Service DELEGATE_METHOD(TFuture<TShuffleHandlePtr>, StartShuffle, ( - const TString& account, + const std::string& account, int partitionCount, NObjectClient::TTransactionId transactionId, const TStartShuffleOptions& options), diff --git a/yt/yt/client/api/rpc_proxy/client_impl.cpp b/yt/yt/client/api/rpc_proxy/client_impl.cpp index cd93d3f214..a763772b7e 100644 --- a/yt/yt/client/api/rpc_proxy/client_impl.cpp +++ b/yt/yt/client/api/rpc_proxy/client_impl.cpp @@ -2667,7 +2667,7 @@ TFuture<TGetFlowViewResult> TClient::GetFlowView( } TFuture<TShuffleHandlePtr> TClient::StartShuffle( - const TString& account, + const std::string& account, int partitionCount, TTransactionId parentTransactionId, const TStartShuffleOptions& options) diff --git a/yt/yt/client/api/rpc_proxy/client_impl.h b/yt/yt/client/api/rpc_proxy/client_impl.h index cfd45388ab..4a5cc37d79 100644 --- a/yt/yt/client/api/rpc_proxy/client_impl.h +++ b/yt/yt/client/api/rpc_proxy/client_impl.h @@ -570,7 +570,7 @@ public: // Shuffle service client TFuture<TShuffleHandlePtr> StartShuffle( - const TString& account, + const std::string& account, int partitionCount, NObjectClient::TTransactionId parentTransactionId, const TStartShuffleOptions& options) override; diff --git a/yt/yt/client/api/shuffle_client.h b/yt/yt/client/api/shuffle_client.h index 27302b46be..7185399148 100644 --- a/yt/yt/client/api/shuffle_client.h +++ b/yt/yt/client/api/shuffle_client.h @@ -10,8 +10,8 @@ struct TShuffleHandle : public NYTree::TYsonStruct { NObjectClient::TTransactionId TransactionId; - TString CoordinatorAddress; - TString Account; + std::string CoordinatorAddress; + std::string Account; int PartitionCount; REGISTER_YSON_STRUCT(TShuffleHandle); @@ -34,7 +34,7 @@ struct IShuffleClient virtual ~IShuffleClient() = default; virtual TFuture<TShuffleHandlePtr> StartShuffle( - const TString& account, + const std::string& account, int partitionCount, NObjectClient::TTransactionId parentTransactionId, const TStartShuffleOptions& options) = 0; diff --git a/yt/yt/client/driver/query_commands.cpp b/yt/yt/client/driver/query_commands.cpp index ab2d9395e1..89a97a7b49 100644 --- a/yt/yt/client/driver/query_commands.cpp +++ b/yt/yt/client/driver/query_commands.cpp @@ -184,6 +184,7 @@ void TReadQueryResultCommand::DoExecute(ICommandContextPtr context) context->GetOutputFormat(), rowset->GetNameTable(), {rowset->GetSchema()}, + {Options.Columns}, context->Request().OutputStream, /*enableContextSaving*/ false, New<TControlAttributesConfig>(), diff --git a/yt/yt/client/driver/shuffle_commands.cpp b/yt/yt/client/driver/shuffle_commands.cpp index 3b647f2909..a6d420b6a2 100644 --- a/yt/yt/client/driver/shuffle_commands.cpp +++ b/yt/yt/client/driver/shuffle_commands.cpp @@ -60,6 +60,7 @@ void TReadShuffleDataCommand::DoExecute(ICommandContextPtr context) format, reader->GetNameTable(), /*tableSchemas*/ {New<TTableSchema>()}, + /*columns*/ {std::nullopt}, context->Request().OutputStream, /*enableContextSaving*/ false, New<TControlAttributesConfig>(), diff --git a/yt/yt/client/driver/shuffle_commands.h b/yt/yt/client/driver/shuffle_commands.h index 2d497cf411..d43f0d7ed4 100644 --- a/yt/yt/client/driver/shuffle_commands.h +++ b/yt/yt/client/driver/shuffle_commands.h @@ -15,7 +15,7 @@ public: static void Register(TRegistrar registrar); private: - TString Account; + std::string Account; int PartitionCount; NObjectClient::TTransactionId ParentTransactionId; @@ -51,7 +51,7 @@ public: private: NApi::TShuffleHandlePtr ShuffleHandle; - TString PartitionColumn; + std::string PartitionColumn; i64 MaxRowBufferSize; void DoExecute(ICommandContextPtr context) override; diff --git a/yt/yt/client/driver/table_commands.cpp b/yt/yt/client/driver/table_commands.cpp index 77be05014c..be98527d0d 100644 --- a/yt/yt/client/driver/table_commands.cpp +++ b/yt/yt/client/driver/table_commands.cpp @@ -129,6 +129,7 @@ void TReadTableCommand::DoExecute(ICommandContextPtr context) format, reader->GetNameTable(), {reader->GetTableSchema()}, + {Path.GetColumns()}, context->Request().OutputStream, false, ControlAttributes, diff --git a/yt/yt/client/federated/client.cpp b/yt/yt/client/federated/client.cpp index 2092672c4f..170dedf910 100644 --- a/yt/yt/client/federated/client.cpp +++ b/yt/yt/client/federated/client.cpp @@ -487,7 +487,7 @@ public: UNIMPLEMENTED_METHOD(TFuture<TDistributedWriteSessionPtr>, StartDistributedWriteSession, (const NYPath::TRichYPath&, const TDistributedWriteSessionStartOptions&)); UNIMPLEMENTED_METHOD(TFuture<void>, FinishDistributedWriteSession, (TDistributedWriteSessionPtr, const TDistributedWriteSessionFinishOptions&)); UNIMPLEMENTED_METHOD(TFuture<ITableWriterPtr>, CreateFragmentTableWriter, (const TFragmentWriteCookiePtr&, const TFragmentTableWriterOptions&)); - UNIMPLEMENTED_METHOD(TFuture<TShuffleHandlePtr>, StartShuffle, (const TString& , int, NObjectClient::TTransactionId, const TStartShuffleOptions&)); + UNIMPLEMENTED_METHOD(TFuture<TShuffleHandlePtr>, StartShuffle, (const std::string& , int, NObjectClient::TTransactionId, const TStartShuffleOptions&)); UNIMPLEMENTED_METHOD(TFuture<IRowBatchReaderPtr>, CreateShuffleReader, (const TShuffleHandlePtr&, int, const NTableClient::TTableReaderConfigPtr&)); UNIMPLEMENTED_METHOD(TFuture<IRowBatchWriterPtr>, CreateShuffleWriter, (const TShuffleHandlePtr&, const std::string&, const NTableClient::TTableWriterConfigPtr&)); diff --git a/yt/yt/client/formats/versioned_writer.cpp b/yt/yt/client/formats/versioned_writer.cpp index 056c86d5e1..545112d825 100644 --- a/yt/yt/client/formats/versioned_writer.cpp +++ b/yt/yt/client/formats/versioned_writer.cpp @@ -1,10 +1,14 @@ #include "versioned_writer.h" #include "config.h" +#include <yt/yt/client/table_client/logical_type.h> +#include <yt/yt/client/table_client/name_table.h> + #include <yt/yt/core/concurrency/async_stream.h> namespace NYT::NFormats { +using namespace NComplexTypes; using namespace NConcurrency; using namespace NYson; using namespace NTableClient; @@ -18,7 +22,20 @@ TVersionedWriter::TVersionedWriter( : Stream_(std::move(stream)) , Schema_(std::move(schema)) , Consumer_(consumerBuilder(&Buffer_)) -{ } +{ + auto nameTable = TNameTable::FromSchema(*Schema_); + + for (const auto& column : Schema_->Columns()) { + if (IsV3Composite(column.LogicalType())) { + auto id = nameTable->GetIdOrThrow(column.Name()); + TComplexTypeFieldDescriptor descriptor(column.Name(), column.LogicalType()); + auto converter = CreateYsonServerToClientConverter(descriptor, /*config*/ {}); + if (converter) { + ColumnConverters_.emplace(id, std::move(converter)); + } + } + } +} TFuture<void> TVersionedWriter::Close() { @@ -52,7 +69,14 @@ bool TVersionedWriter::Write(TRange<TVersionedRow> rows) case EValueType::Any: Consumer_->OnRaw(value.AsStringBuf(), EYsonType::Node); return; - case EValueType::Composite: + case EValueType::Composite: { + if (auto it = ColumnConverters_.find(value.Id); it != ColumnConverters_.end()) { + it->second(value, Consumer_.get()); + } else { + Consumer_->OnRaw(value.AsStringBuf(), EYsonType::Node); + } + return; + } case EValueType::Min: case EValueType::Max: case EValueType::TheBottom: diff --git a/yt/yt/client/formats/versioned_writer.h b/yt/yt/client/formats/versioned_writer.h index 1427d5bf71..4432ddfe52 100644 --- a/yt/yt/client/formats/versioned_writer.h +++ b/yt/yt/client/formats/versioned_writer.h @@ -2,6 +2,8 @@ #include <yt/yt/client/formats/public.h> +#include <yt/yt/client/complex_types/yson_format_conversion.h> + #include <yt/yt/client/table_client/versioned_writer.h> #include <yt/yt/client/table_client/schema.h> @@ -40,6 +42,8 @@ private: TFuture<void> Result_; const std::unique_ptr<NYson::IFlushableYsonConsumer> Consumer_; + + THashMap<int, NComplexTypes::TYsonServerToClientConverter> ColumnConverters_; }; //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/hedging/hedging.cpp b/yt/yt/client/hedging/hedging.cpp index 9d116f0cdc..ac96c64e39 100644 --- a/yt/yt/client/hedging/hedging.cpp +++ b/yt/yt/client/hedging/hedging.cpp @@ -228,7 +228,7 @@ public: UNSUPPORTED_METHOD(TFuture<void>, PausePipeline, (const TYPath&, const TPausePipelineOptions&)); UNSUPPORTED_METHOD(TFuture<TPipelineState>, GetPipelineState, (const TYPath&, const TGetPipelineStateOptions&)); UNSUPPORTED_METHOD(TFuture<TGetFlowViewResult>, GetFlowView, (const NYPath::TYPath&, const NYPath::TYPath&, const TGetFlowViewOptions&)); - UNSUPPORTED_METHOD(TFuture<TShuffleHandlePtr>, StartShuffle, (const TString&, int, NObjectClient::TTransactionId, const TStartShuffleOptions&)); + UNSUPPORTED_METHOD(TFuture<TShuffleHandlePtr>, StartShuffle, (const std::string&, int, NObjectClient::TTransactionId, const TStartShuffleOptions&)); UNSUPPORTED_METHOD(TFuture<IRowBatchReaderPtr>, CreateShuffleReader, (const TShuffleHandlePtr&, int, const NTableClient::TTableReaderConfigPtr&)); UNSUPPORTED_METHOD(TFuture<IRowBatchWriterPtr>, CreateShuffleWriter, (const TShuffleHandlePtr&, const std::string&, const NTableClient::TTableWriterConfigPtr&)); diff --git a/yt/yt/client/unittests/mock/client.h b/yt/yt/client/unittests/mock/client.h index 5467dc7238..31c76a9071 100644 --- a/yt/yt/client/unittests/mock/client.h +++ b/yt/yt/client/unittests/mock/client.h @@ -847,7 +847,7 @@ public: (override)); MOCK_METHOD(TFuture<TShuffleHandlePtr>, StartShuffle, ( - const TString& account, + const std::string& account, int partitionCount, NObjectClient::TTransactionId parentTransactionId, const TStartShuffleOptions& options), diff --git a/yt/yt/core/concurrency/fiber_scheduler_thread.cpp b/yt/yt/core/concurrency/fiber_scheduler_thread.cpp index 441d093a4c..72130a6717 100644 --- a/yt/yt/core/concurrency/fiber_scheduler_thread.cpp +++ b/yt/yt/core/concurrency/fiber_scheduler_thread.cpp @@ -621,7 +621,17 @@ public: void SetFuture(TFuture<void> awaitable) { auto guard = Guard(Lock_); - Future_ = std::move(awaitable); + if (!IsCanceled()) { + Future_ = std::move(awaitable); + return; + } + + guard.Release(); + + ErrorSet_.Wait(); + + YT_ASSERT(!CancelationError_.IsOK()); + awaitable.Cancel(CancelationError_); } void ResetFuture() @@ -644,6 +654,8 @@ public: future = std::move(Future_); } + ErrorSet_.NotifyAll(); + if (future) { YT_LOG_DEBUG("Sending cancelation to fiber, propagating to the awaited future (TargetFiberId: %x)", FiberId_); @@ -654,12 +666,6 @@ public: } } - TError GetCancelationError() const - { - auto guard = Guard(Lock_); - return CancelationError_; - } - void Run(const TError& error) { Cancel(error); @@ -680,6 +686,7 @@ private: const TFiberId FiberId_; std::atomic<bool> Canceled_ = false; + NThreading::TEvent ErrorSet_; NThreading::TSpinLock Lock_; TError CancelationError_; TFuture<void> Future_; @@ -1173,10 +1180,6 @@ void WaitUntilSet(TFuture<void> future, IInvokerPtr invoker) GetCurrentFiberCanceler(); const auto& canceler = NDetail::GetFiberSwitchHandler()->Canceler(); - if (canceler->IsCanceled()) { - future.Cancel(canceler->GetCancelationError()); - } - canceler->SetFuture(future); auto finally = Finally([&] { canceler->ResetFuture(); diff --git a/yt/yt/core/concurrency/throughput_throttler.cpp b/yt/yt/core/concurrency/throughput_throttler.cpp index 913d92b9ec..9cacc0331c 100644 --- a/yt/yt/core/concurrency/throughput_throttler.cpp +++ b/yt/yt/core/concurrency/throughput_throttler.cpp @@ -214,6 +214,18 @@ public: DoReconfigure(limit, Period_); } + std::optional<double> GetLimit() const override + { + VERIFY_THREAD_AFFINITY_ANY(); + + auto limit = Limit_.load(); + if (limit == -1) { + return std::nullopt; + } + + return limit; + } + i64 GetQueueTotalAmount() const override { VERIFY_THREAD_AFFINITY_ANY(); @@ -655,6 +667,13 @@ public: VERIFY_THREAD_AFFINITY_ANY(); } + std::optional<double> GetLimit() const override + { + VERIFY_THREAD_AFFINITY_ANY(); + + return std::nullopt; + } + TFuture<void> GetAvailableFuture() override { YT_UNIMPLEMENTED(); diff --git a/yt/yt/core/concurrency/throughput_throttler.h b/yt/yt/core/concurrency/throughput_throttler.h index a8b8b32e2b..1029ddf7d2 100644 --- a/yt/yt/core/concurrency/throughput_throttler.h +++ b/yt/yt/core/concurrency/throughput_throttler.h @@ -104,6 +104,8 @@ struct IReconfigurableThroughputThrottler //! See TThroughputThrottlerConfig::Limit. virtual void SetLimit(std::optional<double> limit) = 0; + virtual std::optional<double> GetLimit() const = 0; + //! Returns a future that is set when throttler has become available. virtual TFuture<void> GetAvailableFuture() = 0; diff --git a/yt/yt/library/column_converters/column_converter.cpp b/yt/yt/library/column_converters/column_converter.cpp index e798c4c022..c9a2e748f8 100644 --- a/yt/yt/library/column_converters/column_converter.cpp +++ b/yt/yt/library/column_converters/column_converter.cpp @@ -64,27 +64,22 @@ IColumnConverterPtr CreateColumnConvert( TConvertedColumnRange TColumnConverters::ConvertRowsToColumns( TRange<TUnversionedRow> rows, - const THashMap<int, TColumnSchema>& columnSchema) + const THashMap<int, TColumnSchema>& columnSchemas) { TConvertedColumnRange convertedColumnsRange; if (rows.size() == 0) { return convertedColumnsRange; } - if(IsFirstBatch_) { - // Initialize mapping column ids to indexes, since, for example, in the case of column specification (//path/to/table{column1,column3}), not all column ids will exist - - auto firstRow = rows[0]; - - for (const auto* item = firstRow.Begin(); item != firstRow.End(); ++item) { - IdsToIndexes_[item->Id] = std::ssize(ColumnIds_); - ColumnIds_.push_back(item->Id); - auto iterSchema = columnSchema.find(item->Id); - if (iterSchema == columnSchema.end()) { - THROW_ERROR_EXCEPTION("Column with Id %v has no schema", item->Id); - } + if (IsFirstBatch_) { + // Initialize mapping column ids to indexes. + ColumnIds_.reserve(columnSchemas.size()); + for (const auto& columnSchema : columnSchemas) { + IdsToIndexes_[columnSchema.first] = std::ssize(ColumnIds_); + ColumnIds_.push_back(columnSchema.first); } } + IsFirstBatch_ = false; std::vector<TUnversionedRowValues> rowsValues; @@ -101,10 +96,10 @@ TConvertedColumnRange TColumnConverters::ConvertRowsToColumns( } rowsValues.push_back(std::move(rowValues)); } - + convertedColumnsRange.reserve(std::ssize(ColumnIds_)); for (int offset = 0; offset < std::ssize(ColumnIds_); offset++) { - auto iterSchema = columnSchema.find(ColumnIds_[offset]); - YT_VERIFY(iterSchema != columnSchema.end()); + auto iterSchema = columnSchemas.find(ColumnIds_[offset]); + YT_VERIFY(iterSchema != columnSchemas.end()); auto converter = CreateColumnConvert(iterSchema->second, ColumnIds_[offset], offset); auto columns = converter->Convert(rowsValues); convertedColumnsRange.push_back(std::move(columns)); diff --git a/yt/yt/library/column_converters/column_converter.h b/yt/yt/library/column_converters/column_converter.h index 12d9e2a04c..bd06f78fb4 100644 --- a/yt/yt/library/column_converters/column_converter.h +++ b/yt/yt/library/column_converters/column_converter.h @@ -50,7 +50,7 @@ class TColumnConverters public: TConvertedColumnRange ConvertRowsToColumns( TRange<NTableClient::TUnversionedRow> rows, - const THashMap<int, NTableClient::TColumnSchema>& columnSchema); + const THashMap<int, NTableClient::TColumnSchema>& columnSchemas); private: THashMap<int, int> IdsToIndexes_; std::vector<int> ColumnIds_; diff --git a/yt/yt/library/column_converters/string_column_converter.cpp b/yt/yt/library/column_converters/string_column_converter.cpp index 797f64f4ee..04b3854c15 100644 --- a/yt/yt/library/column_converters/string_column_converter.cpp +++ b/yt/yt/library/column_converters/string_column_converter.cpp @@ -299,8 +299,7 @@ private: { for (const auto& rowValues : rowsValues) { auto unversionedValue = rowValues[ColumnOffset_]; - YT_VERIFY(unversionedValue); - auto value = CaptureValue(*unversionedValue); + auto value = CaptureValue(unversionedValue ? *unversionedValue : MakeUnversionedNullValue()); Values_.push_back(value); ++RowCount_; } diff --git a/yt/yt/library/formats/arrow_writer.cpp b/yt/yt/library/formats/arrow_writer.cpp index a3ff967bc6..0ffc0289c3 100644 --- a/yt/yt/library/formats/arrow_writer.cpp +++ b/yt/yt/library/formats/arrow_writer.cpp @@ -26,8 +26,9 @@ namespace NYT::NFormats { -using namespace NTableClient; +using namespace NColumnConverters; using namespace NComplexTypes; +using namespace NTableClient; static constexpr auto& Logger = FormatsLogger; @@ -929,7 +930,8 @@ class TArrowWriter public: TArrowWriter( TNameTablePtr nameTable, - const std::vector<NTableClient::TTableSchemaPtr>& tableSchemas, + const std::vector<TTableSchemaPtr>& tableSchemas, + const std::vector<std::optional<std::vector<std::string>>>& columns, NConcurrency::IAsyncOutputStreamPtr output, bool enableContextSaving, TControlAttributesConfigPtr controlAttributesConfig, @@ -942,6 +944,7 @@ public: keyColumnCount) { YT_VERIFY(tableSchemas.size() > 0); + YT_VERIFY(columns.size() == tableSchemas.size() || columns.size() == 0); ColumnConverters_.resize(tableSchemas.size()); TableCount_ = tableSchemas.size(); @@ -950,9 +953,19 @@ public: IsFirstBatchForSpecificTable_.assign(tableSchemas.size(), false); for (int tableIndex = 0; tableIndex < std::ssize(tableSchemas); ++tableIndex) { + THashSet<std::string> columnNames; + bool hasColumnFilter = false; + if (tableIndex < std::ssize(columns) && columns[tableIndex]) { + hasColumnFilter = true; + for (const auto& columnName : *(columns[tableIndex])) { + columnNames.insert(columnName); + } + } for (const auto& columnSchema : tableSchemas[tableIndex]->Columns()) { - auto columnId = NameTable_->GetIdOrRegisterName(columnSchema.Name()); - ColumnSchemas_[tableIndex][columnId] = columnSchema; + if (!hasColumnFilter || columnNames.contains(columnSchema.Name())) { + auto columnId = NameTable_->GetIdOrRegisterName(columnSchema.Name()); + ColumnSchemas_[tableIndex][columnId] = columnSchema; + } } if (CheckColumnInNameTable(GetRangeIndexColumnId())) { ColumnSchemas_[tableIndex][GetRangeIndexColumnId()] = GetSystemColumnSchema(NameTable_->GetName(GetRangeIndexColumnId()), GetRangeIndexColumnId()); @@ -1037,7 +1050,7 @@ private: ++EncodedRowBatchCount_; } - void DoWriteBatch(NTableClient::IUnversionedRowBatchPtr rowBatch) override + void DoWriteBatch(IUnversionedRowBatchPtr rowBatch) override { auto columnarBatch = rowBatch->TryAsColumnar(); if (!columnarBatch) { @@ -1102,9 +1115,10 @@ private: std::vector<TTypedBatchColumn> TypedColumns_; std::vector<THashMap<int, TColumnSchema>> ColumnSchemas_; std::vector<IUnversionedColumnarRowBatch::TDictionaryId> ArrowDictionaryIds_; - std::vector<NColumnConverters::TColumnConverters> ColumnConverters_; + std::vector<TColumnConverters> ColumnConverters_; std::vector<THashMap<int, int>> TableIdToIndex_; std::vector<bool> IsFirstBatchForSpecificTable_; + TConvertedColumnRange MissingColumns_; i64 EncodedRowBatchCount_ = 0; i64 EncodedColumnarBatchCount_ = 0; @@ -1126,7 +1140,7 @@ private: ControlAttributesConfig_->EnableTabletIndex && IsTabletIndexColumnId(columnIndex); } - bool IsColumnNeedsToAdd(int columnIndex) const + bool ShouldColumnBeAdded(int columnIndex) const { return !IsSystemColumnId(columnIndex) || (CheckIfSystemColumnEnable(columnIndex) && !IsTableIndexColumnId(columnIndex)); @@ -1143,24 +1157,23 @@ private: void PrepareColumns(const TRange<const TBatchColumn*>& batchColumns, int tableIndex) { if (!IsFirstBatchForSpecificTable_[tableIndex]) { - std::vector<bool> idExists(NameTable_->GetSize(), false); - for (const auto* column : batchColumns) { - if (IsColumnNeedsToAdd(column->Id)) { - idExists[column->Id] = true; - } - } int currentIndex = 0; - for (int columnId = 0; columnId < NameTable_->GetSize(); columnId++) { - if (idExists[columnId]) { + for (const auto& columnSchema : ColumnSchemas_[tableIndex]) { + auto columnId = columnSchema.first; + if (ShouldColumnBeAdded(columnId)) { TableIdToIndex_[tableIndex][columnId] = currentIndex; currentIndex++; } } + IsFirstBatchForSpecificTable_[tableIndex] = true; } + TypedColumns_.resize(TableIdToIndex_[tableIndex].size()); + std::vector<bool> columnExists(TableIdToIndex_[tableIndex].size()); + for (const auto* column : batchColumns) { - if (IsColumnNeedsToAdd(column->Id)) { + if (ShouldColumnBeAdded(column->Id)) { auto iterIndex = TableIdToIndex_[tableIndex].find(column->Id); YT_VERIFY(iterIndex != TableIdToIndex_[tableIndex].end()); @@ -1170,6 +1183,36 @@ private: column, iterSchema->second.LogicalType() }; + columnExists[iterIndex->second] = true; + } + } + + THashMap<int, TColumnSchema> missingColumnSchemas; + for (const auto& columnSchema : ColumnSchemas_[tableIndex]) { + auto columnId = columnSchema.first; + if (ShouldColumnBeAdded(columnId)) { + auto iterIndex = TableIdToIndex_[tableIndex].find(columnId); + YT_VERIFY(iterIndex != TableIdToIndex_[tableIndex].end()); + if (!columnExists[iterIndex->second]) { + missingColumnSchemas[columnId] = columnSchema.second; + } + } + } + if (missingColumnSchemas.size() > 0 && RowCount_ > 0) { + std::vector<TUnversionedRow> rows(RowCount_); + TColumnConverters columnConverter; + MissingColumns_ = columnConverter.ConvertRowsToColumns(rows, missingColumnSchemas); + for (ssize_t columnIndex = 0; columnIndex < std::ssize(MissingColumns_); columnIndex++) { + auto iterIndex = TableIdToIndex_[tableIndex].find(MissingColumns_[columnIndex].RootColumn->Id); + YT_VERIFY(iterIndex != TableIdToIndex_[tableIndex].end()); + + auto iterSchema = ColumnSchemas_[tableIndex].find(MissingColumns_[columnIndex].RootColumn->Id); + YT_VERIFY(iterSchema != ColumnSchemas_[tableIndex].end()); + + TypedColumns_[iterIndex->second] = TTypedBatchColumn{ + MissingColumns_[columnIndex].RootColumn, + iterSchema->second.LogicalType() + }; } } } @@ -1459,8 +1502,9 @@ private: //////////////////////////////////////////////////////////////////////////////// ISchemalessFormatWriterPtr CreateWriterForArrow( - NTableClient::TNameTablePtr nameTable, - const std::vector<NTableClient::TTableSchemaPtr>& schemas, + TNameTablePtr nameTable, + const std::vector<TTableSchemaPtr>& schemas, + const std::vector<std::optional<std::vector<std::string>>>& columns, NConcurrency::IAsyncOutputStreamPtr output, bool enableContextSaving, TControlAttributesConfigPtr controlAttributesConfig, @@ -1469,6 +1513,7 @@ ISchemalessFormatWriterPtr CreateWriterForArrow( auto result = New<TArrowWriter>( std::move(nameTable), schemas, + columns, std::move(output), enableContextSaving, std::move(controlAttributesConfig), diff --git a/yt/yt/library/formats/arrow_writer.h b/yt/yt/library/formats/arrow_writer.h index 60b296f73b..ba05ce3c92 100644 --- a/yt/yt/library/formats/arrow_writer.h +++ b/yt/yt/library/formats/arrow_writer.h @@ -16,6 +16,7 @@ namespace NYT::NFormats { ISchemalessFormatWriterPtr CreateWriterForArrow( NTableClient::TNameTablePtr nameTable, const std::vector<NTableClient::TTableSchemaPtr>& schemas, + const std::vector<std::optional<std::vector<std::string>>>& columns, NConcurrency::IAsyncOutputStreamPtr output, bool enableContextSaving, TControlAttributesConfigPtr controlAttributesConfig, diff --git a/yt/yt/library/formats/format.cpp b/yt/yt/library/formats/format.cpp index 8978d0e994..6da0985abf 100644 --- a/yt/yt/library/formats/format.cpp +++ b/yt/yt/library/formats/format.cpp @@ -254,6 +254,7 @@ ISchemalessFormatWriterPtr CreateStaticTableWriterForFormat( const TFormat& format, TNameTablePtr nameTable, const std::vector<TTableSchemaPtr>& tableSchemas, + const std::vector<std::optional<std::vector<std::string>>>& columns, NConcurrency::IAsyncOutputStreamPtr output, bool enableContextSaving, TControlAttributesConfigPtr controlAttributesConfig, @@ -320,6 +321,7 @@ ISchemalessFormatWriterPtr CreateStaticTableWriterForFormat( return CreateWriterForArrow( nameTable, tableSchemas, + columns, std::move(output), enableContextSaving, controlAttributesConfig, diff --git a/yt/yt/library/formats/format.h b/yt/yt/library/formats/format.h index d848ec4b0f..3536118d37 100644 --- a/yt/yt/library/formats/format.h +++ b/yt/yt/library/formats/format.h @@ -64,6 +64,7 @@ ISchemalessFormatWriterPtr CreateStaticTableWriterForFormat( const TFormat& format, NTableClient::TNameTablePtr nameTable, const std::vector<NTableClient::TTableSchemaPtr>& tableSchemas, + const std::vector<std::optional<std::vector<std::string>>>& columns, NConcurrency::IAsyncOutputStreamPtr output, bool enableContextSaving, TControlAttributesConfigPtr controlAttributesConfig, |