hexsha stringlengths 40 40 | size int64 5 1.05M | ext stringclasses 588
values | lang stringclasses 305
values | max_stars_repo_path stringlengths 3 363 | max_stars_repo_name stringlengths 5 118 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count float64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringdate 2015-01-01 00:00:35 2022-03-31 23:43:49 ⌀ | max_stars_repo_stars_event_max_datetime stringdate 2015-01-01 12:37:38 2022-03-31 23:59:52 ⌀ | max_issues_repo_path stringlengths 3 363 | max_issues_repo_name stringlengths 5 118 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count float64 1 134k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 363 | max_forks_repo_name stringlengths 5 135 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count float64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringdate 2015-01-01 00:01:02 2022-03-31 23:27:27 ⌀ | max_forks_repo_forks_event_max_datetime stringdate 2015-01-03 08:55:07 2022-03-31 23:59:24 ⌀ | content stringlengths 5 1.05M | avg_line_length float64 1.13 1.04M | max_line_length int64 1 1.05M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
29214a915b46e40d76598e3869481799524973f2 | 1,593 | h | C | include/renderer/internal/vulkan/vulkan_instance_buffer.h | ravi688/VulkanRenderer | 2e4d15cd53a7fef49fc2e6fe27643746ca1245da | [
"MIT"
] | null | null | null | include/renderer/internal/vulkan/vulkan_instance_buffer.h | ravi688/VulkanRenderer | 2e4d15cd53a7fef49fc2e6fe27643746ca1245da | [
"MIT"
] | 3 | 2022-01-28T23:19:13.000Z | 2022-02-02T07:51:30.000Z | include/renderer/internal/vulkan/vulkan_instance_buffer.h | ravi688/VulkanRenderer | 2e4d15cd53a7fef49fc2e6fe27643746ca1245da | [
"MIT"
] | null | null | null |
#pragma once
#include <renderer/internal/vulkan/vulkan_buffer.h>
#include <renderer/multi_buffer.h>
typedef struct vulkan_renderer_t vulkan_renderer_t;
typedef struct vulkan_instance_buffer_create_info_t
{
u32 stride; // element size
u32 capacity; // initial capacity, zero is also a valid capacity here
} vulkan_instance_buffer_create_info_t;
typedef struct vulkan_instance_buffer_t
{
vulkan_renderer_t* renderer;
vulkan_buffer_t device_buffer; // buffer in the device memory
multi_buffer_t host_buffer; // buffer in the host memory
bool has_device_buffer; // initially only host-side buffer is created and used; so it would be false if *_commit never called
} vulkan_instance_buffer_t;
BEGIN_CPP_COMPATIBLE
// constructors and destructors
RENDERER_API void vulkan_instance_buffer_create(vulkan_renderer_t* renderer, vulkan_instance_buffer_create_info_t* create_info, vulkan_instance_buffer_t* out_instance_buffer);
RENDERER_API void vulkan_instance_buffer_destroy(vulkan_instance_buffer_t* instance_buffer);
RENDERER_API void vulkan_instance_buffer_release_resources(vulkan_instance_buffer_t* instance_buffer);
// getters
RENDERER_API multi_buffer_t* vulkan_instance_buffer_get_host_buffer(vulkan_instance_buffer_t* instance_buffer);
RENDERER_API vulkan_buffer_t* vulkan_instance_buffer_get_device_buffer(vulkan_instance_buffer_t* instance_buffer);
// logic functions
// returns true when this buffer should be binded in the pipeline, otherwise false
RENDERER_API bool vulkan_instance_buffer_commit(vulkan_instance_buffer_t* instance_buffer);
END_CPP_COMPATIBLE
| 39.825 | 175 | 0.849969 |
212e466f2e6041dbd6fd999f4b1635a736386ba1 | 2,063 | h | C | mesherx/near.h | wbnns/refine | 4ae8b3979336cabb4a4b414bead14238571c46e6 | [
"Apache-2.0"
] | 42 | 2017-08-30T17:43:12.000Z | 2022-03-11T16:48:02.000Z | mesherx/near.h | wbnns/refine | 4ae8b3979336cabb4a4b414bead14238571c46e6 | [
"Apache-2.0"
] | 4 | 2020-03-02T12:58:59.000Z | 2021-03-22T15:28:51.000Z | mesherx/near.h | wbnns/refine | 4ae8b3979336cabb4a4b414bead14238571c46e6 | [
"Apache-2.0"
] | 18 | 2018-06-01T14:48:41.000Z | 2021-11-17T20:10:29.000Z |
/* Copyright 2014 United States Government as represented by the
* Administrator of the National Aeronautics and Space
* Administration. No copyright is claimed in the United States under
* Title 17, U.S. Code. All Other Rights Reserved.
*
* The refine platform is licensed under the Apache License, Version
* 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#ifndef NEAR_H
#define NEAR_H
#include "refine_defs.h"
#include <math.h>
BEGIN_C_DECLORATION
typedef struct Near Near;
struct Near {
int index;
double x, y, z;
double radius;
Near *leftChild, *rightChild;
double leftRadius, rightRadius;
};
Near *nearCreate(int index, double x, double y, double z, double radius );
Near *nearInit(Near *, int index, double x, double y, double z, double radius );
void nearFree( Near * );
int nearIndex( Near * );
int nearLeftIndex( Near * );
int nearRightIndex( Near * );
#define nearDistance(near,other) \
( sqrt( (near->x - other->x)*(near->x - other->x) + \
(near->y - other->y)*(near->y - other->y) + \
(near->z - other->z)*(near->z - other->z) ) )
double nearClearance( Near *, Near *other);
Near *nearInsert( Near *, Near *child );
#define nearLeftRadius(near) (near->leftRadius)
#define nearRightRadius(near) (near->rightRadius)
Near *nearVisualize( Near * );
int nearCollisions(Near *, Near *target);
Near *nearTouched(Near *, Near *target, int *found, int maxfound, int *list);
int nearNearestIndex(Near *root, Near *key);
Near *nearNearestIndexAndDistance(Near *root, Near *key,
int *index, double *distance);
END_C_DECLORATION
#endif /* NEAR_H */
| 32.234375 | 80 | 0.709646 |
f609b9883a30e0349174dbc45bfb1235423dcf59 | 233 | h | C | mazeract/paper.h | jarikomppa/speccy | 0868ead821b9e39df9983dd06a78cf091e896b24 | [
"Unlicense"
] | 56 | 2015-12-28T00:10:56.000Z | 2022-03-07T14:03:26.000Z | mazeract/paper.h | jarikomppa/speccy | 0868ead821b9e39df9983dd06a78cf091e896b24 | [
"Unlicense"
] | 1 | 2021-01-19T15:20:35.000Z | 2021-01-20T22:45:53.000Z | mazeract/paper.h | jarikomppa/speccy | 0868ead821b9e39df9983dd06a78cf091e896b24 | [
"Unlicense"
] | 9 | 2016-12-02T10:56:55.000Z | 2021-11-18T01:41:03.000Z | const unsigned char paper_png[] = {
0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0x08, 0x30, 0x1b, 0xb8, 0x18, 0x08, 0x1b, 0x68, 0x18, 0x08
, 0x1a, 0xe8, 0x18, 0x08, 0x1b, 0xa8, 0x18, 0x08, 0x1f, 0xf8, 0x1f, 0xe0, 0x00, 0x00, 0x00, 0x00
};
| 46.6 | 96 | 0.660944 |
7116cbb72e640abbd500f66435ebb8c7783ce7b3 | 366 | h | C | ASDelaunay-lib/ASCircle.h | ethanmick/ASDelaunay | ff301b6da196de5b1abfb1dfb5e1617296dcd11a | [
"MIT"
] | 1 | 2015-07-15T16:36:00.000Z | 2015-07-15T16:36:00.000Z | ASDelaunay-lib/ASCircle.h | ethanmick/ASDelaunay | ff301b6da196de5b1abfb1dfb5e1617296dcd11a | [
"MIT"
] | null | null | null | ASDelaunay-lib/ASCircle.h | ethanmick/ASDelaunay | ff301b6da196de5b1abfb1dfb5e1617296dcd11a | [
"MIT"
] | null | null | null | //
// ASCircle.h
// ASDelaunay
//
// Created by Ethan Mick on 3/6/13.
// Copyright (c) 2013 Ethan Mick. All rights reserved.
//
#import <Foundation/Foundation.h>
@class ASPoint;
@interface ASCircle : NSObject
@property (nonatomic, retain) ASPoint *point;
@property (nonatomic) double radius;
- (id)initWithX:(double)anX y:(double)aY radius:(double)r;
@end
| 17.428571 | 58 | 0.699454 |
5e3b62df1b805cff0780c4a8cdab173882fb397f | 1,459 | h | C | kubernetes/model/io_k8s_api_core_v1_node_selector_term.h | zouxiaoliang/nerv-kubernetes-client-c | 07528948c643270fd757d38edc68da8c9628ee7a | [
"Apache-2.0"
] | null | null | null | kubernetes/model/io_k8s_api_core_v1_node_selector_term.h | zouxiaoliang/nerv-kubernetes-client-c | 07528948c643270fd757d38edc68da8c9628ee7a | [
"Apache-2.0"
] | null | null | null | kubernetes/model/io_k8s_api_core_v1_node_selector_term.h | zouxiaoliang/nerv-kubernetes-client-c | 07528948c643270fd757d38edc68da8c9628ee7a | [
"Apache-2.0"
] | null | null | null | /*
* io_k8s_api_core_v1_node_selector_term.h
*
* A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm.
*/
#ifndef _io_k8s_api_core_v1_node_selector_term_H_
#define _io_k8s_api_core_v1_node_selector_term_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
typedef struct io_k8s_api_core_v1_node_selector_term_t io_k8s_api_core_v1_node_selector_term_t;
#include "io_k8s_api_core_v1_node_selector_requirement.h"
typedef struct io_k8s_api_core_v1_node_selector_term_t {
list_t *match_expressions; //nonprimitive container
list_t *match_fields; //nonprimitive container
} io_k8s_api_core_v1_node_selector_term_t;
io_k8s_api_core_v1_node_selector_term_t *io_k8s_api_core_v1_node_selector_term_create(
list_t *match_expressions,
list_t *match_fields
);
void io_k8s_api_core_v1_node_selector_term_free(io_k8s_api_core_v1_node_selector_term_t *io_k8s_api_core_v1_node_selector_term);
io_k8s_api_core_v1_node_selector_term_t *io_k8s_api_core_v1_node_selector_term_parseFromJSON(cJSON *io_k8s_api_core_v1_node_selector_termJSON);
cJSON *io_k8s_api_core_v1_node_selector_term_convertToJSON(io_k8s_api_core_v1_node_selector_term_t *io_k8s_api_core_v1_node_selector_term);
#endif /* _io_k8s_api_core_v1_node_selector_term_H_ */
| 35.585366 | 168 | 0.856066 |
af1554bb88d2da710b692a1059569a1d27092beb | 541 | h | C | OneClickDemo.framework/Headers/OneClickDemo.h | sendbird/oneclick-framework | 9ef6cbf492893c08fd1ef8a2c86afdaf783d233e | [
"MIT"
] | null | null | null | OneClickDemo.framework/Headers/OneClickDemo.h | sendbird/oneclick-framework | 9ef6cbf492893c08fd1ef8a2c86afdaf783d233e | [
"MIT"
] | null | null | null | OneClickDemo.framework/Headers/OneClickDemo.h | sendbird/oneclick-framework | 9ef6cbf492893c08fd1ef8a2c86afdaf783d233e | [
"MIT"
] | null | null | null | //
// OneClickDemo.h
// OneClickDemo
//
// Created by Jed Gyeong on 8/26/20.
// Copyright © 2020 SendBird. All rights reserved.
//
#import <Foundation/Foundation.h>
//! Project version number for OneClickDemo.
FOUNDATION_EXPORT double OneClickDemoVersionNumber;
//! Project version string for OneClickDemo.
FOUNDATION_EXPORT const unsigned char OneClickDemoVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <OneClickDemo/PublicHeader.h>
#import "OCDMain.h"
| 27.05 | 137 | 0.770795 |
61d3ece3f6c365e979fa367464311c65d112ee8d | 6,893 | h | C | FreeBSD/contrib/llvm/tools/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h | TigerBSD/FreeBSD-Custom-ThinkPad | 3d092f261b362f73170871403397fc5d6b89d1dc | [
"0BSD"
] | 4 | 2016-08-22T22:02:55.000Z | 2017-03-04T22:56:44.000Z | FreeBSD/contrib/llvm/tools/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h | TigerBSD/FreeBSD-Custom-ThinkPad | 3d092f261b362f73170871403397fc5d6b89d1dc | [
"0BSD"
] | 21 | 2016-08-11T09:43:43.000Z | 2017-01-29T12:52:56.000Z | FreeBSD/contrib/llvm/tools/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h | TigerBSD/TigerBSD | 3d092f261b362f73170871403397fc5d6b89d1dc | [
"0BSD"
] | null | null | null | //===-- UnwindAssemblyInstEmulation.h ---------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef liblldb_UnwindAssemblyInstEmulation_h_
#define liblldb_UnwindAssemblyInstEmulation_h_
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/EmulateInstruction.h"
#include "lldb/Core/RegisterValue.h"
#include "lldb/Symbol/UnwindPlan.h"
#include "lldb/Target/UnwindAssembly.h"
class UnwindAssemblyInstEmulation : public lldb_private::UnwindAssembly
{
public:
~UnwindAssemblyInstEmulation() override = default;
bool
GetNonCallSiteUnwindPlanFromAssembly(lldb_private::AddressRange& func,
lldb_private::Thread& thread,
lldb_private::UnwindPlan& unwind_plan) override;
bool
AugmentUnwindPlanFromCallSite(lldb_private::AddressRange& func,
lldb_private::Thread& thread,
lldb_private::UnwindPlan& unwind_plan) override;
bool
GetFastUnwindPlan(lldb_private::AddressRange& func,
lldb_private::Thread& thread,
lldb_private::UnwindPlan &unwind_plan) override;
// thread may be NULL in which case we only use the Target (e.g. if this is called pre-process-launch).
bool
FirstNonPrologueInsn(lldb_private::AddressRange& func,
const lldb_private::ExecutionContext &exe_ctx,
lldb_private::Address& first_non_prologue_insn) override;
static lldb_private::UnwindAssembly *
CreateInstance (const lldb_private::ArchSpec &arch);
//------------------------------------------------------------------
// PluginInterface protocol
//------------------------------------------------------------------
static void
Initialize();
static void
Terminate();
static lldb_private::ConstString
GetPluginNameStatic();
static const char *
GetPluginDescriptionStatic();
lldb_private::ConstString
GetPluginName() override;
uint32_t
GetPluginVersion() override;
private:
// Call CreateInstance to get an instance of this class
UnwindAssemblyInstEmulation(const lldb_private::ArchSpec &arch,
lldb_private::EmulateInstruction *inst_emulator) :
UnwindAssembly (arch),
m_inst_emulator_ap (inst_emulator),
m_range_ptr (NULL),
m_thread_ptr (NULL),
m_unwind_plan_ptr (NULL),
m_curr_row (),
m_cfa_reg_info (),
m_fp_is_cfa (false),
m_register_values (),
m_pushed_regs(),
m_curr_row_modified (false),
m_forward_branch_offset (0)
{
if (m_inst_emulator_ap.get())
{
m_inst_emulator_ap->SetBaton (this);
m_inst_emulator_ap->SetCallbacks (ReadMemory, WriteMemory, ReadRegister, WriteRegister);
}
}
static size_t
ReadMemory (lldb_private::EmulateInstruction *instruction,
void *baton,
const lldb_private::EmulateInstruction::Context &context,
lldb::addr_t addr,
void *dst,
size_t length);
static size_t
WriteMemory (lldb_private::EmulateInstruction *instruction,
void *baton,
const lldb_private::EmulateInstruction::Context &context,
lldb::addr_t addr,
const void *dst,
size_t length);
static bool
ReadRegister (lldb_private::EmulateInstruction *instruction,
void *baton,
const lldb_private::RegisterInfo *reg_info,
lldb_private::RegisterValue ®_value);
static bool
WriteRegister (lldb_private::EmulateInstruction *instruction,
void *baton,
const lldb_private::EmulateInstruction::Context &context,
const lldb_private::RegisterInfo *reg_info,
const lldb_private::RegisterValue ®_value);
// size_t
// ReadMemory (lldb_private::EmulateInstruction *instruction,
// const lldb_private::EmulateInstruction::Context &context,
// lldb::addr_t addr,
// void *dst,
// size_t length);
size_t
WriteMemory (lldb_private::EmulateInstruction *instruction,
const lldb_private::EmulateInstruction::Context &context,
lldb::addr_t addr,
const void *dst,
size_t length);
bool
ReadRegister (lldb_private::EmulateInstruction *instruction,
const lldb_private::RegisterInfo *reg_info,
lldb_private::RegisterValue ®_value);
bool
WriteRegister (lldb_private::EmulateInstruction *instruction,
const lldb_private::EmulateInstruction::Context &context,
const lldb_private::RegisterInfo *reg_info,
const lldb_private::RegisterValue ®_value);
static uint64_t
MakeRegisterKindValuePair (const lldb_private::RegisterInfo ®_info);
void
SetRegisterValue (const lldb_private::RegisterInfo ®_info,
const lldb_private::RegisterValue ®_value);
bool
GetRegisterValue (const lldb_private::RegisterInfo ®_info,
lldb_private::RegisterValue ®_value);
std::unique_ptr<lldb_private::EmulateInstruction> m_inst_emulator_ap;
lldb_private::AddressRange* m_range_ptr;
lldb_private::Thread* m_thread_ptr;
lldb_private::UnwindPlan* m_unwind_plan_ptr;
lldb_private::UnwindPlan::RowSP m_curr_row;
typedef std::map<uint64_t, uint64_t> PushedRegisterToAddrMap;
uint64_t m_initial_sp;
lldb_private::RegisterInfo m_cfa_reg_info;
bool m_fp_is_cfa;
typedef std::map<uint64_t, lldb_private::RegisterValue> RegisterValueMap;
RegisterValueMap m_register_values;
PushedRegisterToAddrMap m_pushed_regs;
// While processing the instruction stream, we need to communicate some state change
// information up to the higher level loop that makes decisions about how to push
// the unwind instructions for the UnwindPlan we're constructing.
// The instruction we're processing updated the UnwindPlan::Row contents
bool m_curr_row_modified;
// The instruction is branching forward with the given offset. 0 value means no branching.
uint32_t m_forward_branch_offset;
};
#endif // liblldb_UnwindAssemblyInstEmulation_h_
| 37.05914 | 107 | 0.629189 |
614a9114f3e44cd4173c00ee61e7695247bdff9a | 20,211 | c | C | src/bb_connection.c | campbellhome/bbclient | 5f9ad881ac65c17f736c3421fddb4e726f23741a | [
"MIT"
] | null | null | null | src/bb_connection.c | campbellhome/bbclient | 5f9ad881ac65c17f736c3421fddb4e726f23741a | [
"MIT"
] | null | null | null | src/bb_connection.c | campbellhome/bbclient | 5f9ad881ac65c17f736c3421fddb4e726f23741a | [
"MIT"
] | null | null | null | // Copyright (c) 2012-2019 Matt Campbell
// MIT license (see License.txt)
#include "bb.h"
#if BB_ENABLED
#include "bbclient/bb_connection.h"
#include "bbclient/bb_log.h"
#include "bbclient/bb_packet.h"
#include "bbclient/bb_socket_errors.h"
#include "bbclient/bb_time.h"
#include <string.h> // for memset
#define BBCON_LOG(...) \
if((con->flags & kBBCon_Blackbox) != 0) { \
bb_log(__VA_ARGS__); \
} else { \
BB_LOG_A("bbcon", __VA_ARGS__); \
}
#define BBCON_WARNING(...) \
if((con->flags & kBBCon_Blackbox) != 0) { \
bb_warning(__VA_ARGS__); \
} else { \
BB_WARNING_A("bbcon", __VA_ARGS__); \
}
#define BBCON_ERROR(...) \
if((con->flags & kBBCon_Blackbox) != 0) { \
bb_error(__VA_ARGS__); \
} else { \
BB_ERROR_A("bbcon", __VA_ARGS__); \
}
static void bbcon_disconnect_no_flush_no_lock(bb_connection_t *con);
enum {
kBBCon_SendIntervalMillis = 500,
};
void bbcon_init(bb_connection_t *con)
{
bb_critical_section_init(&con->cs);
con->sentBytesTotal = con->receivedBytesTotal = 0u;
con->socket = BB_INVALID_SOCKET;
con->sendCursor = con->recvCursor = con->decodeCursor = 0;
con->prevSendTime = 0;
con->sendInterval = kBBCon_SendIntervalMillis;
con->flags = con->flags & (~(kBBCon_Client | kBBCon_Server));
con->state = kBBConnection_NotConnected;
if(!con->connectTimeoutInterval) {
con->connectTimeoutInterval = 10000;
}
}
void bbcon_shutdown(bb_connection_t *con)
{
bbcon_reset(con);
bb_critical_section_shutdown(&con->cs);
}
void bbcon_reset(bb_connection_t *con)
{
bbcon_disconnect(con);
con->sentBytesTotal = con->receivedBytesTotal = 0u;
con->sendCursor = con->recvCursor = con->decodeCursor = 0;
con->prevSendTime = 0;
con->flags = con->flags = con->flags & (~(kBBCon_Client | kBBCon_Server));
if(!con->connectTimeoutInterval) {
con->connectTimeoutInterval = 10000;
}
}
b32 bbcon_connect_client_async(bb_connection_t *con, u32 remoteAddr, u16 remotePort)
{
char ipport[32];
b32 bConnected = false;
bb_socket testSocket;
struct sockaddr_in sin;
bbcon_reset(con);
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_port = htons(remotePort);
BB_S_ADDR_UNION(sin) = htonl(remoteAddr);
testSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if(testSocket == BB_INVALID_SOCKET) {
BBCON_ERROR("bbcon_connect_client failed - could create socket");
return false;
}
bb_format_ipport(ipport, sizeof(ipport), remoteAddr, remotePort);
BBCON_LOG("BlackBox client trying to connect to %s", ipport);
bbnet_socket_nodelay(testSocket, true);
bbnet_socket_nonblocking(testSocket, true);
int ret;
BBCON_LOG("BlackBox client trying to async connect...");
ret = connect(testSocket, (struct sockaddr *)&sin, sizeof(sin));
if(ret == BB_SOCKET_ERROR) {
int err = BBNET_ERRNO;
if(err == BBNET_EWOULDBLOCK || err == BBNET_EINPROGRESS) {
BBCON_LOG("BlackBox client connecting async");
con->socket = testSocket;
con->flags |= kBBCon_Client;
con->state = kBBConnection_Connecting;
con->connectTimeoutTime = bb_current_time_ms() + con->connectTimeoutInterval;
return true;
} else {
BBCON_ERROR("BlackBox client async connect failed with errno %d (%s)", err, bbnet_error_to_string(err));
}
} else {
bConnected = true;
}
if(!bConnected) {
BB_CLOSE(testSocket);
return false;
}
BBCON_LOG("BlackBox client connected");
// We're connected - send an initial packet and flush to ensure the packet is sent
con->socket = testSocket;
con->flags |= kBBCon_Client;
con->state = kBBConnection_Connected;
bbcon_flush(con);
return true;
}
b32 bbcon_tick_connecting(bb_connection_t *con)
{
BB_TIMEVAL tv = { BB_EMPTY_INITIALIZER };
tv.tv_usec = 1000; // 1 millisecond
fd_set set;
FD_ZERO(&set);
BB_FD_SET(con->socket, &set);
//BBCON_LOG("BlackBox client connecting tick");
int ret = select((int)con->socket + 1, 0, &set, 0, &tv);
int err = (ret == BB_SOCKET_ERROR) ? BBNET_ERRNO : 0;
if(err == BBNET_EWOULDBLOCK) {
err = 0;
}
if(ret == 1) {
BBCON_LOG("BlackBox client connected");
con->state = kBBConnection_Connected;
bbcon_flush(con);
return true;
} else if(err) {
BBCON_ERROR("bbcon_tick_connecting failed with errno %d (%s)", err, bbnet_error_to_string(err));
bbcon_disconnect_no_flush(con);
return false;
} else {
u64 now = bb_current_time_ms();
if(now >= con->connectTimeoutTime) {
BBCON_ERROR("bbcon_tick_connecting failed - timed out waiting to connect");
bbcon_disconnect_no_flush(con);
}
return false;
}
}
b32 bbcon_connect_client(bb_connection_t *con, u32 remoteAddr, u16 remotePort, u32 retries)
{
char ipport[32];
b32 bConnected = false;
bb_socket testSocket;
struct sockaddr_in sin;
bbcon_reset(con);
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_port = htons(remotePort);
BB_S_ADDR_UNION(sin) = htonl(remoteAddr);
testSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if(testSocket == BB_INVALID_SOCKET) {
BBCON_ERROR("bbcon_connect_client failed - could create socket");
return false;
}
bb_format_ipport(ipport, sizeof(ipport), remoteAddr, remotePort);
BBCON_LOG("BlackBox client trying to connect to %s", ipport);
for(u32 i = 0; i < retries; ++i) {
int ret;
BBCON_LOG("BlackBox client trying to connect (attempt %u)...", i);
ret = connect(testSocket, (struct sockaddr *)&sin, sizeof(sin));
if(ret == BB_SOCKET_ERROR) {
int err = BBNET_ERRNO;
BBCON_ERROR("BlackBox client connect failed with errno %d (%s)", err, bbnet_error_to_string(err));
} else {
bConnected = true;
break;
}
}
if(!bConnected) {
BB_CLOSE(testSocket);
return false;
}
BBCON_LOG("BlackBox client connected");
bbnet_socket_nodelay(testSocket, true);
bbnet_socket_nonblocking(testSocket, true);
// We're connected - send an initial packet and flush to ensure the packet is sent
con->socket = testSocket;
con->flags |= kBBCon_Client;
con->state = kBBConnection_Connected;
bbcon_flush(con);
return true;
}
bb_socket bbcon_init_server(u32 *localIp, u16 *localPort)
{
int ret;
struct sockaddr_in sin;
socklen_t sinSize = sizeof(sin);
bb_socket testSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if(testSocket == BB_INVALID_SOCKET) {
BB_ERROR_A("bbcon", "bbcon_init_server failed - could create socket");
return BB_INVALID_SOCKET;
}
// Bind the socket to any available address on any available port
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
BB_S_ADDR_UNION(sin) = htonl(*localIp);
sin.sin_port = htons(*localPort);
ret = bind(testSocket, (struct sockaddr *)&sin, sizeof(sin));
if(ret == BB_SOCKET_ERROR) {
BB_ERROR_A("bbcon", "bbcon_init_server failed - could not bind port %d", localPort);
bbnet_gracefulclose(&testSocket);
return BB_INVALID_SOCKET;
}
ret = getsockname(testSocket, (struct sockaddr *)&sin, &sinSize);
if(ret == BB_SOCKET_ERROR) {
BB_ERROR_A("bbcon", "bbcon_init_server failed - could not determine port");
bbnet_gracefulclose(&testSocket);
return BB_INVALID_SOCKET;
}
*localIp = ntohl(BB_S_ADDR_UNION(sin));
*localPort = ntohs(sin.sin_port);
return testSocket;
}
b32 bbcon_connect_server(bb_connection_t *con, bb_socket testSocket, u32 localAddr, u16 localPort)
{
int ret;
char ipport[32];
bb_format_ipport(ipport, sizeof(ipport), localAddr, localPort);
BBCON_LOG("bbcon_connect_server %p listening on %s", con, ipport);
ret = listen(testSocket, 10);
if(ret == BB_SOCKET_ERROR) {
BBCON_ERROR("bbcon_connect_server failed - could not listen");
bbnet_gracefulclose(&testSocket);
return false;
}
bbnet_socket_nodelay(testSocket, true); // #investigate: this wasn't set before
bbnet_socket_nonblocking(testSocket, true);
con->socket = testSocket;
con->state = kBBConnection_Listening;
con->connectTimeoutTime = bb_current_time_ms() + con->connectTimeoutInterval;
return true;
}
b32 bbcon_tick_listening(bb_connection_t *con)
{
BB_TIMEVAL tv;
fd_set set;
struct sockaddr_in remoteAddrStorage; // client address
socklen_t addrLen = sizeof(remoteAddrStorage);
bb_socket clientSock;
tv.tv_sec = 0;
tv.tv_usec = 1000;
FD_ZERO(&set);
BB_FD_SET(con->socket, &set);
// Now wait for the client to connect
if(1 != select((int)con->socket + 1, &set, 0, 0, &tv)) {
u64 now = bb_current_time_ms();
if(now >= con->connectTimeoutTime) {
BBCON_ERROR("bbcon_connect_server failed - timed out waiting for client to connect");
bbcon_disconnect_no_flush(con);
}
return false;
}
clientSock = accept(con->socket, (struct sockaddr *)&remoteAddrStorage, &addrLen);
if(clientSock == BB_INVALID_SOCKET) {
BBCON_ERROR("bbcon_connect_server failed - client failed to connect");
bbcon_disconnect_no_flush(con);
return false;
}
bbnet_socket_nodelay(clientSock, true);
bbnet_socket_nonblocking(clientSock, true);
// We're connected!
BBCON_LOG("bbcon_connect_server success");
bb_socket socketToClose = con->socket;
con->state = kBBConnection_Connected;
con->socket = clientSock;
con->flags |= kBBCon_Server;
bbnet_gracefulclose(&socketToClose);
return true;
}
b32 bbcon_is_connecting(const bb_connection_t *con)
{
return con->socket != BB_INVALID_SOCKET && con->state == kBBConnection_Connecting;
}
b32 bbcon_is_listening(const bb_connection_t *con)
{
return con->socket != BB_INVALID_SOCKET && con->state == kBBConnection_Listening;
}
b32 bbcon_is_connected(const bb_connection_t *con)
{
return con->socket != BB_INVALID_SOCKET && con->state != kBBConnection_Listening && con->state != kBBConnection_Connecting;
}
// Retry sends until we've sent everything or disconnected
static void bbcon_flush_no_lock(bb_connection_t *con, b32 retry)
{
int ret;
u32 nSendCursor = 0;
fd_set set;
struct timeval tv;
u64 start = bb_current_time_ms();
u64 timeout = start + 2000;
if(con->socket != BB_INVALID_SOCKET) {
while(nSendCursor < con->sendCursor) {
FD_ZERO(&set);
BB_FD_SET(con->socket, &set);
tv.tv_sec = 0;
tv.tv_usec = 1000;
ret = select((int)con->socket + 1, 0, &set, 0, &tv);
//BBCON_LOG( "Flush select ret:%d", ret );
if(ret == BB_SOCKET_ERROR) {
int err = BBNET_ERRNO;
BBCON_LOG("bbcon_flush: disconnected during select with errno %d (%s)", err, bbnet_error_to_string(err));
bbcon_disconnect_no_flush_no_lock(con);
break;
}
if(ret == 0) {
u64 now = bb_current_time_ms();
if(now >= timeout) // OS internal buffer has been full for a really long time (server crashed?), so we're done
{
BBCON_LOG("bbcon_flush: timed out after %" PRIu64 " ms", now - start);
bbcon_disconnect_no_flush_no_lock(con);
break;
}
if(!retry) {
break;
}
continue; // OS internal buffer is full temporarily, so we'll retry
}
#if defined(MSG_NOSIGNAL)
const int flags = MSG_NOSIGNAL;
#else
const int flags = 0;
#endif
ret = send(con->socket, (const char *)(con->sendBuffer + nSendCursor), (int)(con->sendCursor - nSendCursor), flags);
if(ret == BB_SOCKET_ERROR) {
int err = BBNET_ERRNO;
BBCON_LOG("bbcon_flush: disconnected during send with errno %d (%s)", err, bbnet_error_to_string(err));
bbcon_disconnect_no_flush_no_lock(con);
break;
}
con->sentBytesTotal += ret;
nSendCursor += ret;
if(!retry) {
break;
}
}
}
u64 end = bb_current_time_ms();
if(nSendCursor < con->sendCursor) {
if(nSendCursor) {
memmove(con->sendBuffer, con->sendBuffer + nSendCursor, con->sendCursor - nSendCursor);
con->sendCursor -= nSendCursor;
}
} else {
con->sendCursor = 0;
con->prevSendTime = end;
}
if(end - start > 10) {
BBCON_WARNING("bb_flush took %" PRIu64 " ms", end - start);
}
}
void bbcon_disconnect(bb_connection_t *con)
{
if(!con->cs.initialized || con->state == kBBConnection_NotConnected)
return;
bb_critical_section_lock(&con->cs);
if(con->socket != BB_INVALID_SOCKET) {
con->state = kBBConnection_NotConnected;
bbcon_flush_no_lock(con, true);
bbnet_gracefulclose(&con->socket);
}
bb_critical_section_unlock(&con->cs);
}
void bbcon_disconnect_no_flush(bb_connection_t *con)
{
if(!con->cs.initialized || con->state == kBBConnection_NotConnected)
return;
bb_critical_section_lock(&con->cs);
if(con->socket != BB_INVALID_SOCKET) {
con->state = kBBConnection_NotConnected;
bbnet_gracefulclose(&con->socket);
}
bb_critical_section_unlock(&con->cs);
}
static void bbcon_disconnect_no_flush_no_lock(bb_connection_t *con)
{
if(!con->cs.initialized || con->state == kBBConnection_NotConnected)
return;
if(con->socket != BB_INVALID_SOCKET) {
con->state = kBBConnection_NotConnected;
bbnet_gracefulclose(&con->socket);
}
}
void bbcon_flush(bb_connection_t *con)
{
if(!con->cs.initialized)
return;
bb_critical_section_lock(&con->cs);
bbcon_flush_no_lock(con, true);
bb_critical_section_unlock(&con->cs);
}
void bbcon_try_flush(bb_connection_t *con)
{
if(!con->cs.initialized)
return;
bb_critical_section_lock(&con->cs);
bbcon_flush_no_lock(con, false);
bb_critical_section_unlock(&con->cs);
}
static void bbcon_send_no_lock(bb_connection_t *con, const void *pData, u32 nBytes)
{
u64 now;
u32 nRemaining = nBytes;
const s8 *pBytes = (const s8 *)(pData);
u32 kSendBufferSize = sizeof(con->sendBuffer);
while(nRemaining && con->socket != BB_INVALID_SOCKET) {
const u32 nBytesToCopy = BB_MIN(kSendBufferSize - con->sendCursor, nRemaining);
memcpy(con->sendBuffer + con->sendCursor, pBytes, nBytesToCopy);
con->sendCursor += nBytesToCopy;
pBytes += nBytesToCopy;
nRemaining -= nBytesToCopy;
if(con->sendCursor == kSendBufferSize && nRemaining > 0) {
bbcon_flush_no_lock(con, true);
}
}
now = bb_current_time_ms();
if(now >= con->prevSendTime + con->sendInterval) {
bbcon_flush_no_lock(con, false);
}
}
void bbcon_send_raw(bb_connection_t *con, const void *pData, u32 nBytes)
{
if(!con->cs.initialized)
return;
bb_critical_section_lock(&con->cs);
if(con->socket != BB_INVALID_SOCKET) {
bbcon_send_no_lock(con, pData, nBytes);
}
bb_critical_section_unlock(&con->cs);
}
void bbcon_send(bb_connection_t *con, bb_decoded_packet_t *decoded)
{
u8 buf[BB_MAX_PACKET_BUFFER_SIZE];
u16 serializedLen;
if(!con->cs.initialized)
return;
serializedLen = bbpacket_serialize(decoded, buf + 2, sizeof(buf) - 2);
if(!serializedLen) {
BBCON_ERROR("bbcon_send failed to encode packet");
return;
}
serializedLen += 2;
buf[0] = (u8)(serializedLen >> 8);
buf[1] = (u8)(serializedLen & 0xFF);
//BBCON_LOG( "bbcon_send packetType:%d nBytes:%d m_nSendCursor:%d", decoded->type, serializedLen, con->sendCursor );
bb_critical_section_lock(&con->cs);
if(con->socket != BB_INVALID_SOCKET) {
bbcon_send_no_lock(con, buf, serializedLen);
}
bb_critical_section_unlock(&con->cs);
}
b32 bbcon_try_send(bb_connection_t *con, bb_decoded_packet_t *decoded)
{
u8 buf[BB_MAX_PACKET_BUFFER_SIZE];
u16 serializedLen;
b32 ret = true;
if(!con->cs.initialized)
return ret;
serializedLen = bbpacket_serialize(decoded, buf + 2, sizeof(buf) - 2);
if(!serializedLen) {
BBCON_ERROR("bbcon_send failed to encode packet");
return ret;
}
serializedLen += 2;
buf[0] = (u8)(serializedLen >> 8);
buf[1] = (u8)(serializedLen & 0xFF);
//BBCON_LOG( "bbcon_try_send packetType:%d nBytes:%d m_nSendCursor:%d", decoded->type, serializedLen, con->sendCursor );
bb_critical_section_lock(&con->cs);
if(con->socket != BB_INVALID_SOCKET) {
u32 kSendBufferSize = sizeof(con->sendBuffer);
const u32 nBytesToCopy = BB_MIN(kSendBufferSize - con->sendCursor, serializedLen);
if(nBytesToCopy == serializedLen) {
const s8 *pBytes = (const s8 *)(buf);
memcpy(con->sendBuffer + con->sendCursor, pBytes, nBytesToCopy);
con->sendCursor += nBytesToCopy;
} else {
ret = false;
}
}
bb_critical_section_unlock(&con->cs);
return ret;
}
static void bbcon_receive(bb_connection_t *con)
{
int ret;
fd_set set;
b32 isServer;
struct timeval tv;
if(con->socket == BB_INVALID_SOCKET)
return;
FD_ZERO(&set);
BB_FD_SET(con->socket, &set);
isServer = (con->flags & kBBCon_Server) != 0;
tv.tv_sec = 0;
tv.tv_usec = (isServer) ? 100 : 0;
ret = select((int)con->socket + 1, &set, 0, 0, &tv);
if(ret != 1) {
if(ret == BB_SOCKET_ERROR) {
int err = BBNET_ERRNO;
BBCON_ERROR("bbcon_receive: disconnected during select with errno %d (%s)", err, bbnet_error_to_string(err));
bbcon_disconnect_no_flush(con);
}
//BBCON_LOG( "select returned %d", ret );
return;
} else {
u32 kRecvBufferSize = sizeof(con->recvBuffer);
u32 nBytesAvailable = kRecvBufferSize - con->recvCursor;
int nBytesReceived = recv(con->socket, (char *)(con->recvBuffer + con->recvCursor), (int)nBytesAvailable, 0);
if(nBytesReceived <= 0) {
if(nBytesAvailable > 0) {
int err = BBNET_ERRNO;
if(err) {
BBCON_ERROR("bbcon_receive: disconnected during recv with errno %d (%s)", err, bbnet_error_to_string(err));
} else {
BBCON_LOG("bbcon_receive: disconnected during recv with errno %d (%s)", err, bbnet_error_to_string(err));
}
bbcon_disconnect_no_flush(con);
}
return;
}
con->receivedBytesTotal += nBytesReceived;
con->recvCursor += nBytesReceived;
//BBCON_LOG( "bbcon_receive nBytesReceived:%d decodeCursor:%d recvCursor:%d", nBytesReceived, con->decodeCursor, con->recvCursor );
}
}
b32 bbcon_decodePacket(bb_connection_t *con, bb_decoded_packet_t *decoded)
{
const u32 kRecvBufferSize = sizeof(con->recvBuffer);
const u32 kHalfRecvBufferBytes = kRecvBufferSize / 2;
b32 valid = false;
if(!con->cs.initialized)
return false;
// #investigate why original impl didn't lock here
bb_critical_section_lock(&con->cs);
if(con->socket != BB_INVALID_SOCKET) {
u16 nDecodableBytes = (u16)(con->recvCursor - con->decodeCursor);
if(nDecodableBytes >= 3) {
u8 *cursor = con->recvBuffer + con->decodeCursor;
u16 nPacketBytes = (u16)((*cursor << 8) + (*(cursor + 1)));
if(nDecodableBytes >= nPacketBytes) {
//BBCON_LOG( "bbcon_decodePacket PRE decodeCursor:%d recvCursor:%d nPacketBytes:%d", con->decodeCursor, con->recvCursor, nPacketBytes );
u8 *buffer = con->recvBuffer + con->decodeCursor;
valid = bbpacket_deserialize(buffer + 2, nPacketBytes - 2U, decoded);
con->decodeCursor += nPacketBytes;
//BBCON_LOG( "bbcon_decodePacket POST decodeCursor:%d recvCursor:%d valid:%d", con->decodeCursor, con->recvCursor, valid );
// TODO: rather lame to keep resetting the buffer - this should be a circular buffer
if(con->decodeCursor >= kHalfRecvBufferBytes) {
u16 nBytesRemaining = (u16)(con->recvCursor - con->decodeCursor);
//BBCON_LOG( "bbcon_decodePacketReset PRE decodeCursor:%d recvCursor:%d", con->decodeCursor, con->recvCursor );
memmove(con->recvBuffer, con->recvBuffer + con->decodeCursor, nBytesRemaining);
con->decodeCursor = 0;
con->recvCursor = nBytesRemaining;
//BBCON_LOG( "bbcon_decodePacketReset POST decodeCursor:%d recvCursor:%d", con->decodeCursor, con->recvCursor );
}
}
}
}
bb_critical_section_unlock(&con->cs);
return valid;
}
void bbcon_tick(bb_connection_t *con)
{
if(con->socket != BB_INVALID_SOCKET && con->cs.initialized) {
bb_critical_section_lock(&con->cs);
u64 now = bb_current_time_ms();
if(now >= con->prevSendTime + con->sendInterval) {
bbcon_flush_no_lock(con, false);
}
bbcon_receive(con);
bb_critical_section_unlock(&con->cs);
}
}
#endif // #if BB_ENABLED
| 29.419214 | 141 | 0.683044 |
79969ec9d1ca8667089e33e567bc6aae16f817b8 | 392 | h | C | benchmarks/lmbench/src/MyEnclave/include/sgx_poll_util.h | shwetasshinde24/Panoply | 9a762c24dec61250d953d1769b070df7f0dd0317 | [
"Apache-2.0"
] | 30 | 2017-02-08T02:53:36.000Z | 2022-03-24T14:26:17.000Z | benchmarks/lmbench/src/MyEnclave/include/sgx_poll_util.h | shwetasshinde24/Panoply | 9a762c24dec61250d953d1769b070df7f0dd0317 | [
"Apache-2.0"
] | 4 | 2017-05-25T00:39:02.000Z | 2018-04-27T10:38:47.000Z | benchmarks/lmbench/src/MyEnclave/include/sgx_poll_util.h | shwetasshinde24/Panoply | 9a762c24dec61250d953d1769b070df7f0dd0317 | [
"Apache-2.0"
] | 8 | 2017-10-31T11:12:35.000Z | 2020-06-15T04:12:51.000Z | /**
* @author ${kekkaishivn} - dattl@ifi.uio.no
*
* ${tags}
*/
#ifndef SGX_POLL_UTIL_H
#define SGX_POLL_UTIL_H
#include <struct/sgx_poll_struct.h>
#include <proxy/sgx_poll_t.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int sgx_wrapper_poll(struct pollfd* fds, unsigned int nfds, int timeout);
#ifdef __cplusplus
}
#endif
#define poll(A, B, C) sgx_wrapper_poll(A, B, C)
#endif
| 15.68 | 80 | 0.711735 |
9596e575c2a4cb20dbdc900521701b23af346ff4 | 7,105 | c | C | src/webfix.c | ericbsd/linuxulator-steam-utils | bbc8313ac450741f5808e18b688fbd5e9d7cbd93 | [
"MIT"
] | 1 | 2020-12-26T04:51:43.000Z | 2020-12-26T04:51:43.000Z | src/webfix.c | ericbsd/linuxulator-steam-utils | bbc8313ac450741f5808e18b688fbd5e9d7cbd93 | [
"MIT"
] | null | null | null | src/webfix.c | ericbsd/linuxulator-steam-utils | bbc8313ac450741f5808e18b688fbd5e9d7cbd93 | [
"MIT"
] | null | null | null | #define _GNU_SOURCE
#include <assert.h>
#include <dlfcn.h>
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
// show CEF version
static int (*orig_cef_initialize)(void*, void*, void*, void*) = NULL;
int cef_initialize(void* args, void* settings, void* application, void* windows_sandbox_info) {
if (!orig_cef_initialize) {
orig_cef_initialize = dlsym(RTLD_NEXT, "cef_initialize");
assert(orig_cef_initialize != NULL);
}
int (*cef_version_info)(int) = dlsym(RTLD_NEXT, "cef_version_info");
assert(cef_version_info != NULL);
int cef_major = cef_version_info(0);
int cef_minor = cef_version_info(1);
int cef_patch = cef_version_info(2);
int cef_commit = cef_version_info(3);
int chrome_major = cef_version_info(4);
int chrome_minor = cef_version_info(5);
int chrome_build = cef_version_info(6);
int chrome_patch = cef_version_info(7);
fprintf(stderr, "[[CEF version = %d.%d.%d.%d, Chrome version = %d.%d.%d.%d]]\n",
cef_major, cef_minor, cef_patch, cef_commit, chrome_major, chrome_minor, chrome_build,chrome_patch);
return orig_cef_initialize(args, settings, application, windows_sandbox_info);
}
#ifndef SKIP_PROC_SELF_TASK_WORKAROUND
// PCHECK(0 == fstat_ret) @ https://cs.chromium.org/chromium/src/sandbox/linux/services/thread_helpers.cc?l=41&rcl=90c6c958243e775074d81e19c204f196d8e76990
// CHECK_LE(3UL, task_stat.st_nlink) @ https://cs.chromium.org/chromium/src/sandbox/linux/services/thread_helpers.cc?l=44&rcl=90c6c958243e775074d81e19c204f196d8e76990
#include <ctype.h>
#include <sys/stat.h>
static int (*libc_close) (int fd) = NULL;
static int (*libc_fxstat64) (int, int, struct stat64*) = NULL;
static int (*libc_fxstatat64)(int, int, const char*, struct stat64*, int) = NULL;
static int (*libc_open64) (const char*, int, ...) = NULL;
static int proc_self_task_fd = -1;
__attribute__((constructor))
static void proc_self_task_workaround_init() {
libc_fxstat64 = dlsym(RTLD_NEXT, "__fxstat64");
libc_fxstatat64 = dlsym(RTLD_NEXT, "__fxstatat64");
libc_close = dlsym(RTLD_NEXT, "close");
libc_open64 = dlsym(RTLD_NEXT, "open64");
proc_self_task_fd = open("/dev/null", O_RDONLY);
}
int __fxstatat64(int ver, int dirfd, const char* path, struct stat64* stat_buf, int flags) {
if (dirfd == proc_self_task_fd) {
assert(isdigit(path[0]));
errno = ENOENT;
return -1;
}
if (strcmp(path, "self/task/") == 0) {
stat_buf->st_nlink = 1 + 2;
return 0;
}
return libc_fxstatat64(ver, dirfd, path, stat_buf, flags);
}
// thread_helpers.cc before https://codereview.chromium.org/914053002
int __fxstat64(int ver, int dirfd, struct stat64* stat_buf) {
if (dirfd == proc_self_task_fd) {
stat_buf->st_nlink = 1 + 2;
return 0;
}
return libc_fxstat64(ver, dirfd, stat_buf);
}
int open64(const char* path, int flags, ...) {
if (strcmp(path, "/proc/self/task/") == 0) {
return proc_self_task_fd;
}
mode_t mode = 0;
if (flags & O_CREAT) {
va_list args;
va_start(args, flags);
mode = va_arg(args, int);
va_end(args);
}
return open(path, flags, mode);
}
int close(int fd) {
// close <- libcef.so`calloc <- libdl.so.2
if (!libc_close) {
return 0;
}
if (fd == proc_self_task_fd) {
return 0;
}
return libc_close(fd);
}
#endif
#ifndef SKIP_CLOCK_GETTIME_WORKAROUND
// CHECK(clock_gettime(clk_id, &ts) == 0) @ https://cs.chromium.org/chromium/src/base/time/time_now_posix.cc?l=52&rcl=b6ad4da425c33a31e4e08b67ce070a0c52082358
#include <time.h>
static int (*libc_clock_gettime)(clockid_t clock_id, struct timespec* tp) = NULL;
int clock_gettime(clockid_t clock_id, struct timespec* tp) {
if (!libc_clock_gettime) {
libc_clock_gettime = dlsym(RTLD_NEXT, "clock_gettime");
}
int err = -1;
// https://github.com/freebsd/freebsd/blob/14aef6dfca96006e52b8fb920bde7c612ba58b79/sys/compat/linux/linux_time.c#L192
switch (clock_id) {
case CLOCK_THREAD_CPUTIME_ID:
err = libc_clock_gettime(-2, tp);
break;
case CLOCK_PROCESS_CPUTIME_ID:
err = libc_clock_gettime(-6, tp);
break;
case CLOCK_MONOTONIC_RAW:
err = libc_clock_gettime(CLOCK_MONOTONIC, tp); // ?
break;
default:
err = libc_clock_gettime(clock_id, tp);
}
/*if (err == -1) {
fprintf(stderr, "%s(%d, %p) -> %d [%s]\n", __func__, clock_id, tp, err, strerror(errno));
}*/
return err;
}
#endif
/* SO_PASSCRED workaround */
#include <execinfo.h>
#include <sys/types.h>
#include <sys/socket.h>
static int (*libc_setsockopt)(int, int, int, const void*, socklen_t) = NULL;
int setsockopt(int s, int level, int optname, const void* optval, socklen_t optlen) {
if (!libc_setsockopt) {
libc_setsockopt = dlsym(RTLD_NEXT, "setsockopt");
}
if (optname == SO_PASSCRED) {
return 0;
}
return libc_setsockopt(s, level, optname, optval, optlen);
}
static struct msghdr* copy_and_add_credentials(struct msghdr* msg) {
struct msghdr* result_msg = malloc(sizeof(struct msghdr));
memcpy(result_msg, msg, sizeof(struct msghdr));
int result_cmsg_len = msg->msg_controllen + CMSG_SPACE(sizeof(struct ucred));
char* result_cmsg = malloc(result_cmsg_len);
memset(result_cmsg, 0, result_cmsg_len);
memcpy(result_cmsg, msg->msg_control, msg->msg_controllen);
result_msg->msg_control = result_cmsg;
result_msg->msg_controllen = result_cmsg_len;
struct cmsghdr* cmsg_in = NULL;
struct cmsghdr* cmsg_out = NULL;
while (true) {
if (!cmsg_in) {
cmsg_in = CMSG_FIRSTHDR(msg);
cmsg_out = CMSG_FIRSTHDR(result_msg);
} else {
cmsg_in = CMSG_NXTHDR(msg, cmsg_in);
cmsg_out = CMSG_NXTHDR(result_msg, cmsg_out);
}
if (cmsg_in != NULL) {
memcpy(cmsg_out, cmsg_in, cmsg_in->cmsg_len);
} else {
cmsg_out->cmsg_len = CMSG_LEN(sizeof(struct ucred));
cmsg_out->cmsg_level = SOL_SOCKET;
cmsg_out->cmsg_type = SCM_CREDENTIALS;
struct ucred* ucred = (struct ucred*)CMSG_DATA(cmsg_out);
ucred->pid = getpid();
ucred->uid = getuid();
ucred->gid = getgid();
break;
}
}
return result_msg;
}
static ssize_t (*libc_sendmsg)(int s, const struct msghdr* msg, int flags) = NULL;
ssize_t sendmsg(int s, const struct msghdr* msg, int flags) {
if (!libc_sendmsg) {
libc_sendmsg = dlsym(RTLD_NEXT, "sendmsg");
}
ssize_t nbytes = -1;
void* buffer[2];
int nframes = backtrace(buffer, 2);
assert(nframes == 2);
char* caller_str = *backtrace_symbols(buffer + 1, 1);
assert(caller_str != NULL);
char* p = strrchr(caller_str, '/');
if (p && strncmp("libcef.so", p + 1, sizeof("libcef.so") - 1) == 0) {
struct msghdr* xmsg = copy_and_add_credentials((struct msghdr*)msg);
nbytes = libc_sendmsg(s, xmsg, flags);
free(xmsg->msg_control);
free(xmsg);
} else {
nbytes = libc_sendmsg(s, msg, flags);
}
return nbytes;
}
| 26.217712 | 166 | 0.673329 |
6698bfc391ab1e858e25d874318890f9957a9277 | 347 | h | C | HMModules/HomeMateModule/HomeMateModule/Classes/HMSDK/HMModels/HMAvgConcentrationMonth.h | kenny2006cen/GYXMPP | fdeaddde91c78b132f747501c09486b7c33ec5d4 | [
"MIT"
] | null | null | null | HMModules/HomeMateModule/HomeMateModule/Classes/HMSDK/HMModels/HMAvgConcentrationMonth.h | kenny2006cen/GYXMPP | fdeaddde91c78b132f747501c09486b7c33ec5d4 | [
"MIT"
] | null | null | null | HMModules/HomeMateModule/HomeMateModule/Classes/HMSDK/HMModels/HMAvgConcentrationMonth.h | kenny2006cen/GYXMPP | fdeaddde91c78b132f747501c09486b7c33ec5d4 | [
"MIT"
] | 1 | 2021-10-10T12:32:01.000Z | 2021-10-10T12:32:01.000Z | //
// HMAvgConcentrationMonth.h
// HomeMate
//
// Created by JQ on 16/8/8.
// Copyright © 2017年 Air. All rights reserved.
//
#import "HMAvgConcentrationBaseModel.h"
@interface HMAvgConcentrationMonth : HMAvgConcentrationBaseModel
@property (nonatomic, copy) NSString *sensorDataMonthId;
@property (nonatomic, copy) NSString *month;
@end
| 18.263158 | 64 | 0.746398 |
9caa4fe95913c672a6b874c5b8b8d573294ae857 | 4,819 | c | C | s2e/source/s2e-linux-kernel/decree-cgc-cfe/arch/arm/mach-kirkwood/board-dt.c | Albocoder/KOOBE | dd8acade05b0185771e1ea9950de03ab5445a981 | [
"MIT"
] | 55 | 2019-12-20T03:25:14.000Z | 2022-01-16T07:19:47.000Z | s2e/source/s2e-linux-kernel/decree-cgc-cfe/arch/arm/mach-kirkwood/board-dt.c | Albocoder/KOOBE | dd8acade05b0185771e1ea9950de03ab5445a981 | [
"MIT"
] | 2 | 2020-11-02T08:01:00.000Z | 2022-03-27T02:59:18.000Z | s2e/source/s2e-linux-kernel/decree-cgc-cfe/arch/arm/mach-kirkwood/board-dt.c | Albocoder/KOOBE | dd8acade05b0185771e1ea9950de03ab5445a981 | [
"MIT"
] | 11 | 2020-08-06T03:59:45.000Z | 2022-02-25T02:31:59.000Z | /*
* Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
*
* arch/arm/mach-kirkwood/board-dt.c
*
* Flattened Device Tree board initialization
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_net.h>
#include <linux/of_platform.h>
#include <linux/clk-provider.h>
#include <linux/dma-mapping.h>
#include <linux/irqchip.h>
#include <linux/kexec.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <mach/bridge-regs.h>
#include <linux/platform_data/usb-ehci-orion.h>
#include <plat/irq.h>
#include <plat/common.h>
#include "common.h"
/*
* There are still devices that doesn't know about DT yet. Get clock
* gates here and add a clock lookup alias, so that old platform
* devices still work.
*/
static void __init kirkwood_legacy_clk_init(void)
{
struct device_node *np = of_find_compatible_node(
NULL, NULL, "marvell,kirkwood-gating-clock");
struct of_phandle_args clkspec;
struct clk *clk;
clkspec.np = np;
clkspec.args_count = 1;
/*
* The ethernet interfaces forget the MAC address assigned by
* u-boot if the clocks are turned off. Until proper DT support
* is available we always enable them for now.
*/
clkspec.args[0] = CGC_BIT_GE0;
clk = of_clk_get_from_provider(&clkspec);
clk_prepare_enable(clk);
clkspec.args[0] = CGC_BIT_GE1;
clk = of_clk_get_from_provider(&clkspec);
clk_prepare_enable(clk);
}
#define MV643XX_ETH_MAC_ADDR_LOW 0x0414
#define MV643XX_ETH_MAC_ADDR_HIGH 0x0418
static void __init kirkwood_dt_eth_fixup(void)
{
struct device_node *np;
/*
* The ethernet interfaces forget the MAC address assigned by u-boot
* if the clocks are turned off. Usually, u-boot on kirkwood boards
* has no DT support to properly set local-mac-address property.
* As a workaround, we get the MAC address from mv643xx_eth registers
* and update the port device node if no valid MAC address is set.
*/
for_each_compatible_node(np, NULL, "marvell,kirkwood-eth-port") {
struct device_node *pnp = of_get_parent(np);
struct clk *clk;
struct property *pmac;
void __iomem *io;
u8 *macaddr;
u32 reg;
if (!pnp)
continue;
/* skip disabled nodes or nodes with valid MAC address*/
if (!of_device_is_available(pnp) || of_get_mac_address(np))
goto eth_fixup_skip;
clk = of_clk_get(pnp, 0);
if (IS_ERR(clk))
goto eth_fixup_skip;
io = of_iomap(pnp, 0);
if (!io)
goto eth_fixup_no_map;
/* ensure port clock is not gated to not hang CPU */
clk_prepare_enable(clk);
/* store MAC address register contents in local-mac-address */
pr_err(FW_INFO "%s: local-mac-address is not set\n",
np->full_name);
pmac = kzalloc(sizeof(*pmac) + 6, GFP_KERNEL);
if (!pmac)
goto eth_fixup_no_mem;
pmac->value = pmac + 1;
pmac->length = 6;
pmac->name = kstrdup("local-mac-address", GFP_KERNEL);
if (!pmac->name) {
kfree(pmac);
goto eth_fixup_no_mem;
}
macaddr = pmac->value;
reg = readl(io + MV643XX_ETH_MAC_ADDR_HIGH);
macaddr[0] = (reg >> 24) & 0xff;
macaddr[1] = (reg >> 16) & 0xff;
macaddr[2] = (reg >> 8) & 0xff;
macaddr[3] = reg & 0xff;
reg = readl(io + MV643XX_ETH_MAC_ADDR_LOW);
macaddr[4] = (reg >> 8) & 0xff;
macaddr[5] = reg & 0xff;
of_update_property(np, pmac);
eth_fixup_no_mem:
iounmap(io);
clk_disable_unprepare(clk);
eth_fixup_no_map:
clk_put(clk);
eth_fixup_skip:
of_node_put(pnp);
}
}
static void __init kirkwood_dt_init(void)
{
pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
/*
* Disable propagation of mbus errors to the CPU local bus,
* as this causes mbus errors (which can occur for example
* for PCI aborts) to throw CPU aborts, which we're not set
* up to deal with.
*/
writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG);
BUG_ON(mvebu_mbus_dt_init());
kirkwood_l2_init();
kirkwood_cpufreq_init();
kirkwood_cpuidle_init();
/* Setup clocks for legacy devices */
kirkwood_legacy_clk_init();
kirkwood_pm_init();
kirkwood_dt_eth_fixup();
#ifdef CONFIG_KEXEC
kexec_reinit = kirkwood_enable_pcie;
#endif
if (of_machine_is_compatible("marvell,mv88f6281gtw-ge"))
mv88f6281gtw_ge_init();
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
}
static const char * const kirkwood_dt_board_compat[] = {
"marvell,kirkwood",
NULL
};
DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
/* Maintainer: Jason Cooper <jason@lakedaemon.net> */
.map_io = kirkwood_map_io,
.init_machine = kirkwood_dt_init,
.restart = kirkwood_restart,
.dt_compat = kirkwood_dt_board_compat,
MACHINE_END
| 25.770053 | 73 | 0.719651 |
ec327cb64a0da679dc836d5fc7f6be3b37c261ee | 10,157 | c | C | linux/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c | bradchesney79/illacceptanything | 4594ae4634fdb5e39263a6423dc255ed46c25208 | [
"MIT"
] | 3 | 2017-09-22T15:10:01.000Z | 2018-03-30T02:11:54.000Z | linux/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c | bradchesney79/illacceptanything | 4594ae4634fdb5e39263a6423dc255ed46c25208 | [
"MIT"
] | null | null | null | linux/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c | bradchesney79/illacceptanything | 4594ae4634fdb5e39263a6423dc255ed46c25208 | [
"MIT"
] | null | null | null | /*
* Copyright 2012 The Nouveau community
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: Martin Peres
*/
#include "priv.h"
#include <core/device.h>
static int
nvkm_therm_update_trip(struct nvkm_therm *therm)
{
struct nvkm_therm_priv *priv = (void *)therm;
struct nvbios_therm_trip_point *trip = priv->fan->bios.trip,
*cur_trip = NULL,
*last_trip = priv->last_trip;
u8 temp = therm->temp_get(therm);
u16 duty, i;
/* look for the trip point corresponding to the current temperature */
cur_trip = NULL;
for (i = 0; i < priv->fan->bios.nr_fan_trip; i++) {
if (temp >= trip[i].temp)
cur_trip = &trip[i];
}
/* account for the hysteresis cycle */
if (last_trip && temp <= (last_trip->temp) &&
temp > (last_trip->temp - last_trip->hysteresis))
cur_trip = last_trip;
if (cur_trip) {
duty = cur_trip->fan_duty;
priv->last_trip = cur_trip;
} else {
duty = 0;
priv->last_trip = NULL;
}
return duty;
}
static int
nvkm_therm_update_linear(struct nvkm_therm *therm)
{
struct nvkm_therm_priv *priv = (void *)therm;
u8 linear_min_temp = priv->fan->bios.linear_min_temp;
u8 linear_max_temp = priv->fan->bios.linear_max_temp;
u8 temp = therm->temp_get(therm);
u16 duty;
/* handle the non-linear part first */
if (temp < linear_min_temp)
return priv->fan->bios.min_duty;
else if (temp > linear_max_temp)
return priv->fan->bios.max_duty;
/* we are in the linear zone */
duty = (temp - linear_min_temp);
duty *= (priv->fan->bios.max_duty - priv->fan->bios.min_duty);
duty /= (linear_max_temp - linear_min_temp);
duty += priv->fan->bios.min_duty;
return duty;
}
static void
nvkm_therm_update(struct nvkm_therm *therm, int mode)
{
struct nvkm_timer *ptimer = nvkm_timer(therm);
struct nvkm_therm_priv *priv = (void *)therm;
unsigned long flags;
bool immd = true;
bool poll = true;
int duty = -1;
spin_lock_irqsave(&priv->lock, flags);
if (mode < 0)
mode = priv->mode;
priv->mode = mode;
switch (mode) {
case NVKM_THERM_CTRL_MANUAL:
ptimer->alarm_cancel(ptimer, &priv->alarm);
duty = nvkm_therm_fan_get(therm);
if (duty < 0)
duty = 100;
poll = false;
break;
case NVKM_THERM_CTRL_AUTO:
switch(priv->fan->bios.fan_mode) {
case NVBIOS_THERM_FAN_TRIP:
duty = nvkm_therm_update_trip(therm);
break;
case NVBIOS_THERM_FAN_LINEAR:
duty = nvkm_therm_update_linear(therm);
break;
case NVBIOS_THERM_FAN_OTHER:
if (priv->cstate)
duty = priv->cstate;
poll = false;
break;
}
immd = false;
break;
case NVKM_THERM_CTRL_NONE:
default:
ptimer->alarm_cancel(ptimer, &priv->alarm);
poll = false;
}
if (list_empty(&priv->alarm.head) && poll)
ptimer->alarm(ptimer, 1000000000ULL, &priv->alarm);
spin_unlock_irqrestore(&priv->lock, flags);
if (duty >= 0) {
nv_debug(therm, "FAN target request: %d%%\n", duty);
nvkm_therm_fan_set(therm, immd, duty);
}
}
int
nvkm_therm_cstate(struct nvkm_therm *ptherm, int fan, int dir)
{
struct nvkm_therm_priv *priv = (void *)ptherm;
if (!dir || (dir < 0 && fan < priv->cstate) ||
(dir > 0 && fan > priv->cstate)) {
nv_debug(ptherm, "default fan speed -> %d%%\n", fan);
priv->cstate = fan;
nvkm_therm_update(ptherm, -1);
}
return 0;
}
static void
nvkm_therm_alarm(struct nvkm_alarm *alarm)
{
struct nvkm_therm_priv *priv =
container_of(alarm, struct nvkm_therm_priv, alarm);
nvkm_therm_update(&priv->base, -1);
}
int
nvkm_therm_fan_mode(struct nvkm_therm *therm, int mode)
{
struct nvkm_therm_priv *priv = (void *)therm;
struct nvkm_device *device = nv_device(therm);
static const char *name[] = {
"disabled",
"manual",
"automatic"
};
/* The default PPWR ucode on fermi interferes with fan management */
if ((mode >= ARRAY_SIZE(name)) ||
(mode != NVKM_THERM_CTRL_NONE && device->card_type >= NV_C0 &&
!nvkm_subdev(device, NVDEV_SUBDEV_PMU)))
return -EINVAL;
/* do not allow automatic fan management if the thermal sensor is
* not available */
if (mode == NVKM_THERM_CTRL_AUTO && therm->temp_get(therm) < 0)
return -EINVAL;
if (priv->mode == mode)
return 0;
nv_info(therm, "fan management: %s\n", name[mode]);
nvkm_therm_update(therm, mode);
return 0;
}
int
nvkm_therm_attr_get(struct nvkm_therm *therm,
enum nvkm_therm_attr_type type)
{
struct nvkm_therm_priv *priv = (void *)therm;
switch (type) {
case NVKM_THERM_ATTR_FAN_MIN_DUTY:
return priv->fan->bios.min_duty;
case NVKM_THERM_ATTR_FAN_MAX_DUTY:
return priv->fan->bios.max_duty;
case NVKM_THERM_ATTR_FAN_MODE:
return priv->mode;
case NVKM_THERM_ATTR_THRS_FAN_BOOST:
return priv->bios_sensor.thrs_fan_boost.temp;
case NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST:
return priv->bios_sensor.thrs_fan_boost.hysteresis;
case NVKM_THERM_ATTR_THRS_DOWN_CLK:
return priv->bios_sensor.thrs_down_clock.temp;
case NVKM_THERM_ATTR_THRS_DOWN_CLK_HYST:
return priv->bios_sensor.thrs_down_clock.hysteresis;
case NVKM_THERM_ATTR_THRS_CRITICAL:
return priv->bios_sensor.thrs_critical.temp;
case NVKM_THERM_ATTR_THRS_CRITICAL_HYST:
return priv->bios_sensor.thrs_critical.hysteresis;
case NVKM_THERM_ATTR_THRS_SHUTDOWN:
return priv->bios_sensor.thrs_shutdown.temp;
case NVKM_THERM_ATTR_THRS_SHUTDOWN_HYST:
return priv->bios_sensor.thrs_shutdown.hysteresis;
}
return -EINVAL;
}
int
nvkm_therm_attr_set(struct nvkm_therm *therm,
enum nvkm_therm_attr_type type, int value)
{
struct nvkm_therm_priv *priv = (void *)therm;
switch (type) {
case NVKM_THERM_ATTR_FAN_MIN_DUTY:
if (value < 0)
value = 0;
if (value > priv->fan->bios.max_duty)
value = priv->fan->bios.max_duty;
priv->fan->bios.min_duty = value;
return 0;
case NVKM_THERM_ATTR_FAN_MAX_DUTY:
if (value < 0)
value = 0;
if (value < priv->fan->bios.min_duty)
value = priv->fan->bios.min_duty;
priv->fan->bios.max_duty = value;
return 0;
case NVKM_THERM_ATTR_FAN_MODE:
return nvkm_therm_fan_mode(therm, value);
case NVKM_THERM_ATTR_THRS_FAN_BOOST:
priv->bios_sensor.thrs_fan_boost.temp = value;
priv->sensor.program_alarms(therm);
return 0;
case NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST:
priv->bios_sensor.thrs_fan_boost.hysteresis = value;
priv->sensor.program_alarms(therm);
return 0;
case NVKM_THERM_ATTR_THRS_DOWN_CLK:
priv->bios_sensor.thrs_down_clock.temp = value;
priv->sensor.program_alarms(therm);
return 0;
case NVKM_THERM_ATTR_THRS_DOWN_CLK_HYST:
priv->bios_sensor.thrs_down_clock.hysteresis = value;
priv->sensor.program_alarms(therm);
return 0;
case NVKM_THERM_ATTR_THRS_CRITICAL:
priv->bios_sensor.thrs_critical.temp = value;
priv->sensor.program_alarms(therm);
return 0;
case NVKM_THERM_ATTR_THRS_CRITICAL_HYST:
priv->bios_sensor.thrs_critical.hysteresis = value;
priv->sensor.program_alarms(therm);
return 0;
case NVKM_THERM_ATTR_THRS_SHUTDOWN:
priv->bios_sensor.thrs_shutdown.temp = value;
priv->sensor.program_alarms(therm);
return 0;
case NVKM_THERM_ATTR_THRS_SHUTDOWN_HYST:
priv->bios_sensor.thrs_shutdown.hysteresis = value;
priv->sensor.program_alarms(therm);
return 0;
}
return -EINVAL;
}
int
_nvkm_therm_init(struct nvkm_object *object)
{
struct nvkm_therm *therm = (void *)object;
struct nvkm_therm_priv *priv = (void *)therm;
int ret;
ret = nvkm_subdev_init(&therm->base);
if (ret)
return ret;
if (priv->suspend >= 0) {
/* restore the pwm value only when on manual or auto mode */
if (priv->suspend > 0)
nvkm_therm_fan_set(therm, true, priv->fan->percent);
nvkm_therm_fan_mode(therm, priv->suspend);
}
nvkm_therm_sensor_init(therm);
nvkm_therm_fan_init(therm);
return 0;
}
int
_nvkm_therm_fini(struct nvkm_object *object, bool suspend)
{
struct nvkm_therm *therm = (void *)object;
struct nvkm_therm_priv *priv = (void *)therm;
nvkm_therm_fan_fini(therm, suspend);
nvkm_therm_sensor_fini(therm, suspend);
if (suspend) {
priv->suspend = priv->mode;
priv->mode = NVKM_THERM_CTRL_NONE;
}
return nvkm_subdev_fini(&therm->base, suspend);
}
int
nvkm_therm_create_(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_oclass *oclass, int length, void **pobject)
{
struct nvkm_therm_priv *priv;
int ret;
ret = nvkm_subdev_create_(parent, engine, oclass, 0, "PTHERM",
"therm", length, pobject);
priv = *pobject;
if (ret)
return ret;
nvkm_alarm_init(&priv->alarm, nvkm_therm_alarm);
spin_lock_init(&priv->lock);
spin_lock_init(&priv->sensor.alarm_program_lock);
priv->base.fan_get = nvkm_therm_fan_user_get;
priv->base.fan_set = nvkm_therm_fan_user_set;
priv->base.fan_sense = nvkm_therm_fan_sense;
priv->base.attr_get = nvkm_therm_attr_get;
priv->base.attr_set = nvkm_therm_attr_set;
priv->mode = priv->suspend = -1; /* undefined */
return 0;
}
int
nvkm_therm_preinit(struct nvkm_therm *therm)
{
nvkm_therm_sensor_ctor(therm);
nvkm_therm_ic_ctor(therm);
nvkm_therm_fan_ctor(therm);
nvkm_therm_fan_mode(therm, NVKM_THERM_CTRL_AUTO);
nvkm_therm_sensor_preinit(therm);
return 0;
}
void
_nvkm_therm_dtor(struct nvkm_object *object)
{
struct nvkm_therm_priv *priv = (void *)object;
kfree(priv->fan);
nvkm_subdev_destroy(&priv->base.base);
}
| 27.600543 | 77 | 0.730235 |
41ec46453b8447f94aa5c96d5c3a552c41e07b56 | 1,547 | h | C | robot/src/fight_with_hair_ui/include/fight_with_hair_ui/cctrldashboard.h | SilenceX12138/ROS-Intelligent-Service-Robot | 9d042940d602fc62d129a05b4f107acb800d24aa | [
"MIT"
] | 60 | 2021-09-07T12:42:48.000Z | 2022-03-12T09:30:36.000Z | robot/src/fight_with_hair_ui/include/fight_with_hair_ui/cctrldashboard.h | SilenceX12138/ROS-Intelligent-Service-Robot | 9d042940d602fc62d129a05b4f107acb800d24aa | [
"MIT"
] | null | null | null | robot/src/fight_with_hair_ui/include/fight_with_hair_ui/cctrldashboard.h | SilenceX12138/ROS-Intelligent-Service-Robot | 9d042940d602fc62d129a05b4f107acb800d24aa | [
"MIT"
] | 1 | 2021-09-14T07:39:48.000Z | 2021-09-14T07:39:48.000Z | #ifndef CCTRLDASHBOARD_H
#define CCTRLDASHBOARD_H
#include <QWidget>
class CCtrlDashBoard : public QWidget
{
Q_OBJECT
public:
enum StyleType {
ST_DEFAULT=0,
ST_ARCBAR
};
explicit CCtrlDashBoard(QWidget *parent = 0, StyleType type=ST_DEFAULT);
void setUnit(int unit){
m_Unit = unit;
update();
}
void setValue(qreal value){
m_DashValue = value + 50;
update();
}
void setBackGroundColor(QColor color){
m_BgColor=color;
update();
}
void setFrontColor(QColor color){
m_FrontColor=color;
update();
}
void setBorderColor(QColor color){
m_BorderColor=color;
update();
}
void setUnitString(QString str){
m_StrUnit=str;
update();
}
void drawBackGround(QPainter *painter, qreal hlafWidth);
void drawScaleDials(QPainter *painter, qreal hlafWidth);
void drawIndicator(QPainter *painter, qreal hlafWidth);
void drawIndicatorBar(QPainter *painter, qreal hlafWidth);
signals:
public slots:
protected:
virtual void paintEvent(QPaintEvent * event);
private:
int m_StartAngle;
int m_EndAngle;
int m_StyleType;
int m_Unit;
qreal m_LineLength;
qreal m_DashValue;
qreal m_MaxValue;
qreal m_MinValue;
qreal m_DashNum;
QColor m_BgColor;
QColor m_FrontColor;
QColor m_BorderColor;
QString m_StrUnit;
qreal m_MaxBorderRadius;
qreal m_MinBorderRadius;
qreal m_DialsRadius;
};
#endif // CCTRLDASHBOARD_H
| 20.626667 | 76 | 0.657401 |
cb3dbfababbb88b793e1c69d9ca44aa5f91acbcd | 2,521 | h | C | src/gbox/core/pixmap/rgb24.h | tboox/gbox | 3dc02fafd6b2a4810788365020a2236c6f59db28 | [
"Apache-2.0"
] | 190 | 2016-12-23T10:43:40.000Z | 2022-03-26T20:26:29.000Z | src/gbox/core/pixmap/rgb24.h | sinmx/gbox | 79c93130fb26cf4fe8ce9f801781415434fd097c | [
"Apache-2.0"
] | 3 | 2018-05-22T14:30:20.000Z | 2021-07-11T12:45:36.000Z | src/gbox/core/pixmap/rgb24.h | sinmx/gbox | 79c93130fb26cf4fe8ce9f801781415434fd097c | [
"Apache-2.0"
] | 28 | 2017-04-07T07:00:53.000Z | 2022-03-01T02:40:04.000Z | /*!The Graphic Box Library
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright (C) 2009 - 2017, TBOOX Open Source Group.
*
* @author ruki
* @file rgb24.h
* @ingroup core
*
*/
#ifndef GB_CORE_PIXMAP_RGB24_H
#define GB_CORE_PIXMAP_RGB24_H
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
*/
#include "prefix.h"
/* //////////////////////////////////////////////////////////////////////////////////////
* implementation
*/
static __tb_inline__ gb_pixel_t gb_pixmap_rgb24_pixel_get_l(tb_cpointer_t data)
{
return tb_bits_get_u24_le(data);
}
static __tb_inline__ gb_pixel_t gb_pixmap_rgb24_pixel_get_b(tb_cpointer_t data)
{
return tb_bits_get_u24_be(data);
}
static __tb_inline__ tb_void_t gb_pixmap_rgb24_pixel_set_lo(tb_pointer_t data, gb_pixel_t pixel, tb_byte_t alpha)
{
tb_bits_set_u24_le(data, pixel);
}
static __tb_inline__ tb_void_t gb_pixmap_rgb24_pixel_set_bo(tb_pointer_t data, gb_pixel_t pixel, tb_byte_t alpha)
{
tb_bits_set_u24_be(data, pixel);
}
static __tb_inline__ tb_void_t gb_pixmap_rgb24_pixel_cpy_o(tb_pointer_t data, tb_cpointer_t source, tb_byte_t alpha)
{
((tb_byte_t*)data)[0] = ((tb_byte_t const*)source)[0];
((tb_byte_t*)data)[1] = ((tb_byte_t const*)source)[1];
((tb_byte_t*)data)[2] = ((tb_byte_t const*)source)[2];
}
static __tb_inline__ tb_void_t gb_pixmap_rgb24_pixels_fill_lo(tb_pointer_t data, gb_pixel_t pixel, tb_size_t count, tb_byte_t alpha)
{
tb_memset_u24(data, tb_bits_ne_to_le_u24(pixel), count);
}
static __tb_inline__ tb_void_t gb_pixmap_rgb24_pixels_fill_bo(tb_pointer_t data, gb_pixel_t pixel, tb_size_t count, tb_byte_t alpha)
{
tb_memset_u24(data, tb_bits_ne_to_be_u24(pixel), count);
}
#endif
| 36.014286 | 132 | 0.709242 |
b3655b20c5576252b67984f14bbd26cddb468e04 | 160 | h | C | MovieManager/MovieDataFetcher/ErrorRepository.h | mdaniyalkhann/SampleTestsCpp | 4601bd9248a879177d96b84353e15c1626b01f6e | [
"MIT"
] | null | null | null | MovieManager/MovieDataFetcher/ErrorRepository.h | mdaniyalkhann/SampleTestsCpp | 4601bd9248a879177d96b84353e15c1626b01f6e | [
"MIT"
] | null | null | null | MovieManager/MovieDataFetcher/ErrorRepository.h | mdaniyalkhann/SampleTestsCpp | 4601bd9248a879177d96b84353e15c1626b01f6e | [
"MIT"
] | null | null | null | #pragma once
#include <string>
class ErrorRepository
{
public:
virtual ~ErrorRepository() = default;
virtual void LogBadMovie(std::string movieName) = 0;
}; | 16 | 53 | 0.74375 |
bee6ab5cf3878a58adcbccac3f9999cd6a5f97a6 | 2,367 | c | C | 2013/programming-practices/hw8.c | medav/nostalgia | 31cb9d8453284dde48dea75c7851199f0569a1ea | [
"MIT"
] | 1 | 2016-08-10T23:25:32.000Z | 2016-08-10T23:25:32.000Z | 2013/programming-practices/hw8.c | medav/nostalgia | 31cb9d8453284dde48dea75c7851199f0569a1ea | [
"MIT"
] | null | null | null | 2013/programming-practices/hw8.c | medav/nostalgia | 31cb9d8453284dde48dea75c7851199f0569a1ea | [
"MIT"
] | null | null | null | /**
* Michael Davies
* mdavies@iastate.edu
* CprE 185 Section E
* Programming Practice 8
*
* Reflection 1:
* I was trying to create a program that would take in some number
* of bytes from the input stream and encrypt them using XOR
* encryption.
*
* Reflection 2:
* I was successful. It isn't the strongest algorithm by any means because
* it essentially is a block cipher with a blocksize of 64 bytes. That and
* the key gen algorithm doesn't do a great job of randomizing the password
* data to create a strong key.
*
* Reflection 3:
* If I were to do this over, I would develop a better key gen
* algorithm. Possibly a standard hashing function to aid in making
* a strong symmetric key.
*
* Reflection 4:
* I learned how to use XOR encryption.
*
* Note on usage:
* To encrypt a file use this:
* ./hw8 password < file > file.enc
*
* To decrypt a file use this:
* ./hw8 password < file.enc
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void printUsage();
void crypt(char * key);
void getSaltedKey(char * password, char ** key);
void printBytes(char * data, int len);
int main(int argc, char * argv[]) {
char * key;
if(argc < 2)
return 0;
getSaltedKey(argv[1], &key);
crypt(key);
free(key);
return 0;
}
void printBytes(char * data, int len) {
int i;
printf("[");
for(i = 0; i < len; i++)
printf("%2x ", data[i]);
printf("]\n");
}
void printUsage() {
printf("Usage for en/decryption:\n");
printf("\t./hw8 <PASSWORD>\n");
}
void crypt(char * key) {
char c, out;
int i = 0;
while(scanf("%c", &c) == 1) {
out = c ^ key[i % 64];
printf("%c", out);
fflush(stdout);
i++;
}
}
void getSaltedKey(char * password, char ** key) {
char salt[] = {0xDE, 0xAD, 0xFA, 0xCE, 0xBE, 0xEF, 0xAA, 0x11,
0xED, 0xAD, 0xAF, 0x1E, 0xBE, 0xE1, 0x0A, 0x11};
(*key) = malloc(64 * sizeof(char));
int rounds = 10000;
int r, i;
char temp;
for(i = 0; i < 64; i++) {
(*key)[i] = password[i % strlen(password)];
}
for(r = 0; r < rounds; r++) {
for(i = 0; i < 64; i++) {
if(i % 2 == 0) {
(*key)[i] -= salt[i % 16];
(*key)[i] = (*key)[i] << 1;
}
else {
(*key)[i] = (*key)[i] >> 1;
(*key)[i] += salt[i % 16];
}
}
temp = (*key)[63];
memcpy((*key) + 1, (*key), 63);
(*key)[0] = temp;
}
}
| 19.561983 | 77 | 0.578369 |
dfdaece91a7f98d5eda12d849cd789b1fefacab4 | 2,719 | h | C | Src/Assist/Map.h | bnagybalint/BoloDemoEngine | 845fc669e0b37bfbffce7aa3d02364d6e715779e | [
"MIT"
] | null | null | null | Src/Assist/Map.h | bnagybalint/BoloDemoEngine | 845fc669e0b37bfbffce7aa3d02364d6e715779e | [
"MIT"
] | null | null | null | Src/Assist/Map.h | bnagybalint/BoloDemoEngine | 845fc669e0b37bfbffce7aa3d02364d6e715779e | [
"MIT"
] | null | null | null | #pragma once
#include "Assist/Common.h"
// TODO eliminate std
#include <map>
#include <utility>
template <class Key, class Value>
class Map
{
public:
Map();
Map(const Map<Key,Value>& other);
~Map();
void add(const Key& key, const Value& val);
bool remove(const Key& key);
void clear();
bool isEmpty();
const Value& operator[] (const Key& key) const;
Value& operator[] (const Key& key);
const Value& get(const Key& key) const;
Value& get(const Key& key);
const Value* find(const Key& key) const;
Value* find(const Key& key);
bool contains(const Key& key) const;
private:
std::map<Key, Value> mValueMap;
};
// TODO create real ObjectDictionary
template <class Key, class Value>
class ObjectMap : public Map<Key, Value> {};
template <class Key, class Value>
Map<Key, Value>::Map()
{
}
template <class Key, class Value>
Map<Key, Value>::Map(const Map<Key, Value>& other)
{
mValueMap.insert(other.mValueMap.begin(), other.mValueMap.end());
}
template <class Key, class Value>
Map<Key, Value>::~Map()
{
}
template <class Key, class Value>
void Map<Key, Value>::add(const Key& key, const Value& val)
{
mValueMap.insert(std::make_pair(key, val));
}
template <class Key, class Value>
bool Map<Key, Value>::remove(const Key& key)
{
Assert(contains(key));
return mValueMap.erase(key) > 0;
}
template <class Key, class Value>
void Map<Key, Value>::clear()
{
mValueMap.clear();
}
template <class Key, class Value>
bool Map<Key, Value>::isEmpty()
{
return mValueMap.empty();
}
template <class Key, class Value>
const Value& Map<Key, Value>::operator[] (const Key& key) const
{
const Value* val = find(key);
Assert(val);
return *val;
}
template <class Key, class Value>
Value& Map<Key, Value>::operator[] (const Key& key)
{
Value* val = find(key);
Assert(val);
return *val;
}
template <class Key, class Value>
const Value& Map<Key, Value>::get(const Key& key) const
{
const Value* val = find(key);
Assert(val);
return *val;
}
template <class Key, class Value>
Value& Map<Key, Value>::get(const Key& key)
{
Value* val = find(key);
Assert(val);
return *val;
}
template <class Key, class Value>
const Value* Map<Key, Value>::find(const Key& key) const
{
std::map<Key,Value>::const_iterator it = mValueMap.find(key);
if (it == mValueMap.end())
return NULL;
return &it->second;
}
template <class Key, class Value>
Value* Map<Key, Value>::find(const Key& key)
{
std::map<Key, Value>::iterator it = mValueMap.find(key);
if (it == mValueMap.end())
return NULL;
return &it->second;
}
template <class Key, class Value>
bool Map<Key,Value>::contains(const Key& key) const
{
std::map<Key, Value>::const_iterator it = mValueMap.find(key);
return it != mValueMap.end();
}
| 18.751724 | 66 | 0.680397 |
7d43078e4b0edccf97db60a7095912d5bf4d43b9 | 258 | c | C | tests/stdlib/mktemp.c | planet-s/relibc | aef7fc3030adc547364775473cd21eb57940c35b | [
"MIT"
] | 750 | 2018-03-02T04:09:57.000Z | 2022-03-28T18:48:50.000Z | tests/stdlib/mktemp.c | planet-s/relibc | aef7fc3030adc547364775473cd21eb57940c35b | [
"MIT"
] | 80 | 2018-03-03T00:18:17.000Z | 2019-06-10T14:32:31.000Z | tests/stdlib/mktemp.c | planet-s/relibc | aef7fc3030adc547364775473cd21eb57940c35b | [
"MIT"
] | 65 | 2018-03-02T13:20:10.000Z | 2022-02-26T11:59:51.000Z | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "test_helpers.h"
int main(void) {
char* string = (char*) calloc(20, sizeof(char));
strcpy(string, "tempXXXXXX");
mktemp(string);
printf("%s\n",string);
free(string);
}
| 18.428571 | 52 | 0.627907 |
6289acb7dd79ae8fb1f0d58a5ca08e45189c2533 | 2,267 | h | C | Modules/CppMicroServices/core/src/module/usModuleResourceContainer_p.h | liu3xing3long/MITK-2016.11 | 385c506f9792414f40337e106e13d5fd61aa3ccc | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | Modules/CppMicroServices/core/src/module/usModuleResourceContainer_p.h | liu3xing3long/MITK-2016.11 | 385c506f9792414f40337e106e13d5fd61aa3ccc | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | Modules/CppMicroServices/core/src/module/usModuleResourceContainer_p.h | liu3xing3long/MITK-2016.11 | 385c506f9792414f40337e106e13d5fd61aa3ccc | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | /*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#ifndef USMODULERESOURCECONTAINER_P_H
#define USMODULERESOURCECONTAINER_P_H
#include "usGlobalConfig.h"
#include "us_stdint.h"
#include <ctime>
#include <string>
#include <vector>
US_BEGIN_NAMESPACE
struct ModuleInfo;
class ModuleResource;
struct ModuleResourceContainerPrivate;
class ModuleResourceContainer
{
public:
ModuleResourceContainer(const ModuleInfo* moduleInfo);
~ModuleResourceContainer();
struct Stat
{
Stat()
: index(-1)
, uncompressedSize(0)
, modifiedTime(0)
, isDir(false)
{}
std::string filePath;
int index;
int uncompressedSize;
time_t modifiedTime;
bool isDir;
};
bool IsValid() const;
bool GetStat(Stat& stat) const;
bool GetStat(int index, Stat& stat) const;
void* GetData(int index) const;
const ModuleInfo* GetModuleInfo() const;
void GetChildren(const std::string& resourcePath, bool relativePaths,
std::vector<std::string>& names, std::vector<uint32_t>& indices) const;
void FindNodes(const std::string& path, const std::string& filePattern,
bool recurse, std::vector<ModuleResource>& resources) const;
private:
bool Matches(const std::string& name, const std::string& filePattern) const;
ModuleResourceContainerPrivate* d;
};
US_END_NAMESPACE
#endif // USMODULERESOURCECONTAINER_P_H
| 25.47191 | 91 | 0.651963 |
13efbb79268a91e1568c13ce9abfc6d748b08b07 | 426 | h | C | clbToolKit/NSObject+ProcessEmjoy.h | jinjinanan/clbToolKit | c1ecb4c7e829a5c4809c22de8aa2f5b656c34d80 | [
"MIT"
] | null | null | null | clbToolKit/NSObject+ProcessEmjoy.h | jinjinanan/clbToolKit | c1ecb4c7e829a5c4809c22de8aa2f5b656c34d80 | [
"MIT"
] | 3 | 2017-11-17T08:57:11.000Z | 2017-12-09T03:40:11.000Z | clbToolKitDemo/Pods/clbToolKit/clbToolKit/NSObject+ProcessEmjoy.h | jinjinanan/clbToolKit | c1ecb4c7e829a5c4809c22de8aa2f5b656c34d80 | [
"MIT"
] | null | null | null | //
// NSObject+ProcessEmjoy.h
// clb
//
// Created by 陈林波 on 16/08/2017.
// Copyright © 2017 陈林波. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSObject (ProcessEmjoy)
//易豪
+(NSString *)getStr:(NSString *)obj;
+(NSString *)getDecimal:(NSString *)obj;
#pragma mark -
// 十进制unicode 转 文字
+(NSString *)getStrByDecimal:(NSString *)str;
//文字转十进制
+(NSString *)getDecimalByStr:(NSString *)str;
@end
| 15.777778 | 46 | 0.683099 |
abfda8c7e05f27c9a10db13dc3cbc2d1c9e621d3 | 285 | h | C | YLCategories/UIKit/UILabel/UILabel+YLAttributed.h | jifengchao/YLCategories | 0c3b7ab5ed475b8e6aea586954afc8bb662506fa | [
"MIT"
] | null | null | null | YLCategories/UIKit/UILabel/UILabel+YLAttributed.h | jifengchao/YLCategories | 0c3b7ab5ed475b8e6aea586954afc8bb662506fa | [
"MIT"
] | null | null | null | YLCategories/UIKit/UILabel/UILabel+YLAttributed.h | jifengchao/YLCategories | 0c3b7ab5ed475b8e6aea586954afc8bb662506fa | [
"MIT"
] | null | null | null | //
// UILabel+YLAttributed.h
// YLCategories
//
// Created by YL on 2020/1/1.
//
#import <UIKit/UIKit.h>
@interface UILabel (YLAttributed)
/* 设置行间距 */
- (void)yl_setLineSpacingWithText:(NSString *)text spacing:(CGFloat)spacing;
- (void)yl_setLineSpacing:(CGFloat)spacing;
@end
| 15.833333 | 76 | 0.705263 |
d88e820993b3af2408878feb7eeeb9ad9b75680a | 7,545 | h | C | libs/quadwild/libs/quadretopology/patterns/patterns/kt84/zenity_util.h | Pentacode-IAFA/Quad-Remeshing | f8fd4c10abf1c54656b38a00b8a698b952a85fe2 | [
"Apache-2.0"
] | null | null | null | libs/quadwild/libs/quadretopology/patterns/patterns/kt84/zenity_util.h | Pentacode-IAFA/Quad-Remeshing | f8fd4c10abf1c54656b38a00b8a698b952a85fe2 | [
"Apache-2.0"
] | null | null | null | libs/quadwild/libs/quadretopology/patterns/patterns/kt84/zenity_util.h | Pentacode-IAFA/Quad-Remeshing | f8fd4c10abf1c54656b38a00b8a698b952a85fe2 | [
"Apache-2.0"
] | null | null | null | #pragma once
#include <cstdio>
#include <sstream>
#include <boost/lexical_cast.hpp>
namespace kt84 {
namespace {
#ifdef _WIN32
inline FILE* popen(const char* command, const char* mode) { return _popen(command, mode); }
inline int pclose(FILE* file) { return _pclose(file); }
#endif
}
namespace zenity_util {
inline int call(std::string& result, const std::string& param) {
std::stringstream command;
command << "zenity " << param;
FILE* p = popen(command.str().c_str(), "r");
const int BUF_SIZE = 4096;
char buf[BUF_SIZE];
buf[0] = 0;
while (fgets(buf, BUF_SIZE, p) != nullptr) {}
// remove '\n' stored at the back of the buffer
int result_len = strlen(buf);
if (result_len > 0) buf[result_len - 1] = 0;
result = buf;
return pclose(p);
}
// text entry
inline bool entry(
std::string& result,
const std::string& title = "",
const std::string& text = "",
const std::string& entry_text = "",
bool hide_text = false)
{
std::stringstream param;
param << "--entry";
if (!title .empty()) param << " --title=\"" << title << "\"";
if (!text .empty()) param << " --text=\"" << text << "\"";
if (!entry_text .empty()) param << " --entry-text=\"" << entry_text << "\"";
if (hide_text) param << " --hide-text";
return call(result, param.str()) == 0;
}
// text entry for non-string type via boost::lexical_cast
template <typename T>
inline bool entryT(
T& result,
const std::string& title = "",
const std::string& text = "",
const T& init_value = T(),
bool hide_text = false)
{
std::stringstream param;
param << "--entry";
if (!title .empty()) param << " --title=\"" << title << "\"";
if (!text .empty()) param << " --text=\"" << text << "\"";
if (hide_text) param << " --hide-text";
std::string entry_text = boost::lexical_cast<std::string>(init_value);
param << " --entry-text=\"" << entry_text << "\"";
std::string result_str;
if (call(result_str, param.str()))
return false;
try {
result = boost::lexical_cast<T>(result_str);
} catch (const boost::bad_lexical_cast&) {
return false;
}
return true;
}
// dialog box with OK button only
enum class MsgBoxType {
Error,
Warning,
Info,
};
inline void msgbox(
MsgBoxType type,
const std::string& title = "",
const std::string& text = "",
bool no_wrap = false)
{
std::string result;
std::stringstream param;
param << "--" << (type == MsgBoxType::Error ? "error" : type == MsgBoxType::Warning ? "warning" : "info");
if (!title.empty()) param << " --title=\"" << title << "\"";
if (!text .empty()) param << " --text=\"" << text << "\"";
if (no_wrap) param << " --no-wrap";
call(result, param.str());
}
// dialog box with OK/Cancel buttons
inline bool question(
const std::string& title = "",
const std::string& text = "",
const std::string& ok_label = "",
const std::string& cancel_label = "",
bool no_wrap = false)
{
std::string result;
std::stringstream param;
param << "--question";
if (!title .empty()) param << " --title=\"" << title << "\"";
if (!text .empty()) param << " --text=\"" << text << "\"";
if (!ok_label .empty()) param << " --ok-label=\"" << ok_label << "\"";
if (!cancel_label.empty()) param << " --cancel-label=\"" << cancel_label << "\"";
if (no_wrap) param << " --no-wrap";
return call(result, param.str()) == 0;
}
// file selection
inline bool file_selection_load(
std::string& result,
const std::string& title = "",
const std::string& filename = "",
const std::string& file_filter = "",
bool directory = false,
bool multiple = false,
char separator = 0)
{
std::stringstream param;
param << "--file-selection";
if (!title .empty()) param << " --title=\"" << title << "\"";
if (!filename .empty()) param << " --filename=\"" << filename << "\"";
if (!file_filter.empty()) param << " --file-filter=\"" << file_filter << "\"";
if (directory) param << " --directory";
if (multiple ) param << " --multiple";
if (separator) param << " --separator=" << separator;
return call(result, param.str()) == 0;
}
inline bool file_selection_save(
std::string& result,
const std::string& title = "",
const std::string& filename = "",
const std::string& file_filter = "",
bool confirm_overwrite = true ,
bool directory = false,
bool multiple = false,
char separator = 0)
{
std::stringstream param;
param << "--file-selection --save";
if (!title .empty()) param << " --title=\"" << title << "\"";
if (!filename .empty()) param << " --filename=\"" << filename << "\"";
if (!file_filter.empty()) param << " --file-filter=\"" << file_filter << "\"";
if (confirm_overwrite) param << " --confirm-overwrite";
if (directory ) param << " --directory";
if (multiple ) param << " --multiple";
if (separator) param << " --separator=" << separator;
return call(result, param.str()) == 0;
}
// scale bar
inline bool scale(
int& result,
const std::string& title = "",
const std::string& text = "",
int value = 0,
int min_value = 0,
int max_value = 100,
int step = 1,
bool hide_value = false)
{
std::string result_str;
std::stringstream param;
param << "--scale";
if (!title.empty()) param << " --title=\"" << title << "\"";
if (!text .empty()) param << " --text=\"" << text << "\"";
param << " --value=" << value ;
param << " --min-value=" << min_value;
param << " --max-value=" << max_value;
param << " --step=" << step ;
if (hide_value) param << " --hide-value";
if (call(result_str, param.str()))
return false;
result = boost::lexical_cast<int>(result_str);
return true;
}
// reporting with text box
inline void text_info(
std::string& result,
const std::string& title = "",
const std::string& filename = "",
bool editable = false)
{
/// TODO
}
//--calendar
//--list
//--notification
//--progress
}
}
| 33.834081 | 115 | 0.457787 |
d897869bf8505440dc8da9f9725deab671f17bc4 | 2,542 | h | C | include/java/nio/CharSequenceAdapter.h | iFindTA/PBJ2Objc | 014bd0f99b129cb094ee35e472802fd38c5c0f87 | [
"MIT"
] | null | null | null | include/java/nio/CharSequenceAdapter.h | iFindTA/PBJ2Objc | 014bd0f99b129cb094ee35e472802fd38c5c0f87 | [
"MIT"
] | null | null | null | include/java/nio/CharSequenceAdapter.h | iFindTA/PBJ2Objc | 014bd0f99b129cb094ee35e472802fd38c5c0f87 | [
"MIT"
] | null | null | null | //
// Generated by the J2ObjC translator. DO NOT EDIT!
// source: android/libcore/luni/src/main/java/java/nio/CharSequenceAdapter.java
//
#ifndef _JavaNioCharSequenceAdapter_H_
#define _JavaNioCharSequenceAdapter_H_
#include "J2ObjC_header.h"
#include "java/nio/CharBuffer.h"
@class IOSCharArray;
@class JavaNioByteOrder;
@protocol JavaLangCharSequence;
@interface JavaNioCharSequenceAdapter : JavaNioCharBuffer {
@public
id<JavaLangCharSequence> sequence_;
}
#pragma mark Public
- (JavaNioCharBuffer *)asReadOnlyBuffer;
- (JavaNioCharBuffer *)compact;
- (JavaNioCharBuffer *)duplicate;
- (jchar)get;
- (JavaNioCharBuffer *)getWithCharArray:(IOSCharArray *)dst
withInt:(jint)dstOffset
withInt:(jint)charCount;
- (jchar)getWithInt:(jint)index;
- (jboolean)isDirect;
- (jboolean)isReadOnly;
- (JavaNioByteOrder *)order;
- (JavaNioCharBuffer *)putWithChar:(jchar)c;
- (JavaNioCharBuffer *)putWithCharArray:(IOSCharArray *)src
withInt:(jint)srcOffset
withInt:(jint)charCount;
- (JavaNioCharBuffer *)putWithInt:(jint)index
withChar:(jchar)c;
- (JavaNioCharBuffer *)putWithNSString:(NSString *)src
withInt:(jint)start
withInt:(jint)end;
- (JavaNioCharBuffer *)slice;
- (JavaNioCharBuffer *)subSequenceFrom:(jint)start
to:(jint)end;
#pragma mark Package-Private
- (instancetype)initWithJavaLangCharSequence:(id<JavaLangCharSequence>)chseq;
+ (JavaNioCharSequenceAdapter *)copy__WithJavaNioCharSequenceAdapter:(JavaNioCharSequenceAdapter *)other OBJC_METHOD_FAMILY_NONE;
- (IOSCharArray *)protectedArray;
- (jint)protectedArrayOffset;
- (jboolean)protectedHasArray;
@end
J2OBJC_EMPTY_STATIC_INIT(JavaNioCharSequenceAdapter)
J2OBJC_FIELD_SETTER(JavaNioCharSequenceAdapter, sequence_, id<JavaLangCharSequence>)
FOUNDATION_EXPORT JavaNioCharSequenceAdapter *JavaNioCharSequenceAdapter_copy__WithJavaNioCharSequenceAdapter_(JavaNioCharSequenceAdapter *other);
FOUNDATION_EXPORT void JavaNioCharSequenceAdapter_initWithJavaLangCharSequence_(JavaNioCharSequenceAdapter *self, id<JavaLangCharSequence> chseq);
FOUNDATION_EXPORT JavaNioCharSequenceAdapter *new_JavaNioCharSequenceAdapter_initWithJavaLangCharSequence_(id<JavaLangCharSequence> chseq) NS_RETURNS_RETAINED;
J2OBJC_TYPE_LITERAL_HEADER(JavaNioCharSequenceAdapter)
#endif // _JavaNioCharSequenceAdapter_H_
| 28.886364 | 159 | 0.742329 |
9e80b37d8dc18bcb230b74ef73ab6091e244bcef | 899 | h | C | src/ai/boss/ballos.h | sodomon2/Cavestory-nx | a65ce948c820b3c60b5a5252e5baba6b918d9ebd | [
"BSD-2-Clause"
] | 8 | 2018-04-03T23:06:33.000Z | 2021-12-28T18:04:19.000Z | src/ai/boss/ballos.h | sodomon2/Cavestory-nx | a65ce948c820b3c60b5a5252e5baba6b918d9ebd | [
"BSD-2-Clause"
] | null | null | null | src/ai/boss/ballos.h | sodomon2/Cavestory-nx | a65ce948c820b3c60b5a5252e5baba6b918d9ebd | [
"BSD-2-Clause"
] | 1 | 2020-07-31T00:23:27.000Z | 2020-07-31T00:23:27.000Z |
#ifndef _BALLOS_H
#define _BALLOS_H
#include "../../object.h"
#include "../../stageboss.h"
#define NUM_EYES 2
enum TRIGDIR { LESS_THAN=0, GREATER_THAN=1 };
class BallosBoss : public StageBoss
{
public:
void OnMapEntry();
void Run();
void RunAftermove();
private:
void RunForm1(Object *o);
void RunForm2(Object *o);
void RunForm3(Object *o);
void RunComeDown(Object *o);
void RunDefeated(Object *o);
void run_eye(int index);
void place_eye(int index);
void SetEyeStates(int newstate);
bool passed_xcoord(bool ltgt, int xcoord, bool reset=false);
bool passed_ycoord(bool ltgt, int ycoord, bool reset=false);
Object *main;
Object *body;
Object *eye[NUM_EYES];
Object *shield; // top shield to cover eyes from above
};
void ondeath_ballos(Object *o);
void ai_ballos_rotator(Object *o);
void aftermove_ballos_rotator(Object *o);
void ai_ballos_platform(Object *o);
#endif
| 20.431818 | 61 | 0.727475 |
fa0f6c92ab190830dee2808b818e81163d2595ac | 13,021 | h | C | src/ptpd.h | DomChey/ptpd | 0380cbfb430eae947ca88474f7dec24c8b3f38a6 | [
"BSD-2-Clause"
] | 1 | 2016-12-07T07:25:24.000Z | 2016-12-07T07:25:24.000Z | src/ptpd.h | DomChey/ptpd | 0380cbfb430eae947ca88474f7dec24c8b3f38a6 | [
"BSD-2-Clause"
] | null | null | null | src/ptpd.h | DomChey/ptpd | 0380cbfb430eae947ca88474f7dec24c8b3f38a6 | [
"BSD-2-Clause"
] | null | null | null | /**
* @file ptpd.h
* @mainpage Ptpd v2 Documentation
* @authors Martin Burnicki, Alexandre van Kempen, Steven Kreuzer,
* George Neville-Neil
* @version 2.0
* @date Fri Aug 27 10:22:19 2010
*
* @section implementation Implementation
* PTTdV2 is not a full implementation of 1588 - 2008 standard.
* It is implemented only with use of Transparent Clock and Peer delay
* mechanism, according to 802.1AS requierements.
*
* This header file includes all others headers.
* It defines functions which are not dependant of the operating system.
*/
#ifndef PTPD_H_
#define PTPD_H_
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif /* HAVE_CONFIG_H */
#ifdef linux
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif /* _GNU_SOURCE */
#endif /* linux */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
#include <errno.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <time.h>
#include <limits.h>
#include <netdb.h>
#include <sys/time.h>
#include <sys/resource.h>
#ifdef HAVE_SYS_TIMEX_H
#include <sys/timex.h>
#endif
#include <sys/socket.h>
#include <sys/select.h>
#include <sys/ioctl.h>
#include <sys/param.h>
#include <arpa/inet.h>
#include <stdarg.h>
#include <syslog.h>
#include <limits.h>
#include <getopt.h>
#include <ctype.h>
#include <glob.h>
#include <stddef.h>
#include <stdint.h>
#ifdef HAVE_UTMPX_H
#include <utmpx.h>
#else
#ifdef HAVE_UTMP_H
#include <utmp.h>
#endif /* HAVE_UTMP_H */
#endif /* HAVE_UTMPX_H */
#ifdef HAVE_NET_ETHERNET_H
#include <net/ethernet.h>
#endif /* HAVE_NET_ETHERNET_H */
#include <netinet/in.h>
#ifdef HAVE_NETINET_IN_SYSTM_H
#include <netinet/in_systm.h>
#endif
#include <netinet/ip.h>
#include <netinet/udp.h>
#ifdef HAVE_NETINET_ETHER_H
#include <netinet/ether.h>
#endif /* HAVE_NETINET_ETHER_H */
#ifdef HAVE_NET_IF_ARP_H
#include <net/if_arp.h>
#endif /* HAVE_NET_IF_ARP_H*/
#ifdef HAVE_NET_IF_H
#include <net/if.h>
#endif /* HAVE_NET_IF_H*/
#ifdef HAVE_NETINET_IF_ETHER_H
#include <netinet/if_ether.h>
#endif /* HAVE_NETINET_IF_ETHER_H */
#ifdef PTPD_PCAP
#ifdef HAVE_PCAP_PCAP_H
#include <pcap/pcap.h>
#else
/* Cases like RHEL5 and others where only pcap.h exists */
#ifdef HAVE_PCAP_H
#include <pcap.h>
#endif /* HAVE_PCAP_H */
#endif
#endif
#if defined(linux) && defined(HAVE_SCHED_H)
#include <sched.h>
#endif /* linux && HAVE_SCHED_H */
#ifdef HAVE_SYS_CPUSET_H
#include <sys/cpuset.h>
#endif /* HAVE_SYS_CPUSET_H */
#include "constants.h"
#include "limits.h"
#include "dep/ipv4_acl.h"
#include "dep/constants_dep.h"
#include "dep/datatypes_dep.h"
#ifdef PTPD_NTPDC
#include "dep/ntpengine/ntpdcontrol.h"
#include "dep/ntpengine/ntp_isc_md5.h"
#endif /* PTPDC_NTPDC */
#include "datatypes.h"
#ifdef PTPD_STATISTICS
#include "dep/statistics.h"
#endif
#include "dep/ptpd_dep.h"
#include "dep/iniparser/dictionary.h"
#include "dep/iniparser/iniparser.h"
#include "dep/daemonconfig.h"
/* NOTE: this macro can be refactored into a function */
#define XMALLOC(ptr,size) \
if(!((ptr)=malloc(size))) { \
PERROR("failed to allocate memory"); \
ptpdShutdown(ptpClock); \
exit(1); \
}
#define IS_SET(data, bitpos) \
((data & ( 0x1 << bitpos )) == (0x1 << bitpos))
#define SET_FIELD(data, bitpos) \
data << bitpos
#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))
#ifdef HAVE_LINUX_RTC_H
#include <linux/rtc.h>
#endif /* HAVE_LINUX_RTC_H */
/** \name arith.c
* -Timing management and arithmetic*/
/**\{*/
/* arith.c */
/**
* \brief Convert Integer64 into TimeInternal structure
*/
void integer64_to_internalTime(Integer64,TimeInternal*);
/**
* \brief Convert TimeInternal structure to Integer64
*/
void internalTime_to_integer64(TimeInternal, Integer64*);
/**
* \brief Convert TimeInternal into Timestamp structure (defined by the spec)
*/
void fromInternalTime(const TimeInternal*,Timestamp*);
/**
* \brief Convert Timestamp to TimeInternal structure (defined by the spec)
*/
void toInternalTime(TimeInternal*, const Timestamp*);
void ts_to_InternalTime(const struct timespec *, TimeInternal *);
void tv_to_InternalTime(const struct timeval *, TimeInternal *);
/**
* \brief Use to normalize a TimeInternal structure
*
* The nanosecondsField member must always be less than 10⁹
* This function is used after adding or substracting TimeInternal
*/
void normalizeTime(TimeInternal*);
/**
* \brief Add two InternalTime structure and normalize
*/
void addTime(TimeInternal*,const TimeInternal*,const TimeInternal*);
/**
* \brief Substract two InternalTime structure and normalize
*/
void subTime(TimeInternal*,const TimeInternal*,const TimeInternal*);
/** \}*/
/**
* \brief Divied an InternalTime by 2
*/
void div2Time(TimeInternal *);
/** \name bmc.c
* -Best Master Clock Algorithm functions*/
/**\{*/
/* bmc.c */
/**
* \brief Compare data set of foreign masters and local data set
* \return The recommended state for the port
*/
UInteger8 bmc(ForeignMasterRecord*, const RunTimeOpts*,PtpClock*);
/**
* \brief When recommended state is Master, copy local data into parent and grandmaster dataset
*/
void m1(const RunTimeOpts *, PtpClock*);
/**
* \brief When recommended state is Slave, copy dataset of master into parent and grandmaster dataset
*/
void s1(MsgHeader*,MsgAnnounce*,PtpClock*, const RunTimeOpts *);
void p1(PtpClock *ptpClock, const RunTimeOpts *rtOpts);
/**
* \brief Initialize datas
*/
void initData(RunTimeOpts*,PtpClock*);
/** \}*/
/** \name protocol.c
* -Execute the protocol engine*/
/**\{*/
/**
* \brief Protocol engine
*/
/* protocol.c */
void protocol(RunTimeOpts*,PtpClock*);
/** \}*/
/** \name management.c
* -Management message support*/
/**\{*/
/* management.c */
/**
* \brief Management message support
*/
void handleMMNullManagement(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMClockDescription(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMSlaveOnly(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMUserDescription(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMSaveInNonVolatileStorage(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMResetNonVolatileStorage(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMInitialize(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMDefaultDataSet(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMCurrentDataSet(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMParentDataSet(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMTimePropertiesDataSet(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMPortDataSet(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMPriority1(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMPriority2(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMDomain(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMLogAnnounceInterval(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMAnnounceReceiptTimeout(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMLogSyncInterval(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMVersionNumber(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMEnablePort(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMDisablePort(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMTime(MsgManagement*, MsgManagement*, PtpClock*, RunTimeOpts*);
void handleMMClockAccuracy(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMUtcProperties(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMTraceabilityProperties(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMDelayMechanism(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMLogMinPdelayReqInterval(MsgManagement*, MsgManagement*, PtpClock*);
void handleMMErrorStatus(MsgManagement*);
void handleErrorManagementMessage(MsgManagement *incoming, MsgManagement *outgoing,
PtpClock *ptpClock, Enumeration16 mgmtId,
Enumeration16 errorId);
/** \}*/
/*
* \brief Packing and Unpacking macros
*/
#define DECLARE_PACK( type ) void pack##type( void*, void* );
DECLARE_PACK( NibbleUpper )
DECLARE_PACK( Enumeration4Lower )
DECLARE_PACK( UInteger4Lower )
DECLARE_PACK( UInteger16 )
DECLARE_PACK( UInteger8 )
DECLARE_PACK( Octet )
DECLARE_PACK( Integer8 )
DECLARE_PACK( UInteger48 )
DECLARE_PACK( Integer64 )
#define DECLARE_UNPACK( type ) void unpack##type( void*, void*, PtpClock *ptpClock );
DECLARE_UNPACK( Boolean )
DECLARE_UNPACK( Enumeration4Lower )
DECLARE_UNPACK( Octet )
DECLARE_UNPACK( UInteger48 )
DECLARE_UNPACK( Integer64 )
//Diplay functions usefull to debug
void displayRunTimeOpts(const RunTimeOpts*);
void displayDefault (const PtpClock*);
void displayCurrent (const PtpClock*);
void displayParent (const PtpClock*);
void displayGlobal (const PtpClock*);
void displayPort (const PtpClock*);
void displayForeignMaster (const PtpClock*);
void displayOthers (const PtpClock*);
void displayBuffer (const PtpClock*);
void displayPtpClock (const PtpClock*);
void timeInternal_display(const TimeInternal*);
void clockIdentity_display(const ClockIdentity);
void netPath_display(const NetPath*);
void intervalTimer_display(const IntervalTimer*);
void integer64_display (const Integer64*);
void timeInterval_display(const TimeInterval*);
void portIdentity_display(const PortIdentity*);
void clockQuality_display (const ClockQuality*);
void PTPText_display(const PTPText*, const PtpClock*);
void iFaceName_display(const Octet*);
void unicast_display(const Octet*);
const char *portState_getName(Enumeration8 portState);
void timestamp_display(const Timestamp * timestamp);
void displayCounters(const PtpClock*);
void displayStatistics(const PtpClock*);
void clearCounters(PtpClock *);
void msgHeader_display(const MsgHeader*);
void msgAnnounce_display(const MsgAnnounce*);
void msgSync_display(const MsgSync *sync);
void msgFollowUp_display(const MsgFollowUp*);
void msgPDelayReq_display(const MsgPDelayReq*);
void msgDelayReq_display(const MsgDelayReq * req);
void msgDelayResp_display(const MsgDelayResp * resp);
void msgPDelayResp_display(const MsgPDelayResp * presp);
void msgPDelayRespFollowUp_display(const MsgPDelayRespFollowUp * prespfollow);
void msgManagement_display(const MsgManagement * manage);
void mMSlaveOnly_display(const MMSlaveOnly*, const PtpClock*);
void mMClockDescription_display(const MMClockDescription*, const PtpClock*);
void mMUserDescription_display(const MMUserDescription*, const PtpClock*);
void mMInitialize_display(const MMInitialize*, const PtpClock*);
void mMDefaultDataSet_display(const MMDefaultDataSet*, const PtpClock*);
void mMCurrentDataSet_display(const MMCurrentDataSet*, const PtpClock*);
void mMParentDataSet_display(const MMParentDataSet*, const PtpClock*);
void mMTimePropertiesDataSet_display(const MMTimePropertiesDataSet*, const PtpClock*);
void mMPortDataSet_display(const MMPortDataSet*, const PtpClock*);
void mMPriority1_display(const MMPriority1*, const PtpClock*);
void mMPriority2_display(const MMPriority2*, const PtpClock*);
void mMDomain_display(const MMDomain*, const PtpClock*);
void mMLogAnnounceInterval_display(const MMLogAnnounceInterval*, const PtpClock*);
void mMAnnounceReceiptTimeout_display(const MMAnnounceReceiptTimeout*, const PtpClock*);
void mMLogSyncInterval_display(const MMLogSyncInterval*, const PtpClock*);
void mMVersionNumber_display(const MMVersionNumber*, const PtpClock*);
void mMTime_display(const MMTime*, const PtpClock*);
void mMClockAccuracy_display(const MMClockAccuracy*, const PtpClock*);
void mMUtcProperties_display(const MMUtcProperties*, const PtpClock*);
void mMTraceabilityProperties_display(const MMTraceabilityProperties*, const PtpClock*);
void mMDelayMechanism_display(const MMDelayMechanism*, const PtpClock*);
void mMLogMinPdelayReqInterval_display(const MMLogMinPdelayReqInterval*, const PtpClock*);
void mMErrorStatus_display(const MMErrorStatus*, const PtpClock*);
void clearTime(TimeInternal *time);
char *dump_TimeInternal(const TimeInternal * p);
char *dump_TimeInternal2(const char *st1, const TimeInternal * p1, const char *st2, const TimeInternal * p2);
int snprint_TimeInternal(char *s, int max_len, const TimeInternal * p);
void nano_to_Time(TimeInternal *time, int nano);
int gtTime(const TimeInternal *x, const TimeInternal *b);
void absTime(TimeInternal *time);
int is_Time_close(const TimeInternal *x, const TimeInternal *b, int nanos);
int isTimeInternalNegative(const TimeInternal * p);
double timeInternalToDouble(const TimeInternal * p);
TimeInternal doubleToTimeInternal(const double d);
int check_timestamp_is_fresh2(const TimeInternal * timeA, const TimeInternal * timeB);
int check_timestamp_is_fresh(const TimeInternal * timeA);
void toState(UInteger8,RunTimeOpts*,PtpClock*);
/* helper functions for leap second handling */
float secondsToMidnight(void);
float getPauseAfterMidnight(Integer8 announceInterval);
Boolean respectUtcOffset(RunTimeOpts * rtOpts, PtpClock * ptpClock);
#endif /*PTPD_H_*/
| 31.681265 | 109 | 0.770832 |
fa16724bfd4d594273c9b36c97697aac80c72fe2 | 366 | h | C | shared/source/gen12lp/hw_info.h | troels/compute-runtime | 3269e719a3ee7bcd97c50ec2cfe78fc8674adec0 | [
"Intel",
"MIT"
] | 778 | 2017-09-29T20:02:43.000Z | 2022-03-31T15:35:28.000Z | shared/source/gen12lp/hw_info.h | troels/compute-runtime | 3269e719a3ee7bcd97c50ec2cfe78fc8674adec0 | [
"Intel",
"MIT"
] | 478 | 2018-01-26T16:06:45.000Z | 2022-03-30T10:19:10.000Z | shared/source/gen12lp/hw_info.h | troels/compute-runtime | 3269e719a3ee7bcd97c50ec2cfe78fc8674adec0 | [
"Intel",
"MIT"
] | 215 | 2018-01-30T08:39:32.000Z | 2022-03-29T11:08:51.000Z | /*
* Copyright (C) 2019-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#ifdef SUPPORT_TGLLP
#include "hw_info_tgllp.h"
#endif
#ifdef SUPPORT_DG1
#include "hw_info_dg1.h"
#endif
#ifdef SUPPORT_RKL
#include "hw_info_rkl.h"
#endif
#ifdef SUPPORT_ADLS
#include "hw_info_adls.h"
#endif
#ifdef SUPPORT_ADLP
#include "hw_info_adlp.h"
#endif | 15.913043 | 44 | 0.754098 |
fa4915fba66f30974a4df9dd808d6fcd669f3150 | 50,305 | c | C | crypto/external/bsd/netpgp/dist/src/lib/netpgp.c | calmsacibis995/minix | dfba95598f553b6560131d35a76658f1f8c9cf38 | [
"Unlicense"
] | 34 | 2015-02-04T18:03:14.000Z | 2020-11-10T06:45:28.000Z | crypto/external/bsd/netpgp/dist/src/lib/netpgp.c | calmsacibis995/minix | dfba95598f553b6560131d35a76658f1f8c9cf38 | [
"Unlicense"
] | 5 | 2015-06-30T21:17:00.000Z | 2016-06-14T22:31:51.000Z | crypto/external/bsd/netpgp/dist/src/lib/netpgp.c | calmsacibis995/minix | dfba95598f553b6560131d35a76658f1f8c9cf38 | [
"Unlicense"
] | 15 | 2015-10-29T14:21:58.000Z | 2022-01-19T07:33:14.000Z | /*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Alistair Crooks (agc@NetBSD.org)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
#include "config.h"
#ifdef HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
#if defined(__NetBSD__)
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
__RCSID("$NetBSD: netpgp.c,v 1.96 2012/02/22 06:58:54 agc Exp $");
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/mman.h>
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <errno.h>
#include <regex.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <errno.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#include <netpgp.h>
#include "packet.h"
#include "packet-parse.h"
#include "keyring.h"
#include "errors.h"
#include "packet-show.h"
#include "create.h"
#include "netpgpsdk.h"
#include "memory.h"
#include "validate.h"
#include "readerwriter.h"
#include "netpgpdefs.h"
#include "crypto.h"
#include "ssh2pgp.h"
#include "defs.h"
/* read any gpg config file */
static int
conffile(netpgp_t *netpgp, char *homedir, char *userid, size_t length)
{
regmatch_t matchv[10];
regex_t keyre;
char buf[BUFSIZ];
FILE *fp;
__PGP_USED(netpgp);
(void) snprintf(buf, sizeof(buf), "%s/gpg.conf", homedir);
if ((fp = fopen(buf, "r")) == NULL) {
return 0;
}
(void) memset(&keyre, 0x0, sizeof(keyre));
(void) regcomp(&keyre, "^[ \t]*default-key[ \t]+([0-9a-zA-F]+)",
REG_EXTENDED);
while (fgets(buf, (int)sizeof(buf), fp) != NULL) {
if (regexec(&keyre, buf, 10, matchv, 0) == 0) {
(void) memcpy(userid, &buf[(int)matchv[1].rm_so],
MIN((unsigned)(matchv[1].rm_eo -
matchv[1].rm_so), length));
if (netpgp->passfp == NULL) {
(void) fprintf(stderr,
"netpgp: default key set to \"%.*s\"\n",
(int)(matchv[1].rm_eo - matchv[1].rm_so),
&buf[(int)matchv[1].rm_so]);
}
}
}
(void) fclose(fp);
regfree(&keyre);
return 1;
}
/* small function to pretty print an 8-character raw userid */
static char *
userid_to_id(const uint8_t *userid, char *id)
{
static const char *hexes = "0123456789abcdef";
int i;
for (i = 0; i < 8 ; i++) {
id[i * 2] = hexes[(unsigned)(userid[i] & 0xf0) >> 4];
id[(i * 2) + 1] = hexes[userid[i] & 0xf];
}
id[8 * 2] = 0x0;
return id;
}
/* print out the successful signature information */
static void
resultp(pgp_io_t *io,
const char *f,
pgp_validation_t *res,
pgp_keyring_t *ring)
{
const pgp_key_t *key;
pgp_pubkey_t *sigkey;
unsigned from;
unsigned i;
time_t t;
char id[MAX_ID_LENGTH + 1];
for (i = 0; i < res->validc; i++) {
(void) fprintf(io->res,
"Good signature for %s made %s",
(f) ? f : "<stdin>",
ctime(&res->valid_sigs[i].birthtime));
if (res->duration > 0) {
t = res->birthtime + res->duration;
(void) fprintf(io->res, "Valid until %s", ctime(&t));
}
(void) fprintf(io->res,
"using %s key %s\n",
pgp_show_pka(res->valid_sigs[i].key_alg),
userid_to_id(res->valid_sigs[i].signer_id, id));
from = 0;
key = pgp_getkeybyid(io, ring,
(const uint8_t *) res->valid_sigs[i].signer_id,
&from, &sigkey);
if (sigkey == &key->enckey) {
(void) fprintf(io->res,
"WARNING: signature for %s made with encryption key\n",
(f) ? f : "<stdin>");
}
pgp_print_keydata(io, ring, key, "signature ", &key->key.pubkey, 0);
}
}
/* check there's enough space in the arrays */
static int
size_arrays(netpgp_t *netpgp, unsigned needed)
{
char **temp;
if (netpgp->size == 0) {
/* only get here first time around */
netpgp->size = needed;
if ((netpgp->name = calloc(sizeof(char *), needed)) == NULL) {
(void) fprintf(stderr, "size_arrays: bad alloc\n");
return 0;
}
if ((netpgp->value = calloc(sizeof(char *), needed)) == NULL) {
free(netpgp->name);
(void) fprintf(stderr, "size_arrays: bad alloc\n");
return 0;
}
} else if (netpgp->c == netpgp->size) {
/* only uses 'needed' when filled array */
netpgp->size += needed;
temp = realloc(netpgp->name, sizeof(char *) * needed);
if (temp == NULL) {
(void) fprintf(stderr, "size_arrays: bad alloc\n");
return 0;
}
netpgp->name = temp;
temp = realloc(netpgp->value, sizeof(char *) * needed);
if (temp == NULL) {
(void) fprintf(stderr, "size_arrays: bad alloc\n");
return 0;
}
netpgp->value = temp;
}
return 1;
}
/* find the name in the array */
static int
findvar(netpgp_t *netpgp, const char *name)
{
unsigned i;
for (i = 0 ; i < netpgp->c && strcmp(netpgp->name[i], name) != 0; i++) {
}
return (i == netpgp->c) ? -1 : (int)i;
}
/* read a keyring and return it */
static void *
readkeyring(netpgp_t *netpgp, const char *name)
{
pgp_keyring_t *keyring;
const unsigned noarmor = 0;
char f[MAXPATHLEN];
char *filename;
char *homedir;
homedir = netpgp_getvar(netpgp, "homedir");
if ((filename = netpgp_getvar(netpgp, name)) == NULL) {
(void) snprintf(f, sizeof(f), "%s/%s.gpg", homedir, name);
filename = f;
}
if ((keyring = calloc(1, sizeof(*keyring))) == NULL) {
(void) fprintf(stderr, "readkeyring: bad alloc\n");
return NULL;
}
if (!pgp_keyring_fileread(keyring, noarmor, filename)) {
free(keyring);
(void) fprintf(stderr, "Can't read %s %s\n", name, filename);
return NULL;
}
netpgp_setvar(netpgp, name, filename);
return keyring;
}
/* read keys from ssh key files */
static int
readsshkeys(netpgp_t *netpgp, char *homedir, const char *needseckey)
{
pgp_keyring_t *pubring;
pgp_keyring_t *secring;
struct stat st;
unsigned hashtype;
char *hash;
char f[MAXPATHLEN];
char *filename;
if ((filename = netpgp_getvar(netpgp, "sshkeyfile")) == NULL) {
/* set reasonable default for RSA key */
(void) snprintf(f, sizeof(f), "%s/id_rsa.pub", homedir);
filename = f;
} else if (strcmp(&filename[strlen(filename) - 4], ".pub") != 0) {
/* got ssh keys, check for pub file name */
(void) snprintf(f, sizeof(f), "%s.pub", filename);
filename = f;
}
/* check the pub file exists */
if (stat(filename, &st) != 0) {
(void) fprintf(stderr, "readsshkeys: bad pubkey filename '%s'\n", filename);
return 0;
}
if ((pubring = calloc(1, sizeof(*pubring))) == NULL) {
(void) fprintf(stderr, "readsshkeys: bad alloc\n");
return 0;
}
/* openssh2 keys use md5 by default */
hashtype = PGP_HASH_MD5;
if ((hash = netpgp_getvar(netpgp, "hash")) != NULL) {
/* openssh 2 hasn't really caught up to anything else yet */
if (netpgp_strcasecmp(hash, "md5") == 0) {
hashtype = PGP_HASH_MD5;
} else if (netpgp_strcasecmp(hash, "sha1") == 0) {
hashtype = PGP_HASH_SHA1;
} else if (netpgp_strcasecmp(hash, "sha256") == 0) {
hashtype = PGP_HASH_SHA256;
}
}
if (!pgp_ssh2_readkeys(netpgp->io, pubring, NULL, filename, NULL, hashtype)) {
free(pubring);
(void) fprintf(stderr, "readsshkeys: can't read %s\n",
filename);
return 0;
}
if (netpgp->pubring == NULL) {
netpgp->pubring = pubring;
} else {
pgp_append_keyring(netpgp->pubring, pubring);
}
if (needseckey) {
netpgp_setvar(netpgp, "sshpubfile", filename);
/* try to take the ".pub" off the end */
if (filename == f) {
f[strlen(f) - 4] = 0x0;
} else {
(void) snprintf(f, sizeof(f), "%.*s",
(int)strlen(filename) - 4, filename);
filename = f;
}
if ((secring = calloc(1, sizeof(*secring))) == NULL) {
free(pubring);
(void) fprintf(stderr, "readsshkeys: bad alloc\n");
return 0;
}
if (!pgp_ssh2_readkeys(netpgp->io, pubring, secring, NULL, filename, hashtype)) {
free(pubring);
free(secring);
(void) fprintf(stderr, "readsshkeys: can't read sec %s\n", filename);
return 0;
}
netpgp->secring = secring;
netpgp_setvar(netpgp, "sshsecfile", filename);
}
return 1;
}
/* get the uid of the first key in the keyring */
static int
get_first_ring(pgp_keyring_t *ring, char *id, size_t len, int last)
{
uint8_t *src;
int i;
int n;
if (ring == NULL) {
return 0;
}
(void) memset(id, 0x0, len);
src = ring->keys[(last) ? ring->keyc - 1 : 0].sigid;
for (i = 0, n = 0 ; i < PGP_KEY_ID_SIZE ; i += 2) {
n += snprintf(&id[n], len - n, "%02x%02x", src[i], src[i + 1]);
}
id[n] = 0x0;
return 1;
}
/* find the time - in a specific %Y-%m-%d format - using a regexp */
static int
grabdate(char *s, int64_t *t)
{
static regex_t r;
static int compiled;
regmatch_t matches[10];
struct tm tm;
if (!compiled) {
compiled = 1;
(void) regcomp(&r, "([0-9][0-9][0-9][0-9])[-/]([0-9][0-9])[-/]([0-9][0-9])", REG_EXTENDED);
}
if (regexec(&r, s, 10, matches, 0) == 0) {
(void) memset(&tm, 0x0, sizeof(tm));
tm.tm_year = (int)strtol(&s[(int)matches[1].rm_so], NULL, 10);
tm.tm_mon = (int)strtol(&s[(int)matches[2].rm_so], NULL, 10) - 1;
tm.tm_mday = (int)strtol(&s[(int)matches[3].rm_so], NULL, 10);
*t = mktime(&tm);
return 1;
}
return 0;
}
/* get expiration in seconds */
static uint64_t
get_duration(char *s)
{
uint64_t now;
int64_t t;
char *mult;
if (s == NULL) {
return 0;
}
now = (uint64_t)strtoull(s, NULL, 10);
if ((mult = strchr("hdwmy", s[strlen(s) - 1])) != NULL) {
switch(*mult) {
case 'h':
return now * 60 * 60;
case 'd':
return now * 60 * 60 * 24;
case 'w':
return now * 60 * 60 * 24 * 7;
case 'm':
return now * 60 * 60 * 24 * 31;
case 'y':
return now * 60 * 60 * 24 * 365;
}
}
if (grabdate(s, &t)) {
return t;
}
return (uint64_t)strtoll(s, NULL, 10);
}
/* get birthtime in seconds */
static int64_t
get_birthtime(char *s)
{
int64_t t;
if (s == NULL) {
return time(NULL);
}
if (grabdate(s, &t)) {
return t;
}
return (uint64_t)strtoll(s, NULL, 10);
}
/* resolve the userid */
static const pgp_key_t *
resolve_userid(netpgp_t *netpgp, const pgp_keyring_t *keyring, const char *userid)
{
const pgp_key_t *key;
pgp_io_t *io;
if (userid == NULL) {
userid = netpgp_getvar(netpgp, "userid");
if (userid == NULL)
return NULL;
} else if (userid[0] == '0' && userid[1] == 'x') {
userid += 2;
}
io = netpgp->io;
if ((key = pgp_getkeybyname(io, keyring, userid)) == NULL) {
(void) fprintf(io->errs, "Can't find key '%s'\n", userid);
}
return key;
}
/* append a key to a keyring */
static int
appendkey(pgp_io_t *io, pgp_key_t *key, char *ringfile)
{
pgp_output_t *create;
const unsigned noarmor = 0;
int fd;
if ((fd = pgp_setup_file_append(&create, ringfile)) < 0) {
fd = pgp_setup_file_write(&create, ringfile, 0);
}
if (fd < 0) {
(void) fprintf(io->errs, "can't open pubring '%s'\n", ringfile);
return 0;
}
if (!pgp_write_xfer_pubkey(create, key, noarmor)) {
(void) fprintf(io->errs, "Cannot write pubkey\n");
return 0;
}
pgp_teardown_file_write(create, fd);
return 1;
}
/* return 1 if the file contains ascii-armoured text */
static unsigned
isarmoured(pgp_io_t *io, const char *f, const void *memory, const char *text)
{
regmatch_t matches[10];
unsigned armoured;
regex_t r;
FILE *fp;
char buf[BUFSIZ];
armoured = 0;
(void) regcomp(&r, text, REG_EXTENDED);
if (f) {
if ((fp = fopen(f, "r")) == NULL) {
(void) fprintf(io->errs, "isarmoured: can't open '%s'\n", f);
regfree(&r);
return 0;
}
if (fgets(buf, (int)sizeof(buf), fp) != NULL) {
if (regexec(&r, buf, 10, matches, 0) == 0) {
armoured = 1;
}
}
(void) fclose(fp);
} else {
if (regexec(&r, memory, 10, matches, 0) == 0) {
armoured = 1;
}
}
regfree(&r);
return armoured;
}
/* vararg print function */
static void
p(FILE *fp, const char *s, ...)
{
va_list args;
va_start(args, s);
while (s != NULL) {
(void) fprintf(fp, "%s", s);
s = va_arg(args, char *);
}
va_end(args);
}
/* print a JSON object to the FILE stream */
static void
pobj(FILE *fp, mj_t *obj, int depth)
{
unsigned i;
char *s;
if (obj == NULL) {
(void) fprintf(stderr, "No object found\n");
return;
}
for (i = 0 ; i < (unsigned)depth ; i++) {
p(fp, " ", NULL);
}
switch(obj->type) {
case MJ_NULL:
case MJ_FALSE:
case MJ_TRUE:
p(fp, (obj->type == MJ_NULL) ? "null" : (obj->type == MJ_FALSE) ? "false" : "true", NULL);
break;
case MJ_NUMBER:
p(fp, obj->value.s, NULL);
break;
case MJ_STRING:
if ((i = mj_asprint(&s, obj, MJ_HUMAN)) > 2) {
(void) fprintf(fp, "%.*s", (int)i - 2, &s[1]);
free(s);
}
break;
case MJ_ARRAY:
for (i = 0 ; i < obj->c ; i++) {
pobj(fp, &obj->value.v[i], depth + 1);
if (i < obj->c - 1) {
(void) fprintf(fp, ", ");
}
}
(void) fprintf(fp, "\n");
break;
case MJ_OBJECT:
for (i = 0 ; i < obj->c ; i += 2) {
pobj(fp, &obj->value.v[i], depth + 1);
p(fp, ": ", NULL);
pobj(fp, &obj->value.v[i + 1], 0);
if (i < obj->c - 1) {
p(fp, ", ", NULL);
}
}
p(fp, "\n", NULL);
break;
default:
break;
}
}
/* return the time as a string */
static char *
ptimestr(char *dest, size_t size, time_t t)
{
struct tm *tm;
tm = gmtime(&t);
(void) snprintf(dest, size, "%04d-%02d-%02d",
tm->tm_year + 1900,
tm->tm_mon + 1,
tm->tm_mday);
return dest;
}
/* format a JSON object */
static void
format_json_key(FILE *fp, mj_t *obj, const int psigs)
{
int64_t birthtime;
int64_t duration;
time_t now;
char tbuf[32];
char *s;
mj_t *sub;
int i;
if (pgp_get_debug_level(__FILE__)) {
mj_asprint(&s, obj, MJ_HUMAN);
(void) fprintf(stderr, "formatobj: json is '%s'\n", s);
free(s);
}
if (obj->c == 2 && obj->value.v[1].type == MJ_STRING &&
strcmp(obj->value.v[1].value.s, "[REVOKED]") == 0) {
/* whole key has been rovoked - just return */
return;
}
pobj(fp, &obj->value.v[mj_object_find(obj, "header", 0, 2) + 1], 0);
p(fp, " ", NULL);
pobj(fp, &obj->value.v[mj_object_find(obj, "key bits", 0, 2) + 1], 0);
p(fp, "/", NULL);
pobj(fp, &obj->value.v[mj_object_find(obj, "pka", 0, 2) + 1], 0);
p(fp, " ", NULL);
pobj(fp, &obj->value.v[mj_object_find(obj, "key id", 0, 2) + 1], 0);
birthtime = (int64_t)strtoll(obj->value.v[mj_object_find(obj, "birthtime", 0, 2) + 1].value.s, NULL, 10);
p(fp, " ", ptimestr(tbuf, sizeof(tbuf), birthtime), NULL);
duration = (int64_t)strtoll(obj->value.v[mj_object_find(obj, "duration", 0, 2) + 1].value.s, NULL, 10);
if (duration > 0) {
now = time(NULL);
p(fp, " ", (birthtime + duration < now) ? "[EXPIRED " : "[EXPIRES ",
ptimestr(tbuf, sizeof(tbuf), birthtime + duration), "]", NULL);
}
p(fp, "\n", "Key fingerprint: ", NULL);
pobj(fp, &obj->value.v[mj_object_find(obj, "fingerprint", 0, 2) + 1], 0);
p(fp, "\n", NULL);
/* go to field after \"duration\" */
for (i = mj_object_find(obj, "duration", 0, 2) + 2; i < mj_arraycount(obj) ; i += 2) {
if (strcmp(obj->value.v[i].value.s, "uid") == 0) {
sub = &obj->value.v[i + 1];
p(fp, "uid", NULL);
pobj(fp, &sub->value.v[0], (psigs) ? 4 : 14); /* human name */
pobj(fp, &sub->value.v[1], 1); /* any revocation */
p(fp, "\n", NULL);
} else if (strcmp(obj->value.v[i].value.s, "encryption") == 0) {
sub = &obj->value.v[i + 1];
p(fp, "encryption", NULL);
pobj(fp, &sub->value.v[0], 1); /* size */
p(fp, "/", NULL);
pobj(fp, &sub->value.v[1], 0); /* alg */
p(fp, " ", NULL);
pobj(fp, &sub->value.v[2], 0); /* id */
p(fp, " ", ptimestr(tbuf, sizeof(tbuf),
(time_t)strtoll(sub->value.v[3].value.s, NULL, 10)),
"\n", NULL);
} else if (strcmp(obj->value.v[i].value.s, "sig") == 0) {
sub = &obj->value.v[i + 1];
p(fp, "sig", NULL);
pobj(fp, &sub->value.v[0], 8); /* size */
p(fp, " ", ptimestr(tbuf, sizeof(tbuf),
(time_t)strtoll(sub->value.v[1].value.s, NULL, 10)),
" ", NULL); /* time */
pobj(fp, &sub->value.v[2], 0); /* human name */
p(fp, "\n", NULL);
} else {
fprintf(stderr, "weird '%s'\n", obj->value.v[i].value.s);
pobj(fp, &obj->value.v[i], 0); /* human name */
}
}
p(fp, "\n", NULL);
}
/* save a pgp pubkey to a temp file */
static int
savepubkey(char *res, char *f, size_t size)
{
size_t len;
int cc;
int wc;
int fd;
(void) snprintf(f, size, "/tmp/pgp2ssh.XXXXXXX");
if ((fd = mkstemp(f)) < 0) {
(void) fprintf(stderr, "can't create temp file '%s'\n", f);
return 0;
}
len = strlen(res);
for (cc = 0 ; (wc = (int)write(fd, &res[cc], len - (size_t)cc)) > 0 ; cc += wc) {
}
(void) close(fd);
return 1;
}
/* format a uint32_t */
static int
formatu32(uint8_t *buffer, uint32_t value)
{
buffer[0] = (uint8_t)(value >> 24) & 0xff;
buffer[1] = (uint8_t)(value >> 16) & 0xff;
buffer[2] = (uint8_t)(value >> 8) & 0xff;
buffer[3] = (uint8_t)value & 0xff;
return sizeof(uint32_t);
}
/* format a string as (len, string) */
static int
formatstring(char *buffer, const uint8_t *s, size_t len)
{
int cc;
cc = formatu32((uint8_t *)buffer, (uint32_t)len);
(void) memcpy(&buffer[cc], s, len);
return cc + (int)len;
}
/* format a bignum, checking for "interesting" high bit values */
static int
formatbignum(char *buffer, BIGNUM *bn)
{
size_t len;
uint8_t *cp;
int cc;
len = (size_t) BN_num_bytes(bn);
if ((cp = calloc(1, len + 1)) == NULL) {
(void) fprintf(stderr, "calloc failure in formatbignum\n");
return 0;
}
(void) BN_bn2bin(bn, cp + 1);
cp[0] = 0x0;
cc = (cp[1] & 0x80) ? formatstring(buffer, cp, len + 1) : formatstring(buffer, &cp[1], len);
free(cp);
return cc;
}
#define MAX_PASSPHRASE_ATTEMPTS 3
#define INFINITE_ATTEMPTS -1
/* get the passphrase from the user */
static int
find_passphrase(FILE *passfp, const char *id, char *passphrase, size_t size, int attempts)
{
char prompt[BUFSIZ];
char buf[128];
char *cp;
int cc;
int i;
if (passfp) {
if (fgets(passphrase, (int)size, passfp) == NULL) {
return 0;
}
return (int)strlen(passphrase);
}
for (i = 0 ; i < attempts ; i++) {
(void) snprintf(prompt, sizeof(prompt), "Enter passphrase for %.16s: ", id);
if ((cp = getpass(prompt)) == NULL) {
break;
}
cc = snprintf(buf, sizeof(buf), "%s", cp);
(void) snprintf(prompt, sizeof(prompt), "Repeat passphrase for %.16s: ", id);
if ((cp = getpass(prompt)) == NULL) {
break;
}
cc = snprintf(passphrase, size, "%s", cp);
if (strcmp(buf, passphrase) == 0) {
(void) memset(buf, 0x0, sizeof(buf));
return cc;
}
}
(void) memset(buf, 0x0, sizeof(buf));
(void) memset(passphrase, 0x0, size);
return 0;
}
/***************************************************************************/
/* exported functions start here */
/***************************************************************************/
/* initialise a netpgp_t structure */
int
netpgp_init(netpgp_t *netpgp)
{
pgp_io_t *io;
time_t t;
char id[MAX_ID_LENGTH];
char *homedir;
char *userid;
char *stream;
char *passfd;
char *results;
int coredumps;
int last;
#ifdef HAVE_SYS_RESOURCE_H
struct rlimit limit;
coredumps = netpgp_getvar(netpgp, "coredumps") != NULL;
if (!coredumps) {
(void) memset(&limit, 0x0, sizeof(limit));
if (setrlimit(RLIMIT_CORE, &limit) != 0) {
(void) fprintf(stderr,
"netpgp: warning - can't turn off core dumps\n");
coredumps = 1;
}
}
#else
coredumps = 1;
#endif
if ((io = calloc(1, sizeof(*io))) == NULL) {
(void) fprintf(stderr, "netpgp_init: bad alloc\n");
return 0;
}
io->outs = stdout;
if ((stream = netpgp_getvar(netpgp, "outs")) != NULL &&
strcmp(stream, "<stderr>") == 0) {
io->outs = stderr;
}
io->errs = stderr;
if ((stream = netpgp_getvar(netpgp, "errs")) != NULL &&
strcmp(stream, "<stdout>") == 0) {
io->errs = stdout;
}
if ((results = netpgp_getvar(netpgp, "res")) == NULL) {
io->res = io->errs;
} else if (strcmp(results, "<stdout>") == 0) {
io->res = stdout;
} else if (strcmp(results, "<stderr>") == 0) {
io->res = stderr;
} else {
if ((io->res = fopen(results, "w")) == NULL) {
(void) fprintf(io->errs, "Can't open results %s for writing\n",
results);
free(io);
return 0;
}
}
netpgp->io = io;
/* get passphrase from an fd */
if ((passfd = netpgp_getvar(netpgp, "pass-fd")) != NULL &&
(netpgp->passfp = fdopen(atoi(passfd), "r")) == NULL) {
(void) fprintf(io->errs, "Can't open fd %s for reading\n",
passfd);
return 0;
}
/* warn if core dumps are enabled */
if (coredumps) {
(void) fprintf(io->errs,
"netpgp: warning: core dumps enabled\n");
}
/* get home directory - where keyrings are in a subdir */
if ((homedir = netpgp_getvar(netpgp, "homedir")) == NULL) {
(void) fprintf(io->errs, "netpgp: bad homedir\n");
return 0;
}
if (netpgp_getvar(netpgp, "ssh keys") == NULL) {
/* read from ordinary pgp keyrings */
netpgp->pubring = readkeyring(netpgp, "pubring");
if (netpgp->pubring == NULL) {
(void) fprintf(io->errs, "Can't read pub keyring\n");
return 0;
}
/* if a userid has been given, we'll use it */
if ((userid = netpgp_getvar(netpgp, "userid")) == NULL) {
/* also search in config file for default id */
(void) memset(id, 0x0, sizeof(id));
(void) conffile(netpgp, homedir, id, sizeof(id));
if (id[0] != 0x0) {
netpgp_setvar(netpgp, "userid", userid = id);
}
}
/* only read secret keys if we need to */
if (netpgp_getvar(netpgp, "need seckey")) {
/* read the secret ring */
netpgp->secring = readkeyring(netpgp, "secring");
if (netpgp->secring == NULL) {
(void) fprintf(io->errs, "Can't read sec keyring\n");
return 0;
}
/* now, if we don't have a valid user, use the first in secring */
if (!userid && netpgp_getvar(netpgp, "need userid") != NULL) {
/* signing - need userid and sec key */
(void) memset(id, 0x0, sizeof(id));
if (get_first_ring(netpgp->secring, id, sizeof(id), 0)) {
netpgp_setvar(netpgp, "userid", userid = id);
}
}
} else if (netpgp_getvar(netpgp, "need userid") != NULL) {
/* encrypting - get first in pubring */
if (!userid && get_first_ring(netpgp->pubring, id, sizeof(id), 0)) {
(void) netpgp_setvar(netpgp, "userid", userid = id);
}
}
if (!userid && netpgp_getvar(netpgp, "need userid")) {
/* if we don't have a user id, and we need one, fail */
(void) fprintf(io->errs, "Cannot find user id\n");
return 0;
}
} else {
/* read from ssh keys */
last = (netpgp->pubring != NULL);
if (!readsshkeys(netpgp, homedir, netpgp_getvar(netpgp, "need seckey"))) {
(void) fprintf(io->errs, "Can't read ssh keys\n");
return 0;
}
if ((userid = netpgp_getvar(netpgp, "userid")) == NULL) {
get_first_ring(netpgp->pubring, id, sizeof(id), last);
netpgp_setvar(netpgp, "userid", userid = id);
}
if (userid == NULL) {
if (netpgp_getvar(netpgp, "need userid") != NULL) {
(void) fprintf(io->errs,
"Cannot find user id\n");
return 0;
}
} else {
(void) netpgp_setvar(netpgp, "userid", userid);
}
}
t = time(NULL);
netpgp_setvar(netpgp, "initialised", ctime(&t));
return 1;
}
/* finish off with the netpgp_t struct */
int
netpgp_end(netpgp_t *netpgp)
{
unsigned i;
for (i = 0 ; i < netpgp->c ; i++) {
if (netpgp->name[i] != NULL) {
free(netpgp->name[i]);
}
if (netpgp->value[i] != NULL) {
free(netpgp->value[i]);
}
}
if (netpgp->name != NULL) {
free(netpgp->name);
}
if (netpgp->value != NULL) {
free(netpgp->value);
}
if (netpgp->pubring != NULL) {
pgp_keyring_free(netpgp->pubring);
}
if (netpgp->secring != NULL) {
pgp_keyring_free(netpgp->secring);
}
free(netpgp->io);
return 1;
}
/* list the keys in a keyring */
int
netpgp_list_keys(netpgp_t *netpgp, const int psigs)
{
if (netpgp->pubring == NULL) {
(void) fprintf(stderr, "No keyring\n");
return 0;
}
return pgp_keyring_list(netpgp->io, netpgp->pubring, psigs);
}
/* list the keys in a keyring, returning a JSON encoded string */
int
netpgp_list_keys_json(netpgp_t *netpgp, char **json, const int psigs)
{
mj_t obj;
int ret;
if (netpgp->pubring == NULL) {
(void) fprintf(stderr, "No keyring\n");
return 0;
}
(void) memset(&obj, 0x0, sizeof(obj));
if (!pgp_keyring_json(netpgp->io, netpgp->pubring, &obj, psigs)) {
(void) fprintf(stderr, "No keys in keyring\n");
return 0;
}
ret = mj_asprint(json, &obj, MJ_JSON_ENCODE);
mj_delete(&obj);
return ret;
}
DEFINE_ARRAY(strings_t, char *);
#ifndef HKP_VERSION
#define HKP_VERSION 1
#endif
/* find and list some keys in a keyring */
int
netpgp_match_keys(netpgp_t *netpgp, char *name, const char *fmt, void *vp, const int psigs)
{
const pgp_key_t *key;
unsigned k;
strings_t pubs;
FILE *fp = (FILE *)vp;
if (name[0] == '0' && name[1] == 'x') {
name += 2;
}
(void) memset(&pubs, 0x0, sizeof(pubs));
k = 0;
do {
key = pgp_getnextkeybyname(netpgp->io, netpgp->pubring,
name, &k);
if (key != NULL) {
ALLOC(char *, pubs.v, pubs.size, pubs.c, 10, 10,
"netpgp_match_keys", return 0);
if (strcmp(fmt, "mr") == 0) {
pgp_hkp_sprint_keydata(netpgp->io, netpgp->pubring,
key, &pubs.v[pubs.c],
&key->key.pubkey, psigs);
} else {
pgp_sprint_keydata(netpgp->io, netpgp->pubring,
key, &pubs.v[pubs.c],
"signature ",
&key->key.pubkey, psigs);
}
if (pubs.v[pubs.c] != NULL) {
pubs.c += 1;
}
k += 1;
}
} while (key != NULL);
if (strcmp(fmt, "mr") == 0) {
(void) fprintf(fp, "info:%d:%d\n", HKP_VERSION, pubs.c);
} else {
(void) fprintf(fp, "%d key%s found\n", pubs.c,
(pubs.c == 1) ? "" : "s");
}
for (k = 0 ; k < pubs.c ; k++) {
(void) fprintf(fp, "%s%s", pubs.v[k], (k < pubs.c - 1) ? "\n" : "");
free(pubs.v[k]);
}
free(pubs.v);
return pubs.c;
}
/* find and list some keys in a keyring - return JSON string */
int
netpgp_match_keys_json(netpgp_t *netpgp, char **json, char *name, const char *fmt, const int psigs)
{
const pgp_key_t *key;
unsigned k;
mj_t id_array;
char *newkey;
int ret;
if (name[0] == '0' && name[1] == 'x') {
name += 2;
}
(void) memset(&id_array, 0x0, sizeof(id_array));
k = 0;
*json = NULL;
mj_create(&id_array, "array");
do {
key = pgp_getnextkeybyname(netpgp->io, netpgp->pubring,
name, &k);
if (key != NULL) {
if (strcmp(fmt, "mr") == 0) {
pgp_hkp_sprint_keydata(netpgp->io, netpgp->pubring,
key, &newkey,
&key->key.pubkey, 0);
if (newkey) {
printf("%s\n", newkey);
free(newkey);
}
} else {
ALLOC(mj_t, id_array.value.v, id_array.size,
id_array.c, 10, 10, "netpgp_match_keys_json", return 0);
pgp_sprint_mj(netpgp->io, netpgp->pubring,
key, &id_array.value.v[id_array.c++],
"signature ",
&key->key.pubkey, psigs);
}
k += 1;
}
} while (key != NULL);
ret = mj_asprint(json, &id_array, MJ_JSON_ENCODE);
mj_delete(&id_array);
return ret;
}
/* find and list some public keys in a keyring */
int
netpgp_match_pubkeys(netpgp_t *netpgp, char *name, void *vp)
{
const pgp_key_t *key;
unsigned k;
ssize_t cc;
char out[1024 * 64];
FILE *fp = (FILE *)vp;
k = 0;
do {
key = pgp_getnextkeybyname(netpgp->io, netpgp->pubring,
name, &k);
if (key != NULL) {
cc = pgp_sprint_pubkey(key, out, sizeof(out));
(void) fprintf(fp, "%.*s", (int)cc, out);
k += 1;
}
} while (key != NULL);
return k;
}
/* find a key in a keyring */
int
netpgp_find_key(netpgp_t *netpgp, char *id)
{
pgp_io_t *io;
io = netpgp->io;
if (id == NULL) {
(void) fprintf(io->errs, "NULL id to search for\n");
return 0;
}
return pgp_getkeybyname(netpgp->io, netpgp->pubring, id) != NULL;
}
/* get a key in a keyring */
char *
netpgp_get_key(netpgp_t *netpgp, const char *name, const char *fmt)
{
const pgp_key_t *key;
char *newkey;
if ((key = resolve_userid(netpgp, netpgp->pubring, name)) == NULL) {
return NULL;
}
if (strcmp(fmt, "mr") == 0) {
return (pgp_hkp_sprint_keydata(netpgp->io, netpgp->pubring,
key, &newkey,
&key->key.pubkey,
netpgp_getvar(netpgp, "subkey sigs") != NULL) > 0) ? newkey : NULL;
}
return (pgp_sprint_keydata(netpgp->io, netpgp->pubring,
key, &newkey, "signature",
&key->key.pubkey,
netpgp_getvar(netpgp, "subkey sigs") != NULL) > 0) ? newkey : NULL;
}
/* export a given key */
char *
netpgp_export_key(netpgp_t *netpgp, char *name)
{
const pgp_key_t *key;
pgp_io_t *io;
io = netpgp->io;
if ((key = resolve_userid(netpgp, netpgp->pubring, name)) == NULL) {
return NULL;
}
return pgp_export_key(io, key, NULL);
}
#define IMPORT_ARMOR_HEAD "-----BEGIN PGP PUBLIC KEY BLOCK-----"
/* import a key into our keyring */
int
netpgp_import_key(netpgp_t *netpgp, char *f)
{
pgp_io_t *io;
unsigned realarmor;
int done;
io = netpgp->io;
realarmor = isarmoured(io, f, NULL, IMPORT_ARMOR_HEAD);
done = pgp_keyring_fileread(netpgp->pubring, realarmor, f);
if (!done) {
(void) fprintf(io->errs, "Cannot import key from file %s\n", f);
return 0;
}
return pgp_keyring_list(io, netpgp->pubring, 0);
}
#define ID_OFFSET 38
/* generate a new key */
int
netpgp_generate_key(netpgp_t *netpgp, char *id, int numbits)
{
pgp_output_t *create;
const unsigned noarmor = 0;
pgp_key_t *key;
pgp_io_t *io;
uint8_t *uid;
char passphrase[128];
char newid[1024];
char filename[MAXPATHLEN];
char dir[MAXPATHLEN];
char *cp;
char *ringfile;
char *numtries;
int attempts;
int passc;
int fd;
int cc;
uid = NULL;
io = netpgp->io;
/* generate a new key */
if (id) {
(void) snprintf(newid, sizeof(newid), "%s", id);
} else {
(void) snprintf(newid, sizeof(newid),
"RSA %d-bit key <%s@localhost>", numbits, getenv("LOGNAME"));
}
uid = (uint8_t *)newid;
key = pgp_rsa_new_selfsign_key(numbits, 65537UL, uid,
netpgp_getvar(netpgp, "hash"),
netpgp_getvar(netpgp, "cipher"));
if (key == NULL) {
(void) fprintf(io->errs, "Cannot generate key\n");
return 0;
}
cp = NULL;
pgp_sprint_keydata(netpgp->io, NULL, key, &cp, "signature ", &key->key.seckey.pubkey, 0);
(void) fprintf(stdout, "%s", cp);
/* write public key */
cc = snprintf(dir, sizeof(dir), "%s/%.16s", netpgp_getvar(netpgp, "homedir"), &cp[ID_OFFSET]);
netpgp_setvar(netpgp, "generated userid", &dir[cc - 16]);
if (mkdir(dir, 0700) < 0) {
(void) fprintf(io->errs, "can't mkdir '%s'\n", dir);
return 0;
}
(void) fprintf(io->errs, "netpgp: generated keys in directory %s\n", dir);
(void) snprintf(ringfile = filename, sizeof(filename), "%s/pubring.gpg", dir);
if (!appendkey(io, key, ringfile)) {
(void) fprintf(io->errs, "Cannot write pubkey to '%s'\n", ringfile);
return 0;
}
if (netpgp->pubring != NULL) {
pgp_keyring_free(netpgp->pubring);
}
/* write secret key */
(void) snprintf(ringfile = filename, sizeof(filename), "%s/secring.gpg", dir);
if ((fd = pgp_setup_file_append(&create, ringfile)) < 0) {
fd = pgp_setup_file_write(&create, ringfile, 0);
}
if (fd < 0) {
(void) fprintf(io->errs, "can't append secring '%s'\n", ringfile);
return 0;
}
/* get the passphrase */
if ((numtries = netpgp_getvar(netpgp, "numtries")) == NULL ||
(attempts = atoi(numtries)) <= 0) {
attempts = MAX_PASSPHRASE_ATTEMPTS;
} else if (strcmp(numtries, "unlimited") == 0) {
attempts = INFINITE_ATTEMPTS;
}
passc = find_passphrase(netpgp->passfp, &cp[ID_OFFSET], passphrase, sizeof(passphrase), attempts);
if (!pgp_write_xfer_seckey(create, key, (uint8_t *)passphrase, (const unsigned)passc, noarmor)) {
(void) fprintf(io->errs, "Cannot write seckey\n");
return 0;
}
pgp_teardown_file_write(create, fd);
if (netpgp->secring != NULL) {
pgp_keyring_free(netpgp->secring);
}
pgp_keydata_free(key);
free(cp);
return 1;
}
/* encrypt a file */
int
netpgp_encrypt_file(netpgp_t *netpgp,
const char *userid,
const char *f,
char *out,
int armored)
{
const pgp_key_t *key;
const unsigned overwrite = 1;
const char *suffix;
pgp_io_t *io;
char outname[MAXPATHLEN];
io = netpgp->io;
if (f == NULL) {
(void) fprintf(io->errs,
"netpgp_encrypt_file: no filename specified\n");
return 0;
}
suffix = (armored) ? ".asc" : ".gpg";
/* get key with which to sign */
if ((key = resolve_userid(netpgp, netpgp->pubring, userid)) == NULL) {
return 0;
}
if (out == NULL) {
(void) snprintf(outname, sizeof(outname), "%s%s", f, suffix);
out = outname;
}
return (int)pgp_encrypt_file(io, f, out, key, (unsigned)armored,
overwrite, netpgp_getvar(netpgp, "cipher"));
}
#define ARMOR_HEAD "-----BEGIN PGP MESSAGE-----"
/* decrypt a file */
int
netpgp_decrypt_file(netpgp_t *netpgp, const char *f, char *out, int armored)
{
const unsigned overwrite = 1;
pgp_io_t *io;
unsigned realarmor;
unsigned sshkeys;
char *numtries;
int attempts;
__PGP_USED(armored);
io = netpgp->io;
if (f == NULL) {
(void) fprintf(io->errs,
"netpgp_decrypt_file: no filename specified\n");
return 0;
}
realarmor = isarmoured(io, f, NULL, ARMOR_HEAD);
sshkeys = (unsigned)(netpgp_getvar(netpgp, "ssh keys") != NULL);
if ((numtries = netpgp_getvar(netpgp, "numtries")) == NULL ||
(attempts = atoi(numtries)) <= 0) {
attempts = MAX_PASSPHRASE_ATTEMPTS;
} else if (strcmp(numtries, "unlimited") == 0) {
attempts = INFINITE_ATTEMPTS;
}
return pgp_decrypt_file(netpgp->io, f, out, netpgp->secring,
netpgp->pubring,
realarmor, overwrite, sshkeys,
netpgp->passfp, attempts, get_passphrase_cb);
}
/* sign a file */
int
netpgp_sign_file(netpgp_t *netpgp,
const char *userid,
const char *f,
char *out,
int armored,
int cleartext,
int detached)
{
const pgp_key_t *keypair;
const pgp_key_t *pubkey;
const unsigned overwrite = 1;
pgp_seckey_t *seckey;
const char *hashalg;
pgp_io_t *io;
char *numtries;
int attempts;
int ret;
int i;
io = netpgp->io;
if (f == NULL) {
(void) fprintf(io->errs,
"netpgp_sign_file: no filename specified\n");
return 0;
}
/* get key with which to sign */
if ((keypair = resolve_userid(netpgp, netpgp->secring, userid)) == NULL) {
return 0;
}
ret = 1;
if ((numtries = netpgp_getvar(netpgp, "numtries")) == NULL ||
(attempts = atoi(numtries)) <= 0) {
attempts = MAX_PASSPHRASE_ATTEMPTS;
} else if (strcmp(numtries, "unlimited") == 0) {
attempts = INFINITE_ATTEMPTS;
}
for (i = 0, seckey = NULL ; !seckey && (i < attempts || attempts == INFINITE_ATTEMPTS) ; i++) {
if (netpgp->passfp == NULL) {
/* print out the user id */
pubkey = pgp_getkeybyname(io, netpgp->pubring, userid);
if (pubkey == NULL) {
(void) fprintf(io->errs,
"netpgp: warning - using pubkey from secring\n");
pgp_print_keydata(io, netpgp->pubring, keypair, "signature ",
&keypair->key.seckey.pubkey, 0);
} else {
pgp_print_keydata(io, netpgp->pubring, pubkey, "signature ",
&pubkey->key.pubkey, 0);
}
}
if (netpgp_getvar(netpgp, "ssh keys") == NULL) {
/* now decrypt key */
seckey = pgp_decrypt_seckey(keypair, netpgp->passfp);
if (seckey == NULL) {
(void) fprintf(io->errs, "Bad passphrase\n");
}
} else {
pgp_keyring_t *secring;
secring = netpgp->secring;
seckey = &secring->keys[0].key.seckey;
}
}
if (seckey == NULL) {
(void) fprintf(io->errs, "Bad passphrase\n");
return 0;
}
/* sign file */
hashalg = netpgp_getvar(netpgp, "hash");
if (seckey->pubkey.alg == PGP_PKA_DSA) {
hashalg = "sha1";
}
if (detached) {
ret = pgp_sign_detached(io, f, out, seckey, hashalg,
get_birthtime(netpgp_getvar(netpgp, "birthtime")),
get_duration(netpgp_getvar(netpgp, "duration")),
(unsigned)armored,
overwrite);
} else {
ret = pgp_sign_file(io, f, out, seckey, hashalg,
get_birthtime(netpgp_getvar(netpgp, "birthtime")),
get_duration(netpgp_getvar(netpgp, "duration")),
(unsigned)armored, (unsigned)cleartext,
overwrite);
}
pgp_forget(seckey, (unsigned)sizeof(*seckey));
return ret;
}
#define ARMOR_SIG_HEAD "-----BEGIN PGP (SIGNATURE|SIGNED MESSAGE)-----"
/* verify a file */
int
netpgp_verify_file(netpgp_t *netpgp, const char *in, const char *out, int armored)
{
pgp_validation_t result;
pgp_io_t *io;
unsigned realarmor;
__PGP_USED(armored);
(void) memset(&result, 0x0, sizeof(result));
io = netpgp->io;
if (in == NULL) {
(void) fprintf(io->errs,
"netpgp_verify_file: no filename specified\n");
return 0;
}
realarmor = isarmoured(io, in, NULL, ARMOR_SIG_HEAD);
if (pgp_validate_file(io, &result, in, out, (const int)realarmor, netpgp->pubring)) {
resultp(io, in, &result, netpgp->pubring);
return 1;
}
if (result.validc + result.invalidc + result.unknownc == 0) {
(void) fprintf(io->errs,
"\"%s\": No signatures found - is this a signed file?\n",
in);
} else if (result.invalidc == 0 && result.unknownc == 0) {
(void) fprintf(io->errs,
"\"%s\": file verification failure: invalid signature time\n", in);
} else {
(void) fprintf(io->errs,
"\"%s\": verification failure: %u invalid signatures, %u unknown signatures\n",
in, result.invalidc, result.unknownc);
}
return 0;
}
/* sign some memory */
int
netpgp_sign_memory(netpgp_t *netpgp,
const char *userid,
char *mem,
size_t size,
char *out,
size_t outsize,
const unsigned armored,
const unsigned cleartext)
{
const pgp_key_t *keypair;
const pgp_key_t *pubkey;
pgp_seckey_t *seckey;
pgp_memory_t *signedmem;
const char *hashalg;
pgp_io_t *io;
char *numtries;
int attempts;
int ret;
int i;
io = netpgp->io;
if (mem == NULL) {
(void) fprintf(io->errs,
"netpgp_sign_memory: no memory to sign\n");
return 0;
}
if ((keypair = resolve_userid(netpgp, netpgp->secring, userid)) == NULL) {
return 0;
}
ret = 1;
if ((numtries = netpgp_getvar(netpgp, "numtries")) == NULL ||
(attempts = atoi(numtries)) <= 0) {
attempts = MAX_PASSPHRASE_ATTEMPTS;
} else if (strcmp(numtries, "unlimited") == 0) {
attempts = INFINITE_ATTEMPTS;
}
for (i = 0, seckey = NULL ; !seckey && (i < attempts || attempts == INFINITE_ATTEMPTS) ; i++) {
if (netpgp->passfp == NULL) {
/* print out the user id */
pubkey = pgp_getkeybyname(io, netpgp->pubring, userid);
if (pubkey == NULL) {
(void) fprintf(io->errs,
"netpgp: warning - using pubkey from secring\n");
pgp_print_keydata(io, netpgp->pubring, keypair, "signature ",
&keypair->key.seckey.pubkey, 0);
} else {
pgp_print_keydata(io, netpgp->pubring, pubkey, "signature ",
&pubkey->key.pubkey, 0);
}
}
/* now decrypt key */
seckey = pgp_decrypt_seckey(keypair, netpgp->passfp);
if (seckey == NULL) {
(void) fprintf(io->errs, "Bad passphrase\n");
}
}
if (seckey == NULL) {
(void) fprintf(io->errs, "Bad passphrase\n");
return 0;
}
/* sign file */
(void) memset(out, 0x0, outsize);
hashalg = netpgp_getvar(netpgp, "hash");
if (seckey->pubkey.alg == PGP_PKA_DSA) {
hashalg = "sha1";
}
signedmem = pgp_sign_buf(io, mem, size, seckey,
get_birthtime(netpgp_getvar(netpgp, "birthtime")),
get_duration(netpgp_getvar(netpgp, "duration")),
hashalg, armored, cleartext);
if (signedmem) {
size_t m;
m = MIN(pgp_mem_len(signedmem), outsize);
(void) memcpy(out, pgp_mem_data(signedmem), m);
pgp_memory_free(signedmem);
ret = (int)m;
} else {
ret = 0;
}
pgp_forget(seckey, (unsigned)sizeof(*seckey));
return ret;
}
/* verify memory */
int
netpgp_verify_memory(netpgp_t *netpgp, const void *in, const size_t size,
void *out, size_t outsize, const int armored)
{
pgp_validation_t result;
pgp_memory_t *signedmem;
pgp_memory_t *cat;
pgp_io_t *io;
size_t m;
int ret;
(void) memset(&result, 0x0, sizeof(result));
io = netpgp->io;
if (in == NULL) {
(void) fprintf(io->errs,
"netpgp_verify_memory: no memory to verify\n");
return 0;
}
signedmem = pgp_memory_new();
pgp_memory_add(signedmem, in, size);
if (out) {
cat = pgp_memory_new();
}
ret = pgp_validate_mem(io, &result, signedmem,
(out) ? &cat : NULL,
armored, netpgp->pubring);
/* signedmem is freed from pgp_validate_mem */
if (ret) {
resultp(io, "<stdin>", &result, netpgp->pubring);
if (out) {
m = MIN(pgp_mem_len(cat), outsize);
(void) memcpy(out, pgp_mem_data(cat), m);
pgp_memory_free(cat);
} else {
m = 1;
}
return (int)m;
}
if (result.validc + result.invalidc + result.unknownc == 0) {
(void) fprintf(io->errs,
"No signatures found - is this memory signed?\n");
} else if (result.invalidc == 0 && result.unknownc == 0) {
(void) fprintf(io->errs,
"memory verification failure: invalid signature time\n");
} else {
(void) fprintf(io->errs,
"memory verification failure: %u invalid signatures, %u unknown signatures\n",
result.invalidc, result.unknownc);
}
return 0;
}
/* encrypt some memory */
int
netpgp_encrypt_memory(netpgp_t *netpgp,
const char *userid,
void *in,
const size_t insize,
char *out,
size_t outsize,
int armored)
{
const pgp_key_t *keypair;
pgp_memory_t *enc;
pgp_io_t *io;
size_t m;
io = netpgp->io;
if (in == NULL) {
(void) fprintf(io->errs,
"netpgp_encrypt_buf: no memory to encrypt\n");
return 0;
}
if ((keypair = resolve_userid(netpgp, netpgp->pubring, userid)) == NULL) {
return 0;
}
if (in == out) {
(void) fprintf(io->errs,
"netpgp_encrypt_buf: input and output bufs need to be different\n");
return 0;
}
if (outsize < insize) {
(void) fprintf(io->errs,
"netpgp_encrypt_buf: input size is larger than output size\n");
return 0;
}
enc = pgp_encrypt_buf(io, in, insize, keypair, (unsigned)armored,
netpgp_getvar(netpgp, "cipher"));
m = MIN(pgp_mem_len(enc), outsize);
(void) memcpy(out, pgp_mem_data(enc), m);
pgp_memory_free(enc);
return (int)m;
}
/* decrypt a chunk of memory */
int
netpgp_decrypt_memory(netpgp_t *netpgp, const void *input, const size_t insize,
char *out, size_t outsize, const int armored)
{
pgp_memory_t *mem;
pgp_io_t *io;
unsigned realarmour;
unsigned sshkeys;
size_t m;
char *numtries;
int attempts;
__PGP_USED(armored);
io = netpgp->io;
if (input == NULL) {
(void) fprintf(io->errs,
"netpgp_decrypt_memory: no memory\n");
return 0;
}
realarmour = isarmoured(io, NULL, input, ARMOR_HEAD);
sshkeys = (unsigned)(netpgp_getvar(netpgp, "ssh keys") != NULL);
if ((numtries = netpgp_getvar(netpgp, "numtries")) == NULL ||
(attempts = atoi(numtries)) <= 0) {
attempts = MAX_PASSPHRASE_ATTEMPTS;
} else if (strcmp(numtries, "unlimited") == 0) {
attempts = INFINITE_ATTEMPTS;
}
mem = pgp_decrypt_buf(netpgp->io, input, insize, netpgp->secring,
netpgp->pubring,
realarmour, sshkeys,
netpgp->passfp,
attempts,
get_passphrase_cb);
if (mem == NULL) {
return -1;
}
m = MIN(pgp_mem_len(mem), outsize);
(void) memcpy(out, pgp_mem_data(mem), m);
pgp_memory_free(mem);
return (int)m;
}
/* wrappers for the ops_debug_level functions we added to openpgpsdk */
/* set the debugging level per filename */
int
netpgp_set_debug(const char *f)
{
return pgp_set_debug_level(f);
}
/* get the debugging level per filename */
int
netpgp_get_debug(const char *f)
{
return pgp_get_debug_level(f);
}
/* return the version for the library */
const char *
netpgp_get_info(const char *type)
{
return pgp_get_info(type);
}
/* list all the packets in a file */
int
netpgp_list_packets(netpgp_t *netpgp, char *f, int armor, char *pubringname)
{
pgp_keyring_t *keyring;
const unsigned noarmor = 0;
struct stat st;
pgp_io_t *io;
char ringname[MAXPATHLEN];
char *homedir;
int ret;
io = netpgp->io;
if (f == NULL) {
(void) fprintf(io->errs, "No file containing packets\n");
return 0;
}
if (stat(f, &st) < 0) {
(void) fprintf(io->errs, "No such file '%s'\n", f);
return 0;
}
homedir = netpgp_getvar(netpgp, "homedir");
if (pubringname == NULL) {
(void) snprintf(ringname, sizeof(ringname),
"%s/pubring.gpg", homedir);
pubringname = ringname;
}
if ((keyring = calloc(1, sizeof(*keyring))) == NULL) {
(void) fprintf(io->errs, "netpgp_list_packets: bad alloc\n");
return 0;
}
if (!pgp_keyring_fileread(keyring, noarmor, pubringname)) {
free(keyring);
(void) fprintf(io->errs, "Cannot read pub keyring %s\n",
pubringname);
return 0;
}
netpgp->pubring = keyring;
netpgp_setvar(netpgp, "pubring", pubringname);
ret = pgp_list_packets(io, f, (unsigned)armor,
netpgp->secring,
netpgp->pubring,
netpgp->passfp,
get_passphrase_cb);
free(keyring);
return ret;
}
/* set a variable */
int
netpgp_setvar(netpgp_t *netpgp, const char *name, const char *value)
{
char *newval;
int i;
/* protect against the case where 'value' is netpgp->value[i] */
newval = netpgp_strdup(value);
if ((i = findvar(netpgp, name)) < 0) {
/* add the element to the array */
if (size_arrays(netpgp, netpgp->size + 15)) {
netpgp->name[i = netpgp->c++] = netpgp_strdup(name);
}
} else {
/* replace the element in the array */
if (netpgp->value[i]) {
free(netpgp->value[i]);
netpgp->value[i] = NULL;
}
}
/* sanity checks for range of values */
if (strcmp(name, "hash") == 0 || strcmp(name, "algorithm") == 0) {
if (pgp_str_to_hash_alg(newval) == PGP_HASH_UNKNOWN) {
free(newval);
return 0;
}
}
netpgp->value[i] = newval;
return 1;
}
/* unset a variable */
int
netpgp_unsetvar(netpgp_t *netpgp, const char *name)
{
int i;
if ((i = findvar(netpgp, name)) >= 0) {
if (netpgp->value[i]) {
free(netpgp->value[i]);
netpgp->value[i] = NULL;
}
netpgp->value[i] = NULL;
return 1;
}
return 0;
}
/* get a variable's value (NULL if not set) */
char *
netpgp_getvar(netpgp_t *netpgp, const char *name)
{
int i;
return ((i = findvar(netpgp, name)) < 0) ? NULL : netpgp->value[i];
}
/* increment a value */
int
netpgp_incvar(netpgp_t *netpgp, const char *name, const int delta)
{
char *cp;
char num[16];
int val;
val = 0;
if ((cp = netpgp_getvar(netpgp, name)) != NULL) {
val = atoi(cp);
}
(void) snprintf(num, sizeof(num), "%d", val + delta);
netpgp_setvar(netpgp, name, num);
return 1;
}
/* set the home directory value to "home/subdir" */
int
netpgp_set_homedir(netpgp_t *netpgp, char *home, const char *subdir, const int quiet)
{
struct stat st;
char d[MAXPATHLEN];
if (home == NULL) {
if (!quiet) {
(void) fprintf(stderr, "NULL HOME directory\n");
}
return 0;
}
(void) snprintf(d, sizeof(d), "%s%s", home, (subdir) ? subdir : "");
if (stat(d, &st) == 0) {
if ((st.st_mode & S_IFMT) == S_IFDIR) {
netpgp_setvar(netpgp, "homedir", d);
return 1;
}
(void) fprintf(stderr, "netpgp: homedir \"%s\" is not a dir\n",
d);
return 0;
}
if (!quiet) {
(void) fprintf(stderr,
"netpgp: warning homedir \"%s\" not found\n", d);
}
netpgp_setvar(netpgp, "homedir", d);
return 1;
}
/* validate all sigs in the pub keyring */
int
netpgp_validate_sigs(netpgp_t *netpgp)
{
pgp_validation_t result;
return (int)pgp_validate_all_sigs(&result, netpgp->pubring, NULL);
}
/* print the json out on 'fp' */
int
netpgp_format_json(void *vp, const char *json, const int psigs)
{
mj_t ids;
FILE *fp;
int from;
int idc;
int tok;
int to;
int i;
if ((fp = (FILE *)vp) == NULL || json == NULL) {
return 0;
}
/* ids is an array of strings, each containing 1 entry */
(void) memset(&ids, 0x0, sizeof(ids));
from = to = tok = 0;
/* convert from string into an mj structure */
(void) mj_parse(&ids, json, &from, &to, &tok);
if ((idc = mj_arraycount(&ids)) == 1 && strchr(json, '{') == NULL) {
idc = 0;
}
(void) fprintf(fp, "%d key%s found\n", idc, (idc == 1) ? "" : "s");
for (i = 0 ; i < idc ; i++) {
format_json_key(fp, &ids.value.v[i], psigs);
}
/* clean up */
mj_delete(&ids);
return idc;
}
/* find a key in keyring, and write it in ssh format */
int
netpgp_write_sshkey(netpgp_t *netpgp, char *s, const char *userid, char *out, size_t size)
{
const pgp_key_t *key;
pgp_keyring_t *keyring;
pgp_io_t *io;
unsigned k;
size_t cc;
char f[MAXPATHLEN];
keyring = NULL;
io = NULL;
cc = 0;
if ((io = calloc(1, sizeof(pgp_io_t))) == NULL) {
(void) fprintf(stderr, "netpgp_save_sshpub: bad alloc 1\n");
goto done;
}
io->outs = stdout;
io->errs = stderr;
io->res = stderr;
netpgp->io = io;
/* write new to temp file */
savepubkey(s, f, sizeof(f));
if ((keyring = calloc(1, sizeof(*keyring))) == NULL) {
(void) fprintf(stderr, "netpgp_save_sshpub: bad alloc 2\n");
goto done;
}
if (!pgp_keyring_fileread(netpgp->pubring = keyring, 1, f)) {
(void) fprintf(stderr, "can't import key\n");
goto done;
}
/* get rsa key */
k = 0;
key = pgp_getnextkeybyname(netpgp->io, netpgp->pubring, userid, &k);
if (key == NULL) {
(void) fprintf(stderr, "no key found for '%s'\n", userid);
goto done;
}
if (key->key.pubkey.alg != PGP_PKA_RSA) {
/* we're not interested in supporting DSA either :-) */
(void) fprintf(stderr, "key not RSA '%s'\n", userid);
goto done;
}
/* XXX - check trust sigs */
/* XXX - check expiry */
/* XXX - check start */
/* XXX - check not weak key */
/* get rsa e and n */
(void) memset(out, 0x0, size);
cc = formatstring((char *)out, (const uint8_t *)"ssh-rsa", 7);
cc += formatbignum((char *)&out[cc], key->key.pubkey.key.rsa.e);
cc += formatbignum((char *)&out[cc], key->key.pubkey.key.rsa.n);
done:
if (io) {
free(io);
}
if (keyring) {
free(keyring);
}
return (int)cc;
}
| 25.718303 | 106 | 0.625644 |
320d521661a5ba67e78bca3f85f1ed32e974769c | 6,215 | c | C | crypto/ecdsa_extra/ecdsa_asn1.c | WillChilds-Klein/aws-lc | c6365d5eda4e1f4cfc5a35444ab0cede42d31f86 | [
"BSD-3-Clause"
] | 45 | 2020-09-02T17:15:04.000Z | 2022-03-25T19:24:53.000Z | crypto/ecdsa_extra/ecdsa_asn1.c | WillChilds-Klein/aws-lc | c6365d5eda4e1f4cfc5a35444ab0cede42d31f86 | [
"BSD-3-Clause"
] | 133 | 2020-09-03T20:24:53.000Z | 2022-03-30T23:24:44.000Z | crypto/ecdsa_extra/ecdsa_asn1.c | WillChilds-Klein/aws-lc | c6365d5eda4e1f4cfc5a35444ab0cede42d31f86 | [
"BSD-3-Clause"
] | 35 | 2020-09-02T17:28:45.000Z | 2022-03-08T17:37:09.000Z | /* ====================================================================
* Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. 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.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* openssl-core@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED 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 OpenSSL PROJECT OR
* ITS 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.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com). */
#include <openssl/ecdsa.h>
#include <limits.h>
#include <string.h>
#include <openssl/bn.h>
#include <openssl/bytestring.h>
#include <openssl/err.h>
#include <openssl/ec_key.h>
#include <openssl/mem.h>
#include "../bytestring/internal.h"
#include "../fipsmodule/ec/internal.h"
#include "../internal.h"
size_t ECDSA_size(const EC_KEY *key) {
if (key == NULL) {
return 0;
}
size_t group_order_size;
if (key->ecdsa_meth && key->ecdsa_meth->group_order_size) {
group_order_size = key->ecdsa_meth->group_order_size(key);
} else {
const EC_GROUP *group = EC_KEY_get0_group(key);
if (group == NULL) {
return 0;
}
group_order_size = BN_num_bytes(EC_GROUP_get0_order(group));
}
return ECDSA_SIG_max_len(group_order_size);
}
ECDSA_SIG *ECDSA_SIG_parse(CBS *cbs) {
ECDSA_SIG *ret = ECDSA_SIG_new();
if (ret == NULL) {
return NULL;
}
CBS child;
if (!CBS_get_asn1(cbs, &child, CBS_ASN1_SEQUENCE) ||
!BN_parse_asn1_unsigned(&child, ret->r) ||
!BN_parse_asn1_unsigned(&child, ret->s) ||
CBS_len(&child) != 0) {
OPENSSL_PUT_ERROR(ECDSA, ECDSA_R_BAD_SIGNATURE);
ECDSA_SIG_free(ret);
return NULL;
}
return ret;
}
ECDSA_SIG *ECDSA_SIG_from_bytes(const uint8_t *in, size_t in_len) {
CBS cbs;
CBS_init(&cbs, in, in_len);
ECDSA_SIG *ret = ECDSA_SIG_parse(&cbs);
if (ret == NULL || CBS_len(&cbs) != 0) {
OPENSSL_PUT_ERROR(ECDSA, ECDSA_R_BAD_SIGNATURE);
ECDSA_SIG_free(ret);
return NULL;
}
return ret;
}
int ECDSA_SIG_marshal(CBB *cbb, const ECDSA_SIG *sig) {
CBB child;
if (!CBB_add_asn1(cbb, &child, CBS_ASN1_SEQUENCE) ||
!BN_marshal_asn1(&child, sig->r) ||
!BN_marshal_asn1(&child, sig->s) ||
!CBB_flush(cbb)) {
OPENSSL_PUT_ERROR(ECDSA, ECDSA_R_ENCODE_ERROR);
return 0;
}
return 1;
}
int ECDSA_SIG_to_bytes(uint8_t **out_bytes, size_t *out_len,
const ECDSA_SIG *sig) {
CBB cbb;
CBB_zero(&cbb);
if (!CBB_init(&cbb, 0) ||
!ECDSA_SIG_marshal(&cbb, sig) ||
!CBB_finish(&cbb, out_bytes, out_len)) {
OPENSSL_PUT_ERROR(ECDSA, ECDSA_R_ENCODE_ERROR);
CBB_cleanup(&cbb);
return 0;
}
return 1;
}
// der_len_len returns the number of bytes needed to represent a length of |len|
// in DER.
static size_t der_len_len(size_t len) {
if (len < 0x80) {
return 1;
}
size_t ret = 1;
while (len > 0) {
ret++;
len >>= 8;
}
return ret;
}
size_t ECDSA_SIG_max_len(size_t order_len) {
// Compute the maximum length of an |order_len| byte integer. Defensively
// assume that the leading 0x00 is included.
size_t integer_len = 1 /* tag */ + der_len_len(order_len + 1) + 1 + order_len;
if (integer_len < order_len) {
return 0;
}
// An ECDSA signature is two INTEGERs.
size_t value_len = 2 * integer_len;
if (value_len < integer_len) {
return 0;
}
// Add the header.
size_t ret = 1 /* tag */ + der_len_len(value_len) + value_len;
if (ret < value_len) {
return 0;
}
return ret;
}
ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **out, const uint8_t **inp, long len) {
if (len < 0) {
return NULL;
}
CBS cbs;
CBS_init(&cbs, *inp, (size_t)len);
ECDSA_SIG *ret = ECDSA_SIG_parse(&cbs);
if (ret == NULL) {
return NULL;
}
if (out != NULL) {
ECDSA_SIG_free(*out);
*out = ret;
}
*inp = CBS_data(&cbs);
return ret;
}
int i2d_ECDSA_SIG(const ECDSA_SIG *sig, uint8_t **outp) {
CBB cbb;
if (!CBB_init(&cbb, 0) ||
!ECDSA_SIG_marshal(&cbb, sig)) {
CBB_cleanup(&cbb);
return -1;
}
return CBB_finish_i2d(&cbb, outp);
}
| 30.317073 | 80 | 0.67144 |
89dab933fdeab7013b487385c50771d082e91ebe | 21,065 | h | C | illustratorapi/illustrator/legacy/AI120Symbol.h | btempleton/sg-aics3mac-plugins | e5332b11ef8ce03a7e842c9df3fe1ce9145c0b67 | [
"Intel",
"Unlicense"
] | 1 | 2021-10-09T18:23:44.000Z | 2021-10-09T18:23:44.000Z | illustratorapi/illustrator/legacy/AI120Symbol.h | btempleton/sg-aics3mac-plugins | e5332b11ef8ce03a7e842c9df3fe1ce9145c0b67 | [
"Intel",
"Unlicense"
] | null | null | null | illustratorapi/illustrator/legacy/AI120Symbol.h | btempleton/sg-aics3mac-plugins | e5332b11ef8ce03a7e842c9df3fe1ce9145c0b67 | [
"Intel",
"Unlicense"
] | null | null | null | #ifndef __AI120Symbol__
#define __AI120Symbol__
/*
* Name: AI120Symbol.h
* Author:
* Date:
* Purpose: Adobe Illustrator 12.0 Symbol Suite.
*
* ADOBE SYSTEMS INCORPORATED
* Copyright 1990-2007 Adobe Systems Incorporated.
* All rights reserved.
*
* NOTICE: Adobe permits you to use, modify, and distribute this file
* in accordance with the terms of the Adobe license agreement
* accompanying it. If you have received this file from a source other
* than Adobe, then your use, modification, or distribution of it
* requires the prior written permission of Adobe.
*
*/
/*******************************************************************************
**
** Imports
**
**/
#include "AISymbol.h"
#include "AIHeaderBegin.h"
/** @file AI120Symbol.h */
/*******************************************************************************
**
** Constants
**
**/
#define kAI12SymbolSuite kAISymbolSuite
#define kAISymbolSuiteVersion3 AIAPI_VERSION(3)
#define kAI120SymbolSuiteVersion kAISymbolSuiteVersion3
#define kAI120SymbolVersion kAI120SymbolSuiteVersion
/*******************************************************************************
**
** AI120Symbol Suite
**
**/
/* This suite differs from the AI 11 version in that symbol names are ai::UnicodeString instead of char *.
It differs from the AI 13 version only in that it does not have the SetSymbolPatternFromSelGetBounds
API at the end.
*/
typedef struct {
/** Get a count of the number of symbol definitions in the global list. See the suite
overview for the meaning of the includeUnlisted parameter.*/
AIAPI AIErr (*CountSymbolPatterns) ( long *count, ASBoolean includeUnlisted );
/** Get the nth (0 based) symbol pattern in the list. See the suite overview for the
meaning of the includeUnlisted parameter. */
AIAPI AIErr (*GetNthSymbolPattern) ( long n, AIPatternHandle *symbolPattern, ASBoolean includeUnlisted );
/** Get the symbol definition with the specified name if any. */
AIAPI AIErr (*GetSymbolPatternByName) ( const ai::UnicodeString& name, AIPatternHandle *symbolPattern );
/** Get the symbol definition with the specified name in the specified document. The
document may be obtained with the AIDocumentListSuite or by importing a collection
of symbols with AIPathStyleSuite::ImportStyles(). */
AIAPI AIErr (*GetSymbolByNameFromDocument) ( const ai::UnicodeString& name, AIPatternHandle *symbolPattern,
AIDocumentHandle document );
/** Get a count of the number of symbol definitions in the the global list of the
specified document. The document may be obtained with the AIDocumentListSuite or
by importing a collection of symbols with AIPathStyleSuite::ImportStyles().*/
AIAPI AIErr (*CountSymbolPatternsFromDocument) ( long* count, AIDocumentHandle document );
/** Get the nth (0 based) symbol definition in the the global list of the specified
document. The document may be obtained with the AIDocumentListSuite or by
importing a collection of symbols with AIPathStyleSuite::ImportStyles().*/
AIAPI AIErr (*GetNthSymbolPatternFromDocument) ( long n, AIPatternHandle *symbolPattern,
AIDocumentHandle document );
/** Make a new symbol definition from the definition art. If definitionArt is not null,
it will be copied as the defining art. If it is null, then the definition will be an
empty group. (We do not bother making a checkerboard pattern like NewPattern does.)
(See suite overview for a discussion of listed vs unlisted.) */
AIAPI AIErr (*NewSymbolPattern) ( AIPatternHandle *newSymbolPattern, AIArtHandle definitionArt, ASBoolean unlisted );
/** If something is selected, it will be copied as the defining art. If nothing is selected,
then the definition will be an empty group. (You don't get a choice of unlisted on
this one - symbols defined from the selected art are assumed to be permanent.) */
AIAPI AIErr (*NewSymbolPatternFromSel) ( AIPatternHandle *symbolPattern );
/** Like NewSymbolPatternFromSel except that it returns the bounds of the selected art
used to define the symbol (which cannot be obtained by calling GetArtBounds on the
symbol pattern art after defining it, because like patterns and brush patterns the
copied definition art gets moved to a standardized location.) It could be obtained
by getting all the selected objects and unioning up their bounds, but since
NewSymbolPatternFromSel() knows the bounds anyway it is easy to hand it back. This
is mainly intended for clients who want to insert an instance of the symbol in place
of the selection after it is created. */
AIAPI AIErr (*NewSymbolPatternFromSelGetBounds) ( AIPatternHandle *symbolPattern, AIRealRect *selectionBounds );
/** Delete the symbol definition. */
AIAPI AIErr (*DeleteSymbolPattern) ( AIPatternHandle symbolPattern );
/** Is this symbol still known to the system? (It should never be necessary to use this
if you don't hang onto the AIPatternHandle between messages, or if you process the
#kAIArtSymbolSetChangedNotifier.) */
AIAPI AIBoolean (*ValidateSymbolPattern) ( AIPatternHandle symbolPattern );
// Functions for examining and modifying a symbol definition
/** This 'peeks' at the actual symbol definition. The art returned cannot be edited, just
examined or duplicated!! */
AIAPI AIErr (*GetSymbolPatternArt) ( AIPatternHandle pattern, AIArtHandle *art );
/** Analogous to AIPatternSuite::GetPattern() (I just don't think 'Get' is a very
intuitive name for inserting a copy of the defining art into the current layer or
insertion group.) Especially since we use GetPatternArt to mean peek at the real
definition. */
AIAPI AIErr (*PasteSymbolPatternArt) ( AIPatternHandle symbolPattern );
/** paintOrder (see #AIPaintOrder), prep and newArt have the same meaning as
AIArtSuite::DuplicateArt(). The recommended way to get an editable copy of a symbol
definition is not to use PasteSymbolPatternArt(), but rather to use AIDictionarySuite::NewArtEntry()
to create a group that isn't in the artwork, insert the definition copy into that,
and then delete the dictionary entry. That way you don't modify the art tree
and trigger irrelevant synchronization, change notifications, etc. (This is often
used by export filters that need to make systematic adjustments to Illustrator
art before getting it in an easy-to-export form.) */
AIAPI AIErr (*CopySymbolPatternArt) ( AIPatternHandle symbolPattern,
short paintOrder, AIArtHandle prep, AIArtHandle *newArt );
/** Copy the definitionArt as the new symbol definition. Any existing instances of the
symbol will be updated. */
AIAPI AIErr (*SetSymbolPatternArt) ( AIPatternHandle symbolPattern, AIArtHandle definitionArt );
/** Analogous to AIPatternSuite::SetPattern(). Again, I just think that 'Set'
isn't very intuitive for something that copies the selected art. */
AIAPI AIErr (*SetSymbolPatternFromSel) ( AIPatternHandle symbolPattern );
// The functions below use C strings. If you have or want Pascal strings, you can
// also get and set the name of a symbol using GetPatternName and SetPatternName
// from AIPattern.h.
/** If the actual symbol name is too long to fit in the buffer, it will be filled with
a truncated form of the name and #kNameTooLongErr will be returned. */
AIAPI AIErr (*GetSymbolPatternName) ( AIPatternHandle symbolPattern, ai::UnicodeString& name );
/** If the name length exceeds #kMaxSymbolNameLength then #kNameTooLongErr will be returned
If the name contains illegal characters, is of zero length, or consists entirely of spaces,
then #kInvalidNameErr will be returned. In either case, the symbol will retain the
original name. If the name is already used for another symbol, then #kNameInUseErr
will be returned */
AIAPI AIErr (*SetSymbolPatternName) ( AIPatternHandle symbolPattern, const ai::UnicodeString& name );
/** Strips any hidden characters from the end of a name. The name is modified in place. */
AIAPI AIErr (*GetSymbolPatternDisplayName) ( ai::UnicodeString& name );
/** Like SetSymbolPatternName(), except if the given name is already used, the name
will be changed by appending numbers until a unique name is generated. (If the
name is very long and already in use, then the prefix may be truncated before
appending numbers, but this is unlikely to happen since #kSymbolMaxNameLength is
so large.) */
AIAPI AIErr (*SetSymbolPatternBaseName) ( AIPatternHandle symbolPattern, ai::UnicodeString& name );
/** Create a new symbol instance (art object of type #kSymbolArt) in the center of the
document view. The paintOrder (see #AIPaintOrder) and prep parameters have the same
meaning as AIArtSuite::NewArt().
You can also use AIArtSuite::NewArt(), which is like NewInstanceCenteredInView() where
the symbolPattern is the first one in the set. (It will return #kBadParameterErr if
there are no symbols defined in the current document.)
*/
AIAPI AIErr (*NewInstanceCenteredInView) ( AIPatternHandle symbolPattern,
short paintOrder, AIArtHandle prep, AIArtHandle *newArt );
/** Create a new symbol instance (art object of type #kSymbolArt) at the specified center
location. The paintOrder (see #AIPaintOrder) and prep parameters have the same
meaning as AIArtSuite::NewArt(). */
AIAPI AIErr (*NewInstanceAtLocation) ( AIPatternHandle symbolPattern, AIRealPoint center,
short paintOrder, AIArtHandle prep, AIArtHandle *newArt );
/** Create a new symbol instance (art object of type #kSymbolArt) with specified transform
matrix. The paintOrder (see #AIPaintOrder) and prep parameters have the same
meaning as AIArtSuite::NewArt(). */
AIAPI AIErr (*NewInstanceWithTransform) ( AIPatternHandle symbolPattern, AIRealMatrix *transform,
short paintOrder, AIArtHandle prep, AIArtHandle *newArt );
/** Given a symbol instance (art object of type #kSymbolArt) returns its corresponding
symbol definition. */
AIAPI AIErr (*GetSymbolPatternOfSymbolArt) ( AIArtHandle symbolArt, AIPatternHandle *symbolPattern );
/** Given a symbol instance (art object of type #kSymbolArt) sets its corresponding
symbol definition. */
AIAPI AIErr (*SetSymbolPatternOfSymbolArt) ( AIArtHandle symbolArt, AIPatternHandle symbolPattern );
/** Return the matrix used internally by Illustrator to transform the SymbolPatternArt into
an instance. See AIHardSoftSuite for a discussion of coordinate systems.
You can translate between the hard and soft forms of the matrix using AIRealMatrixRealSoft
and AIRealMatrixRealHard from the AIHardSoftSuite. (Do not use AIRealMatrixHarden and
AIRealMatrixSoften, which harden/soften only the tx ty components.) */
AIAPI AIErr (*GetHardTransformOfSymbolArt) ( AIArtHandle symbolArt, AIRealMatrix *transform );
/** Set the matrix used internally by Illustrator to transform the SymbolPatternArt into
an instance. See AIHardSoftSuite for a discussion of coordinate systems. */
AIAPI AIErr (*SetHardTransformOfSymbolArt) ( AIArtHandle symbolArt, AIRealMatrix *transform );
/** Return the matrix that can be used by a plugin to transform the SymbolPatternArt into
an instance. (If you are going to be using the TransformArt suite, this is the matrix
you want.) See AIHardSoftSuite for a discussion of coordinate systems. */
AIAPI AIErr (*GetSoftTransformOfSymbolArt) ( AIArtHandle symbolArt, AIRealMatrix *transform );
/** Set the matrix that can be used by a plugin to transform the SymbolPatternArt into
an instance. (If you are going to be using the TransformArt suite, this is the matrix
you want.) See AIHardSoftSuite for a discussion of coordinate systems. */
AIAPI AIErr (*SetSoftTransformOfSymbolArt) ( AIArtHandle symbolArt, AIRealMatrix *transform );
/** paintOrder (see #AIPaintOrder), prep and newArt have the same meaning as AIArtSuite::DuplicateArt()
If the instance matrix is a simple placement matrix, then this function is equivalent to
BreakLinkToSymbol(), see below. If the instance matrix includes a scale, rotation, shear
or reflection then it expands any appearances or plugin groups inside the symbol definition,
followed by a transformation by the instance matrix. Also if the instance matrix includes
a shear or a non-uniform scale, it expands strokes before applying the instance matrix.
This routine thus preserves appearance of the instance at the cost of preserving the
original editability of the symbol definition. Does not delete symbolArt. */
AIAPI AIErr (*InsertExpandedSymbolArt) ( AIArtHandle symbolArt,
short paintOrder, AIArtHandle prep, AIArtHandle *expandedArt );
/** Returns true if the symbol definition is listed. See the suite overview for a discussion. */
AIAPI AIBoolean (*IsSymbolPatternListed) ( AIPatternHandle symbolPattern );
/** Makes the symbol definition listed. See the suite overview for a discussion. */
AIAPI AIErr (*MakeSymbolPatternListed) ( AIPatternHandle symbolPattern );
/** Makes the symbol definition unlisted. See the suite overview for a discussion. */
AIAPI AIErr (*UnlistSymbolPattern) ( AIPatternHandle symbolPattern );
AIAPI AIErr (*SortListedSymbolPatterns) ( void );
/** Make the listed symbolPattern have the given index. Use -1 to move to end of list. */
AIAPI AIErr (*MoveSymbolPatternInList) ( AIPatternHandle symbolPattern, int index );
/** Check to see whether the given art object uses the targetSymbol. searchScope is a bit vector;
see #AISymbolSearchScope
If the art object is null, then the entire artwork is searched. In this case,
the #kSearchDescendants flag is assumed even if it is not on in the searchScope,
because it is meaningless to search the whole artwork unless you look inside layer groups.
The targetSymbol can be null; if so the art is searched for any symbol usage
If the targetSymbol is not null, then the remaining three parameters are all ignored!
The oneFoundSymbol pointer can also be null. It is ignored if targetSymbol is not null.
If targetSymbol is null, and oneFoundSymbol is not null, and the art object uses exactly
one symbol definition within the scope searched, then *oneFoundSymbol will be returned as
that symbol. If it uses multiple symbols, the function returns true but *oneFoundSymbol
is returned null.
If it uses multiple symbols and allFoundSymbols is non-null, then *allFoundSymbols is
returned as a handle to an array of all those symbols and *foundCount. Like the
AIMatchingArtSuite, the memory is allocated by ArtUsesSymbolPattern, and must be freed
by the calling plugin using AIMdMemorySuite::MdMemoryDisposeHandle().
*oneFoundSymbol is mostly intended for the Symbols palette to decide which symbol to select,
and if an object uses multiple symbols then nothing is selected. The searchScope in this
type of usage should not include #kSearchNestedSymbolPatterns, because if symbol A's
definition includes symbol B, and the user selects an instance of symbol A, we want
to consider symbol A to be selected. But if they select a particle set containing
instances of both symbol A and symbol B, we want to select neither symbol in the palette.
*allFoundSymbols with a null art object is mostly intended for implementing the
"Select All Unused" command in the Symbols palette.
*allFoundSymbols with a non-null art object is mostly intended for examining which symbol
patterns are referenced by a plugin group that puts multiple symbols in its dictionary,
such as a particle set.
Currently unimplemented: If globalObjectUsage is not null, we additionally report whether
the symbol was found inside graph designs or inside other symbols. See #AISymbolGlobalObjectUsage.
(This does not affect the searchScope, so if there was a non-null input art object, any
non-zero return value will mean that it was found inside a graph design or symbol that
was used in that object.)
*/
AIAPI AIBoolean (*ArtUsesSymbolPattern) ( AIArtHandle art, short searchScope, AIPatternHandle targetSymbol,
AIPatternHandle *oneFoundSymbol,
AIPatternHandle ***allFoundSymbols, int *foundCount,
int *globalObjectUsage);
/** paintOrder (see #AIPaintOrder), prep and newArt have the same meaning as AIArtSuite::DuplicateArt()
Like CopySymbolPatternArt() for the symbolArt's symbolPattern followed by a transformation
by the instance matrix, but more efficient than using the AITransformArtSuite since
it is all done internally. Also transfers attributes from the symbol instance to the
transformed defintion. If the instance matrix is a simple placement matrix, then this
function is equivalent to InsertExpandedSymbolArt(), see above, since neither function
does any deep expansion when the matrix is simple. But this function does not do any
internal expansion of strokes, active styles or plugin groups inside the symbol definition
even when a rotational or shear transform is applied to the instance. Since transforming
an object containing such active elements is not always visually identical to transforming
what it "looks like", this routine preserves the full structure and editability of the
symbol definition, at the cost of sometimes not preserving the appearance of the instance.
Does not delete symbolArt. */
AIAPI AIErr (*BreakLinkToSymbol) ( AIArtHandle symbolArt,
short paintOrder, AIArtHandle prep, AIArtHandle *expandedArt );
/** Analogous to AIObjectSetSuite::RetargetForCurrentDocument() and AIPathStyleSuite::RetargetForCurrentDoc().
Intended primarily for drag-and-drop between library palettes and the main document
palette.
This function can be safely used with fill patterns and brush patterns as well as
with symbol patterns (see the AIPatternSuite and AIBrushPatternSuite.) Therefore the
description below refers to "patterns". This should be taken to mean a symbol pattern
if passed a symbol pattern, a fill pattern if passed a fill pattern, etc.
The function was not needed for fill patterns because they are usually retargetted
indirectly using the AIPathStyleSuite, and it was not needed for brush patterns
because they are usually retargetted indirectly using the AIObjectSetSuite. But
there is no corresponding data structure that wraps around a symbol pattern in
a palette.
If the srcPattern is in the current document, just returns it back.
If the srcPattern is not in the current document, but there is already a pattern
in the current document with the same name and the same definition, returns the
handle to that pattern.
If the srcPattern is not in the current document and there is no pattern with the
same name and definition, then it creates a new pattern in the current document
with the same definition art, and a name based on the srcPattern's name (possibly
appending numbers if the srcPattern's name is assigned to a pattern in the current
document with a different definition.) All other global objects (colors, patterns,
brushes, styles, etc.) used indirectly in the definition are similarly retargetted,
using an existing object if one matches and creating a new one otherwise.
For purposes of determining sameness, a listed symbol never matches an unlisted one,
even if they otherwise have the same name and definition.
*/
AIAPI AIErr (*RetargetForCurrentDocument) ( AIPatternHandle srcPattern, AIPatternHandle *dstPattern );
// New for Illustrator 11:
/** Like CopySymbolPatternArt(), but it inserts a copy of the prototype as passed through the
AIArtConverterSuite::ArtConvertToOutline() with the given options. Calling this is
usually more efficient than calling CopySymbolPatternArt() followed by ArtConvertToOutline(),
because it caches the outline in a dictionary the first time it is generated, and if
asked a second time with the same options, returns the cached outline.
Note: If the given options cause nothing to be generated, e.g., if #kOutlineEliminateUnpainted
is on and all the objects in the symbol are unpainted, then *newArt will be returned as null
and kNoErr will be returned. So always check for a null return art, and do not assume that
it is equivalent to an error condition. */
AIAPI AIErr (*CopySymbolPatternOutline) ( AIPatternHandle symbolPattern,
short paintOrder, AIArtHandle prep, AIArtHandle *newArt, long convertToOutlineOptions );
/** Analogous to InsertExpandedSymbolArt(), except that it transforms the outline proxy. */
AIAPI AIErr (*InsertSymbolArtOutline) ( AIArtHandle symbolArt,
short paintOrder, AIArtHandle prep, AIArtHandle *expandedArt, long convertToOutlineOptions );
/** This 'peeks' at the actual cached outline, returning null if none has been generated yet
for the given options. The art returned cannot be edited, just examined or duplicated!! */
AIAPI AIErr (*PeekCachedPatternOutline) ( AIPatternHandle symbolPattern, AIArtHandle *outlineArt, long convertToOutlineOptions );
} AI120SymbolSuite;
#include "AIHeaderEnd.h"
#endif
| 58.67688 | 130 | 0.7662 |
d6221fcccb92310e6a4b7ab6976f0637546a8ea6 | 471 | h | C | ProgI_TP2_H17_PierreAlexandreGarneau/CollisionSprite.h | PierreAlexandreGarneau/ProgAvI_H17_TP2_FinalFantasy_33 | dcc55483a52f1202e7f12133cc35c7041030775f | [
"MIT"
] | null | null | null | ProgI_TP2_H17_PierreAlexandreGarneau/CollisionSprite.h | PierreAlexandreGarneau/ProgAvI_H17_TP2_FinalFantasy_33 | dcc55483a52f1202e7f12133cc35c7041030775f | [
"MIT"
] | null | null | null | ProgI_TP2_H17_PierreAlexandreGarneau/CollisionSprite.h | PierreAlexandreGarneau/ProgAvI_H17_TP2_FinalFantasy_33 | dcc55483a52f1202e7f12133cc35c7041030775f | [
"MIT"
] | null | null | null | #pragma once
#include "Sprite.h"
#include "MapSprite.h"
#include "CollisionDirection.h"
class CollisionSprite : public Sprite
{
public:
CollisionSprite(MapSprite* ms, float x, float y, float w, float h, CollisionDirection direction);
void Update();
virtual void OnCollisionEnter(b2Fixture* fixture);
virtual void OnCollisionLeave(b2Fixture* fixture);
private:
MapSprite* mmapSprite;
float mx;
float my;
float mw;
float mh;
CollisionDirection mdirection;
};
| 19.625 | 98 | 0.764331 |
aabbf216f1d223be4b17fb3388b0b4db7f66373d | 1,965 | h | C | DefineStructure/input_output.h | marufdsi/grappolo | f9c024f6d4e0fdaa0b7af7bb2f3704474a30afec | [
"BSD-3-Clause"
] | null | null | null | DefineStructure/input_output.h | marufdsi/grappolo | f9c024f6d4e0fdaa0b7af7bb2f3704474a30afec | [
"BSD-3-Clause"
] | null | null | null | DefineStructure/input_output.h | marufdsi/grappolo | f9c024f6d4e0fdaa0b7af7bb2f3704474a30afec | [
"BSD-3-Clause"
] | null | null | null | #ifndef __input__output
#define __input__output
#include "defs.h"
comm_type removeEdges(comm_type NV, comm_type NE, edge *edgeList); //Remove duplicates
void SortEdgesUndirected(comm_type NV, comm_type NE, edge *list1, edge *list2, comm_type *ptrs);
void loadMetisFileFormat(graph *G, const char* filename); //Metis (DIMACS#10)
bool parse_MatrixMarket(graph * G, char *fileName); //Matrix-Market
void parse_MatrixMarket_Sym_AsGraph(graph * G, char *fileName);
void parse_DirectedEdgeList(dGraph * G, char *fileName); //Directed graph
void parse_UndirectedEdgeListWeighted(graph * G, char *fileName); // for John F's graphs
void parse_UndirectedEdgeList(graph * G, char *fileName);
void parse_EdgeListBinaryNew(graph * G, char *fileName);
void parse_PajekFormatUndirected(graph* G, char* fileName);
void parse_PajekFormat(graph* G, char* fileName);
void parse_Dimacs9FormatDirectedNewD(graph* G, char* fileName);
void parse_SNAP(graph * G, char *fileName);
void parse_SNAP_GroundTruthCommunities(char *fileVertexMap, char *fileGroundTruth);
void parse_UndirectedEdgeListFromJason(graph * G, char *fileName); //Data from Jason
void parse_UndirectedEdgeListDarpaHive(graph * G, char *fileName); //DARPA-HIVE Challenge
void writeGraphBinaryFormatNew(graph* G, char *filename, comm_type weighted);
void writeGraphMetisSimpleFormat(graph* G, char *filename);
void writeGraphMatrixMarketFormatSymmetric(graph* G, char *filename);
void writeGraphPajekFormat(graph* G, char *filename); //Pajek
void writeGraphPajekFormatWithCommunityInfo(graph* G, char *filename, comm_type *C); //Pajek+Community
void writeGraphMatrixMarketFormatSymmetricReordered(graph* G, char *filename, comm_type *old2NewMap);
void writeGraphMatrixMarketFormatBipartiteReordered(graph* G, char *filename, comm_type *old2NewMap);
void parse_EdgeListCompressedHDF5(graph * G, char *fileName);
void parse_EdgeListCompressedHDF5NoDuplicates(graph * G, char *fileName);
using namespace std;
#endif
| 49.125 | 102 | 0.804071 |
d290fd167cd7f68f099decec6455773d3532b106 | 6,207 | h | C | cegui/include/CEGUI/falagard/LayerSpecification.h | cbeck88/cegui-mirror | 50d3a670b22fd957eba06549a9a7e04796d0b92f | [
"MIT"
] | null | null | null | cegui/include/CEGUI/falagard/LayerSpecification.h | cbeck88/cegui-mirror | 50d3a670b22fd957eba06549a9a7e04796d0b92f | [
"MIT"
] | null | null | null | cegui/include/CEGUI/falagard/LayerSpecification.h | cbeck88/cegui-mirror | 50d3a670b22fd957eba06549a9a7e04796d0b92f | [
"MIT"
] | null | null | null | /***********************************************************************
created: Mon Jun 13 2005
author: Paul D Turner <paul@cegui.org.uk>
*************************************************************************/
/***************************************************************************
* Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************/
#ifndef _CEGUIFalLayerSpecification_h_
#define _CEGUIFalLayerSpecification_h_
#include "./SectionSpecification.h"
#include "../Window.h"
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4251)
#endif
// Start of CEGUI namespace section
namespace CEGUI
{
/*!
\brief
Class that encapsulates a single layer of imagery.
*/
class CEGUIEXPORT LayerSpecification
{
public:
//! The container type for SectionSpecifications
typedef std::vector<SectionSpecification> SectionSpecificationList;
//! The container type for pointers to SectionSpecifications
typedef std::vector<SectionSpecification*> SectionSpecificationPointerList;
/*!
\brief
Constructor.
\param priority
Specifies the priority of the layer. Layers with higher priorities will be drawn on top
of layers with lower priorities.
*/
LayerSpecification(unsigned int priority = 0);
/*!
\brief
Render this layer.
\param srcWindow
Window to use when calculating pixel values from BaseDim values.
\return
Nothing.
*/
void render(Window& srcWindow, const ColourRect* modcols = 0, const Rectf* clipper = 0, bool clipToDisplay = false) const;
/*!
\brief
Render this layer.
\param srcWindow
Window to use when calculating pixel values from BaseDim values.
\param baseRect
Rect to use when calculating pixel values from BaseDim values.
\return
Nothing.
*/
void render(Window& srcWindow, const Rectf& baseRect, const ColourRect* modcols = 0, const Rectf* clipper = 0, bool clipToDisplay = false) const;
/*!
\brief
Add a section specification to the layer.
A section specification is a reference to a named ImagerySection within the WidgetLook.
\param section
SectionSpecification object descibing the section that should be added to this layer.
\return
Nothing,
*/
void addSectionSpecification(const SectionSpecification& section);
/*!
\brief
Clear all section specifications from this layer,
\return
Nothing.
*/
void clearSectionSpecifications();
/*!
\brief
Return the priority of this layer.
\return
unsigned int value descibing the priority of this LayerSpecification.
*/
unsigned int getLayerPriority() const;
/*!
\brief
Sets the priority of this layer.
\return
unsigned int value descibing the priority of this LayerSpecification.
*/
void setLayerPriority(unsigned int priority);
/*!
\brief
Writes an xml representation of this Layer to \a out_stream.
\param xml_stream
Stream where xml data should be output.
\return
Nothing.
*/
void writeXMLToStream(XMLSerializer& xml_stream) const;
/*!
\brief
Returns a reference to the vector of SectionSpecifications that are currently added to this LayerSpecification.
\return
A const reference to the vector SectionSpecifications that are currently added to this LayerSpecification
*/
const SectionSpecificationList& getSectionSpecifications() const;
/*!
\brief
Returns a vector of pointers to the SectionSpecifications that are currently added to this LayerSpecification. If a
SectionSpecification is added or removed from this LayerSpecification, then the pointers in this vector are not valid
anymore. The function should then be called again to retrieve valid pointers.
\return
A vector of pointers to the SectionSpecifications that are currently added to this LayerSpecification
*/
SectionSpecificationPointerList getSectionSpecificationPointers();
//! The comparison operator, which is used for sorting
bool operator< (const LayerSpecification& otherLayerSpec) const;
private:
//! Collection of SectionSpecification instances
SectionSpecificationList d_sections;
//! Priority of the layer
unsigned int d_layerPriority;
};
} // End of CEGUI namespace section
#if defined(_MSC_VER)
# pragma warning(pop)
#endif
#endif // end of guard _CEGUIFalLayerSpecification_h_
| 33.733696 | 153 | 0.62349 |
d2b10e0b2f39a7db59d8e86d96a151b267ace1c4 | 8,586 | c | C | mp1/http_client.c | Atrifex/ECE-438 | fbf2c3f51291bfa347abaa06f843e2d20d5239f6 | [
"MIT"
] | 2 | 2019-04-25T00:24:55.000Z | 2019-04-25T04:35:05.000Z | mp1/http_client.c | Atrifex/ECE-438 | fbf2c3f51291bfa347abaa06f843e2d20d5239f6 | [
"MIT"
] | null | null | null | mp1/http_client.c | Atrifex/ECE-438 | fbf2c3f51291bfa347abaa06f843e2d20d5239f6 | [
"MIT"
] | 1 | 2020-10-02T21:32:34.000Z | 2020-10-02T21:32:34.000Z | /*
* MP1 http_client
* Author: Rishi Thakkar
* Assignment: MP1
* Date: 2/07/2017
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
// Error checking
#define PREFIX_S "http://"
#define ERROR -1
#define TRUE 1
#define FALSE 0
// Default values
#define DEFAULT_PORT "80"
#define MAXDATASIZE 3000 // max bytes for communication
// Communication Values
#define GET_S "GET /"
#define HTTP_S " HTTP/1.0\r\n"
#define HOST_S "Host: "
#define CRLF "\r\n"
#define TWO_CRLF "\r\n\r\n"
#define RDIR_RESP_1 "HTTP/1.1 301"
#define RDIR_RESP_0 "HTTP/1.0 301"
#define LOCATION "Location: "
#define REDIR 1
#define COMM_SUCCESS 0
#define DEFAULT 0
/**
A modified version of strtok_mod that returns a poitner to the second
half of the token instead of the first
@param str - Input string to be broken into tokens
@param delim - delimitor to use to break
@return - pointer to the second toke
*/
char * strtok_mod(char *str, const char *delim)
{
int lengthPre, lengthPost;
lengthPre = strlen(str);
strtok(str, delim);
lengthPost = strlen(str);
return (lengthPre == lengthPost)? NULL : (str + lengthPost + 1);
}
/**
Used to parse the inputs into the 3 chunks of information that are needed
to connect to the server.
@param info - an array of character pointers in which to store parsed infromation
@param arguments - string to parse
@return - error value
*/
int parse_inputs(char * info[4], char * arguments)
{
if(strncmp(arguments, PREFIX_S, strlen(PREFIX_S)) != 0)
return ERROR;
arguments[0] = '8';
arguments[1] = '0';
arguments[2] = '\0';
// extract server name
info[0] = arguments + 7;
// extract path
info[2] = strtok_mod(info[0], "/");
if(info[2] == NULL){
info[2] = arguments + 2;
}
// extract port or use default port
info[1] = strtok_mod(info[0], ":");
if(info[1] == NULL){
info[1] = arguments;
}
return 0;
}
/**
Parses the url provided by the HTTP response for redirection.
It uses parse_inputs() as a helper function.
@param sockfd - the fd
@param info - array of http communication info
@param redirectionURL - the URL to redirect to
*/
void parse_redirection(int sockfd, char * info[4], char * redirectionURL)
{
unsigned int url_length;
char * parser;
// point to url
redirectionURL += strlen(LOCATION);
parser = strchr(redirectionURL, '\r');
url_length = parser - redirectionURL;
info[3] = (char *)malloc((url_length+1)*sizeof(char));
strncpy(info[3], redirectionURL, url_length);
info[3][url_length] = '\0';
if(parse_inputs(info, info[3]) == ERROR){
close(sockfd);
fprintf(stderr,"Redirection URL not valid\n");
exit(1);
}
}
/**
Function creates a TCP connection with a server
@param server - string with hostname
@param port - port to connect to
@return - sockfd
*/
int connect_TCP(char * server, char * port)
{
int sockfd;
struct addrinfo hints, * servinfo, * p;
int gai_rv;
memset(&hints, 0, sizeof hints);
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
if ((gai_rv = getaddrinfo(server, port, &hints, &servinfo)) != 0) {
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(gai_rv));
exit(1);
}
// loop through all the results and connect to the first we can
for(p = servinfo; p != NULL; p = p->ai_next) {
// get a socket to be able to communicate
if ((sockfd = socket(p->ai_family, p->ai_socktype,
p->ai_protocol)) == -1) {
perror("client: socket");
continue;
}
// connect with server
if (connect(sockfd, p->ai_addr, p->ai_addrlen) == -1) {
close(sockfd);
perror("client: connect");
continue;
}
break;
}
// if the addresses are all invalid
if (p == NULL) {
fprintf(stderr, "client: failed to connect\n");
freeaddrinfo(servinfo); // all done with this structure
exit(2);
}
freeaddrinfo(servinfo); // all done with this structure
return sockfd;
}
/**
Abstraction of the get request. User only needs to pass the path.
Everyting else is done using default values.
@param sockfd - the fd
@param host - hostname
@param buffer - path of file
*/
void get_request(int sockfd, char * host, char * port, char * path)
{
int bytes_sent;
if ((bytes_sent = send(sockfd, GET_S, strlen(GET_S), 0)) == -1){
perror("send");
close(sockfd);
exit(1);
}
if ((bytes_sent = send(sockfd, path, strlen(path), 0)) == -1){
perror("send");
close(sockfd);
exit(1);
}
if ((bytes_sent = send(sockfd, HTTP_S, strlen(HTTP_S), 0)) == -1){
perror("send");
close(sockfd);
exit(1);
}
if ((bytes_sent = send(sockfd, HOST_S, strlen(HOST_S), 0)) == -1){
perror("send");
close(sockfd);
exit(1);
}
if ((bytes_sent = send(sockfd, host, strlen(host), 0)) == -1){
perror("send");
close(sockfd);
exit(1);
}
if ((bytes_sent = send(sockfd, ":", 1, 0)) == -1){
perror("send");
close(sockfd);
exit(1);
}
if ((bytes_sent = send(sockfd, port, strlen(port), 0)) == -1){
perror("send");
close(sockfd);
exit(1);
}
if ((bytes_sent = send(sockfd, TWO_CRLF, strlen(TWO_CRLF), 0)) == -1){
perror("send");
close(sockfd);
exit(1);
}
}
/**
Function is used to receive a HTTP response and check for redirection.
If there is redirection then it handles it correctly and tells main that a new connection
needs to be formed.
@param sockfd - the fd
@param info - array of http communication info
@return - returns redirection status
*/
int recv_msg(int sockfd, char * info[4])
{
FILE * outputFile;
int bytes_read;
char buf_in[MAXDATASIZE];
char * message_parser, * str_redir;
char parse_for_msgbdy = TRUE;
static unsigned char redir_flag = DEFAULT;
// Open file for storing messages
outputFile = fopen("output", "w");
// free pointers to prepare for redirection
if(redir_flag == REDIR){
// NOTE: done only after being redirected once
free(info[3]);
info[3] = NULL;
}
do{
// read MAXDATASIZE characters
if ((bytes_read = recv(sockfd, buf_in, MAXDATASIZE-1, 0)) == -1) {
perror("recv");
close(sockfd);
exit(1);
}
buf_in[bytes_read] = '\0';
// parse to find message body
if(parse_for_msgbdy == TRUE){
// check for redirection
if((strstr(buf_in, RDIR_RESP_0) != NULL) || (strstr(buf_in, RDIR_RESP_1) != NULL)){
if((str_redir = strstr(buf_in, LOCATION)) != NULL){
parse_redirection(sockfd, info, str_redir);
redir_flag = REDIR;
close(sockfd);
return REDIR;
}
}
// search for end of header
if((message_parser = strstr(buf_in, TWO_CRLF)) == NULL)
continue;
// write message to output file
message_parser += strlen(TWO_CRLF);
fwrite(message_parser, sizeof(char), bytes_read - (message_parser - buf_in), outputFile);
parse_for_msgbdy = FALSE;
} else{
// write message to output file
fwrite(buf_in, sizeof(char), bytes_read, outputFile);
}
fflush(outputFile);
} while(bytes_read != 0);
// close the file being written to
fclose(outputFile);
return COMM_SUCCESS;
}
int main(int argc, char *argv[])
{
int sockfd;
char * http_conn_info[4];
unsigned char redir_flag = DEFAULT;
// Error Checking and Parsing inputs
if ((argc != 2) || (parse_inputs(http_conn_info, argv[1]) == ERROR)){
fprintf(stderr,"usage: ./http_client http://hostname[:port]/path/to/file\n");
exit(1);
}
// Connect and Communicate
do {
// connect to server
sockfd = connect_TCP(http_conn_info[0], http_conn_info[1]);
// send GET Request
get_request(sockfd, http_conn_info[0], http_conn_info[1], http_conn_info[2]);
// read message or retry if redirected
} while(recv_msg(sockfd, http_conn_info) == REDIR);
return 0;
}
| 25.939577 | 101 | 0.596203 |
306290ef768304d68f7f5f00196efa4e75285011 | 7,224 | h | C | extensions/common/file_util.h | zipated/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 2,151 | 2020-04-18T07:31:17.000Z | 2022-03-31T08:39:18.000Z | extensions/common/file_util.h | cangulcan/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 395 | 2020-04-18T08:22:18.000Z | 2021-12-08T13:04:49.000Z | extensions/common/file_util.h | cangulcan/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 338 | 2020-04-18T08:03:10.000Z | 2022-03-29T12:33:22.000Z | // Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef EXTENSIONS_COMMON_FILE_UTIL_H_
#define EXTENSIONS_COMMON_FILE_UTIL_H_
#include <map>
#include <string>
#include <vector>
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "extensions/common/manifest.h"
#include "extensions/common/message_bundle.h"
class ExtensionIconSet;
class GURL;
namespace base {
class FilePath;
}
namespace extensions {
class Extension;
struct InstallWarning;
// Utilities for manipulating the on-disk storage of extensions.
namespace file_util {
extern const base::FilePath::CharType kTempDirectoryName[];
// Sets the flag to enable safe installation (i.e. flush all installed files).
void SetUseSafeInstallation(bool use_safe_installation);
// Copies |unpacked_source_dir| into the right location under |extensions_dir|.
// The destination directory is returned on success, or empty path is returned
// on failure.
base::FilePath InstallExtension(const base::FilePath& unpacked_source_dir,
const std::string& id,
const std::string& version,
const base::FilePath& extensions_dir);
// Removes all versions of the extension with |id| from |extensions_dir|.
void UninstallExtension(const base::FilePath& extensions_dir,
const std::string& id);
// Loads and validates an extension from the specified directory. Returns NULL
// on failure, with a description of the error in |error|.
scoped_refptr<Extension> LoadExtension(const base::FilePath& extension_root,
Manifest::Location location,
int flags,
std::string* error);
// The same as LoadExtension except use the provided |extension_id|.
scoped_refptr<Extension> LoadExtension(const base::FilePath& extension_root,
const std::string& extension_id,
Manifest::Location location,
int flags,
std::string* error);
// Loads an extension manifest from the specified directory. Returns NULL
// on failure, with a description of the error in |error|.
std::unique_ptr<base::DictionaryValue> LoadManifest(
const base::FilePath& extension_root,
std::string* error);
// Convenience overload for specifying a manifest filename.
std::unique_ptr<base::DictionaryValue> LoadManifest(
const base::FilePath& extension_root,
const base::FilePath::CharType* manifest_filename,
std::string* error);
// Returns true if the given extension object is valid and consistent.
// May also append a series of warning messages to |warnings|, but they
// should not prevent the extension from running.
//
// Otherwise, returns false, and a description of the error is
// returned in |error|.
bool ValidateExtension(const Extension* extension,
std::string* error,
std::vector<InstallWarning>* warnings);
// Returns a list of files that contain private keys inside |extension_dir|.
std::vector<base::FilePath> FindPrivateKeyFiles(
const base::FilePath& extension_dir);
// We need to reserve the namespace of entries that start with "_" for future
// use by Chrome.
// If any files or directories are found using "_" prefix and are not on
// reserved list we return false, and set error message.
bool CheckForIllegalFilenames(const base::FilePath& extension_path,
std::string* error);
// We need to reserve the names of special Windows filenames, such as
// "com2.zip."
// If any files or directories are found to be using a reserved Windows
// filename, we return false, and set error message.
bool CheckForWindowsReservedFilenames(const base::FilePath& extension_dir,
std::string* error);
// Returns a path to a temporary directory for unpacking an extension that will
// be installed into |extensions_dir|. Creates the directory if necessary.
// The directory will be on the same file system as |extensions_dir| so
// that the extension directory can be efficiently renamed into place. Returns
// an empty file path on failure.
base::FilePath GetInstallTempDir(const base::FilePath& extensions_dir);
// Helper function to delete files. This is used to avoid ugly casts which
// would be necessary with PostMessage since base::Delete is overloaded.
// TODO(skerner): Make a version of Delete that is not overloaded in file_util.
void DeleteFile(const base::FilePath& path, bool recursive);
// Get a relative file path from a chrome-extension:// URL.
base::FilePath ExtensionURLToRelativeFilePath(const GURL& url);
// Returns true if the icons in the icon set exist. Oherwise, populates
// |error| with the |error_message_id| for an invalid file.
bool ValidateExtensionIconSet(const ExtensionIconSet& icon_set,
const Extension* extension,
int error_message_id,
std::string* error);
// Loads extension message catalogs and returns message bundle.
// Returns NULL on error or if the extension is not localized.
MessageBundle* LoadMessageBundle(const base::FilePath& extension_path,
const std::string& default_locale,
std::string* error);
// Loads the extension message bundle substitution map. Contains at least
// the extension_id item.
MessageBundle::SubstitutionMap* LoadMessageBundleSubstitutionMap(
const base::FilePath& extension_path,
const std::string& extension_id,
const std::string& default_locale);
// Loads the extension message bundle substitution map for a non-localized
// extension. Contains only the extension_id item.
// This doesn't require hitting disk, so it's safe to call on any thread.
MessageBundle::SubstitutionMap* LoadNonLocalizedMessageBundleSubstitutionMap(
const std::string& extension_id);
// Loads the extension message bundle substitution map from the specified paths.
// Contains at least the extension_id item.
MessageBundle::SubstitutionMap* LoadMessageBundleSubstitutionMapFromPaths(
const std::vector<base::FilePath>& paths,
const std::string& extension_id,
const std::string& default_locale);
// Helper functions for getting paths for files used in content verification.
base::FilePath GetVerifiedContentsPath(const base::FilePath& extension_path);
base::FilePath GetComputedHashesPath(const base::FilePath& extension_path);
// Helper function to get path used for the indexed ruleset by the Declarative
// Net Request API.
base::FilePath GetIndexedRulesetPath(const base::FilePath& extension_path);
// Returns the list of file-paths reserved for use by the Extension system in
// the kMetadataFolder.
std::vector<base::FilePath> GetReservedMetadataFilePaths(
const base::FilePath& extension_path);
} // namespace file_util
} // namespace extensions
#endif // EXTENSIONS_COMMON_FILE_UTIL_H_
| 43.257485 | 80 | 0.710825 |
65f692f5ca2803f476b87be2c4b8e9ea33319006 | 4,437 | h | C | bnn/src/library/hls_include/hls_frexp_apfixed.h | fcaspe/BNN-PYNQ | 3053526aa214cf0474e0cb62ce2a804ff758d862 | [
"BSD-3-Clause"
] | 3 | 2021-04-23T05:28:05.000Z | 2022-02-01T21:54:22.000Z | bnn/src/library/hls_include/hls_frexp_apfixed.h | fcaspe/BNN-PYNQ | 3053526aa214cf0474e0cb62ce2a804ff758d862 | [
"BSD-3-Clause"
] | null | null | null | bnn/src/library/hls_include/hls_frexp_apfixed.h | fcaspe/BNN-PYNQ | 3053526aa214cf0474e0cb62ce2a804ff758d862 | [
"BSD-3-Clause"
] | null | null | null |
/*****************************************************************************
*
* Author: Xilinx, Inc.
*
* This text contains proprietary, confidential information of
* Xilinx, Inc. , is distributed by under license from Xilinx,
* Inc., and may be used, copied and/or disclosed only pursuant to
* the terms of a valid license agreement with Xilinx, Inc.
*
* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"
* AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND
* SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE,
* OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,
* APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION
* THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,
* AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE
* FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY
* WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE
* IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR
* REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF
* INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE.
*
* Xilinx products are not intended for use in life support appliances,
* devices, or systems. Use in such applications is expressly prohibited.
*
* (c) Copyright 2018 Xilinx Inc.
* All rights reserved.
*
*****************************************************************************/
/**
* @file hls_frexp_ap_fixed.h
* @brief implement frexp function for ap_fixed data type.
*/
#ifndef _X_HLS_FREXP_APFIXED_H_
#define _X_HLS_FREXP_APFIXED_H_
#include "ap_fixed.h"
#include "hls_round_copysign_apfixed.h"
namespace frexp_internal {
template<int W, int I>
ap_fixed<W,I> frexp(ap_fixed<W,I> x,
ap_fixed<W,I>* exp){
if(I<0) {
*exp = 0;
return x;
}
static const int F = W - I;
static const int we = W > 5 ? W/2 : 3;//width of exp, should be log2(W) + 1;
ap_int<we> e = 0;
ap_ufixed<W, I> r_p = 0;
ap_fixed<W+1, I+1> xi = x;
ap_ufixed<W, I> x_p = fabs_fixed(xi);
static const ap_uint<3> clz_table_6bit[64] = {7, 6, 5, 5, 4, 4, 4, 4,
3, 3, 3, 3, 3, 3, 3, 3,
2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1};
int pos = 0;//should be log(mqx(I,F));
//use clz_table to reduce the loop_tripcount
static const int loop_nm = W > 6 ? (W + 5)/6 : 1;
CLZ_LOOP:
for(int l = loop_nm; l > 0; --l){
#pragma HLS pipeline II=1
ap_uint<6> t = 0;
if(l*6 > W) t = x_p(W - 1, (l - 1) * 6);
else t = x_p(l * 6 - 1, (l - 1) * 6);
if((t & 0x3f) != 0) {
pos = l * 6 - clz_table_6bit[t];
break;
}
}
if(pos >= 0) {
e = pos + 1 - F;
if(F > 0) {
ap_uint<we> w_f = (pos + 1) < F ? (pos + 1) : F;
r_p(F - 1,F - w_f) = x_p(pos, pos + 1 - w_f);
}
} else {
e = 0;
r_p = 0;
}
ap_fixed<W, I> r = 0;
if(xi[W-1]) r = -r_p;
else r = r_p;
#ifndef __SYNTHESIS__
assert(r > -1 && r < 1);
#endif
*exp = e;
return r;
}
template<int W, int I>
ap_ufixed<W,I> frexp(ap_ufixed<W,I> x,
ap_ufixed<W,I>* exp){
ap_fixed<W+1, I+1> xe = x;
ap_fixed<W+1, I+1> ee = 0;
ap_fixed<W+1, I+1> r = frexp(xe,&ee);
*exp = ee;
return r;
}
template<int I>
ap_uint<I> frexp(ap_uint<I> x,
ap_uint<I>* exp) {
ap_fixed<I, I> xe = x;
ap_fixed<I, I> ee = 0;
ap_fixed<I, I> r = frexp(xe,&ee);
*exp = ee;
return r;
}
template<int I>
ap_int<I> frexp(ap_int<I> x,
ap_int<I>* exp) {
ap_fixed<I+1, I+1> xe = x;
ap_fixed<I+1, I+1> ee = 0;
ap_fixed<I+1, I+1> r = frexp(xe,&ee);
*exp = ee;
return r;
}
}
#endif//define _X_HLS_FREXP_APFIXED_H_
// 67d7842dbbe25473c3c32b93c0da8047785f30d78e8a024de1b57352245f9689
| 34.130769 | 80 | 0.51341 |
e718147846e15e7b1c9722ad0e19c69852cac806 | 2,796 | c | C | src/aix-memory.c | loongson-zn/Bitbucket-papi | dcf0ce127719927154f55cb29b643abb604227b8 | [
"BSD-3-Clause"
] | null | null | null | src/aix-memory.c | loongson-zn/Bitbucket-papi | dcf0ce127719927154f55cb29b643abb604227b8 | [
"BSD-3-Clause"
] | null | null | null | src/aix-memory.c | loongson-zn/Bitbucket-papi | dcf0ce127719927154f55cb29b643abb604227b8 | [
"BSD-3-Clause"
] | null | null | null | /*
* File: aix-memory.c
* Author: Kevin London
* london@cs.utk.edu
*
* Mods: <your name here>
* <your email address>
*/
#include "papi.h"
#include "papi_internal.h"
int get_memory_info(PAPI_hw_info_t * mem_info)
{
PAPI_mh_level_t *L = mem_info->mem_hierarchy.level;
/* Not quite sure what bit 30 indicates.
I'm assuming it flags a unified tlb */
if (_system_configuration.tlb_attrib & (1 << 30)) {
L[0].tlb[0].type = PAPI_MH_TYPE_UNIFIED;
L[0].tlb[0].num_entries = _system_configuration.itlb_size;
L[0].tlb[0].type = PAPI_MH_TYPE_UNIFIED;
} else {
L[0].tlb[0].type = PAPI_MH_TYPE_INST;
L[0].tlb[0].num_entries = _system_configuration.itlb_size;
L[0].tlb[0].associativity = _system_configuration.itlb_asc;
L[0].tlb[1].type = PAPI_MH_TYPE_DATA;
L[0].tlb[1].num_entries = _system_configuration.dtlb_size;
L[0].tlb[1].associativity = _system_configuration.dtlb_asc;
}
/* Not quite sure what bit 30 indicates.
I'm assuming it flags a unified cache */
if (_system_configuration.cache_attrib & (1 << 30)) {
L[0].cache[0].type = PAPI_MH_TYPE_UNIFIED;
L[0].cache[0].size = _system_configuration.icache_size;
L[0].cache[0].associativity = _system_configuration.icache_asc;
L[0].cache[0].line_size = _system_configuration.icache_line;
} else {
L[0].cache[0].type = PAPI_MH_TYPE_INST;
L[0].cache[0].size = _system_configuration.icache_size;
L[0].cache[0].associativity = _system_configuration.icache_asc;
L[0].cache[0].line_size = _system_configuration.icache_line;
L[0].cache[1].type = PAPI_MH_TYPE_DATA;
L[0].cache[1].size = _system_configuration.dcache_size;
L[0].cache[1].associativity = _system_configuration.dcache_asc;
L[0].cache[1].line_size = _system_configuration.dcache_line;
}
L[1].cache[0].type = PAPI_MH_TYPE_UNIFIED;
L[1].cache[0].size = _system_configuration.L2_cache_size;
L[1].cache[0].associativity = _system_configuration.L2_cache_asc;
/* is there a line size for Level 2 cache? */
/* it looks like we've always got at least 2 levels of info */
/* what about level 3 cache? */
mem_info->mem_hierarchy.levels = 2;
return PAPI_OK;
}
long _papi_hwd_get_dmem_info(int option)
{
struct procsinfo pi;
pid_t mypid = getpid();
pid_t pid;
int found = 0;
pid = 0;
while (1) {
if (getprocs(&pi, sizeof(pi), 0, 0, &pid, 1) != 1)
break;
if (mypid == pi.pi_pid) {
found = 1;
break;
}
}
if (!found)
return (PAPI_ESYS);
switch (option) {
case PAPI_GET_RESSIZE:
return (pi.pi_drss + pi.pi_trss);
case PAPI_GET_SIZE:
return (pi.pi_size);
default:
return (PAPI_EINVAL);
}
}
| 31.772727 | 69 | 0.652003 |
aaa38b7ce7e563ea198af7cdbc29b0abd786f752 | 2,524 | c | C | runtime/libpgmath/lib/common/mth_vreturns.c | pawosm-arm/flang | dc6ca7de36567704d8117536eed60344683d0845 | [
"Apache-2.0"
] | 1 | 2019-12-11T17:43:58.000Z | 2019-12-11T17:43:58.000Z | runtime/libpgmath/lib/common/mth_vreturns.c | pawosm-arm/flang | dc6ca7de36567704d8117536eed60344683d0845 | [
"Apache-2.0"
] | 2 | 2019-12-29T21:15:40.000Z | 2020-06-15T11:21:10.000Z | runtime/libpgmath/lib/common/mth_vreturns.c | pawosm-arm/flang | dc6ca7de36567704d8117536eed60344683d0845 | [
"Apache-2.0"
] | 3 | 2019-12-21T06:35:35.000Z | 2020-06-07T23:18:58.000Z | /*
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*
* These functions are used in returning two vector arguments from a
* single function.
*
* In particular, the sincos() function returns two results, SIN(x), and
* COS(x). The compiler expects the return values to be in (x86-64) x/ymm0
* and x/ymm1. There is no way with C to return those two values in those
* two registers without some trickery.
*
* Given a function of the form:
*
* VectorType
* FunctionNameReturning2Vectors(vector_type x)
* {
* VectorType sine;
* VectorType cossine;
* return (sine,cosine); <------------ Will not work.
* }
*
* But, because the our compiler ABI uses the same vector registers
* to return the two registers as the x86-64 calling sequence ABI,
* we can call a dummy function with those two "return" values as arguments
* and then do nothing in the dummy function.
*
* This will work as long as the caller does nothing after calling the
* dummy function.
*
* Now function FunctionNameReturning2Vectors becomes:
*
* extern VectorType return2VectorType(VectorType, VectorType);
*
* VectorType
* FunctionNameReturning2Vectors(vector_type x)
* {
* VectorType sine;
* VectorType cossine;
* return (return2VectorType(sine,cosine));
* }
*
*/
#ifdef __cplusplus
extern "C" {
#endif
void
__mth_return2vectors(void)
{
return;
}
#if !defined(TARGET_OSX_X8664)
#if defined(TARGET_LINUX_ARM64)
#define ALIAS(altname) \
void __mth_return2##altname(void) \
__attribute__ ((alias ("__mth_return2vectors")));
#else
/*
* OSX does not support weak aliases - so just use the generic for all
* vector types.
*/
#define ALIAS(altname) \
void __mth_return2##altname(void) \
__attribute__ ((weak, alias ("__mth_return2vectors")));
#endif
ALIAS(vrs4_t)
ALIAS(vrd2_t)
ALIAS(vrs8_t)
ALIAS(vrd4_t)
ALIAS(vrs16_t)
ALIAS(vrd8_t)
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
| 26.291667 | 75 | 0.712361 |
70082a5249e5a2786a5e76e878e5e2e256678fb0 | 1,470 | h | C | Pods/Headers/Public/HXPhotoPicker/HXPhotoBottomSelectView.h | wuvdan/RichTextDemo | 0bb3ae63d4327b95072a73e200bb77c701239aff | [
"MIT"
] | null | null | null | Pods/Headers/Public/HXPhotoPicker/HXPhotoBottomSelectView.h | wuvdan/RichTextDemo | 0bb3ae63d4327b95072a73e200bb77c701239aff | [
"MIT"
] | null | null | null | Pods/Headers/Public/HXPhotoPicker/HXPhotoBottomSelectView.h | wuvdan/RichTextDemo | 0bb3ae63d4327b95072a73e200bb77c701239aff | [
"MIT"
] | null | null | null | //
// HXPhotoBottomSelectView.h
// 照片选择器
//
// Created by 洪欣 on 2019/9/30.
// Copyright © 2019 洪欣. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface HXPhotoBottomSelectView : UIView
@property (copy, nonatomic) NSArray *titles;
@property (strong, nonatomic) UIView *headerView;
@property (copy, nonatomic) NSString *cancelTitle;
@property (copy, nonatomic) void (^ selectCompletion)(NSInteger index, NSString * _Nullable title);
@property (copy, nonatomic) void (^ cancelClick)(void);
/// 显示底部选择视频
/// @param titles 标题数组
/// @param cancelTitle 取消按钮标题
/// @param adaptiveDarkness 是否自适应暗黑风格
/// @param selectCompletion 选择完成
/// @param cancelClick 取消选择
+ (instancetype)showSelectViewWithTitles:(NSArray * _Nullable)titles cancelTitle:(NSString * _Nullable)cancelTitle adaptiveDarkness:(BOOL)adaptiveDarkness selectCompletion:(void (^)(NSInteger index, NSString *title))selectCompletion cancelClick:(void (^ _Nullable)(void))cancelClick;
+ (instancetype)showSelectViewWithTitles:(NSArray * _Nullable)titles headerView:(UIView *)headerView selectCompletion:(void (^)(NSInteger index, NSString *title))selectCompletion cancelClick:(void (^ _Nullable)(void))cancelClick;
- (void)showView;
- (void)hideView;
/// 重新计算视图高度
- (void)recalculateHeight;
@end
@interface HXPhotoBottomSelectViewCell : UITableViewCell
@property (assign, nonatomic) BOOL adaptiveDarkness;
@property (copy, nonatomic) NSString *title;
@end
NS_ASSUME_NONNULL_END
| 35.853659 | 283 | 0.77415 |
4a31d9043230528376fd44adf7e238798d444dd8 | 2,600 | h | C | Common/CFObj.h | FlashSheridan/OMC | 206e38255df5d863c7a2e056ea4bf42dcfb9a155 | [
"MIT"
] | 20 | 2020-01-15T14:55:17.000Z | 2022-03-28T06:23:21.000Z | Common/CFObj.h | FlashSheridan/OMC | 206e38255df5d863c7a2e056ea4bf42dcfb9a155 | [
"MIT"
] | 15 | 2019-08-19T07:28:21.000Z | 2022-01-21T01:06:02.000Z | Common/CFObj.h | FlashSheridan/OMC | 206e38255df5d863c7a2e056ea4bf42dcfb9a155 | [
"MIT"
] | 5 | 2020-02-25T22:19:39.000Z | 2021-04-13T08:32:51.000Z | //**************************************************************************************
// Filename: CFObj.h
// Part of Contextual Menu Workshop by Abracode Inc.
// http://free.abracode.com/cmworkshop/
// Copyright � 2005 Abracode, Inc. All rights reserved.
//
// Description: Template-based CFObjectRef smart pointer.
//
//**************************************************************************************
// Revision History:
// Friday, Oct 16, 2005 - Original
//**************************************************************************************
#pragma once
#include <CoreFoundation/CoreFoundation.h>
typedef enum CFObjRetainType
{
kCFObjRetain,
kCFObjDontRetain
} CFObjRetainType;
template <typename T> class CFObj
{
public:
CFObj() noexcept
: mRef(nullptr)
{
}
CFObj(T inRef, CFObjRetainType inRetainType = kCFObjDontRetain) noexcept
: mRef(inRef)
{
if( (mRef != nullptr) && (inRetainType == kCFObjRetain) )
CFRetain(mRef);
}
explicit CFObj(const CFObj& inRef) noexcept
: mRef(inRef)
{
if(mRef != nullptr)
CFRetain(mRef);
}
virtual ~CFObj() noexcept
{
Release();
}
T Detach() noexcept
{
T outRef = mRef;
mRef = nullptr;
return outRef;
}
void Release() noexcept
{
if(mRef != nullptr)
{
CFRelease(mRef);
mRef = nullptr;
}
}
void Swap(CFObj &inOther) noexcept
{
T tempRef = mRef;
mRef = inOther.mRef;
inOther.mRef = tempRef;
}
void Adopt(T inRef, CFObjRetainType inRetainType = kCFObjDontRetain) noexcept
{
if( (inRef != nullptr) && (inRetainType == kCFObjRetain) )
CFRetain(inRef);
Release();
mRef = inRef;
}
CFObj& operator=(T &inRef) noexcept
{
Adopt(inRef, kCFObjDontRetain);
return *this;
}
CFObj& operator=(const CFObj& inRef) noexcept
{
Adopt(inRef, kCFObjRetain);
return *this;
}
operator T() const noexcept
{
return mRef;
}
T* operator &() noexcept
{
return &mRef;
}
T Get() const noexcept
{
return mRef;
}
T& GetReference() noexcept
{
return mRef;
}
protected:
T mRef;
};
template<class T> bool operator==(CFObj<T>& inObj, nullptr_t)
{
return ((T)inObj == (T)nullptr);
}
template<class T> bool operator!=(CFObj<T>& inObj, nullptr_t)
{
return ((T)inObj != (T)nullptr);
}
| 20.472441 | 88 | 0.501538 |
04033459a9c0d6ce483657c4ce25d35f54af0159 | 406 | h | C | designpattern/reactive_x/reactive_x/src/reactive_x/custom_observer.h | bg1bgst333/Sample | 68e3a5c26c6d9bc1906ce0cca2fd586f0790fa52 | [
"MIT"
] | 9 | 2016-12-22T20:24:09.000Z | 2021-05-08T08:48:24.000Z | designpattern/reactive_x/reactive_x/src/reactive_x/custom_observer.h | bg1bgst333/Sample | 68e3a5c26c6d9bc1906ce0cca2fd586f0790fa52 | [
"MIT"
] | 36 | 2018-08-16T06:43:36.000Z | 2022-03-25T19:01:34.000Z | designpattern/reactive_x/reactive_x/src/reactive_x/custom_observer.h | bg1bgst333/Sample | 68e3a5c26c6d9bc1906ce0cca2fd586f0790fa52 | [
"MIT"
] | 9 | 2016-09-03T02:57:31.000Z | 2021-09-09T02:42:26.000Z | // 二重インクルード防止
#ifndef __CUSTOM_OBSERVER_H_
#define __CUSTOM_OBSERVER_H_
// 独自のヘッダ
#include "observer.h" // interface_observer
// クラスclass_custom_observer
class class_custom_observer : public interface_observer{
// 公開メンバ
public:
// 公開メンバ関数
virtual void completed(); // メンバ関数completed
virtual void error(); // メンバ関数error
virtual void next(std::string value); // メンバ関数next
};
#endif
| 18.454545 | 56 | 0.731527 |
62917e150ce70afebc4db7628ddd6d799a6af653 | 2,429 | h | C | src/map.h | moritzrinow/cdata | ac0e4a4424a9267dd0c430fa71bb0b471007069b | [
"MIT"
] | 5 | 2019-06-21T12:12:19.000Z | 2021-07-06T01:02:31.000Z | src/map.h | moritzrinow/cdata | ac0e4a4424a9267dd0c430fa71bb0b471007069b | [
"MIT"
] | null | null | null | src/map.h | moritzrinow/cdata | ac0e4a4424a9267dd0c430fa71bb0b471007069b | [
"MIT"
] | null | null | null | #ifndef _CDATA_MAP_H
#define _CDATA_MAP_H
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#include "array.h"
#include "types.h"
typedef struct key_val_pair_s {
void *key;
void *val;
} key_val_pair_t;
typedef struct map_func_s {
bool (*key_compare)(void *, void *);
uint32_t (*key_hash)(void *);
void (*key_destroy)(void *);
void (*val_destroy)(void *);
} map_func_t;
typedef struct map_entry_s {
struct map_entry_s *next;
void *key;
void *value;
} map_entry_t;
/*
All keys and values pushed into this
data structure are not copied. The map
only keeps the pointers. Therefore
allocating memory is on you. You can
decide what will happend to the keys and values
memory at map cleanup with setting the key_destroy
and val_destroy function pointers in the map_func_t
data structure.
*/
typedef struct map_s {
alloc_t alloc;
array_t entries;
map_func_t func;
uint32_t num_elem;
} map_t;
typedef struct map_iterator_s {
map_t *map;
map_entry_t *current;
uint32_t index;
} map_iterator_t;
bool map_init(map_t *map,
uint32_t size,
map_func_t func,
bool std_alloc);
void map_destroy(map_t *map);
void *map_add_key(map_t *map,
void *key);
void *map_add_key_value(map_t *map,
void *key,
void *value);
void *map_lookup(map_t *map,
void *key);
bool map_contains_key(map_t *map,
void *key);
void map_remove(map_t *map,
void *key);
bool map_rehash(map_t *map);
void map_merge(map_t *target,
map_t *source);
typedef void (*map_foreach_key_func_t)(void *);
typedef void (*map_foreach_key_val_func_t)(key_val_pair_t pair);
void map_foreach_key(map_t *map,
map_foreach_key_func_t action);
void map_foreach_key_val(map_t *map,
map_foreach_key_val_func_t action);
bool map_iterator_init(map_iterator_t *iterator,
map_t *map);
bool map_iterator_next(map_iterator_t *iterator);
bool map_iterator_first(map_iterator_t *iterator);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // _CDATA_MAP_H
| 27.292135 | 64 | 0.602717 |
2e505105f41e30918e3f7baf0d7340d1c7dbaa14 | 842 | h | C | System/Library/PrivateFrameworks/CoreCDPInternal.framework/CDPDCircleStateObserver.h | lechium/tvOS10Headers | f0c99993da6cc502d36fdc5cb4ff90d94b12bf67 | [
"MIT"
] | 4 | 2017-03-23T00:01:54.000Z | 2018-08-04T20:16:32.000Z | System/Library/PrivateFrameworks/CoreCDPInternal.framework/CDPDCircleStateObserver.h | lechium/tvOS10Headers | f0c99993da6cc502d36fdc5cb4ff90d94b12bf67 | [
"MIT"
] | null | null | null | System/Library/PrivateFrameworks/CoreCDPInternal.framework/CDPDCircleStateObserver.h | lechium/tvOS10Headers | f0c99993da6cc502d36fdc5cb4ff90d94b12bf67 | [
"MIT"
] | 4 | 2017-05-14T16:23:26.000Z | 2019-12-21T15:07:59.000Z | /*
* This header is generated by classdump-dyld 1.0
* on Wednesday, March 22, 2017 at 9:08:13 AM Mountain Standard Time
* Operating System: Version 10.1 (Build 14U593)
* Image Source: /System/Library/PrivateFrameworks/CoreCDPInternal.framework/CoreCDPInternal
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos.
*/
@protocol OS_dispatch_queue, CDPDCircleProxy;
@class NSObject;
@interface CDPDCircleStateObserver : NSObject {
int _circleChangeToken;
BOOL _isObserving;
NSObject*<OS_dispatch_queue> _eventQueue;
id<CDPDCircleProxy> _circleProxy;
}
-(void)dealloc;
-(id)initWithProxy:(id)arg1 ;
-(const char*)_notificationName;
-(void)observeCircleStateWithChangeHandler:(/*^block*/id)arg1 ;
-(void)observeChangeToState:(int)arg1 handler:(/*^block*/id)arg2 ;
-(void)stopObservingCircleStatusChange;
@end
| 29.034483 | 91 | 0.78266 |
fad17c9f1d87791fb345a0f089daa5a85647cbcd | 178 | h | C | src/readstat/sas/ieee.h | gorcha/haven | 66f0d030588666c97a05655859f32c1562264e4c | [
"MIT"
] | 231 | 2016-09-30T16:51:34.000Z | 2022-03-11T16:57:41.000Z | src/readstat/sas/ieee.h | gorcha/haven | 66f0d030588666c97a05655859f32c1562264e4c | [
"MIT"
] | 452 | 2016-09-30T17:06:08.000Z | 2022-03-25T04:30:18.000Z | src/readstat/sas/ieee.h | gorcha/haven | 66f0d030588666c97a05655859f32c1562264e4c | [
"MIT"
] | 108 | 2016-10-06T03:36:21.000Z | 2022-03-15T10:56:29.000Z | #define CN_TYPE_NATIVE 0
#define CN_TYPE_XPORT 1
#define CN_TYPE_IEEEB 2
#define CN_TYPE_IEEEL 3
int cnxptiee(const void *from_bytes, int fromtype, void *to_bytes, int totype);
| 25.428571 | 79 | 0.803371 |
435a148f0c573406f14c53bff516775c21852bdf | 3,543 | c | C | 08. Matrix/strassen.c | dwijaxo/DSA-cpp-Hacktoberfest2021 | 1025c11f9c4795b02163cc32cac4a759189ce4ac | [
"MIT"
] | null | null | null | 08. Matrix/strassen.c | dwijaxo/DSA-cpp-Hacktoberfest2021 | 1025c11f9c4795b02163cc32cac4a759189ce4ac | [
"MIT"
] | null | null | null | 08. Matrix/strassen.c | dwijaxo/DSA-cpp-Hacktoberfest2021 | 1025c11f9c4795b02163cc32cac4a759189ce4ac | [
"MIT"
] | null | null | null | #include <stdio.h>
void Strassen(int n, int (*P)[n],int (*Q)[n], int (*R)[n] )
{
if (n==1)
{
R[0][0]=P[0][0]*Q[0][0];
}
else
{
int a[n/2][n/2], b[n/2][n/2], c[n/2][n/2], d[n/2][n/2];
int e[n/2][n/2], f[n/2][n/2], g[n/2][n/2], h[n/2][n/2];
int p1[n/2][n/2], p2[n/2][n/2], p3[n/2][n/2], p4[n/2][n/2], p5[n/2][n/2], p6[n/2][n/2], p7[n/2][n/2];
int C1[n/2][n/2], C2[n/2][n/2], C3[n/2][n/2], C4[n/2][n/2];
int t1[n/2][n/2], t2[n/2][n/2], t3[n/2][n/2], t4[n/2][n/2], t5[n/2][n/2];
int t6[n/2][n/2], t7[n/2][n/2], t8[n/2][n/2], t9[n/2][n/2], t10[n/2][n/2];
for (int i=0;i<n/2;i++)
{
for (int j=0;j<n/2;j++)
{
a[i][j] = P[i][j];
b[i][j] = P[i][n/2 + j];
c[i][j] = P[n/2+i][j];
d[i][j] = P[n/2+i][n/2+j];
e[i][j] = Q[i][j];
f[i][j] = Q[i][n/2 + j];
g[i][j] = Q[n/2+i][j];
h[i][j] = Q[n/2+i][n/2+j];
}
}
for (int i=0;i<n/2;i++)
{
for (int j=0;j<n/2;j++)
{
t1[i][j] = f[i][j] - h[i][j];
t2[i][j] = a[i][j] + b[i][j];
t3[i][j] = c[i][j] + d[i][j];
t4[i][j] = g[i][j] - e[i][j];
t5[i][j] = a[i][j] + d[i][j];
t6[i][j] = e[i][j] + h[i][j];
t7[i][j] = b[i][j] - d[i][j];
t8[i][j] = g[i][j] + h[i][j];
t9[i][j] = a[i][j] - c[i][j];
t10[i][j] = e[i][j] + f[i][j];
}
}
Strassen(n/2,a,t1,p1);
Strassen(n/2,t2,h,p2);
Strassen(n/2,t3,e,p3);
Strassen(n/2,d,t4,p4);
Strassen(n/2,t5,t6,p5);
Strassen(n/2,t7,t8,p6);
Strassen(n/2,t9,t10,p7);
for (int i=0;i<n/2;i++)
{
for (int j=0;j<n/2;j++)
{
C1[i][j] = p5[i][j] + p4[i][j] - p2[i][j] + p6[i][j];
C2[i][j] = p1[i][j] + p2[i][j];
C3[i][j] = p3[i][j] + p4[i][j];
C4[i][j] = p1[i][j] + p5[i][j] - p3[i][j] - p7[i][j];
}
}
for (int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
if(i<n/2 && j<n/2)
{
R[i][j] = C1[i][j];
}
if(i<n/2 && j>=n/2)
{
R[i][j] = C2[i][j - n/2];
}
if(i>=n/2 && j<n/2)
{
R[i][j] = C3[i - n/2][j];
}
if(i>=n/2 && j>=n/2)
{
R[i][j] = C4[i - n/2][j - n/2];
}
}
}
}
}
int main()
{
int n,i,j;
scanf("%d",&n);
int P[n][n], Q[n][n], R[n][n];
for (i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&P[i][j]);
}
}
for (i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&Q[i][j]);
}
}
for (i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&R[i][j]);
}
}
Strassen(n,P,Q,R);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
printf("%d\n", R[i][j]);
}
}
return 0;
} | 25.12766 | 109 | 0.25374 |
94e243507c85c09a5b4709438c1e3cb961a8c6d1 | 2,056 | c | C | src/spice3/src/lib/dev/asrc/asrcconv.c | yrrapt/cacd | 696f5a22cb71b83eabbb9de199f1972d458fa9e9 | [
"ISC"
] | 11 | 2019-10-16T11:03:49.000Z | 2021-09-28T19:46:12.000Z | src/spice3/src/lib/dev/asrc/asrcconv.c | yrrapt/cacd | 696f5a22cb71b83eabbb9de199f1972d458fa9e9 | [
"ISC"
] | null | null | null | src/spice3/src/lib/dev/asrc/asrcconv.c | yrrapt/cacd | 696f5a22cb71b83eabbb9de199f1972d458fa9e9 | [
"ISC"
] | 1 | 2021-09-29T18:15:17.000Z | 2021-09-29T18:15:17.000Z | /**********
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1988 Kanwar Jit Singh
**********/
#include "spice.h"
#include <stdio.h>
#include "misc.h"
#include "cktdefs.h"
#include "asrcdefs.h"
#include "sperror.h"
#include "util.h"
int ASRCconvTest(GENmodel *inModel, CKTcircuit *ckt)
{
register ASRCmodel *model = (ASRCmodel *)inModel;
register ASRCinstance *here;
int i, node_num, branch;
double diff;
double prev;
double tol;
double rhs;
for ( ; model; model = model->ASRCnextModel) {
for (here = model->ASRCinstances; here; here = here->ASRCnextInstance) {
i = here->ASRCtree->numVars;
if (asrc_nvals < i) {
if (asrc_nvals) {
FREE(asrc_vals);
FREE(asrc_derivs);
}
asrc_nvals = i;
asrc_vals = NEWN(double, i);
asrc_derivs = NEWN(double, i);
}
for (i = 0; i < here->ASRCtree->numVars; i++) {
if (here->ASRCtree->varTypes[i] == IF_INSTANCE) {
branch = CKTfndBranch(ckt, here->ASRCtree->vars[i].uValue);
asrc_vals[i] = *(ckt->CKTrhsOld + branch);
} else {
node_num = ((CKTnode *)(here->ASRCtree->vars[i].nValue))->number;
asrc_vals[i] = *(ckt->CKTrhsOld + node_num);
}
}
if ((*(here->ASRCtree->IFeval))(here->ASRCtree, ckt->CKTgmin, &rhs,
asrc_vals, asrc_derivs) == OK) {
prev = here->ASRCprev_value;
diff = FABS(prev - rhs);
if (here->ASRCtype == ASRC_VOLTAGE) {
tol = ckt->CKTreltol * MAX(FABS(rhs), FABS(prev)) + ckt->CKTvoltTol;
} else {
tol = ckt->CKTreltol * MAX(FABS(rhs), FABS(prev)) + ckt->CKTabstol;
}
if (diff > tol) {
ckt->CKTnoncon++;
ckt->CKTtroubleElt = (GENinstance *) here;
return(OK);
}
} else {
return(E_BADPARM);
}
}
}
return(OK);
}
| 29.371429 | 88 | 0.523833 |
9e17866b82f7fa16de96c54b767fc254ffb887e1 | 104 | c | C | arpdummy.c | NuruNabiyev/AdvancedNetworkProgramming | d8f5f4923fb64c24d249ca5d9a0addc6aa2d2ec4 | [
"Apache-2.0"
] | null | null | null | arpdummy.c | NuruNabiyev/AdvancedNetworkProgramming | d8f5f4923fb64c24d249ca5d9a0addc6aa2d2ec4 | [
"Apache-2.0"
] | null | null | null | arpdummy.c | NuruNabiyev/AdvancedNetworkProgramming | d8f5f4923fb64c24d249ca5d9a0addc6aa2d2ec4 | [
"Apache-2.0"
] | null | null | null |
#include <unistd.h>
#include <limits.h>
int main(int argv, char **argc){
return sleep(INT_MAX);
}
| 13 | 32 | 0.653846 |
b144f1ce3a159bb029e65b49cc3036abd06c5456 | 4,174 | h | C | front-end/qemu-2.3/slirp/mbuf.h | zheli-1/crete-dev | a226c245f51347b88ba9a95448a694bf1997a080 | [
"BSD-2-Clause-FreeBSD"
] | 473 | 2015-05-29T16:58:24.000Z | 2021-11-17T08:01:24.000Z | front-end/qemu-2.3/slirp/mbuf.h | zheli-1/crete-dev | a226c245f51347b88ba9a95448a694bf1997a080 | [
"BSD-2-Clause-FreeBSD"
] | 46 | 2016-11-16T02:07:38.000Z | 2020-04-01T06:17:33.000Z | front-end/qemu-2.3/slirp/mbuf.h | zheli-1/crete-dev | a226c245f51347b88ba9a95448a694bf1997a080 | [
"BSD-2-Clause-FreeBSD"
] | 64 | 2015-05-29T16:59:12.000Z | 2020-04-20T13:10:47.000Z | /*
* Copyright (c) 1982, 1986, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)mbuf.h 8.3 (Berkeley) 1/21/94
* mbuf.h,v 1.9 1994/11/14 13:54:20 bde Exp
*/
#ifndef _MBUF_H_
#define _MBUF_H_
#define MINCSIZE 4096 /* Amount to increase mbuf if too small */
/*
* Macros for type conversion
* mtod(m,t) - convert mbuf pointer to data pointer of correct type
*/
#define mtod(m,t) ((t)(m)->m_data)
/* XXX About mbufs for slirp:
* Only one mbuf is ever used in a chain, for each "cell" of data.
* m_nextpkt points to the next packet, if fragmented.
* If the data is too large, the M_EXT is used, and a larger block
* is alloced. Therefore, m_free[m] must check for M_EXT and if set
* free the m_ext. This is inefficient memory-wise, but who cares.
*/
/*
* How much room is in the mbuf, from m_data to the end of the mbuf
*/
#define M_ROOM(m) ((m->m_flags & M_EXT)? \
(((m)->m_ext + (m)->m_size) - (m)->m_data) \
: \
(((m)->m_dat + (m)->m_size) - (m)->m_data))
/*
* How much free room there is
*/
#define M_FREEROOM(m) (M_ROOM(m) - (m)->m_len)
#define M_TRAILINGSPACE M_FREEROOM
struct mbuf {
/* XXX should union some of these! */
/* header at beginning of each mbuf: */
struct mbuf *m_next; /* Linked list of mbufs */
struct mbuf *m_prev;
struct mbuf *m_nextpkt; /* Next packet in queue/record */
struct mbuf *m_prevpkt; /* Flags aren't used in the output queue */
int m_flags; /* Misc flags */
int m_size; /* Size of data */
struct socket *m_so;
caddr_t m_data; /* Location of data */
int m_len; /* Amount of data in this mbuf */
Slirp *slirp;
bool arp_requested;
uint64_t expiration_date;
/* start of dynamic buffer area, must be last element */
union {
char m_dat[1]; /* ANSI don't like 0 sized arrays */
char *m_ext;
};
};
#define ifq_prev m_prev
#define ifq_next m_next
#define ifs_prev m_prevpkt
#define ifs_next m_nextpkt
#define ifq_so m_so
#define M_EXT 0x01 /* m_ext points to more (malloced) data */
#define M_FREELIST 0x02 /* mbuf is on free list */
#define M_USEDLIST 0x04 /* XXX mbuf is on used list (for dtom()) */
#define M_DOFREE 0x08 /* when m_free is called on the mbuf, free()
* it rather than putting it on the free list */
void m_init(Slirp *);
void m_cleanup(Slirp *slirp);
struct mbuf * m_get(Slirp *);
void m_free(struct mbuf *);
void m_cat(register struct mbuf *, register struct mbuf *);
void m_inc(struct mbuf *, int);
void m_adj(struct mbuf *, int);
int m_copy(struct mbuf *, struct mbuf *, int, int);
struct mbuf * dtom(Slirp *, void *);
static inline void ifs_init(struct mbuf *ifm)
{
ifm->ifs_next = ifm->ifs_prev = ifm;
}
#endif
| 35.07563 | 77 | 0.707954 |
d21b205685202d54027db5070a3f608d347a0780 | 4,305 | h | C | llvm/lib/CodeGen/AsmPrinter/WinException.h | MochalovaAn/llvm | 528aa5ca4aa9df447dc3497ef19da3b124e88d7d | [
"Apache-2.0"
] | 1 | 2021-02-17T04:40:38.000Z | 2021-02-17T04:40:38.000Z | llvm/lib/CodeGen/AsmPrinter/WinException.h | MochalovaAn/llvm | 528aa5ca4aa9df447dc3497ef19da3b124e88d7d | [
"Apache-2.0"
] | null | null | null | llvm/lib/CodeGen/AsmPrinter/WinException.h | MochalovaAn/llvm | 528aa5ca4aa9df447dc3497ef19da3b124e88d7d | [
"Apache-2.0"
] | null | null | null | //===-- WinException.h - Windows Exception Handling ----------*- C++ -*--===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file contains support for writing windows exception info into asm files.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_WIN64EXCEPTION_H
#define LLVM_LIB_CODEGEN_ASMPRINTER_WIN64EXCEPTION_H
#include "EHStreamer.h"
namespace llvm {
class GlobalValue;
class MachineFunction;
class MCExpr;
class MCSection;
struct WinEHFuncInfo;
class LLVM_LIBRARY_VISIBILITY WinException : public EHStreamer {
/// Per-function flag to indicate if personality info should be emitted.
bool shouldEmitPersonality = false;
/// Per-function flag to indicate if the LSDA should be emitted.
bool shouldEmitLSDA = false;
/// Per-function flag to indicate if frame moves info should be emitted.
bool shouldEmitMoves = false;
/// True if this is a 64-bit target and we should use image relative offsets.
bool useImageRel32 = false;
/// True if we are generating exception handling on Windows for ARM64.
bool isAArch64 = false;
/// Pointer to the current funclet entry BB.
const MachineBasicBlock *CurrentFuncletEntry = nullptr;
/// The section of the last funclet start.
MCSection *CurrentFuncletTextSection = nullptr;
/// The list of symbols to add to the ehcont section
std::vector<const MCSymbol *> EHContTargets;
void emitCSpecificHandlerTable(const MachineFunction *MF);
void emitSEHActionsForRange(const WinEHFuncInfo &FuncInfo,
const MCSymbol *BeginLabel,
const MCSymbol *EndLabel, int State);
/// Emit the EH table data for 32-bit and 64-bit functions using
/// the __CxxFrameHandler3 personality.
void emitCXXFrameHandler3Table(const MachineFunction *MF);
/// Emit the EH table data for _except_handler3 and _except_handler4
/// personality functions. These are only used on 32-bit and do not use CFI
/// tables.
void emitExceptHandlerTable(const MachineFunction *MF);
void emitCLRExceptionTable(const MachineFunction *MF);
void computeIP2StateTable(
const MachineFunction *MF, const WinEHFuncInfo &FuncInfo,
SmallVectorImpl<std::pair<const MCExpr *, int>> &IPToStateTable);
/// Emits the label used with llvm.eh.recoverfp, which is used by
/// outlined funclets.
void emitEHRegistrationOffsetLabel(const WinEHFuncInfo &FuncInfo,
StringRef FLinkageName);
const MCExpr *create32bitRef(const MCSymbol *Value);
const MCExpr *create32bitRef(const GlobalValue *GV);
const MCExpr *getLabel(const MCSymbol *Label);
const MCExpr *getOffset(const MCSymbol *OffsetOf, const MCSymbol *OffsetFrom);
const MCExpr *getOffsetPlusOne(const MCSymbol *OffsetOf,
const MCSymbol *OffsetFrom);
/// Gets the offset that we should use in a table for a stack object with the
/// given index. For targets using CFI (Win64, etc), this is relative to the
/// established SP at the end of the prologue. For targets without CFI (Win32
/// only), it is relative to the frame pointer.
int getFrameIndexOffset(int FrameIndex, const WinEHFuncInfo &FuncInfo);
void endFuncletImpl();
public:
//===--------------------------------------------------------------------===//
// Main entry points.
//
WinException(AsmPrinter *A);
~WinException() override;
/// Emit all exception information that should come after the content.
void endModule() override;
/// Gather pre-function exception information. Assumes being emitted
/// immediately after the function entry point.
void beginFunction(const MachineFunction *MF) override;
void markFunctionEnd() override;
/// Gather and emit post-function exception information.
void endFunction(const MachineFunction *) override;
/// Emit target-specific EH funclet machinery.
void beginFunclet(const MachineBasicBlock &MBB, MCSymbol *Sym) override;
void endFunclet() override;
};
}
#endif
| 36.794872 | 80 | 0.690128 |
cfdd8f573ce13c7327aefaec0c3e8ca883a8c418 | 14,571 | c | C | bootloader/bootloader.c | blueacro/ba-dualdoser-firmware | 26d53c0f19607a0ee885b22bf4dc7cbc7e18fa87 | [
"BSD-3-Clause"
] | 4 | 2022-01-31T04:08:28.000Z | 2022-02-18T11:06:12.000Z | bootloader/bootloader.c | blueacro/ba-dualdoser-firmware | 26d53c0f19607a0ee885b22bf4dc7cbc7e18fa87 | [
"BSD-3-Clause"
] | 3 | 2022-02-03T01:48:09.000Z | 2022-02-15T06:53:45.000Z | bootloader/bootloader.c | blueacro/ba-dualdoser-firmware | 26d53c0f19607a0ee885b22bf4dc7cbc7e18fa87 | [
"BSD-3-Clause"
] | null | null | null | /*
* 1kByte USB DFU bootloader for Atmel SAMD11 microcontrollers
*
* Copyright (c) 2018-2020, Peter Lawrence
* derived from https://github.com/ataradov/vcp Copyright (c) 2016, Alex Taradov <alex@taradov.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. 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.
* 3. The name of the author may not 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 HOLDER 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.
*/
/*
NOTES:
- anything pointed to by udc_mem[*].*.ADDR.reg *MUST* BE IN RAM and be 32-bit aligned... no exceptions
*/
/*- Includes ----------------------------------------------------------------*/
#include <stdbool.h>
#include <string.h>
#include <sam.h>
#include "usb.h"
#include "nvm_data.h"
#include "usb_descriptors.h"
/*- Definitions -------------------------------------------------------------*/
// #define USE_DBL_TAP /* comment out to use GPIO input for bootloader entry */
#define REBOOT_AFTER_DOWNLOAD /* comment out to prevent boot into app after it has been downloaded */
#define USB_CMD(dir, rcpt, type) ((USB_##dir##_TRANSFER << 7) | (USB_##type##_REQUEST << 5) | (USB_##rcpt##_RECIPIENT << 0))
#define SIMPLE_USB_CMD(rcpt, type) ((USB_##type##_REQUEST << 5) | (USB_##rcpt##_RECIPIENT << 0))
/*- Types -------------------------------------------------------------------*/
typedef struct
{
UsbDeviceDescBank out;
UsbDeviceDescBank in;
} udc_mem_t;
/*- Variables ---------------------------------------------------------------*/
static uint32_t usb_config = 0;
static uint32_t dfu_status_choices[4] =
{
0x00000000, 0x00000002, /* normal */
0x00000000, 0x00000005, /* dl */
};
static udc_mem_t udc_mem[USB_EPT_NUM];
static uint32_t udc_ctrl_in_buf[16];
static uint32_t udc_ctrl_out_buf[16];
/*- Implementations ---------------------------------------------------------*/
//-----------------------------------------------------------------------------
static void __attribute__((noinline)) udc_control_send(const uint32_t *data, uint32_t size)
{
/* USB peripheral *only* reads valid data from 32-bit aligned RAM locations */
udc_mem[0].in.ADDR.reg = (uint32_t)data;
udc_mem[0].in.PCKSIZE.reg = USB_DEVICE_PCKSIZE_BYTE_COUNT(size) | USB_DEVICE_PCKSIZE_MULTI_PACKET_SIZE(0) | USB_DEVICE_PCKSIZE_SIZE(3 /*64 Byte*/);
USB->DEVICE.DeviceEndpoint[0].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_TRCPT1;
USB->DEVICE.DeviceEndpoint[0].EPSTATUSSET.bit.BK1RDY = 1;
while (0 == USB->DEVICE.DeviceEndpoint[0].EPINTFLAG.bit.TRCPT1);
}
//-----------------------------------------------------------------------------
static void __attribute__((noinline)) udc_control_send_zlp(void)
{
udc_control_send(NULL, 0); /* peripheral can't read from NULL address, but size is zero and this value takes less space to compile */
}
//-----------------------------------------------------------------------------
static void __attribute__((noinline)) USB_Service(void)
{
static uint32_t dfu_addr;
if (USB->DEVICE.INTFLAG.bit.EORST) /* End Of Reset */
{
USB->DEVICE.INTFLAG.reg = USB_DEVICE_INTFLAG_EORST;
USB->DEVICE.DADD.reg = USB_DEVICE_DADD_ADDEN;
USB->DEVICE.DeviceEndpoint[0].EPCFG.reg = USB_DEVICE_EPCFG_EPTYPE0(1 /*CONTROL*/) | USB_DEVICE_EPCFG_EPTYPE1(1 /*CONTROL*/);
USB->DEVICE.DeviceEndpoint[0].EPSTATUSSET.bit.BK0RDY = 1;
USB->DEVICE.DeviceEndpoint[0].EPSTATUSCLR.bit.BK1RDY = 1;
udc_mem[0].in.ADDR.reg = (uint32_t)udc_ctrl_in_buf;
udc_mem[0].in.PCKSIZE.reg = USB_DEVICE_PCKSIZE_BYTE_COUNT(0) | USB_DEVICE_PCKSIZE_MULTI_PACKET_SIZE(0) | USB_DEVICE_PCKSIZE_SIZE(3 /*64 Byte*/);
udc_mem[0].out.ADDR.reg = (uint32_t)udc_ctrl_out_buf;
udc_mem[0].out.PCKSIZE.reg = USB_DEVICE_PCKSIZE_BYTE_COUNT(64) | USB_DEVICE_PCKSIZE_MULTI_PACKET_SIZE(0) | USB_DEVICE_PCKSIZE_SIZE(3 /*64 Byte*/);
USB->DEVICE.DeviceEndpoint[0].EPSTATUSCLR.bit.BK0RDY = 1;
}
if (USB->DEVICE.DeviceEndpoint[0].EPINTFLAG.bit.TRCPT0) /* Transmit Complete 0 */
{
if (dfu_addr)
{
if (0 == ((dfu_addr >> 6) & 0x3))
{
NVMCTRL->ADDR.reg = dfu_addr >> 1;
NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMDEX_KEY | NVMCTRL_CTRLA_CMD(NVMCTRL_CTRLA_CMD_ER);
while (!NVMCTRL->INTFLAG.bit.READY);
}
uint16_t *nvm_addr = (uint16_t *)(dfu_addr);
uint16_t *ram_addr = (uint16_t *)udc_ctrl_out_buf;
for (unsigned i = 0; i < 32; i++)
*nvm_addr++ = *ram_addr++;
while (!NVMCTRL->INTFLAG.bit.READY);
udc_control_send_zlp();
dfu_addr = 0;
}
USB->DEVICE.DeviceEndpoint[0].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_TRCPT0;
}
if (USB->DEVICE.DeviceEndpoint[0].EPINTFLAG.bit.RXSTP) /* Received Setup */
{
USB->DEVICE.DeviceEndpoint[0].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_RXSTP;
USB->DEVICE.DeviceEndpoint[0].EPSTATUSCLR.bit.BK0RDY = 1;
usb_request_t *request = (usb_request_t *)udc_ctrl_out_buf;
uint8_t type = request->wValue >> 8;
uint16_t length = request->wLength;
static uint32_t *dfu_status = dfu_status_choices + 0;
/* for these other USB requests, we must examine all fields in bmRequestType */
if (USB_CMD(OUT, INTERFACE, STANDARD) == request->bmRequestType)
{
udc_control_send_zlp();
return;
}
/* for these "simple" USB requests, we can ignore the direction and use only bRequest */
switch (request->bmRequestType & 0x7F)
{
case SIMPLE_USB_CMD(DEVICE, STANDARD):
case SIMPLE_USB_CMD(INTERFACE, STANDARD):
switch (request->bRequest)
{
case USB_GET_DESCRIPTOR:
if (USB_DEVICE_DESCRIPTOR == type)
{
udc_control_send((uint32_t *)&usb_device_descriptor, length);
}
else if (USB_CONFIGURATION_DESCRIPTOR == type)
{
udc_control_send((uint32_t *)&usb_configuration_hierarchy, length);
}
else
{
USB->DEVICE.DeviceEndpoint[0].EPSTATUSSET.bit.STALLRQ1 = 1;
}
break;
case USB_GET_CONFIGURATION:
udc_control_send(&usb_config, 1);
break;
case USB_GET_STATUS:
udc_control_send(dfu_status_choices + 0, 2); /* a 32-bit aligned zero in RAM is all we need */
break;
case USB_SET_FEATURE:
case USB_CLEAR_FEATURE:
USB->DEVICE.DeviceEndpoint[0].EPSTATUSSET.bit.STALLRQ1 = 1;
break;
case USB_SET_ADDRESS:
udc_control_send_zlp();
USB->DEVICE.DADD.reg = USB_DEVICE_DADD_ADDEN | USB_DEVICE_DADD_DADD(request->wValue);
break;
case USB_SET_CONFIGURATION:
usb_config = request->wValue;
udc_control_send_zlp();
break;
}
break;
case SIMPLE_USB_CMD(INTERFACE, CLASS):
switch (request->bRequest)
{
case 0x03: // DFU_GETSTATUS
udc_control_send(&dfu_status[0], 6);
break;
case 0x05: // DFU_GETSTATE
udc_control_send(&dfu_status[1], 1);
break;
case 0x01: // DFU_DNLOAD
dfu_status = dfu_status_choices + 0;
if (request->wLength)
{
dfu_status = dfu_status_choices + 2;
dfu_addr = 0x400 + request->wValue * 64;
}
#ifdef REBOOT_AFTER_DOWNLOAD
else
{
/* the download has now finished, so now reboot */
WDT->CONFIG.reg = WDT_CONFIG_PER_16K | WDT_CONFIG_WINDOW_16K;
WDT->CTRL.reg = WDT_CTRL_ENABLE;
}
#endif
/* fall through */
default: // DFU_UPLOAD & others
/* 0x00 == DFU_DETACH, 0x04 == DFU_CLRSTATUS, 0x06 == DFU_ABORT, and 0x01 == DFU_DNLOAD and 0x02 == DFU_UPLOAD */
if (!dfu_addr)
udc_control_send_zlp();
break;
}
break;
}
}
}
#define DBL_TAP_MAGIC 0xf02669ef
static volatile uint32_t __attribute__((section(".vectors_ram"))) double_tap;
void bootloader(void)
{
#ifndef USE_DBL_TAP
/* configure PA16 (bootloader entry pin used by SAM-BA) as input pull-up */
PORT->Group[0].PINCFG[16].reg = PORT_PINCFG_PULLEN | PORT_PINCFG_INEN;
PORT->Group[0].DIRSET.reg = (1UL << 17);
PORT->Group[0].OUTSET.reg = (1UL << 16) | (1<<17);
#endif
PAC1->WPCLR.reg = 2; /* clear DSU */
DSU->ADDR.reg = 0x400; /* start CRC check at beginning of user app */
DSU->LENGTH.reg = *(volatile uint32_t *)0x410; /* use length encoded into unused vector address in user app */
/* ask DSU to compute CRC */
DSU->DATA.reg = 0xFFFFFFFF;
DSU->CTRL.bit.CRC = 1;
while (!DSU->STATUSA.bit.DONE);
if (DSU->DATA.reg)
goto run_bootloader; /* CRC failed, so run bootloader */
#ifndef USE_DBL_TAP
if (!(PORT->Group[0].IN.reg & (1UL << 16)))
goto run_bootloader; /* pin grounded, so run bootloader */
// Check if the DBL_TAP_MAGIC constant is at the right memory address, this isn't a power on, and if so, jump to the bootloader
if (double_tap == DBL_TAP_MAGIC) {
double_tap = 0;
goto run_bootloader;
}
return; /* we've checked everything and there is no reason to run the bootloader */
#else
if (PM->RCAUSE.reg & PM_RCAUSE_POR)
double_tap = 0; /* a power up event should never be considered a 'double tap' */
if (double_tap == DBL_TAP_MAGIC)
{
/* a 'double tap' has happened, so run bootloader */
double_tap = 0;
goto run_bootloader;
}
/* postpone boot for a short period of time; if a second reset happens during this window, the "magic" value will remain */
double_tap = DBL_TAP_MAGIC;
volatile int wait = 65536; while (wait--);
/* however, if execution reaches this point, the window of opportunity has closed and the "magic" disappears */
double_tap = 0;
return;
#endif
run_bootloader:
#if 1
/*
configure oscillator for crystal-free USB operation (USBCRM / USB Clock Recovery Mode)
*/
SYSCTRL->OSC8M.bit.PRESC = 0;
SYSCTRL->INTFLAG.reg = SYSCTRL_INTFLAG_BOD33RDY | SYSCTRL_INTFLAG_BOD33DET | SYSCTRL_INTFLAG_DFLLRDY;
NVMCTRL->CTRLB.reg = NVMCTRL_CTRLB_RWS_DUAL;
SYSCTRL->DFLLCTRL.reg = 0; // See Errata 9905
while (!SYSCTRL->PCLKSR.bit.DFLLRDY);
SYSCTRL->DFLLMUL.reg = SYSCTRL_DFLLMUL_MUL(48000);
SYSCTRL->DFLLVAL.reg = SYSCTRL_DFLLVAL_COARSE( NVM_READ_CAL(NVM_DFLL48M_COARSE_CAL) ) | SYSCTRL_DFLLVAL_FINE( NVM_READ_CAL(NVM_DFLL48M_FINE_CAL) );
SYSCTRL->DFLLCTRL.reg = SYSCTRL_DFLLCTRL_ENABLE | SYSCTRL_DFLLCTRL_USBCRM | SYSCTRL_DFLLCTRL_MODE | SYSCTRL_DFLLCTRL_BPLCKC | SYSCTRL_DFLLCTRL_CCDIS | SYSCTRL_DFLLCTRL_STABLE;
while (!SYSCTRL->PCLKSR.bit.DFLLRDY);
GCLK->GENCTRL.reg = GCLK_GENCTRL_ID(0) | GCLK_GENCTRL_SRC(GCLK_SOURCE_DFLL48M) | GCLK_GENCTRL_RUNSTDBY | GCLK_GENCTRL_GENEN;
while (GCLK->STATUS.bit.SYNCBUSY);
#else
/*
configure oscillator for operation disciplined by external 32k crystal
This can only be used on PCBs (such as Arduino Zero derived designs) that have these extra components populated.
It *should* be wholly unnecessary to use this instead of the above USBCRM code.
However, some problem (Sparkfun?) PCBs experience unreliable USB operation in USBCRM mode.
*/
NVMCTRL->CTRLB.reg = NVMCTRL_CTRLB_RWS_DUAL;
SYSCTRL->XOSC32K.reg = SYSCTRL_XOSC32K_STARTUP( 0x6u ) | SYSCTRL_XOSC32K_XTALEN | SYSCTRL_XOSC32K_EN32K;
SYSCTRL->XOSC32K.reg |= SYSCTRL_XOSC32K_ENABLE;
while (!(SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_XOSC32KRDY));
GCLK->GENDIV.reg = GCLK_GENDIV_ID( 1u /* XOSC32K */ );
GCLK->GENCTRL.reg = GCLK_GENCTRL_ID( 1u /* XOSC32K */ ) | GCLK_GENCTRL_SRC_XOSC32K | GCLK_GENCTRL_GENEN;
GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID( 0u /* DFLL48M */ ) | GCLK_CLKCTRL_GEN_GCLK1 | GCLK_CLKCTRL_CLKEN;
// while (GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY);
SYSCTRL->DFLLCTRL.reg = 0; // See Errata 9905
// while (!SYSCTRL->PCLKSR.bit.DFLLRDY);
SYSCTRL->DFLLMUL.reg = SYSCTRL_DFLLMUL_CSTEP( 31 ) | SYSCTRL_DFLLMUL_FSTEP( 511 ) | SYSCTRL_DFLLMUL_MUL(48000000ul / 32768ul);
SYSCTRL->DFLLCTRL.reg = SYSCTRL_DFLLCTRL_ENABLE | SYSCTRL_DFLLCTRL_MODE | SYSCTRL_DFLLCTRL_WAITLOCK | SYSCTRL_DFLLCTRL_QLDIS;
while ( !(SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_DFLLLCKC) || !(SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_DFLLLCKF) || !(SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_DFLLRDY) );
GCLK->GENDIV.reg = GCLK_GENDIV_ID( 0u /* MAIN */ );
GCLK->GENCTRL.reg = GCLK_GENCTRL_ID( 0u /* MAIN */ ) | GCLK_GENCTRL_SRC_DFLL48M | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN;
while (GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY);
#endif
/*
initialize USB
*/
PORT->Group[0].PINCFG[24].reg |= PORT_PINCFG_PMUXEN;
PORT->Group[0].PINCFG[25].reg |= PORT_PINCFG_PMUXEN;
PORT->Group[0].PMUX[24>>1].reg = PORT_PMUX_PMUXO(PORT_PMUX_PMUXO_G_Val) | PORT_PMUX_PMUXE(PORT_PMUX_PMUXE_G_Val);
PM->APBBMASK.reg |= PM_APBBMASK_USB;
GCLK->CLKCTRL.reg = GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_ID(USB_GCLK_ID) | GCLK_CLKCTRL_GEN(0);
USB->DEVICE.CTRLA.reg = USB_CTRLA_SWRST;
while (USB->DEVICE.SYNCBUSY.bit.SWRST);
USB->DEVICE.PADCAL.reg = USB_PADCAL_TRANSN( NVM_READ_CAL(NVM_USB_TRANSN) ) | USB_PADCAL_TRANSP( NVM_READ_CAL(NVM_USB_TRANSP) ) | USB_PADCAL_TRIM( NVM_READ_CAL(NVM_USB_TRIM) );
USB->DEVICE.DESCADD.reg = (uint32_t)udc_mem;
USB->DEVICE.CTRLA.reg = USB_CTRLA_MODE_DEVICE | USB_CTRLA_RUNSTDBY;
USB->DEVICE.CTRLB.reg = USB_DEVICE_CTRLB_SPDCONF_FS;
USB->DEVICE.CTRLA.reg |= USB_CTRLA_ENABLE;
/*
service USB
*/
while (1)
USB_Service();
}
| 38.044386 | 177 | 0.670441 |
3205f0f3bbfb99ed15b6ceb0ad2dcfcf87718abb | 2,612 | h | C | SimG4CMS/CherenkovAnalysis/interface/DreamSD.h | Purva-Chaudhari/cmssw | 32e5cbfe54c4d809d60022586cf200b7c3020bcf | [
"Apache-2.0"
] | 852 | 2015-01-11T21:03:51.000Z | 2022-03-25T21:14:00.000Z | SimG4CMS/CherenkovAnalysis/interface/DreamSD.h | Purva-Chaudhari/cmssw | 32e5cbfe54c4d809d60022586cf200b7c3020bcf | [
"Apache-2.0"
] | 30,371 | 2015-01-02T00:14:40.000Z | 2022-03-31T23:26:05.000Z | SimG4CMS/CherenkovAnalysis/interface/DreamSD.h | Purva-Chaudhari/cmssw | 32e5cbfe54c4d809d60022586cf200b7c3020bcf | [
"Apache-2.0"
] | 3,240 | 2015-01-02T05:53:18.000Z | 2022-03-31T17:24:21.000Z | #ifndef SimG4CMS_DreamSD_h
#define SimG4CMS_DreamSD_h
#include "SimG4CMS/Calo/interface/CaloSD.h"
#include "DetectorDescription/Core/interface/DDCompactView.h"
#include "DetectorDescription/DDCMS/interface/DDCompactView.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
#include "G4PhysicsFreeVector.hh"
#include <DD4hep/DD4hepUnits.h>
#include <map>
const int MAXPHOTONS = 500; // Maximum number of photons we can store
class G4LogicalVolume;
class DreamSD : public CaloSD {
public:
DreamSD(const std::string &,
const DDCompactView *,
const cms::DDCompactView *,
const SensitiveDetectorCatalog &,
edm::ParameterSet const &,
const SimTrackManager *);
~DreamSD() override {}
uint32_t setDetUnitId(const G4Step *) override;
protected:
double getEnergyDeposit(const G4Step *) override;
void initRun() override;
private:
typedef std::pair<double, double> Doubles;
typedef std::map<G4LogicalVolume *, Doubles> DimensionMap;
void initMap(const std::string &);
void fillMap(const std::string &, double, double);
double curve_LY(const G4Step *, int);
double crystalLength(G4LogicalVolume *) const;
double crystalWidth(G4LogicalVolume *) const;
/// Returns the total energy due to Cherenkov radiation
double cherenkovDeposit_(const G4Step *aStep);
/// Returns average number of photons created by track
double getAverageNumberOfPhotons_(const double charge,
const double beta,
const G4Material *aMaterial,
const G4MaterialPropertyVector *rIndex);
/// Returns energy deposit for a given photon
double getPhotonEnergyDeposit_(const G4ParticleMomentum &p, const G4ThreeVector &x, const G4Step *aStep);
/// Sets material properties at run-time...
bool setPbWO2MaterialProperties_(G4Material *aMaterial);
static constexpr double k_ScaleFromDDDToG4 = 1.0;
static constexpr double k_ScaleFromDD4HepToG4 = 1.0 / dd4hep::mm;
const DDCompactView *cpvDDD_;
const cms::DDCompactView *cpvDD4Hep_;
bool useBirk_, doCherenkov_, readBothSide_, dd4hep_;
double birk1_, birk2_, birk3_;
double slopeLY_;
DimensionMap xtalLMap_; // Store length and width
int side_;
/// Table of Cherenkov angle integrals vs photon momentum
std::unique_ptr<G4PhysicsFreeVector> chAngleIntegrals_;
G4MaterialPropertiesTable *materialPropertiesTable_;
int nphotons_;
};
#endif // DreamSD_h
| 32.246914 | 107 | 0.730092 |
963baf9863587f338de4b725900372184d083758 | 352 | h | C | Example/EHHorizontalFlexibleWidthItemsView/CustomViews/WFEPercentageLabel.h | waterflowseast/EHHorizontalFlexibleWidthItemsView | 0ea31f6e54a79c509d015a4311ab2e2fc4456538 | [
"MIT"
] | null | null | null | Example/EHHorizontalFlexibleWidthItemsView/CustomViews/WFEPercentageLabel.h | waterflowseast/EHHorizontalFlexibleWidthItemsView | 0ea31f6e54a79c509d015a4311ab2e2fc4456538 | [
"MIT"
] | null | null | null | Example/EHHorizontalFlexibleWidthItemsView/CustomViews/WFEPercentageLabel.h | waterflowseast/EHHorizontalFlexibleWidthItemsView | 0ea31f6e54a79c509d015a4311ab2e2fc4456538 | [
"MIT"
] | null | null | null | //
// WFEPercentageLabel.h
// EHHorizontalFixedWidthItemsView
//
// Created by Eric Huang on 17/1/15.
// Copyright © 2017年 Eric Huang. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <EHItemViewCommon/EHItemViewDelegate.h>
@interface WFEPercentageLabel : UILabel <EHItemViewDelegate>
- (instancetype)initWithText:(NSString *)text;
@end
| 20.705882 | 60 | 0.75 |
d27de9a31db69dedffe991f9f2ddc68cc1a666e1 | 215 | h | C | Include/Serialization/Contexts.h | PipeRift/rift-core | 82e1e287808e78b752fd76f3bee74bfb926859d1 | [
"MIT"
] | 6 | 2021-01-22T21:18:12.000Z | 2022-02-25T19:16:32.000Z | Include/Serialization/Contexts.h | PipeRift/rift-core | 82e1e287808e78b752fd76f3bee74bfb926859d1 | [
"MIT"
] | null | null | null | Include/Serialization/Contexts.h | PipeRift/rift-core | 82e1e287808e78b752fd76f3bee74bfb926859d1 | [
"MIT"
] | null | null | null | // Copyright 2015-2021 Piperift - All rights reserved
#pragma once
#include "Serialization/Contexts/CommonContext.h"
#include "Serialization/Contexts/ReadContext.h"
#include "Serialization/Contexts/WriteContext.h"
| 30.714286 | 53 | 0.813953 |
d2e5b194b938b1afd3c30f12ddd6151ca89e1d38 | 10,276 | h | C | linux-4.14.90-dev/linux-4.14.90/drivers/infiniband/hw/mthca/mthca_cmd.h | bingchunjin/1806_SDK | d5ed0258fc22f60e00ec025b802d175f33da6e41 | [
"MIT"
] | 55 | 2019-12-20T03:25:14.000Z | 2022-01-16T07:19:47.000Z | linux-4.14.90-dev/linux-4.14.90/drivers/infiniband/hw/mthca/mthca_cmd.h | bingchunjin/1806_SDK | d5ed0258fc22f60e00ec025b802d175f33da6e41 | [
"MIT"
] | 13 | 2021-07-10T04:36:17.000Z | 2022-03-03T10:50:05.000Z | linux-4.14.90-dev/linux-4.14.90/drivers/infiniband/hw/mthca/mthca_cmd.h | bingchunjin/1806_SDK | d5ed0258fc22f60e00ec025b802d175f33da6e41 | [
"MIT"
] | 30 | 2018-05-02T08:43:27.000Z | 2022-01-23T03:25:54.000Z | /*
* Copyright (c) 2004, 2005 Topspin Communications. All rights reserved.
* Copyright (c) 2005 Mellanox Technologies. All rights reserved.
* Copyright (c) 2006 Cisco Systems. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
*
* 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.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef MTHCA_CMD_H
#define MTHCA_CMD_H
#include <rdma/ib_verbs.h>
#define MTHCA_MAILBOX_SIZE 4096
enum {
/* command completed successfully: */
MTHCA_CMD_STAT_OK = 0x00,
/* Internal error (such as a bus error) occurred while processing command: */
MTHCA_CMD_STAT_INTERNAL_ERR = 0x01,
/* Operation/command not supported or opcode modifier not supported: */
MTHCA_CMD_STAT_BAD_OP = 0x02,
/* Parameter not supported or parameter out of range: */
MTHCA_CMD_STAT_BAD_PARAM = 0x03,
/* System not enabled or bad system state: */
MTHCA_CMD_STAT_BAD_SYS_STATE = 0x04,
/* Attempt to access reserved or unallocaterd resource: */
MTHCA_CMD_STAT_BAD_RESOURCE = 0x05,
/* Requested resource is currently executing a command, or is otherwise busy: */
MTHCA_CMD_STAT_RESOURCE_BUSY = 0x06,
/* memory error: */
MTHCA_CMD_STAT_DDR_MEM_ERR = 0x07,
/* Required capability exceeds device limits: */
MTHCA_CMD_STAT_EXCEED_LIM = 0x08,
/* Resource is not in the appropriate state or ownership: */
MTHCA_CMD_STAT_BAD_RES_STATE = 0x09,
/* Index out of range: */
MTHCA_CMD_STAT_BAD_INDEX = 0x0a,
/* FW image corrupted: */
MTHCA_CMD_STAT_BAD_NVMEM = 0x0b,
/* Attempt to modify a QP/EE which is not in the presumed state: */
MTHCA_CMD_STAT_BAD_QPEE_STATE = 0x10,
/* Bad segment parameters (Address/Size): */
MTHCA_CMD_STAT_BAD_SEG_PARAM = 0x20,
/* Memory Region has Memory Windows bound to: */
MTHCA_CMD_STAT_REG_BOUND = 0x21,
/* HCA local attached memory not present: */
MTHCA_CMD_STAT_LAM_NOT_PRE = 0x22,
/* Bad management packet (silently discarded): */
MTHCA_CMD_STAT_BAD_PKT = 0x30,
/* More outstanding CQEs in CQ than new CQ size: */
MTHCA_CMD_STAT_BAD_SIZE = 0x40
};
enum {
MTHCA_TRANS_INVALID = 0,
MTHCA_TRANS_RST2INIT,
MTHCA_TRANS_INIT2INIT,
MTHCA_TRANS_INIT2RTR,
MTHCA_TRANS_RTR2RTS,
MTHCA_TRANS_RTS2RTS,
MTHCA_TRANS_SQERR2RTS,
MTHCA_TRANS_ANY2ERR,
MTHCA_TRANS_RTS2SQD,
MTHCA_TRANS_SQD2SQD,
MTHCA_TRANS_SQD2RTS,
MTHCA_TRANS_ANY2RST,
};
enum {
DEV_LIM_FLAG_RC = 1 << 0,
DEV_LIM_FLAG_UC = 1 << 1,
DEV_LIM_FLAG_UD = 1 << 2,
DEV_LIM_FLAG_RD = 1 << 3,
DEV_LIM_FLAG_RAW_IPV6 = 1 << 4,
DEV_LIM_FLAG_RAW_ETHER = 1 << 5,
DEV_LIM_FLAG_SRQ = 1 << 6,
DEV_LIM_FLAG_IPOIB_CSUM = 1 << 7,
DEV_LIM_FLAG_BAD_PKEY_CNTR = 1 << 8,
DEV_LIM_FLAG_BAD_QKEY_CNTR = 1 << 9,
DEV_LIM_FLAG_MW = 1 << 16,
DEV_LIM_FLAG_AUTO_PATH_MIG = 1 << 17,
DEV_LIM_FLAG_ATOMIC = 1 << 18,
DEV_LIM_FLAG_RAW_MULTI = 1 << 19,
DEV_LIM_FLAG_UD_AV_PORT_ENFORCE = 1 << 20,
DEV_LIM_FLAG_UD_MULTI = 1 << 21,
};
struct mthca_mailbox {
dma_addr_t dma;
void *buf;
};
struct mthca_dev_lim {
int max_srq_sz;
int max_qp_sz;
int reserved_qps;
int max_qps;
int reserved_srqs;
int max_srqs;
int reserved_eecs;
int max_eecs;
int max_cq_sz;
int reserved_cqs;
int max_cqs;
int max_mpts;
int reserved_eqs;
int max_eqs;
int reserved_mtts;
int max_mrw_sz;
int reserved_mrws;
int max_mtt_seg;
int max_requester_per_qp;
int max_responder_per_qp;
int max_rdma_global;
int local_ca_ack_delay;
int max_mtu;
int max_port_width;
int max_vl;
int num_ports;
int max_gids;
u16 stat_rate_support;
int max_pkeys;
u32 flags;
int reserved_uars;
int uar_size;
int min_page_sz;
int max_sg;
int max_desc_sz;
int max_qp_per_mcg;
int reserved_mgms;
int max_mcgs;
int reserved_pds;
int max_pds;
int reserved_rdds;
int max_rdds;
int eec_entry_sz;
int qpc_entry_sz;
int eeec_entry_sz;
int eqpc_entry_sz;
int eqc_entry_sz;
int cqc_entry_sz;
int srq_entry_sz;
int uar_scratch_entry_sz;
int mpt_entry_sz;
union {
struct {
int max_avs;
} tavor;
struct {
int resize_srq;
int max_pbl_sz;
u8 bmme_flags;
u32 reserved_lkey;
int lam_required;
u64 max_icm_sz;
} arbel;
} hca;
};
struct mthca_adapter {
u32 vendor_id;
u32 device_id;
u32 revision_id;
char board_id[MTHCA_BOARD_ID_LEN];
u8 inta_pin;
};
struct mthca_init_hca_param {
u64 qpc_base;
u64 eec_base;
u64 srqc_base;
u64 cqc_base;
u64 eqpc_base;
u64 eeec_base;
u64 eqc_base;
u64 rdb_base;
u64 mc_base;
u64 mpt_base;
u64 mtt_base;
u64 uar_scratch_base;
u64 uarc_base;
u16 log_mc_entry_sz;
u16 mc_hash_sz;
u8 log_num_qps;
u8 log_num_eecs;
u8 log_num_srqs;
u8 log_num_cqs;
u8 log_num_eqs;
u8 log_mc_table_sz;
u8 mtt_seg_sz;
u8 log_mpt_sz;
u8 log_uar_sz;
u8 log_uarc_sz;
};
struct mthca_init_ib_param {
int port_width;
int vl_cap;
int mtu_cap;
u16 gid_cap;
u16 pkey_cap;
int set_guid0;
u64 guid0;
int set_node_guid;
u64 node_guid;
int set_si_guid;
u64 si_guid;
};
struct mthca_set_ib_param {
int set_si_guid;
int reset_qkey_viol;
u64 si_guid;
u32 cap_mask;
};
int mthca_cmd_init(struct mthca_dev *dev);
void mthca_cmd_cleanup(struct mthca_dev *dev);
int mthca_cmd_use_events(struct mthca_dev *dev);
void mthca_cmd_use_polling(struct mthca_dev *dev);
void mthca_cmd_event(struct mthca_dev *dev, u16 token,
u8 status, u64 out_param);
struct mthca_mailbox *mthca_alloc_mailbox(struct mthca_dev *dev,
gfp_t gfp_mask);
void mthca_free_mailbox(struct mthca_dev *dev, struct mthca_mailbox *mailbox);
int mthca_SYS_EN(struct mthca_dev *dev);
int mthca_SYS_DIS(struct mthca_dev *dev);
int mthca_MAP_FA(struct mthca_dev *dev, struct mthca_icm *icm);
int mthca_UNMAP_FA(struct mthca_dev *dev);
int mthca_RUN_FW(struct mthca_dev *dev);
int mthca_QUERY_FW(struct mthca_dev *dev);
int mthca_ENABLE_LAM(struct mthca_dev *dev);
int mthca_DISABLE_LAM(struct mthca_dev *dev);
int mthca_QUERY_DDR(struct mthca_dev *dev);
int mthca_QUERY_DEV_LIM(struct mthca_dev *dev,
struct mthca_dev_lim *dev_lim);
int mthca_QUERY_ADAPTER(struct mthca_dev *dev,
struct mthca_adapter *adapter);
int mthca_INIT_HCA(struct mthca_dev *dev,
struct mthca_init_hca_param *param);
int mthca_INIT_IB(struct mthca_dev *dev,
struct mthca_init_ib_param *param,
int port);
int mthca_CLOSE_IB(struct mthca_dev *dev, int port);
int mthca_CLOSE_HCA(struct mthca_dev *dev, int panic);
int mthca_SET_IB(struct mthca_dev *dev, struct mthca_set_ib_param *param,
int port);
int mthca_MAP_ICM(struct mthca_dev *dev, struct mthca_icm *icm, u64 virt);
int mthca_MAP_ICM_page(struct mthca_dev *dev, u64 dma_addr, u64 virt);
int mthca_UNMAP_ICM(struct mthca_dev *dev, u64 virt, u32 page_count);
int mthca_MAP_ICM_AUX(struct mthca_dev *dev, struct mthca_icm *icm);
int mthca_UNMAP_ICM_AUX(struct mthca_dev *dev);
int mthca_SET_ICM_SIZE(struct mthca_dev *dev, u64 icm_size, u64 *aux_pages);
int mthca_SW2HW_MPT(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
int mpt_index);
int mthca_HW2SW_MPT(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
int mpt_index);
int mthca_WRITE_MTT(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
int num_mtt);
int mthca_SYNC_TPT(struct mthca_dev *dev);
int mthca_MAP_EQ(struct mthca_dev *dev, u64 event_mask, int unmap,
int eq_num);
int mthca_SW2HW_EQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
int eq_num);
int mthca_HW2SW_EQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
int eq_num);
int mthca_SW2HW_CQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
int cq_num);
int mthca_HW2SW_CQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
int cq_num);
int mthca_RESIZE_CQ(struct mthca_dev *dev, int cq_num, u32 lkey, u8 log_size);
int mthca_SW2HW_SRQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
int srq_num);
int mthca_HW2SW_SRQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
int srq_num);
int mthca_QUERY_SRQ(struct mthca_dev *dev, u32 num,
struct mthca_mailbox *mailbox);
int mthca_ARM_SRQ(struct mthca_dev *dev, int srq_num, int limit);
int mthca_MODIFY_QP(struct mthca_dev *dev, enum ib_qp_state cur,
enum ib_qp_state next, u32 num, int is_ee,
struct mthca_mailbox *mailbox, u32 optmask);
int mthca_QUERY_QP(struct mthca_dev *dev, u32 num, int is_ee,
struct mthca_mailbox *mailbox);
int mthca_CONF_SPECIAL_QP(struct mthca_dev *dev, int type, u32 qpn);
int mthca_MAD_IFC(struct mthca_dev *dev, int ignore_mkey, int ignore_bkey,
int port, const struct ib_wc *in_wc, const struct ib_grh *in_grh,
const void *in_mad, void *response_mad);
int mthca_READ_MGM(struct mthca_dev *dev, int index,
struct mthca_mailbox *mailbox);
int mthca_WRITE_MGM(struct mthca_dev *dev, int index,
struct mthca_mailbox *mailbox);
int mthca_MGID_HASH(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
u16 *hash);
int mthca_NOP(struct mthca_dev *dev);
#endif /* MTHCA_CMD_H */
| 31.521472 | 81 | 0.741242 |
cf83e3ad9d3cd621cb70df235302cfa2aae29c47 | 646 | h | C | SmartDeviceLink/private/SDLCheckChoiceVROptionalOperation.h | LuxoftSDL/sdl_ios | 271071686037b42eac5d9fa03cb900400b31a4cf | [
"BSD-3-Clause"
] | 171 | 2015-01-13T14:17:29.000Z | 2022-03-18T19:55:24.000Z | SmartDeviceLink/private/SDLCheckChoiceVROptionalOperation.h | LuxoftSDL/sdl_ios | 271071686037b42eac5d9fa03cb900400b31a4cf | [
"BSD-3-Clause"
] | 1,524 | 2015-01-16T14:31:10.000Z | 2022-03-30T14:37:02.000Z | SmartDeviceLink/private/SDLCheckChoiceVROptionalOperation.h | LuxoftSDL/sdl_ios | 271071686037b42eac5d9fa03cb900400b31a4cf | [
"BSD-3-Clause"
] | 129 | 2015-01-15T19:27:18.000Z | 2021-11-26T01:49:12.000Z | //
// SDLCheckChoiceVROptionalOperation.h
// SmartDeviceLink
//
// Created by Joel Fischer on 5/24/18.
// Copyright © 2018 smartdevicelink. All rights reserved.
//
#import "SDLAsynchronousOperation.h"
@protocol SDLConnectionManagerType;
NS_ASSUME_NONNULL_BEGIN
@interface SDLCheckChoiceVROptionalOperation : SDLAsynchronousOperation
typedef void(^SDLCheckChoiceVROptionalCompletionHandler)(BOOL isVROptional, NSError *_Nullable error);
- (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connectionManager completionHandler:(SDLCheckChoiceVROptionalCompletionHandler)completionHandler;
@end
NS_ASSUME_NONNULL_END
| 25.84 | 169 | 0.837461 |
5cb5da8ffe2f6931064ceb200dda6a6729943eab | 391 | h | C | DLToolDemo/DLToolDemo/DLTool/Classes/DLTool/DLNetworkSpeed.h | DeIouch/DLTool | 95c4e92a05ad5c036a5c811be6887f94864c1ea0 | [
"MIT"
] | null | null | null | DLToolDemo/DLToolDemo/DLTool/Classes/DLTool/DLNetworkSpeed.h | DeIouch/DLTool | 95c4e92a05ad5c036a5c811be6887f94864c1ea0 | [
"MIT"
] | null | null | null | DLToolDemo/DLToolDemo/DLTool/Classes/DLTool/DLNetworkSpeed.h | DeIouch/DLTool | 95c4e92a05ad5c036a5c811be6887f94864c1ea0 | [
"MIT"
] | null | null | null | // 网速监听
#import <Foundation/Foundation.h>
@interface DLNetworkSpeed : NSObject
- (instancetype)init UNAVAILABLE_ATTRIBUTE;
+ (instancetype)new UNAVAILABLE_ATTRIBUTE;
@property (nonatomic, copy, readonly) NSString*downloadNetworkSpeed;
@property (nonatomic, copy, readonly) NSString *uploadNetworkSpeed;
+ (instancetype)shareInstance;
//开始监听
- (void)start;
//停止监听
- (void)stop;
@end
| 17.772727 | 68 | 0.767263 |
5cba49391f2c37ff8216390b4cc2b569de06db89 | 146,784 | h | C | wolfssl-3.13.0-stable/wolfssl/certs_test.h | sieren/esp-wolfssl | 04de416bd7642c1f9053caa3e3022c84053e892a | [
"MIT"
] | 75 | 2020-04-07T01:59:32.000Z | 2022-03-24T23:28:52.000Z | wolfssl-3.13.0-stable/wolfssl/certs_test.h | sieren/esp-wolfssl | 04de416bd7642c1f9053caa3e3022c84053e892a | [
"MIT"
] | 3 | 2020-04-13T03:34:59.000Z | 2022-02-25T03:44:19.000Z | wolfssl-3.13.0-stable/wolfssl/certs_test.h | sieren/esp-wolfssl | 04de416bd7642c1f9053caa3e3022c84053e892a | [
"MIT"
] | 22 | 2020-05-10T15:28:44.000Z | 2021-09-26T15:34:33.000Z | /* certs_test.h */
#ifndef WOLFSSL_CERTS_TEST_H
#define WOLFSSL_CERTS_TEST_H
#ifdef USE_CERT_BUFFERS_1024
/* ./certs/1024/client-key.der, 1024-bit */
static const unsigned char client_key_der_1024[] =
{
0x30, 0x82, 0x02, 0x5C, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81,
0x00, 0xBC, 0x73, 0x0E, 0xA8, 0x49, 0xF3, 0x74, 0xA2, 0xA9,
0xEF, 0x18, 0xA5, 0xDA, 0x55, 0x99, 0x21, 0xF9, 0xC8, 0xEC,
0xB3, 0x6D, 0x48, 0xE5, 0x35, 0x35, 0x75, 0x77, 0x37, 0xEC,
0xD1, 0x61, 0x90, 0x5F, 0x3E, 0xD9, 0xE4, 0xD5, 0xDF, 0x94,
0xCA, 0xC1, 0xA9, 0xD7, 0x19, 0xDA, 0x86, 0xC9, 0xE8, 0x4D,
0xC4, 0x61, 0x36, 0x82, 0xFE, 0xAB, 0xAD, 0x7E, 0x77, 0x25,
0xBB, 0x8D, 0x11, 0xA5, 0xBC, 0x62, 0x3A, 0xA8, 0x38, 0xCC,
0x39, 0xA2, 0x04, 0x66, 0xB4, 0xF7, 0xF7, 0xF3, 0xAA, 0xDA,
0x4D, 0x02, 0x0E, 0xBB, 0x5E, 0x8D, 0x69, 0x48, 0xDC, 0x77,
0xC9, 0x28, 0x0E, 0x22, 0xE9, 0x6B, 0xA4, 0x26, 0xBA, 0x4C,
0xE8, 0xC1, 0xFD, 0x4A, 0x6F, 0x2B, 0x1F, 0xEF, 0x8A, 0xAE,
0xF6, 0x90, 0x62, 0xE5, 0x64, 0x1E, 0xEB, 0x2B, 0x3C, 0x67,
0xC8, 0xDC, 0x27, 0x00, 0xF6, 0x91, 0x68, 0x65, 0xA9, 0x02,
0x03, 0x01, 0x00, 0x01, 0x02, 0x81, 0x80, 0x13, 0x97, 0xEA,
0xE8, 0x38, 0x78, 0x25, 0xA2, 0x5C, 0x04, 0xCE, 0x0D, 0x40,
0x7C, 0x31, 0xE5, 0xC4, 0x70, 0xCD, 0x9B, 0x82, 0x3B, 0x58,
0x09, 0x86, 0x3B, 0x66, 0x5F, 0xDC, 0x31, 0x90, 0xF1, 0x4F,
0xD5, 0xDB, 0x15, 0xDD, 0xDE, 0xD7, 0x3B, 0x95, 0x93, 0x31,
0x18, 0x31, 0x0E, 0x5E, 0xA3, 0xD6, 0xA2, 0x1A, 0x71, 0x6E,
0x81, 0x48, 0x1C, 0x4B, 0xCF, 0xDB, 0x8E, 0x7A, 0x86, 0x61,
0x32, 0xDC, 0xFB, 0x55, 0xC1, 0x16, 0x6D, 0x27, 0x92, 0x24,
0x45, 0x8B, 0xF1, 0xB8, 0x48, 0xB1, 0x4B, 0x1D, 0xAC, 0xDE,
0xDA, 0xDD, 0x8E, 0x2F, 0xC2, 0x91, 0xFB, 0xA5, 0xA9, 0x6E,
0xF8, 0x3A, 0x6A, 0xF1, 0xFD, 0x50, 0x18, 0xEF, 0x9F, 0xE7,
0xC3, 0xCA, 0x78, 0xEA, 0x56, 0xD3, 0xD3, 0x72, 0x5B, 0x96,
0xDD, 0x4E, 0x06, 0x4E, 0x3A, 0xC3, 0xD9, 0xBE, 0x72, 0xB6,
0x65, 0x07, 0x07, 0x4C, 0x01, 0x02, 0x41, 0x00, 0xFA, 0x47,
0xD4, 0x7A, 0x7C, 0x92, 0x3C, 0x55, 0xEF, 0x81, 0xF0, 0x41,
0x30, 0x2D, 0xA3, 0xCF, 0x8F, 0x1C, 0xE6, 0x87, 0x27, 0x05,
0x70, 0x0D, 0xDF, 0x98, 0x35, 0xD6, 0xF1, 0x8B, 0x38, 0x2F,
0x24, 0xB5, 0xD0, 0x84, 0xB6, 0x79, 0x4F, 0x71, 0x29, 0x94,
0x5A, 0xF0, 0x64, 0x6A, 0xAC, 0xE7, 0x72, 0xC6, 0xED, 0x4D,
0x59, 0x98, 0x3E, 0x67, 0x3A, 0xF3, 0x74, 0x2C, 0xF9, 0x61,
0x17, 0x69, 0x02, 0x41, 0x00, 0xC0, 0xC1, 0x82, 0x0D, 0x0C,
0xEB, 0xC6, 0x2F, 0xDC, 0x92, 0xF9, 0x9D, 0x82, 0x1A, 0x31,
0xE9, 0xE9, 0xF7, 0x4B, 0xF2, 0x82, 0x87, 0x1C, 0xEE, 0x16,
0x6A, 0xD1, 0x1D, 0x18, 0x82, 0x70, 0xF3, 0xC0, 0xB6, 0x2F,
0xF6, 0xF3, 0xF7, 0x1D, 0xF1, 0x86, 0x23, 0xC8, 0x4E, 0xEB,
0x8F, 0x56, 0x8E, 0x8F, 0xF5, 0xBF, 0xF1, 0xF7, 0x2B, 0xB5,
0xCC, 0x3D, 0xC6, 0x57, 0x39, 0x0C, 0x1B, 0x54, 0x41, 0x02,
0x41, 0x00, 0x9D, 0x7E, 0x05, 0xDE, 0xED, 0xF4, 0xB7, 0xB2,
0xFB, 0xFC, 0x30, 0x4B, 0x55, 0x1D, 0xE3, 0x2F, 0x01, 0x47,
0x96, 0x69, 0x05, 0xCD, 0x0E, 0x2E, 0x2C, 0xBD, 0x83, 0x63,
0xB6, 0xAB, 0x7C, 0xB7, 0x6D, 0xCA, 0x5B, 0x64, 0xA7, 0xCE,
0xBE, 0x86, 0xDF, 0x3B, 0x53, 0xDE, 0x61, 0xD2, 0x1E, 0xEB,
0xA5, 0xF6, 0x37, 0xED, 0xAC, 0xAB, 0x78, 0xD9, 0x4C, 0xE7,
0x55, 0xFB, 0xD7, 0x11, 0x99, 0xC1, 0x02, 0x40, 0x18, 0x98,
0x18, 0x29, 0xE6, 0x1E, 0x27, 0x39, 0x70, 0x21, 0x68, 0xAC,
0x0A, 0x2F, 0xA1, 0x72, 0xC1, 0x21, 0x86, 0x95, 0x38, 0xC6,
0x58, 0x90, 0xA0, 0x57, 0x9C, 0xBA, 0xE3, 0xA7, 0xB1, 0x15,
0xC8, 0xDE, 0xF6, 0x1B, 0xC2, 0x61, 0x23, 0x76, 0xEF, 0xB0,
0x9D, 0x1C, 0x44, 0xBE, 0x13, 0x43, 0x39, 0x67, 0x17, 0xC8,
0x9D, 0xCA, 0xFB, 0xF5, 0x45, 0x64, 0x8B, 0x38, 0x82, 0x2C,
0xF2, 0x81, 0x02, 0x40, 0x39, 0x89, 0xE5, 0x9C, 0x19, 0x55,
0x30, 0xBA, 0xB7, 0x48, 0x8C, 0x48, 0x14, 0x0E, 0xF4, 0x9F,
0x7E, 0x77, 0x97, 0x43, 0xE1, 0xB4, 0x19, 0x35, 0x31, 0x23,
0x75, 0x9C, 0x3B, 0x44, 0xAD, 0x69, 0x12, 0x56, 0xEE, 0x00,
0x61, 0x64, 0x16, 0x66, 0xD3, 0x7C, 0x74, 0x2B, 0x15, 0xB4,
0xA2, 0xFE, 0xBF, 0x08, 0x6B, 0x1A, 0x5D, 0x3F, 0x90, 0x12,
0xB1, 0x05, 0x86, 0x31, 0x29, 0xDB, 0xD9, 0xE2
};
static const int sizeof_client_key_der_1024 = sizeof(client_key_der_1024);
/* ./certs/1024/client-keyPub.der, 1024-bit */
static const unsigned char client_keypub_der_1024[] =
{
0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48,
0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81,
0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xBC,
0x73, 0x0E, 0xA8, 0x49, 0xF3, 0x74, 0xA2, 0xA9, 0xEF, 0x18,
0xA5, 0xDA, 0x55, 0x99, 0x21, 0xF9, 0xC8, 0xEC, 0xB3, 0x6D,
0x48, 0xE5, 0x35, 0x35, 0x75, 0x77, 0x37, 0xEC, 0xD1, 0x61,
0x90, 0x5F, 0x3E, 0xD9, 0xE4, 0xD5, 0xDF, 0x94, 0xCA, 0xC1,
0xA9, 0xD7, 0x19, 0xDA, 0x86, 0xC9, 0xE8, 0x4D, 0xC4, 0x61,
0x36, 0x82, 0xFE, 0xAB, 0xAD, 0x7E, 0x77, 0x25, 0xBB, 0x8D,
0x11, 0xA5, 0xBC, 0x62, 0x3A, 0xA8, 0x38, 0xCC, 0x39, 0xA2,
0x04, 0x66, 0xB4, 0xF7, 0xF7, 0xF3, 0xAA, 0xDA, 0x4D, 0x02,
0x0E, 0xBB, 0x5E, 0x8D, 0x69, 0x48, 0xDC, 0x77, 0xC9, 0x28,
0x0E, 0x22, 0xE9, 0x6B, 0xA4, 0x26, 0xBA, 0x4C, 0xE8, 0xC1,
0xFD, 0x4A, 0x6F, 0x2B, 0x1F, 0xEF, 0x8A, 0xAE, 0xF6, 0x90,
0x62, 0xE5, 0x64, 0x1E, 0xEB, 0x2B, 0x3C, 0x67, 0xC8, 0xDC,
0x27, 0x00, 0xF6, 0x91, 0x68, 0x65, 0xA9, 0x02, 0x03, 0x01,
0x00, 0x01
};
static const int sizeof_client_keypub_der_1024 = sizeof(client_keypub_der_1024);
/* ./certs/1024/client-cert.der, 1024-bit */
static const unsigned char client_cert_der_1024[] =
{
0x30, 0x82, 0x03, 0xC5, 0x30, 0x82, 0x03, 0x2E, 0xA0, 0x03,
0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0xF3, 0x63, 0xB8, 0x35,
0x1D, 0x0A, 0xD8, 0xD9, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x30,
0x81, 0x9E, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06,
0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74,
0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55,
0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61,
0x6E, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x0A,
0x0C, 0x0C, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x5F,
0x31, 0x30, 0x32, 0x34, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03,
0x55, 0x04, 0x0B, 0x0C, 0x10, 0x50, 0x72, 0x6F, 0x67, 0x72,
0x61, 0x6D, 0x6D, 0x69, 0x6E, 0x67, 0x2D, 0x31, 0x30, 0x32,
0x34, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03,
0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66,
0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30,
0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01,
0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77,
0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D,
0x30, 0x1E, 0x17, 0x0D, 0x31, 0x36, 0x30, 0x38, 0x31, 0x31,
0x32, 0x30, 0x30, 0x37, 0x33, 0x37, 0x5A, 0x17, 0x0D, 0x31,
0x39, 0x30, 0x35, 0x30, 0x38, 0x32, 0x30, 0x30, 0x37, 0x33,
0x37, 0x5A, 0x30, 0x81, 0x9E, 0x31, 0x0B, 0x30, 0x09, 0x06,
0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10,
0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D,
0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E,
0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A,
0x65, 0x6D, 0x61, 0x6E, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03,
0x55, 0x04, 0x0A, 0x0C, 0x0C, 0x77, 0x6F, 0x6C, 0x66, 0x53,
0x53, 0x4C, 0x5F, 0x31, 0x30, 0x32, 0x34, 0x31, 0x19, 0x30,
0x17, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x10, 0x50, 0x72,
0x6F, 0x67, 0x72, 0x61, 0x6D, 0x6D, 0x69, 0x6E, 0x67, 0x2D,
0x31, 0x30, 0x32, 0x34, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03,
0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77,
0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D,
0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66,
0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E,
0x63, 0x6F, 0x6D, 0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09,
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05,
0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81,
0x81, 0x00, 0xBC, 0x73, 0x0E, 0xA8, 0x49, 0xF3, 0x74, 0xA2,
0xA9, 0xEF, 0x18, 0xA5, 0xDA, 0x55, 0x99, 0x21, 0xF9, 0xC8,
0xEC, 0xB3, 0x6D, 0x48, 0xE5, 0x35, 0x35, 0x75, 0x77, 0x37,
0xEC, 0xD1, 0x61, 0x90, 0x5F, 0x3E, 0xD9, 0xE4, 0xD5, 0xDF,
0x94, 0xCA, 0xC1, 0xA9, 0xD7, 0x19, 0xDA, 0x86, 0xC9, 0xE8,
0x4D, 0xC4, 0x61, 0x36, 0x82, 0xFE, 0xAB, 0xAD, 0x7E, 0x77,
0x25, 0xBB, 0x8D, 0x11, 0xA5, 0xBC, 0x62, 0x3A, 0xA8, 0x38,
0xCC, 0x39, 0xA2, 0x04, 0x66, 0xB4, 0xF7, 0xF7, 0xF3, 0xAA,
0xDA, 0x4D, 0x02, 0x0E, 0xBB, 0x5E, 0x8D, 0x69, 0x48, 0xDC,
0x77, 0xC9, 0x28, 0x0E, 0x22, 0xE9, 0x6B, 0xA4, 0x26, 0xBA,
0x4C, 0xE8, 0xC1, 0xFD, 0x4A, 0x6F, 0x2B, 0x1F, 0xEF, 0x8A,
0xAE, 0xF6, 0x90, 0x62, 0xE5, 0x64, 0x1E, 0xEB, 0x2B, 0x3C,
0x67, 0xC8, 0xDC, 0x27, 0x00, 0xF6, 0x91, 0x68, 0x65, 0xA9,
0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x82, 0x01, 0x07, 0x30,
0x82, 0x01, 0x03, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E,
0x04, 0x16, 0x04, 0x14, 0x81, 0x69, 0x0F, 0xF8, 0xDF, 0xDD,
0xCF, 0x34, 0x29, 0xD5, 0x67, 0x75, 0x71, 0x85, 0xC7, 0x75,
0x10, 0x69, 0x59, 0xEC, 0x30, 0x81, 0xD3, 0x06, 0x03, 0x55,
0x1D, 0x23, 0x04, 0x81, 0xCB, 0x30, 0x81, 0xC8, 0x80, 0x14,
0x81, 0x69, 0x0F, 0xF8, 0xDF, 0xDD, 0xCF, 0x34, 0x29, 0xD5,
0x67, 0x75, 0x71, 0x85, 0xC7, 0x75, 0x10, 0x69, 0x59, 0xEC,
0xA1, 0x81, 0xA4, 0xA4, 0x81, 0xA1, 0x30, 0x81, 0x9E, 0x31,
0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04,
0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61,
0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C,
0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x15,
0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x0C, 0x77,
0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x5F, 0x31, 0x30, 0x32,
0x34, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x0B,
0x0C, 0x10, 0x50, 0x72, 0x6F, 0x67, 0x72, 0x61, 0x6D, 0x6D,
0x69, 0x6E, 0x67, 0x2D, 0x31, 0x30, 0x32, 0x34, 0x31, 0x18,
0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77,
0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C,
0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09,
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16,
0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66,
0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82, 0x09, 0x00,
0xF3, 0x63, 0xB8, 0x35, 0x1D, 0x0A, 0xD8, 0xD9, 0x30, 0x0C,
0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01,
0x01, 0xFF, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x03, 0x81, 0x81,
0x00, 0x31, 0x5E, 0xC5, 0x8C, 0x6F, 0xB7, 0xC5, 0x47, 0x1B,
0x51, 0x5F, 0x99, 0x91, 0xA1, 0x23, 0x45, 0x3C, 0x36, 0x59,
0x20, 0xFE, 0x90, 0x46, 0x95, 0x79, 0xE8, 0xB8, 0xD9, 0xDB,
0x44, 0x7F, 0x63, 0x42, 0x71, 0x59, 0xD5, 0x59, 0xA5, 0x3C,
0xD3, 0x43, 0x83, 0xA0, 0x7D, 0x1E, 0x56, 0x36, 0x02, 0x92,
0xE2, 0x0A, 0x19, 0xF6, 0x97, 0xF2, 0x82, 0x12, 0xA6, 0xB2,
0xBF, 0x3B, 0xB6, 0xB0, 0x07, 0xFC, 0x7A, 0x5B, 0x78, 0x22,
0xA0, 0x31, 0xF4, 0x3D, 0xEB, 0x0A, 0xC5, 0xE4, 0xE5, 0xB4,
0xC7, 0xBB, 0x4F, 0xA9, 0xB8, 0x37, 0x19, 0xBF, 0xC7, 0x64,
0x9D, 0x74, 0x9E, 0x78, 0xDF, 0x09, 0xF5, 0xD6, 0xDD, 0xC2,
0xFB, 0xCE, 0x94, 0xD5, 0xBF, 0x97, 0xB0, 0x76, 0xB5, 0xE9,
0x10, 0x65, 0x6C, 0x48, 0x85, 0xC4, 0x1B, 0xFF, 0x5B, 0x64,
0xC7, 0x11, 0x30, 0x06, 0xE4, 0x40, 0xF5, 0x90, 0x2B
};
static const int sizeof_client_cert_der_1024 = sizeof(client_cert_der_1024);
/* ./certs/1024/dh1024.der, 1024-bit */
static const unsigned char dh_key_der_1024[] =
{
0x30, 0x81, 0x87, 0x02, 0x81, 0x81, 0x00, 0xA4, 0xD2, 0xB8,
0x6E, 0x78, 0xF5, 0xD9, 0xED, 0x2D, 0x7C, 0xDD, 0xB6, 0x16,
0x86, 0x5A, 0x4B, 0x05, 0x76, 0x90, 0xDD, 0x66, 0x61, 0xB9,
0x6D, 0x52, 0xA7, 0x1C, 0xAF, 0x62, 0xC6, 0x69, 0x47, 0x7B,
0x39, 0xF2, 0xFB, 0x94, 0xEC, 0xBC, 0x79, 0xFF, 0x24, 0x5E,
0xEF, 0x79, 0xBB, 0x59, 0xB2, 0xFC, 0xCA, 0x07, 0xD6, 0xF4,
0xE9, 0x34, 0xF7, 0xE8, 0x38, 0xE7, 0xD7, 0x33, 0x44, 0x1D,
0xA3, 0x64, 0x76, 0x1A, 0x84, 0x97, 0x54, 0x74, 0x40, 0x84,
0x1F, 0x15, 0xFE, 0x7C, 0x25, 0x2A, 0x2B, 0x25, 0xFD, 0x9E,
0xC1, 0x89, 0x33, 0x8C, 0x39, 0x25, 0x2B, 0x40, 0xE6, 0xCD,
0xF8, 0xA8, 0xA1, 0x8A, 0x53, 0xC6, 0x47, 0xB2, 0xA0, 0xD7,
0x8F, 0xEB, 0x2E, 0x60, 0x0A, 0x0D, 0x4B, 0xF8, 0xB4, 0x94,
0x8C, 0x63, 0x0A, 0xAD, 0xC7, 0x10, 0xEA, 0xC7, 0xA1, 0xB9,
0x9D, 0xF2, 0xA8, 0x37, 0x73, 0x02, 0x01, 0x02
};
static const int sizeof_dh_key_der_1024 = sizeof(dh_key_der_1024);
/* ./certs/1024/dsa1024.der, 1024-bit */
static const unsigned char dsa_key_der_1024[] =
{
0x30, 0x82, 0x01, 0xBC, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81,
0x00, 0xF7, 0x4B, 0xF9, 0xBB, 0x15, 0x98, 0xEB, 0xDD, 0xDE,
0x1E, 0x4E, 0x71, 0x88, 0x85, 0xF2, 0xB7, 0xBA, 0xE2, 0x4A,
0xDA, 0x76, 0x40, 0xCD, 0x69, 0x48, 0x9E, 0x83, 0x7C, 0x11,
0xF7, 0x65, 0x31, 0x78, 0xF5, 0x25, 0x2D, 0xF7, 0xB7, 0xF8,
0x52, 0x3F, 0xBE, 0xD8, 0xB6, 0xC5, 0xFE, 0x18, 0x15, 0x5B,
0xB9, 0xD5, 0x92, 0x86, 0xBC, 0xB2, 0x17, 0x7C, 0xD8, 0xB0,
0xBE, 0xA0, 0x7C, 0xF2, 0xD5, 0x73, 0x7A, 0x58, 0x8F, 0x8D,
0xE5, 0x4A, 0x00, 0x99, 0x83, 0x4A, 0xC0, 0x9E, 0x16, 0x09,
0xA1, 0x10, 0x34, 0xD5, 0x19, 0xBB, 0x63, 0xE3, 0xDD, 0x83,
0x74, 0x7F, 0x10, 0xCA, 0x73, 0x75, 0xEE, 0x31, 0x4A, 0xDD,
0x9F, 0xE0, 0x02, 0x6A, 0x9D, 0xEE, 0xB2, 0x4B, 0xA7, 0x6B,
0x2A, 0x6C, 0xC7, 0x86, 0x77, 0xE8, 0x04, 0x15, 0xDC, 0x92,
0xB4, 0x7A, 0x29, 0x1F, 0x4E, 0x83, 0x63, 0x85, 0x55, 0x02,
0x15, 0x00, 0xD2, 0x05, 0xE4, 0x73, 0xFB, 0xC1, 0x99, 0xC5,
0xDC, 0x68, 0xA4, 0x8D, 0x92, 0x27, 0x3D, 0xE2, 0x52, 0x5F,
0x89, 0x8B, 0x02, 0x81, 0x81, 0x00, 0xAA, 0x21, 0x02, 0x09,
0x43, 0x6E, 0xFB, 0xA2, 0x54, 0x14, 0x85, 0x0A, 0xF4, 0x28,
0x7C, 0xCB, 0xCC, 0xDB, 0xF5, 0x1E, 0xA2, 0x18, 0xA9, 0x21,
0xDE, 0x88, 0x88, 0x33, 0x8C, 0x2E, 0xEB, 0x8D, 0xA3, 0xF0,
0x1D, 0xC8, 0x8F, 0xF6, 0x7E, 0xF8, 0xCF, 0x12, 0xF5, 0xB4,
0xA1, 0x11, 0x6F, 0x0C, 0xD4, 0xF0, 0x06, 0xAD, 0xC4, 0xFC,
0x14, 0x45, 0xC7, 0x94, 0x15, 0xBC, 0x19, 0x4B, 0xAE, 0xEF,
0x93, 0x6A, 0x4F, 0xCC, 0x14, 0xD8, 0x47, 0x8B, 0x39, 0x66,
0x87, 0x02, 0xD4, 0x28, 0x0A, 0xB8, 0xEE, 0x09, 0x37, 0xF4,
0x00, 0xA0, 0x04, 0xA7, 0x79, 0xA7, 0xD2, 0x3C, 0xF7, 0x34,
0x43, 0x56, 0x8E, 0xD0, 0x7C, 0xC2, 0xD8, 0x4D, 0x0F, 0x89,
0xED, 0x14, 0xC1, 0x2C, 0x9C, 0x4C, 0x19, 0x9B, 0x9E, 0xDC,
0x53, 0x09, 0x9F, 0xDF, 0x2D, 0xF0, 0x0C, 0x27, 0x54, 0x3A,
0x77, 0x14, 0x2D, 0xDE, 0x02, 0x81, 0x81, 0x00, 0xE8, 0x1F,
0x7C, 0xB7, 0xC0, 0x54, 0x51, 0xA7, 0x28, 0x2D, 0x58, 0x7C,
0xDE, 0xD4, 0x5C, 0xDD, 0xD5, 0x76, 0x84, 0x3C, 0x36, 0x20,
0xC0, 0xC3, 0x25, 0xD7, 0x3A, 0x38, 0xE1, 0x54, 0xC8, 0xFD,
0x40, 0x68, 0x1A, 0x21, 0x54, 0x26, 0x39, 0x14, 0xBF, 0xF6,
0xA3, 0x9C, 0x5E, 0xD9, 0x2B, 0xF7, 0xC9, 0x25, 0xBA, 0x00,
0x09, 0xCB, 0x7F, 0x0C, 0x4A, 0x24, 0xFD, 0x15, 0x16, 0x15,
0x48, 0xCD, 0x0B, 0x52, 0x44, 0x40, 0x7B, 0x90, 0x63, 0x2B,
0x90, 0x22, 0xC5, 0x18, 0x05, 0x80, 0x53, 0xAF, 0x83, 0x1F,
0x54, 0xE2, 0xB0, 0xA2, 0x0B, 0x5A, 0x92, 0x24, 0xE1, 0x62,
0x28, 0x3F, 0xB7, 0xCA, 0xB9, 0x89, 0xD6, 0xA0, 0xB7, 0xAD,
0xAE, 0x05, 0xE1, 0xC1, 0x59, 0x40, 0xED, 0x4A, 0x1B, 0x68,
0xA7, 0x7B, 0xFB, 0xC3, 0x20, 0x81, 0xEF, 0x4B, 0xF3, 0x69,
0x91, 0xB0, 0xCE, 0x3A, 0xB0, 0x38, 0x02, 0x14, 0x25, 0x38,
0x3B, 0xA1, 0x19, 0x75, 0xDF, 0x9B, 0xF5, 0x72, 0x53, 0x4F,
0x39, 0xE1, 0x1C, 0xEC, 0x13, 0x84, 0x82, 0x18
};
static const int sizeof_dsa_key_der_1024 = sizeof(dsa_key_der_1024);
/* ./certs/1024/rsa1024.der, 1024-bit */
static const unsigned char rsa_key_der_1024[] =
{
0x30, 0x82, 0x02, 0x5D, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81,
0x00, 0xBE, 0x70, 0x70, 0xB8, 0x04, 0x18, 0xE5, 0x28, 0xFE,
0x66, 0xD8, 0x90, 0x88, 0xE0, 0xF1, 0xB7, 0xC3, 0xD0, 0xD2,
0x3E, 0xE6, 0x4B, 0x94, 0x74, 0xB0, 0xFF, 0xB0, 0xF7, 0x63,
0xA5, 0xAB, 0x7E, 0xAF, 0xB6, 0x2B, 0xB7, 0x38, 0x16, 0x1A,
0x50, 0xBF, 0xF1, 0xCA, 0x87, 0x3A, 0xD5, 0xB0, 0xDA, 0xF8,
0x43, 0x7A, 0x15, 0xB9, 0x7E, 0xEA, 0x2A, 0x80, 0xD2, 0x51,
0xB0, 0x35, 0xAF, 0x07, 0xF3, 0xF2, 0x5D, 0x24, 0x3A, 0x4B,
0x87, 0x56, 0x48, 0x1B, 0x3C, 0x24, 0x9A, 0xDA, 0x70, 0x80,
0xBD, 0x3C, 0x8B, 0x03, 0x4A, 0x0C, 0x83, 0x71, 0xDE, 0xE3,
0x03, 0x70, 0xA2, 0xB7, 0x60, 0x09, 0x1B, 0x5E, 0xC7, 0x3D,
0xA0, 0x64, 0x60, 0xE3, 0xA9, 0x06, 0x8D, 0xD3, 0xFF, 0x42,
0xBB, 0x0A, 0x94, 0x27, 0x2D, 0x57, 0x42, 0x0D, 0xB0, 0x2D,
0xE0, 0xBA, 0x18, 0x25, 0x60, 0x92, 0x11, 0x92, 0xF3, 0x02,
0x03, 0x01, 0x00, 0x01, 0x02, 0x81, 0x80, 0x0E, 0xEE, 0x1D,
0xC8, 0x2F, 0x7A, 0x0C, 0x2D, 0x44, 0x94, 0xA7, 0x91, 0xDD,
0x49, 0x55, 0x6A, 0x04, 0xCE, 0x10, 0x4D, 0xA2, 0x1C, 0x76,
0xCD, 0x17, 0x3B, 0x54, 0x92, 0x70, 0x9B, 0x82, 0x70, 0x72,
0x32, 0x24, 0x07, 0x3F, 0x3C, 0x6C, 0x5F, 0xBC, 0x4C, 0xA6,
0x86, 0x27, 0x94, 0xAD, 0x42, 0xDD, 0x87, 0xDC, 0xC0, 0x6B,
0x44, 0x89, 0xF3, 0x3F, 0x1A, 0x3E, 0x11, 0x44, 0x84, 0x2E,
0x69, 0x4C, 0xBB, 0x4A, 0x71, 0x1A, 0xBB, 0x9A, 0x52, 0x3C,
0x6B, 0xDE, 0xBC, 0xB2, 0x7C, 0x51, 0xEF, 0x4F, 0x8F, 0x3A,
0xDC, 0x50, 0x04, 0x4E, 0xB6, 0x31, 0x66, 0xA8, 0x8E, 0x06,
0x3B, 0x51, 0xA9, 0xC1, 0x8A, 0xCB, 0xC4, 0x81, 0xCA, 0x2D,
0x69, 0xEC, 0x88, 0xFC, 0x33, 0x88, 0xD1, 0xD4, 0x29, 0x47,
0x87, 0x37, 0xF9, 0x6A, 0x22, 0x69, 0xB9, 0xC9, 0xFE, 0xEB,
0x8C, 0xC5, 0x21, 0x41, 0x71, 0x02, 0x41, 0x00, 0xFD, 0x17,
0x98, 0x42, 0x54, 0x1C, 0x23, 0xF8, 0xD7, 0x5D, 0xEF, 0x49,
0x4F, 0xAF, 0xD9, 0x35, 0x6F, 0x08, 0xC6, 0xC7, 0x40, 0x5C,
0x7E, 0x58, 0x86, 0xC2, 0xB2, 0x16, 0x39, 0x24, 0xC5, 0x06,
0xB0, 0x3D, 0xAF, 0x02, 0xD2, 0x87, 0x77, 0xD2, 0x76, 0xBA,
0xE3, 0x59, 0x60, 0x42, 0xF1, 0x16, 0xEF, 0x33, 0x0B, 0xF2,
0x0B, 0xBA, 0x99, 0xCC, 0xB6, 0x4C, 0x46, 0x3F, 0x33, 0xE4,
0xD4, 0x67, 0x02, 0x41, 0x00, 0xC0, 0xA0, 0x91, 0x6D, 0xFE,
0x28, 0xE0, 0x81, 0x5A, 0x15, 0xA7, 0xC9, 0xA8, 0x98, 0xC6,
0x0A, 0xAB, 0x00, 0xC5, 0x40, 0xC9, 0x21, 0xBB, 0xB2, 0x33,
0x5A, 0xA7, 0xCB, 0x6E, 0xB8, 0x08, 0x56, 0x4A, 0x76, 0x28,
0xE8, 0x6D, 0xBD, 0xF5, 0x26, 0x7B, 0xBF, 0xC5, 0x46, 0x45,
0x0D, 0xEC, 0x7D, 0xEE, 0x82, 0xD6, 0xCA, 0x5F, 0x3D, 0x6E,
0xCC, 0x94, 0x73, 0xCD, 0xCE, 0x86, 0x6E, 0x95, 0x95, 0x02,
0x40, 0x38, 0xFD, 0x28, 0x1E, 0xBF, 0x5B, 0xBA, 0xC9, 0xDC,
0x8C, 0xDD, 0x45, 0xAF, 0xB8, 0xD3, 0xFB, 0x11, 0x2E, 0x73,
0xBC, 0x08, 0x05, 0x0B, 0xBA, 0x19, 0x56, 0x1B, 0xCD, 0x9F,
0x3E, 0x65, 0x53, 0x15, 0x3A, 0x3E, 0x7F, 0x2F, 0x32, 0xAB,
0xCB, 0x6B, 0x4A, 0xB7, 0xC8, 0xB7, 0x41, 0x3B, 0x92, 0x43,
0x78, 0x46, 0x17, 0x51, 0x86, 0xC9, 0xFC, 0xEB, 0x8B, 0x8F,
0x41, 0xCA, 0x08, 0x9B, 0xBF, 0x02, 0x41, 0x00, 0xAD, 0x9B,
0x89, 0xB6, 0xF2, 0x8C, 0x70, 0xDA, 0xE4, 0x10, 0x04, 0x6B,
0x11, 0x92, 0xAF, 0x5A, 0xCA, 0x08, 0x25, 0xBF, 0x60, 0x07,
0x11, 0x1D, 0x68, 0x7F, 0x5A, 0x1F, 0x55, 0x28, 0x74, 0x0B,
0x21, 0x8D, 0x21, 0x0D, 0x6A, 0x6A, 0xFB, 0xD9, 0xB5, 0x4A,
0x7F, 0x47, 0xF7, 0xD0, 0xB6, 0xC6, 0x41, 0x02, 0x97, 0x07,
0x49, 0x93, 0x1A, 0x9B, 0x33, 0x68, 0xB3, 0xA2, 0x61, 0x32,
0xA5, 0x89, 0x02, 0x41, 0x00, 0x8F, 0xEF, 0xAD, 0xB5, 0xB0,
0xB0, 0x7E, 0x86, 0x03, 0x43, 0x93, 0x6E, 0xDD, 0x3C, 0x2D,
0x9B, 0x6A, 0x55, 0xFF, 0x6F, 0x3E, 0x70, 0x2A, 0xD4, 0xBF,
0x1F, 0x8C, 0x93, 0x60, 0x9E, 0x6D, 0x2F, 0x18, 0x6C, 0x11,
0x36, 0x98, 0x3F, 0x10, 0x78, 0xE8, 0x3E, 0x8F, 0xFE, 0x55,
0xB9, 0x9E, 0xD5, 0x5B, 0x2E, 0x87, 0x1C, 0x58, 0xD0, 0x37,
0x89, 0x96, 0xEC, 0x48, 0x54, 0xF5, 0x9F, 0x0F, 0xB3
};
static const int sizeof_rsa_key_der_1024 = sizeof(rsa_key_der_1024);
/* ./certs/1024/ca-key.der, 1024-bit */
static const unsigned char ca_key_der_1024[] =
{
0x30, 0x82, 0x02, 0x5E, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81,
0x00, 0xCD, 0xAC, 0xDD, 0x47, 0xEC, 0xBE, 0xB7, 0x24, 0xC3,
0x63, 0x1B, 0x54, 0x98, 0x79, 0xE1, 0xC7, 0x31, 0x16, 0x59,
0xD6, 0x9D, 0x77, 0x9D, 0x8D, 0xE2, 0x8B, 0xED, 0x04, 0x17,
0xB2, 0xC6, 0xEB, 0xE4, 0x9B, 0x91, 0xBE, 0x31, 0x50, 0x62,
0x97, 0x58, 0xB5, 0x7F, 0x29, 0xDE, 0xB3, 0x71, 0x24, 0x0B,
0xBF, 0x97, 0x09, 0x7F, 0x26, 0xDC, 0x2D, 0xEC, 0xA8, 0x2E,
0xB2, 0x64, 0x2B, 0x7A, 0x2B, 0x35, 0x19, 0x2D, 0xA2, 0x80,
0xCB, 0x99, 0xFD, 0x94, 0x71, 0x1B, 0x23, 0x8D, 0x54, 0xDB,
0x2E, 0x62, 0x8D, 0x81, 0x08, 0x2D, 0xF4, 0x24, 0x72, 0x27,
0x6C, 0xF9, 0xC9, 0x8E, 0xDB, 0x4C, 0x75, 0xBA, 0x9B, 0x01,
0xF8, 0x3F, 0x18, 0xF4, 0xE6, 0x7F, 0xFB, 0x57, 0x94, 0x92,
0xCC, 0x88, 0xC4, 0xB4, 0x00, 0xC2, 0xAA, 0xD4, 0xE5, 0x88,
0x18, 0xB3, 0x11, 0x2F, 0x73, 0xC0, 0xD6, 0x29, 0x09, 0x02,
0x03, 0x01, 0x00, 0x01, 0x02, 0x81, 0x80, 0x52, 0x35, 0x3D,
0x01, 0x29, 0xA4, 0x95, 0x29, 0x71, 0x9B, 0x64, 0x6A, 0x2C,
0xC3, 0xD2, 0xB5, 0xBE, 0x6E, 0x13, 0x9C, 0x8F, 0xB6, 0x26,
0xD8, 0x76, 0x6B, 0xBD, 0x61, 0xBC, 0x63, 0x2D, 0xD5, 0x4D,
0xBB, 0xCC, 0xC6, 0x3B, 0x89, 0xC8, 0xCE, 0x7B, 0x9B, 0x97,
0xE7, 0x51, 0x67, 0x61, 0xDA, 0xA9, 0x83, 0x7B, 0xC8, 0x44,
0xF5, 0x70, 0x5E, 0x3E, 0xD0, 0x7E, 0x51, 0xB9, 0x6E, 0x13,
0x57, 0x08, 0x5C, 0xE1, 0x67, 0x4F, 0x61, 0x5E, 0xA5, 0x09,
0xEC, 0x11, 0xDD, 0xE4, 0xB8, 0xB4, 0xF4, 0xE0, 0x63, 0x34,
0x4C, 0xDA, 0x32, 0x20, 0x1F, 0x85, 0x41, 0x5D, 0xBC, 0xDB,
0x24, 0xC5, 0xAF, 0xBE, 0x02, 0x5F, 0x22, 0xF1, 0x7C, 0xCC,
0x05, 0x56, 0xA6, 0xA6, 0x37, 0x9A, 0xEB, 0xFF, 0x52, 0x2D,
0xBF, 0x30, 0x4B, 0x9A, 0x1D, 0xEE, 0xAB, 0x9C, 0x2C, 0xE2,
0xC1, 0xB8, 0x9D, 0xC9, 0x31, 0x02, 0x41, 0x00, 0xE9, 0x89,
0x16, 0xCD, 0xAC, 0x2E, 0xF2, 0x4D, 0x66, 0x17, 0xBD, 0x78,
0x12, 0x12, 0x8D, 0x8E, 0x84, 0x24, 0xDE, 0x2D, 0x50, 0x41,
0x85, 0x8C, 0x34, 0x09, 0xFA, 0xFB, 0x6D, 0x87, 0x51, 0x4C,
0x13, 0x28, 0xF0, 0x60, 0x11, 0x86, 0x3D, 0xC2, 0xA4, 0xCF,
0x5E, 0xC5, 0x6F, 0x5B, 0x11, 0x32, 0x0A, 0xB5, 0x28, 0xD0,
0x82, 0x47, 0x44, 0x26, 0x92, 0xE2, 0x78, 0x59, 0xB4, 0x08,
0xB3, 0xFD, 0x02, 0x41, 0x00, 0xE1, 0x75, 0xB4, 0x6A, 0xB5,
0x8C, 0x11, 0xFB, 0xCC, 0x42, 0x02, 0xC5, 0xDA, 0x48, 0xCE,
0x29, 0x43, 0x14, 0x01, 0x9A, 0x2C, 0xB3, 0xA4, 0xCB, 0x73,
0xEB, 0xA1, 0x35, 0x57, 0xAD, 0xB5, 0x16, 0x17, 0x80, 0x03,
0x5F, 0x32, 0x37, 0xBE, 0xA2, 0x6F, 0xF9, 0x31, 0x84, 0xBF,
0x00, 0x6E, 0x8D, 0x03, 0x0E, 0x30, 0x1C, 0xD0, 0x2F, 0x37,
0xF0, 0x7E, 0xC2, 0x64, 0xBF, 0xEE, 0x4B, 0xE8, 0xFD, 0x02,
0x41, 0x00, 0xE1, 0x99, 0x8B, 0x2B, 0xD8, 0x9F, 0xE9, 0x76,
0x97, 0x9F, 0x6B, 0x6B, 0x28, 0x9A, 0x3F, 0xA1, 0x63, 0x4A,
0x72, 0x4E, 0xF7, 0xEE, 0xB3, 0xE2, 0x43, 0x0B, 0x39, 0x27,
0xD6, 0x21, 0x18, 0x8A, 0x13, 0x20, 0x43, 0x45, 0xAA, 0xE8,
0x31, 0x95, 0x6C, 0xBC, 0xDE, 0xE2, 0x7F, 0xB6, 0x4B, 0xA0,
0x39, 0xF3, 0xD3, 0x9F, 0xC9, 0x9A, 0xAA, 0xDD, 0x50, 0x9B,
0xF2, 0x83, 0x45, 0x85, 0xFA, 0xC9, 0x02, 0x41, 0x00, 0xAF,
0xB0, 0xC7, 0x7C, 0xF8, 0x28, 0x44, 0xC3, 0x50, 0xF2, 0x87,
0xB2, 0xA2, 0x5D, 0x65, 0xBA, 0x25, 0xB9, 0x6B, 0x5E, 0x37,
0x43, 0x6E, 0x41, 0xD4, 0xFD, 0x63, 0x4C, 0x6C, 0x1C, 0xC3,
0x26, 0x89, 0xFD, 0x89, 0xA3, 0x1F, 0x40, 0xED, 0x5F, 0x2B,
0x9E, 0xA6, 0x85, 0xE9, 0x49, 0x6E, 0xDC, 0x97, 0xEA, 0xF0,
0x77, 0x23, 0x8C, 0x08, 0x2D, 0x72, 0xBA, 0x0D, 0x44, 0xBB,
0x6F, 0x90, 0x09, 0x02, 0x41, 0x00, 0x91, 0xE4, 0x2E, 0xCA,
0x8C, 0x0A, 0x69, 0x2F, 0x62, 0xE2, 0x62, 0x3B, 0xA5, 0x8D,
0x5A, 0x2C, 0x56, 0x3E, 0x7F, 0x67, 0x42, 0x92, 0x12, 0x92,
0x5F, 0xF3, 0x97, 0xDD, 0xE1, 0xA9, 0x7F, 0xAD, 0x2E, 0x2D,
0xF4, 0x4A, 0x57, 0xB3, 0x7A, 0x10, 0xBD, 0xD7, 0xE4, 0xEC,
0x6A, 0x08, 0x21, 0xE9, 0xF2, 0x46, 0x49, 0xD2, 0x69, 0x47,
0x8A, 0x20, 0x4B, 0xF2, 0xB1, 0x52, 0x83, 0xAB, 0x6F, 0x10
};
static const int sizeof_ca_key_der_1024 = sizeof(ca_key_der_1024);
/* ./certs/1024/ca-cert.der, 1024-bit */
static const unsigned char ca_cert_der_1024[] =
{
0x30, 0x82, 0x03, 0xB5, 0x30, 0x82, 0x03, 0x1E, 0xA0, 0x03,
0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0x8F, 0x44, 0x26, 0xFF,
0xB7, 0x43, 0xE1, 0x9A, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30,
0x81, 0x99, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06,
0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74,
0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55,
0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61,
0x6E, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x0A,
0x0C, 0x08, 0x53, 0x61, 0x77, 0x74, 0x6F, 0x6F, 0x74, 0x68,
0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C,
0x0F, 0x43, 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, 0x6E,
0x67, 0x5F, 0x31, 0x30, 0x32, 0x34, 0x31, 0x18, 0x30, 0x16,
0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77,
0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63,
0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69,
0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73,
0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x31,
0x35, 0x30, 0x39, 0x32, 0x33, 0x31, 0x39, 0x32, 0x33, 0x33,
0x38, 0x5A, 0x17, 0x0D, 0x31, 0x38, 0x30, 0x36, 0x31, 0x39,
0x31, 0x39, 0x32, 0x33, 0x33, 0x38, 0x5A, 0x30, 0x81, 0x99,
0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55,
0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E,
0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07,
0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31,
0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x08,
0x53, 0x61, 0x77, 0x74, 0x6F, 0x6F, 0x74, 0x68, 0x31, 0x18,
0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0F, 0x43,
0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, 0x6E, 0x67, 0x5F,
0x31, 0x30, 0x32, 0x34, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03,
0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77,
0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D,
0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66,
0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E,
0x63, 0x6F, 0x6D, 0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09,
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05,
0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81,
0x81, 0x00, 0xCD, 0xAC, 0xDD, 0x47, 0xEC, 0xBE, 0xB7, 0x24,
0xC3, 0x63, 0x1B, 0x54, 0x98, 0x79, 0xE1, 0xC7, 0x31, 0x16,
0x59, 0xD6, 0x9D, 0x77, 0x9D, 0x8D, 0xE2, 0x8B, 0xED, 0x04,
0x17, 0xB2, 0xC6, 0xEB, 0xE4, 0x9B, 0x91, 0xBE, 0x31, 0x50,
0x62, 0x97, 0x58, 0xB5, 0x7F, 0x29, 0xDE, 0xB3, 0x71, 0x24,
0x0B, 0xBF, 0x97, 0x09, 0x7F, 0x26, 0xDC, 0x2D, 0xEC, 0xA8,
0x2E, 0xB2, 0x64, 0x2B, 0x7A, 0x2B, 0x35, 0x19, 0x2D, 0xA2,
0x80, 0xCB, 0x99, 0xFD, 0x94, 0x71, 0x1B, 0x23, 0x8D, 0x54,
0xDB, 0x2E, 0x62, 0x8D, 0x81, 0x08, 0x2D, 0xF4, 0x24, 0x72,
0x27, 0x6C, 0xF9, 0xC9, 0x8E, 0xDB, 0x4C, 0x75, 0xBA, 0x9B,
0x01, 0xF8, 0x3F, 0x18, 0xF4, 0xE6, 0x7F, 0xFB, 0x57, 0x94,
0x92, 0xCC, 0x88, 0xC4, 0xB4, 0x00, 0xC2, 0xAA, 0xD4, 0xE5,
0x88, 0x18, 0xB3, 0x11, 0x2F, 0x73, 0xC0, 0xD6, 0x29, 0x09,
0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x82, 0x01, 0x01, 0x30,
0x81, 0xFE, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04,
0x16, 0x04, 0x14, 0xD3, 0x22, 0x8F, 0x28, 0x2C, 0xE0, 0x05,
0xEE, 0xD3, 0xED, 0xC3, 0x71, 0x3D, 0xC9, 0xB2, 0x36, 0x3A,
0x1D, 0xBF, 0xA8, 0x30, 0x81, 0xCE, 0x06, 0x03, 0x55, 0x1D,
0x23, 0x04, 0x81, 0xC6, 0x30, 0x81, 0xC3, 0x80, 0x14, 0xD3,
0x22, 0x8F, 0x28, 0x2C, 0xE0, 0x05, 0xEE, 0xD3, 0xED, 0xC3,
0x71, 0x3D, 0xC9, 0xB2, 0x36, 0x3A, 0x1D, 0xBF, 0xA8, 0xA1,
0x81, 0x9F, 0xA4, 0x81, 0x9C, 0x30, 0x81, 0x99, 0x31, 0x0B,
0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55,
0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08,
0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31,
0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07,
0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x11, 0x30,
0x0F, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x08, 0x53, 0x61,
0x77, 0x74, 0x6F, 0x6F, 0x74, 0x68, 0x31, 0x18, 0x30, 0x16,
0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0F, 0x43, 0x6F, 0x6E,
0x73, 0x75, 0x6C, 0x74, 0x69, 0x6E, 0x67, 0x5F, 0x31, 0x30,
0x32, 0x34, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04,
0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C,
0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F,
0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D,
0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40,
0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F,
0x6D, 0x82, 0x09, 0x00, 0x8F, 0x44, 0x26, 0xFF, 0xB7, 0x43,
0xE1, 0x9A, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04,
0x05, 0x30, 0x03, 0x01, 0x01, 0xFF, 0x30, 0x0D, 0x06, 0x09,
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05,
0x00, 0x03, 0x81, 0x81, 0x00, 0x0E, 0x46, 0xAC, 0xD8, 0x29,
0x1D, 0x12, 0x12, 0x06, 0x0C, 0xD3, 0x3F, 0x7D, 0x58, 0x2E,
0x0D, 0x11, 0x5E, 0x5D, 0x0D, 0xDD, 0x17, 0xC0, 0x0F, 0xAA,
0x01, 0x4D, 0xA4, 0xC4, 0x84, 0x81, 0x6E, 0x64, 0xAE, 0xD1,
0x5D, 0x58, 0xCD, 0x19, 0x6A, 0x74, 0xA4, 0x46, 0x2F, 0xC8,
0x43, 0x79, 0x39, 0xC0, 0x91, 0x4B, 0x7C, 0x71, 0xEA, 0x4E,
0x63, 0x44, 0x66, 0x15, 0x41, 0x15, 0xDE, 0x50, 0x82, 0xE3,
0xE9, 0xD1, 0x55, 0x55, 0xCC, 0x5A, 0x38, 0x1E, 0x3A, 0x59,
0xB3, 0x0E, 0xEE, 0x0E, 0x54, 0x4D, 0x93, 0xE7, 0xE0, 0x8E,
0x27, 0xA5, 0x6E, 0x08, 0xB8, 0x6A, 0x39, 0xDA, 0x2D, 0x47,
0x62, 0xC4, 0x5B, 0x89, 0xC0, 0x48, 0x48, 0x2A, 0xD5, 0xF0,
0x55, 0x74, 0xFD, 0xA6, 0xB1, 0x68, 0x3C, 0x70, 0xA4, 0x52,
0x24, 0x81, 0xEC, 0x4C, 0x57, 0xE0, 0xE8, 0x18, 0x73, 0x9D,
0x0A, 0x4D, 0xD8
};
static const int sizeof_ca_cert_der_1024 = sizeof(ca_cert_der_1024);
/* ./certs/1024/server-key.der, 1024-bit */
static const unsigned char server_key_der_1024[] =
{
0x30, 0x82, 0x02, 0x5D, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81,
0x00, 0xAA, 0x3E, 0xA5, 0x9C, 0xD3, 0x17, 0x49, 0x65, 0x43,
0xDE, 0xD0, 0xF3, 0x4B, 0x1C, 0xDB, 0x49, 0x0C, 0xFC, 0x7A,
0x65, 0x05, 0x6D, 0xDE, 0x6A, 0xC4, 0xE4, 0x73, 0x2C, 0x8A,
0x96, 0x82, 0x8F, 0x23, 0xA5, 0x06, 0x71, 0x1C, 0x06, 0x3E,
0x2F, 0x92, 0x8D, 0x0B, 0x29, 0x34, 0x45, 0x59, 0xE9, 0xA9,
0xBC, 0x61, 0xD7, 0x24, 0x37, 0x5D, 0xB5, 0xC4, 0x37, 0x8D,
0xBA, 0x67, 0xB2, 0xEF, 0x03, 0x27, 0xFA, 0xC1, 0xB4, 0xCD,
0x6B, 0x00, 0x66, 0xB4, 0xD6, 0x73, 0x70, 0x1F, 0x08, 0x3A,
0xCC, 0x77, 0xAD, 0xE9, 0xF9, 0x34, 0xD4, 0xF3, 0xA0, 0x2D,
0xA9, 0xE7, 0x58, 0xA9, 0xC0, 0x61, 0x84, 0xB6, 0xEC, 0x3D,
0x0A, 0xAD, 0xFD, 0x5C, 0x86, 0x73, 0xAA, 0x6B, 0x47, 0xD8,
0x8B, 0x2E, 0x58, 0x4B, 0x69, 0x12, 0x82, 0x26, 0x55, 0xE6,
0x14, 0xBF, 0x55, 0x70, 0x88, 0xFE, 0xF9, 0x75, 0xE1, 0x02,
0x03, 0x01, 0x00, 0x01, 0x02, 0x81, 0x80, 0x0A, 0x4C, 0xC1,
0xFE, 0x4B, 0xF3, 0x23, 0xB8, 0xA1, 0xB3, 0x90, 0x56, 0xB7,
0xDB, 0xA6, 0x14, 0xB4, 0x59, 0x6E, 0x1A, 0x40, 0x8A, 0xD6,
0x23, 0x05, 0x88, 0x80, 0xC3, 0x58, 0x1B, 0x25, 0x08, 0xFD,
0xF2, 0x15, 0x02, 0xB0, 0xDC, 0x5B, 0xD4, 0xCA, 0xFC, 0x07,
0x89, 0xD5, 0xA4, 0xC0, 0x7C, 0xD7, 0x8D, 0x13, 0x2A, 0x4E,
0x01, 0x9F, 0x84, 0xC8, 0xBB, 0x47, 0xB2, 0xD8, 0x65, 0x45,
0xFA, 0x84, 0x9F, 0x88, 0xD0, 0xF4, 0xF5, 0x22, 0x35, 0x77,
0x11, 0x67, 0x1C, 0xDE, 0x5F, 0x85, 0x6D, 0x55, 0xD8, 0xA7,
0x07, 0x15, 0x8C, 0xE1, 0xB0, 0xA7, 0x79, 0xB4, 0x47, 0x9D,
0x70, 0xB3, 0xD2, 0xF1, 0x1F, 0x41, 0x4C, 0x65, 0x72, 0x26,
0xEB, 0x66, 0xC8, 0x95, 0xF6, 0x6D, 0x87, 0x35, 0x53, 0xFE,
0xB1, 0x52, 0x4D, 0x76, 0x5B, 0x61, 0x53, 0x89, 0xB1, 0x20,
0x1A, 0x8B, 0xE4, 0x7D, 0xF1, 0x02, 0x41, 0x00, 0xD9, 0x6E,
0xE1, 0xD9, 0x06, 0x56, 0xA1, 0xF6, 0xDF, 0x54, 0x45, 0xC5,
0xEC, 0x6A, 0xC8, 0x2A, 0x38, 0x4E, 0x6B, 0xC6, 0xE8, 0xEA,
0xFB, 0x6F, 0x65, 0x2D, 0xBA, 0xDE, 0x27, 0x63, 0x37, 0x21,
0x2E, 0xA4, 0x55, 0xAB, 0xE7, 0xDB, 0xCE, 0x71, 0xE1, 0x08,
0xFC, 0xF2, 0xCA, 0x52, 0x33, 0x55, 0xE8, 0x39, 0xB3, 0xDA,
0xC5, 0xB0, 0x69, 0x84, 0x6E, 0xE3, 0xCF, 0x47, 0x80, 0xA6,
0xB6, 0x85, 0x02, 0x41, 0x00, 0xC8, 0x71, 0x0D, 0x37, 0x47,
0xE1, 0x7B, 0x21, 0x2D, 0x11, 0x2D, 0x95, 0x2E, 0xC7, 0xD0,
0xB6, 0xD3, 0x7C, 0x5C, 0x93, 0x3C, 0x5B, 0x22, 0xE5, 0xE0,
0x8B, 0x6D, 0x47, 0xF9, 0x14, 0x0F, 0x9E, 0x08, 0x1B, 0x53,
0xAB, 0x0A, 0xA9, 0xE4, 0x7F, 0x40, 0xD3, 0xDF, 0x62, 0x74,
0x10, 0xA2, 0xFE, 0x83, 0x1F, 0xCF, 0x55, 0x66, 0xEB, 0x5D,
0xC5, 0x83, 0xBA, 0xEC, 0x9F, 0xD2, 0xB5, 0x06, 0xAD, 0x02,
0x41, 0x00, 0xB7, 0x68, 0x19, 0xA7, 0xC7, 0xF9, 0xF1, 0x9A,
0xDD, 0x5D, 0x27, 0x91, 0xC1, 0x4F, 0x7D, 0x52, 0x67, 0xB6,
0x76, 0xA1, 0x0D, 0x3D, 0x91, 0x23, 0xB0, 0xB3, 0xF7, 0x49,
0x86, 0xED, 0xE0, 0xC5, 0xE3, 0xA3, 0x09, 0x04, 0xFD, 0x89,
0xE2, 0xC5, 0x1A, 0x6E, 0x4B, 0x77, 0xBD, 0x03, 0xC3, 0x7B,
0xB6, 0x6C, 0x5D, 0xF2, 0xAF, 0x08, 0x94, 0xA8, 0xFA, 0x24,
0xBD, 0x66, 0x71, 0xF5, 0xAE, 0x45, 0x02, 0x40, 0x15, 0x52,
0xD1, 0x91, 0x1B, 0xF8, 0x84, 0xDC, 0xD6, 0xAA, 0x89, 0x2A,
0xE1, 0xBB, 0x28, 0x1D, 0x0B, 0x0A, 0xA3, 0xDE, 0x96, 0x01,
0x2C, 0x09, 0x40, 0x86, 0x14, 0xAE, 0x1F, 0x75, 0x5E, 0xE3,
0xF5, 0x00, 0xD3, 0x39, 0xD2, 0xFC, 0x97, 0xEE, 0x61, 0xBB,
0x28, 0x7C, 0x94, 0xD4, 0x60, 0x42, 0xAB, 0x38, 0x6B, 0x1A,
0x2E, 0xC4, 0xC3, 0x49, 0x0B, 0xE6, 0x8A, 0xDD, 0xC5, 0xD0,
0xB4, 0x51, 0x02, 0x41, 0x00, 0xA9, 0x8B, 0xA7, 0xA9, 0xEE,
0xAE, 0xBB, 0x17, 0xCB, 0x72, 0xF2, 0x50, 0x22, 0x9D, 0xB3,
0xDF, 0xE0, 0x40, 0x37, 0x08, 0xD5, 0x7F, 0x19, 0x58, 0x80,
0x70, 0x79, 0x69, 0x99, 0xDF, 0x62, 0x0D, 0x21, 0xAB, 0xDD,
0xB2, 0xCE, 0x68, 0xB3, 0x9F, 0x87, 0xAF, 0x55, 0xF4, 0xAA,
0xE1, 0x00, 0x72, 0xBE, 0x6E, 0xC3, 0x94, 0x49, 0xDC, 0xBB,
0x8E, 0x1A, 0x78, 0xE5, 0x49, 0x1F, 0x55, 0x41, 0xA1
};
static const int sizeof_server_key_der_1024 = sizeof(server_key_der_1024);
/* ./certs/1024/server-cert.der, 1024-bit */
static const unsigned char server_cert_der_1024[] =
{
0x30, 0x82, 0x03, 0xA9, 0x30, 0x82, 0x03, 0x12, 0xA0, 0x03,
0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x30, 0x0D, 0x06, 0x09,
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05,
0x00, 0x30, 0x81, 0x99, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03,
0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30,
0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F,
0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06,
0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65,
0x6D, 0x61, 0x6E, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55,
0x04, 0x0A, 0x0C, 0x08, 0x53, 0x61, 0x77, 0x74, 0x6F, 0x6F,
0x74, 0x68, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04,
0x0B, 0x0C, 0x0F, 0x43, 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74,
0x69, 0x6E, 0x67, 0x5F, 0x31, 0x30, 0x32, 0x34, 0x31, 0x18,
0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77,
0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C,
0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09,
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16,
0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66,
0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x1E, 0x17,
0x0D, 0x31, 0x35, 0x30, 0x39, 0x32, 0x33, 0x31, 0x39, 0x32,
0x33, 0x33, 0x38, 0x5A, 0x17, 0x0D, 0x31, 0x38, 0x30, 0x36,
0x31, 0x39, 0x31, 0x39, 0x32, 0x33, 0x33, 0x38, 0x5A, 0x30,
0x81, 0x95, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06,
0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74,
0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55,
0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61,
0x6E, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x0A,
0x0C, 0x07, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x31,
0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0C,
0x53, 0x75, 0x70, 0x70, 0x6F, 0x72, 0x74, 0x5F, 0x31, 0x30,
0x32, 0x34, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04,
0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C,
0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F,
0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D,
0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40,
0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F,
0x6D, 0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03,
0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00,
0xAA, 0x3E, 0xA5, 0x9C, 0xD3, 0x17, 0x49, 0x65, 0x43, 0xDE,
0xD0, 0xF3, 0x4B, 0x1C, 0xDB, 0x49, 0x0C, 0xFC, 0x7A, 0x65,
0x05, 0x6D, 0xDE, 0x6A, 0xC4, 0xE4, 0x73, 0x2C, 0x8A, 0x96,
0x82, 0x8F, 0x23, 0xA5, 0x06, 0x71, 0x1C, 0x06, 0x3E, 0x2F,
0x92, 0x8D, 0x0B, 0x29, 0x34, 0x45, 0x59, 0xE9, 0xA9, 0xBC,
0x61, 0xD7, 0x24, 0x37, 0x5D, 0xB5, 0xC4, 0x37, 0x8D, 0xBA,
0x67, 0xB2, 0xEF, 0x03, 0x27, 0xFA, 0xC1, 0xB4, 0xCD, 0x6B,
0x00, 0x66, 0xB4, 0xD6, 0x73, 0x70, 0x1F, 0x08, 0x3A, 0xCC,
0x77, 0xAD, 0xE9, 0xF9, 0x34, 0xD4, 0xF3, 0xA0, 0x2D, 0xA9,
0xE7, 0x58, 0xA9, 0xC0, 0x61, 0x84, 0xB6, 0xEC, 0x3D, 0x0A,
0xAD, 0xFD, 0x5C, 0x86, 0x73, 0xAA, 0x6B, 0x47, 0xD8, 0x8B,
0x2E, 0x58, 0x4B, 0x69, 0x12, 0x82, 0x26, 0x55, 0xE6, 0x14,
0xBF, 0x55, 0x70, 0x88, 0xFE, 0xF9, 0x75, 0xE1, 0x02, 0x03,
0x01, 0x00, 0x01, 0xA3, 0x82, 0x01, 0x01, 0x30, 0x81, 0xFE,
0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04,
0x14, 0xD9, 0x3C, 0x35, 0xEA, 0x74, 0x0E, 0x23, 0xBE, 0x9C,
0xFC, 0xFA, 0x29, 0x90, 0x09, 0xC1, 0xE7, 0x84, 0x16, 0x9F,
0x7C, 0x30, 0x81, 0xCE, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04,
0x81, 0xC6, 0x30, 0x81, 0xC3, 0x80, 0x14, 0xD3, 0x22, 0x8F,
0x28, 0x2C, 0xE0, 0x05, 0xEE, 0xD3, 0xED, 0xC3, 0x71, 0x3D,
0xC9, 0xB2, 0x36, 0x3A, 0x1D, 0xBF, 0xA8, 0xA1, 0x81, 0x9F,
0xA4, 0x81, 0x9C, 0x30, 0x81, 0x99, 0x31, 0x0B, 0x30, 0x09,
0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31,
0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07,
0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30,
0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F,
0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x11, 0x30, 0x0F, 0x06,
0x03, 0x55, 0x04, 0x0A, 0x0C, 0x08, 0x53, 0x61, 0x77, 0x74,
0x6F, 0x6F, 0x74, 0x68, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03,
0x55, 0x04, 0x0B, 0x0C, 0x0F, 0x43, 0x6F, 0x6E, 0x73, 0x75,
0x6C, 0x74, 0x69, 0x6E, 0x67, 0x5F, 0x31, 0x30, 0x32, 0x34,
0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C,
0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73,
0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D,
0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09,
0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F,
0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82,
0x09, 0x00, 0x8F, 0x44, 0x26, 0xFF, 0xB7, 0x43, 0xE1, 0x9A,
0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05, 0x30,
0x03, 0x01, 0x01, 0xFF, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03,
0x81, 0x81, 0x00, 0x0A, 0x04, 0xC7, 0x9A, 0xC4, 0xF6, 0x46,
0xDB, 0xE4, 0x85, 0xD4, 0x22, 0x02, 0x12, 0x3E, 0x53, 0x27,
0x25, 0x24, 0x8A, 0x9B, 0x2F, 0x93, 0x7F, 0xDE, 0x70, 0x94,
0xC5, 0x6C, 0x4C, 0x26, 0x25, 0x25, 0x7A, 0xD7, 0x0F, 0x33,
0xB9, 0x9C, 0xD2, 0x5A, 0x94, 0x7F, 0x8D, 0x30, 0x75, 0xAD,
0x82, 0xC9, 0xBF, 0x4B, 0x6C, 0x91, 0x58, 0x7C, 0x45, 0x1A,
0x89, 0xDF, 0x8E, 0xCA, 0x31, 0x9F, 0xAB, 0x38, 0xB3, 0xAE,
0xC2, 0x8F, 0x14, 0x87, 0xE6, 0x1C, 0xAB, 0x12, 0x4E, 0xDF,
0x82, 0x36, 0xC9, 0x41, 0x46, 0xC4, 0x05, 0x95, 0x88, 0x62,
0x09, 0x72, 0x57, 0x66, 0x31, 0x80, 0xB8, 0x9C, 0x55, 0xA8,
0xFB, 0x74, 0x01, 0x32, 0xE7, 0x5A, 0x40, 0xDF, 0x9B, 0xE4,
0x98, 0xD7, 0x5B, 0xEA, 0x69, 0x5C, 0x14, 0x1B, 0x9B, 0x8B,
0x08, 0x2D, 0xD9, 0x58, 0x28, 0xBE, 0xC9, 0x01, 0xE0, 0xE1,
0xA9
};
static const int sizeof_server_cert_der_1024 = sizeof(server_cert_der_1024);
#endif /* USE_CERT_BUFFERS_1024 */
#ifdef USE_CERT_BUFFERS_2048
/* ./certs/client-key.der, 2048-bit */
static const unsigned char client_key_der_2048[] =
{
0x30, 0x82, 0x04, 0xA4, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01,
0x01, 0x00, 0xC3, 0x03, 0xD1, 0x2B, 0xFE, 0x39, 0xA4, 0x32,
0x45, 0x3B, 0x53, 0xC8, 0x84, 0x2B, 0x2A, 0x7C, 0x74, 0x9A,
0xBD, 0xAA, 0x2A, 0x52, 0x07, 0x47, 0xD6, 0xA6, 0x36, 0xB2,
0x07, 0x32, 0x8E, 0xD0, 0xBA, 0x69, 0x7B, 0xC6, 0xC3, 0x44,
0x9E, 0xD4, 0x81, 0x48, 0xFD, 0x2D, 0x68, 0xA2, 0x8B, 0x67,
0xBB, 0xA1, 0x75, 0xC8, 0x36, 0x2C, 0x4A, 0xD2, 0x1B, 0xF7,
0x8B, 0xBA, 0xCF, 0x0D, 0xF9, 0xEF, 0xEC, 0xF1, 0x81, 0x1E,
0x7B, 0x9B, 0x03, 0x47, 0x9A, 0xBF, 0x65, 0xCC, 0x7F, 0x65,
0x24, 0x69, 0xA6, 0xE8, 0x14, 0x89, 0x5B, 0xE4, 0x34, 0xF7,
0xC5, 0xB0, 0x14, 0x93, 0xF5, 0x67, 0x7B, 0x3A, 0x7A, 0x78,
0xE1, 0x01, 0x56, 0x56, 0x91, 0xA6, 0x13, 0x42, 0x8D, 0xD2,
0x3C, 0x40, 0x9C, 0x4C, 0xEF, 0xD1, 0x86, 0xDF, 0x37, 0x51,
0x1B, 0x0C, 0xA1, 0x3B, 0xF5, 0xF1, 0xA3, 0x4A, 0x35, 0xE4,
0xE1, 0xCE, 0x96, 0xDF, 0x1B, 0x7E, 0xBF, 0x4E, 0x97, 0xD0,
0x10, 0xE8, 0xA8, 0x08, 0x30, 0x81, 0xAF, 0x20, 0x0B, 0x43,
0x14, 0xC5, 0x74, 0x67, 0xB4, 0x32, 0x82, 0x6F, 0x8D, 0x86,
0xC2, 0x88, 0x40, 0x99, 0x36, 0x83, 0xBA, 0x1E, 0x40, 0x72,
0x22, 0x17, 0xD7, 0x52, 0x65, 0x24, 0x73, 0xB0, 0xCE, 0xEF,
0x19, 0xCD, 0xAE, 0xFF, 0x78, 0x6C, 0x7B, 0xC0, 0x12, 0x03,
0xD4, 0x4E, 0x72, 0x0D, 0x50, 0x6D, 0x3B, 0xA3, 0x3B, 0xA3,
0x99, 0x5E, 0x9D, 0xC8, 0xD9, 0x0C, 0x85, 0xB3, 0xD9, 0x8A,
0xD9, 0x54, 0x26, 0xDB, 0x6D, 0xFA, 0xAC, 0xBB, 0xFF, 0x25,
0x4C, 0xC4, 0xD1, 0x79, 0xF4, 0x71, 0xD3, 0x86, 0x40, 0x18,
0x13, 0xB0, 0x63, 0xB5, 0x72, 0x4E, 0x30, 0xC4, 0x97, 0x84,
0x86, 0x2D, 0x56, 0x2F, 0xD7, 0x15, 0xF7, 0x7F, 0xC0, 0xAE,
0xF5, 0xFC, 0x5B, 0xE5, 0xFB, 0xA1, 0xBA, 0xD3, 0x02, 0x03,
0x01, 0x00, 0x01, 0x02, 0x82, 0x01, 0x01, 0x00, 0xA2, 0xE6,
0xD8, 0x5F, 0x10, 0x71, 0x64, 0x08, 0x9E, 0x2E, 0x6D, 0xD1,
0x6D, 0x1E, 0x85, 0xD2, 0x0A, 0xB1, 0x8C, 0x47, 0xCE, 0x2C,
0x51, 0x6A, 0xA0, 0x12, 0x9E, 0x53, 0xDE, 0x91, 0x4C, 0x1D,
0x6D, 0xEA, 0x59, 0x7B, 0xF2, 0x77, 0xAA, 0xD9, 0xC6, 0xD9,
0x8A, 0xAB, 0xD8, 0xE1, 0x16, 0xE4, 0x63, 0x26, 0xFF, 0xB5,
0x6C, 0x13, 0x59, 0xB8, 0xE3, 0xA5, 0xC8, 0x72, 0x17, 0x2E,
0x0C, 0x9F, 0x6F, 0xE5, 0x59, 0x3F, 0x76, 0x6F, 0x49, 0xB1,
0x11, 0xC2, 0x5A, 0x2E, 0x16, 0x29, 0x0D, 0xDE, 0xB7, 0x8E,
0xDC, 0x40, 0xD5, 0xA2, 0xEE, 0xE0, 0x1E, 0xA1, 0xF4, 0xBE,
0x97, 0xDB, 0x86, 0x63, 0x96, 0x14, 0xCD, 0x98, 0x09, 0x60,
0x2D, 0x30, 0x76, 0x9C, 0x3C, 0xCD, 0xE6, 0x88, 0xEE, 0x47,
0x92, 0x79, 0x0B, 0x5A, 0x00, 0xE2, 0x5E, 0x5F, 0x11, 0x7C,
0x7D, 0xF9, 0x08, 0xB7, 0x20, 0x06, 0x89, 0x2A, 0x5D, 0xFD,
0x00, 0xAB, 0x22, 0xE1, 0xF0, 0xB3, 0xBC, 0x24, 0xA9, 0x5E,
0x26, 0x0E, 0x1F, 0x00, 0x2D, 0xFE, 0x21, 0x9A, 0x53, 0x5B,
0x6D, 0xD3, 0x2B, 0xAB, 0x94, 0x82, 0x68, 0x43, 0x36, 0xD8,
0xF6, 0x2F, 0xC6, 0x22, 0xFC, 0xB5, 0x41, 0x5D, 0x0D, 0x33,
0x60, 0xEA, 0xA4, 0x7D, 0x7E, 0xE8, 0x4B, 0x55, 0x91, 0x56,
0xD3, 0x5C, 0x57, 0x8F, 0x1F, 0x94, 0x17, 0x2F, 0xAA, 0xDE,
0xE9, 0x9E, 0xA8, 0xF4, 0xCF, 0x8A, 0x4C, 0x8E, 0xA0, 0xE4,
0x56, 0x73, 0xB2, 0xCF, 0x4F, 0x86, 0xC5, 0x69, 0x3C, 0xF3,
0x24, 0x20, 0x8B, 0x5C, 0x96, 0x0C, 0xFA, 0x6B, 0x12, 0x3B,
0x9A, 0x67, 0xC1, 0xDF, 0xC6, 0x96, 0xB2, 0xA5, 0xD5, 0x92,
0x0D, 0x9B, 0x09, 0x42, 0x68, 0x24, 0x10, 0x45, 0xD4, 0x50,
0xE4, 0x17, 0x39, 0x48, 0xD0, 0x35, 0x8B, 0x94, 0x6D, 0x11,
0xDE, 0x8F, 0xCA, 0x59, 0x02, 0x81, 0x81, 0x00, 0xEA, 0x24,
0xA7, 0xF9, 0x69, 0x33, 0xE9, 0x71, 0xDC, 0x52, 0x7D, 0x88,
0x21, 0x28, 0x2F, 0x49, 0xDE, 0xBA, 0x72, 0x16, 0xE9, 0xCC,
0x47, 0x7A, 0x88, 0x0D, 0x94, 0x57, 0x84, 0x58, 0x16, 0x3A,
0x81, 0xB0, 0x3F, 0xA2, 0xCF, 0xA6, 0x6C, 0x1E, 0xB0, 0x06,
0x29, 0x00, 0x8F, 0xE7, 0x77, 0x76, 0xAC, 0xDB, 0xCA, 0xC7,
0xD9, 0x5E, 0x9B, 0x3F, 0x26, 0x90, 0x52, 0xAE, 0xFC, 0x38,
0x90, 0x00, 0x14, 0xBB, 0xB4, 0x0F, 0x58, 0x94, 0xE7, 0x2F,
0x6A, 0x7E, 0x1C, 0x4F, 0x41, 0x21, 0xD4, 0x31, 0x59, 0x1F,
0x4E, 0x8A, 0x1A, 0x8D, 0xA7, 0x57, 0x6C, 0x22, 0xD8, 0xE5,
0xF4, 0x7E, 0x32, 0xA6, 0x10, 0xCB, 0x64, 0xA5, 0x55, 0x03,
0x87, 0xA6, 0x27, 0x05, 0x8C, 0xC3, 0xD7, 0xB6, 0x27, 0xB2,
0x4D, 0xBA, 0x30, 0xDA, 0x47, 0x8F, 0x54, 0xD3, 0x3D, 0x8B,
0x84, 0x8D, 0x94, 0x98, 0x58, 0xA5, 0x02, 0x81, 0x81, 0x00,
0xD5, 0x38, 0x1B, 0xC3, 0x8F, 0xC5, 0x93, 0x0C, 0x47, 0x0B,
0x6F, 0x35, 0x92, 0xC5, 0xB0, 0x8D, 0x46, 0xC8, 0x92, 0x18,
0x8F, 0xF5, 0x80, 0x0A, 0xF7, 0xEF, 0xA1, 0xFE, 0x80, 0xB9,
0xB5, 0x2A, 0xBA, 0xCA, 0x18, 0xB0, 0x5D, 0xA5, 0x07, 0xD0,
0x93, 0x8D, 0xD8, 0x9C, 0x04, 0x1C, 0xD4, 0x62, 0x8E, 0xA6,
0x26, 0x81, 0x01, 0xFF, 0xCE, 0x8A, 0x2A, 0x63, 0x34, 0x35,
0x40, 0xAA, 0x6D, 0x80, 0xDE, 0x89, 0x23, 0x6A, 0x57, 0x4D,
0x9E, 0x6E, 0xAD, 0x93, 0x4E, 0x56, 0x90, 0x0B, 0x6D, 0x9D,
0x73, 0x8B, 0x0C, 0xAE, 0x27, 0x3D, 0xDE, 0x4E, 0xF0, 0xAA,
0xC5, 0x6C, 0x78, 0x67, 0x6C, 0x94, 0x52, 0x9C, 0x37, 0x67,
0x6C, 0x2D, 0xEF, 0xBB, 0xAF, 0xDF, 0xA6, 0x90, 0x3C, 0xC4,
0x47, 0xCF, 0x8D, 0x96, 0x9E, 0x98, 0xA9, 0xB4, 0x9F, 0xC5,
0xA6, 0x50, 0xDC, 0xB3, 0xF0, 0xFB, 0x74, 0x17, 0x02, 0x81,
0x80, 0x5E, 0x83, 0x09, 0x62, 0xBD, 0xBA, 0x7C, 0xA2, 0xBF,
0x42, 0x74, 0xF5, 0x7C, 0x1C, 0xD2, 0x69, 0xC9, 0x04, 0x0D,
0x85, 0x7E, 0x3E, 0x3D, 0x24, 0x12, 0xC3, 0x18, 0x7B, 0xF3,
0x29, 0xF3, 0x5F, 0x0E, 0x76, 0x6C, 0x59, 0x75, 0xE4, 0x41,
0x84, 0x69, 0x9D, 0x32, 0xF3, 0xCD, 0x22, 0xAB, 0xB0, 0x35,
0xBA, 0x4A, 0xB2, 0x3C, 0xE5, 0xD9, 0x58, 0xB6, 0x62, 0x4F,
0x5D, 0xDE, 0xE5, 0x9E, 0x0A, 0xCA, 0x53, 0xB2, 0x2C, 0xF7,
0x9E, 0xB3, 0x6B, 0x0A, 0x5B, 0x79, 0x65, 0xEC, 0x6E, 0x91,
0x4E, 0x92, 0x20, 0xF6, 0xFC, 0xFC, 0x16, 0xED, 0xD3, 0x76,
0x0C, 0xE2, 0xEC, 0x7F, 0xB2, 0x69, 0x13, 0x6B, 0x78, 0x0E,
0x5A, 0x46, 0x64, 0xB4, 0x5E, 0xB7, 0x25, 0xA0, 0x5A, 0x75,
0x3A, 0x4B, 0xEF, 0xC7, 0x3C, 0x3E, 0xF7, 0xFD, 0x26, 0xB8,
0x20, 0xC4, 0x99, 0x0A, 0x9A, 0x73, 0xBE, 0xC3, 0x19, 0x02,
0x81, 0x81, 0x00, 0xBA, 0x44, 0x93, 0x14, 0xAC, 0x34, 0x19,
0x3B, 0x5F, 0x91, 0x60, 0xAC, 0xF7, 0xB4, 0xD6, 0x81, 0x05,
0x36, 0x51, 0x53, 0x3D, 0xE8, 0x65, 0xDC, 0xAF, 0x2E, 0xDC,
0x61, 0x3E, 0xC9, 0x7D, 0xB8, 0x7F, 0x87, 0xF0, 0x3B, 0x9B,
0x03, 0x82, 0x29, 0x37, 0xCE, 0x72, 0x4E, 0x11, 0xD5, 0xB1,
0xC1, 0x0C, 0x07, 0xA0, 0x99, 0x91, 0x4A, 0x8D, 0x7F, 0xEC,
0x79, 0xCF, 0xF1, 0x39, 0xB5, 0xE9, 0x85, 0xEC, 0x62, 0xF7,
0xDA, 0x7D, 0xBC, 0x64, 0x4D, 0x22, 0x3C, 0x0E, 0xF2, 0xD6,
0x51, 0xF5, 0x87, 0xD8, 0x99, 0xC0, 0x11, 0x20, 0x5D, 0x0F,
0x29, 0xFD, 0x5B, 0xE2, 0xAE, 0xD9, 0x1C, 0xD9, 0x21, 0x56,
0x6D, 0xFC, 0x84, 0xD0, 0x5F, 0xED, 0x10, 0x15, 0x1C, 0x18,
0x21, 0xE7, 0xC4, 0x3D, 0x4B, 0xD7, 0xD0, 0x9E, 0x6A, 0x95,
0xCF, 0x22, 0xC9, 0x03, 0x7B, 0x9E, 0xE3, 0x60, 0x01, 0xFC,
0x2F, 0x02, 0x81, 0x80, 0x11, 0xD0, 0x4B, 0xCF, 0x1B, 0x67,
0xB9, 0x9F, 0x10, 0x75, 0x47, 0x86, 0x65, 0xAE, 0x31, 0xC2,
0xC6, 0x30, 0xAC, 0x59, 0x06, 0x50, 0xD9, 0x0F, 0xB5, 0x70,
0x06, 0xF7, 0xF0, 0xD3, 0xC8, 0x62, 0x7C, 0xA8, 0xDA, 0x6E,
0xF6, 0x21, 0x3F, 0xD3, 0x7F, 0x5F, 0xEA, 0x8A, 0xAB, 0x3F,
0xD9, 0x2A, 0x5E, 0xF3, 0x51, 0xD2, 0xC2, 0x30, 0x37, 0xE3,
0x2D, 0xA3, 0x75, 0x0D, 0x1E, 0x4D, 0x21, 0x34, 0xD5, 0x57,
0x70, 0x5C, 0x89, 0xBF, 0x72, 0xEC, 0x4A, 0x6E, 0x68, 0xD5,
0xCD, 0x18, 0x74, 0x33, 0x4E, 0x8C, 0x3A, 0x45, 0x8F, 0xE6,
0x96, 0x40, 0xEB, 0x63, 0xF9, 0x19, 0x86, 0x3A, 0x51, 0xDD,
0x89, 0x4B, 0xB0, 0xF3, 0xF9, 0x9F, 0x5D, 0x28, 0x95, 0x38,
0xBE, 0x35, 0xAB, 0xCA, 0x5C, 0xE7, 0x93, 0x53, 0x34, 0xA1,
0x45, 0x5D, 0x13, 0x39, 0x65, 0x42, 0x46, 0xA1, 0x9F, 0xCD,
0xF5, 0xBF
};
static const int sizeof_client_key_der_2048 = sizeof(client_key_der_2048);
/* ./certs/client-keyPub.der, 2048-bit */
static const unsigned char client_keypub_der_2048[] =
{
0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03,
0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82,
0x01, 0x01, 0x00, 0xC3, 0x03, 0xD1, 0x2B, 0xFE, 0x39, 0xA4,
0x32, 0x45, 0x3B, 0x53, 0xC8, 0x84, 0x2B, 0x2A, 0x7C, 0x74,
0x9A, 0xBD, 0xAA, 0x2A, 0x52, 0x07, 0x47, 0xD6, 0xA6, 0x36,
0xB2, 0x07, 0x32, 0x8E, 0xD0, 0xBA, 0x69, 0x7B, 0xC6, 0xC3,
0x44, 0x9E, 0xD4, 0x81, 0x48, 0xFD, 0x2D, 0x68, 0xA2, 0x8B,
0x67, 0xBB, 0xA1, 0x75, 0xC8, 0x36, 0x2C, 0x4A, 0xD2, 0x1B,
0xF7, 0x8B, 0xBA, 0xCF, 0x0D, 0xF9, 0xEF, 0xEC, 0xF1, 0x81,
0x1E, 0x7B, 0x9B, 0x03, 0x47, 0x9A, 0xBF, 0x65, 0xCC, 0x7F,
0x65, 0x24, 0x69, 0xA6, 0xE8, 0x14, 0x89, 0x5B, 0xE4, 0x34,
0xF7, 0xC5, 0xB0, 0x14, 0x93, 0xF5, 0x67, 0x7B, 0x3A, 0x7A,
0x78, 0xE1, 0x01, 0x56, 0x56, 0x91, 0xA6, 0x13, 0x42, 0x8D,
0xD2, 0x3C, 0x40, 0x9C, 0x4C, 0xEF, 0xD1, 0x86, 0xDF, 0x37,
0x51, 0x1B, 0x0C, 0xA1, 0x3B, 0xF5, 0xF1, 0xA3, 0x4A, 0x35,
0xE4, 0xE1, 0xCE, 0x96, 0xDF, 0x1B, 0x7E, 0xBF, 0x4E, 0x97,
0xD0, 0x10, 0xE8, 0xA8, 0x08, 0x30, 0x81, 0xAF, 0x20, 0x0B,
0x43, 0x14, 0xC5, 0x74, 0x67, 0xB4, 0x32, 0x82, 0x6F, 0x8D,
0x86, 0xC2, 0x88, 0x40, 0x99, 0x36, 0x83, 0xBA, 0x1E, 0x40,
0x72, 0x22, 0x17, 0xD7, 0x52, 0x65, 0x24, 0x73, 0xB0, 0xCE,
0xEF, 0x19, 0xCD, 0xAE, 0xFF, 0x78, 0x6C, 0x7B, 0xC0, 0x12,
0x03, 0xD4, 0x4E, 0x72, 0x0D, 0x50, 0x6D, 0x3B, 0xA3, 0x3B,
0xA3, 0x99, 0x5E, 0x9D, 0xC8, 0xD9, 0x0C, 0x85, 0xB3, 0xD9,
0x8A, 0xD9, 0x54, 0x26, 0xDB, 0x6D, 0xFA, 0xAC, 0xBB, 0xFF,
0x25, 0x4C, 0xC4, 0xD1, 0x79, 0xF4, 0x71, 0xD3, 0x86, 0x40,
0x18, 0x13, 0xB0, 0x63, 0xB5, 0x72, 0x4E, 0x30, 0xC4, 0x97,
0x84, 0x86, 0x2D, 0x56, 0x2F, 0xD7, 0x15, 0xF7, 0x7F, 0xC0,
0xAE, 0xF5, 0xFC, 0x5B, 0xE5, 0xFB, 0xA1, 0xBA, 0xD3, 0x02,
0x03, 0x01, 0x00, 0x01
};
static const int sizeof_client_keypub_der_2048 = sizeof(client_keypub_der_2048);
/* ./certs/client-cert.der, 2048-bit */
static const unsigned char client_cert_der_2048[] =
{
0x30, 0x82, 0x04, 0xCA, 0x30, 0x82, 0x03, 0xB2, 0xA0, 0x03,
0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0xB9, 0xBC, 0x90, 0xED,
0xAD, 0xAA, 0x0A, 0x8C, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x30,
0x81, 0x9E, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06,
0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74,
0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55,
0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61,
0x6E, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x0A,
0x0C, 0x0C, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x5F,
0x32, 0x30, 0x34, 0x38, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03,
0x55, 0x04, 0x0B, 0x0C, 0x10, 0x50, 0x72, 0x6F, 0x67, 0x72,
0x61, 0x6D, 0x6D, 0x69, 0x6E, 0x67, 0x2D, 0x32, 0x30, 0x34,
0x38, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03,
0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66,
0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30,
0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01,
0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77,
0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D,
0x30, 0x1E, 0x17, 0x0D, 0x31, 0x36, 0x30, 0x38, 0x31, 0x31,
0x32, 0x30, 0x30, 0x37, 0x33, 0x37, 0x5A, 0x17, 0x0D, 0x31,
0x39, 0x30, 0x35, 0x30, 0x38, 0x32, 0x30, 0x30, 0x37, 0x33,
0x37, 0x5A, 0x30, 0x81, 0x9E, 0x31, 0x0B, 0x30, 0x09, 0x06,
0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10,
0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D,
0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E,
0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A,
0x65, 0x6D, 0x61, 0x6E, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03,
0x55, 0x04, 0x0A, 0x0C, 0x0C, 0x77, 0x6F, 0x6C, 0x66, 0x53,
0x53, 0x4C, 0x5F, 0x32, 0x30, 0x34, 0x38, 0x31, 0x19, 0x30,
0x17, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x10, 0x50, 0x72,
0x6F, 0x67, 0x72, 0x61, 0x6D, 0x6D, 0x69, 0x6E, 0x67, 0x2D,
0x32, 0x30, 0x34, 0x38, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03,
0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77,
0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D,
0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66,
0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E,
0x63, 0x6F, 0x6D, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06,
0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01,
0x05, 0x00, 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01,
0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xC3, 0x03, 0xD1, 0x2B,
0xFE, 0x39, 0xA4, 0x32, 0x45, 0x3B, 0x53, 0xC8, 0x84, 0x2B,
0x2A, 0x7C, 0x74, 0x9A, 0xBD, 0xAA, 0x2A, 0x52, 0x07, 0x47,
0xD6, 0xA6, 0x36, 0xB2, 0x07, 0x32, 0x8E, 0xD0, 0xBA, 0x69,
0x7B, 0xC6, 0xC3, 0x44, 0x9E, 0xD4, 0x81, 0x48, 0xFD, 0x2D,
0x68, 0xA2, 0x8B, 0x67, 0xBB, 0xA1, 0x75, 0xC8, 0x36, 0x2C,
0x4A, 0xD2, 0x1B, 0xF7, 0x8B, 0xBA, 0xCF, 0x0D, 0xF9, 0xEF,
0xEC, 0xF1, 0x81, 0x1E, 0x7B, 0x9B, 0x03, 0x47, 0x9A, 0xBF,
0x65, 0xCC, 0x7F, 0x65, 0x24, 0x69, 0xA6, 0xE8, 0x14, 0x89,
0x5B, 0xE4, 0x34, 0xF7, 0xC5, 0xB0, 0x14, 0x93, 0xF5, 0x67,
0x7B, 0x3A, 0x7A, 0x78, 0xE1, 0x01, 0x56, 0x56, 0x91, 0xA6,
0x13, 0x42, 0x8D, 0xD2, 0x3C, 0x40, 0x9C, 0x4C, 0xEF, 0xD1,
0x86, 0xDF, 0x37, 0x51, 0x1B, 0x0C, 0xA1, 0x3B, 0xF5, 0xF1,
0xA3, 0x4A, 0x35, 0xE4, 0xE1, 0xCE, 0x96, 0xDF, 0x1B, 0x7E,
0xBF, 0x4E, 0x97, 0xD0, 0x10, 0xE8, 0xA8, 0x08, 0x30, 0x81,
0xAF, 0x20, 0x0B, 0x43, 0x14, 0xC5, 0x74, 0x67, 0xB4, 0x32,
0x82, 0x6F, 0x8D, 0x86, 0xC2, 0x88, 0x40, 0x99, 0x36, 0x83,
0xBA, 0x1E, 0x40, 0x72, 0x22, 0x17, 0xD7, 0x52, 0x65, 0x24,
0x73, 0xB0, 0xCE, 0xEF, 0x19, 0xCD, 0xAE, 0xFF, 0x78, 0x6C,
0x7B, 0xC0, 0x12, 0x03, 0xD4, 0x4E, 0x72, 0x0D, 0x50, 0x6D,
0x3B, 0xA3, 0x3B, 0xA3, 0x99, 0x5E, 0x9D, 0xC8, 0xD9, 0x0C,
0x85, 0xB3, 0xD9, 0x8A, 0xD9, 0x54, 0x26, 0xDB, 0x6D, 0xFA,
0xAC, 0xBB, 0xFF, 0x25, 0x4C, 0xC4, 0xD1, 0x79, 0xF4, 0x71,
0xD3, 0x86, 0x40, 0x18, 0x13, 0xB0, 0x63, 0xB5, 0x72, 0x4E,
0x30, 0xC4, 0x97, 0x84, 0x86, 0x2D, 0x56, 0x2F, 0xD7, 0x15,
0xF7, 0x7F, 0xC0, 0xAE, 0xF5, 0xFC, 0x5B, 0xE5, 0xFB, 0xA1,
0xBA, 0xD3, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x82, 0x01,
0x07, 0x30, 0x82, 0x01, 0x03, 0x30, 0x1D, 0x06, 0x03, 0x55,
0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x33, 0xD8, 0x45, 0x66,
0xD7, 0x68, 0x87, 0x18, 0x7E, 0x54, 0x0D, 0x70, 0x27, 0x91,
0xC7, 0x26, 0xD7, 0x85, 0x65, 0xC0, 0x30, 0x81, 0xD3, 0x06,
0x03, 0x55, 0x1D, 0x23, 0x04, 0x81, 0xCB, 0x30, 0x81, 0xC8,
0x80, 0x14, 0x33, 0xD8, 0x45, 0x66, 0xD7, 0x68, 0x87, 0x18,
0x7E, 0x54, 0x0D, 0x70, 0x27, 0x91, 0xC7, 0x26, 0xD7, 0x85,
0x65, 0xC0, 0xA1, 0x81, 0xA4, 0xA4, 0x81, 0xA1, 0x30, 0x81,
0x9E, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06,
0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03,
0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61,
0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04,
0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E,
0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C,
0x0C, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x5F, 0x32,
0x30, 0x34, 0x38, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55,
0x04, 0x0B, 0x0C, 0x10, 0x50, 0x72, 0x6F, 0x67, 0x72, 0x61,
0x6D, 0x6D, 0x69, 0x6E, 0x67, 0x2D, 0x32, 0x30, 0x34, 0x38,
0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C,
0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73,
0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D,
0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09,
0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F,
0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82,
0x09, 0x00, 0xB9, 0xBC, 0x90, 0xED, 0xAD, 0xAA, 0x0A, 0x8C,
0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05, 0x30,
0x03, 0x01, 0x01, 0xFF, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x03,
0x82, 0x01, 0x01, 0x00, 0x33, 0x85, 0x08, 0xB4, 0x58, 0x0E,
0xA2, 0x00, 0x03, 0x74, 0xDE, 0x77, 0xFB, 0xD1, 0x2B, 0x76,
0x9C, 0x97, 0x90, 0x20, 0x21, 0xA2, 0xE8, 0x2E, 0x22, 0x50,
0x26, 0x04, 0x76, 0xBA, 0x5B, 0x47, 0x79, 0xE5, 0x52, 0xF7,
0xC4, 0x0D, 0x79, 0xFF, 0x62, 0x3F, 0x05, 0x7C, 0xC3, 0x08,
0x6C, 0xE0, 0xB7, 0x81, 0xD0, 0xCE, 0xC6, 0xC9, 0x46, 0xB9,
0x8E, 0x4B, 0x5F, 0x56, 0x79, 0x4B, 0x13, 0xB6, 0xD1, 0x6B,
0x66, 0x4B, 0xCE, 0x00, 0x0D, 0xE3, 0x76, 0x5E, 0xFB, 0xCB,
0xB5, 0x5D, 0x12, 0x31, 0x05, 0xF1, 0xBB, 0x39, 0xF6, 0x86,
0x90, 0xCA, 0x92, 0x56, 0xA4, 0xA0, 0x75, 0x21, 0xB6, 0x1D,
0x4C, 0x96, 0xC3, 0x45, 0xEB, 0x5A, 0x91, 0x94, 0x32, 0xD3,
0x59, 0xB8, 0xC9, 0x73, 0x1F, 0x03, 0xA9, 0x81, 0x63, 0xE0,
0x43, 0xC0, 0x1E, 0xC8, 0x65, 0xBE, 0x3B, 0xA7, 0x53, 0xC3,
0x44, 0xFF, 0xB3, 0xFB, 0x47, 0x84, 0xA8, 0xB6, 0x9D, 0x00,
0xD5, 0x6B, 0xAE, 0x87, 0xF8, 0xBB, 0x35, 0xB2, 0x6C, 0x66,
0x0B, 0x11, 0xEE, 0x6F, 0xFE, 0x12, 0xED, 0x59, 0x79, 0xF1,
0x3E, 0xF2, 0xD3, 0x61, 0x27, 0x8B, 0x95, 0x7E, 0x99, 0x75,
0x8D, 0xA4, 0x9F, 0x34, 0x85, 0xF1, 0x25, 0x4D, 0x48, 0x1E,
0x9B, 0x6B, 0x70, 0xF6, 0x66, 0xCC, 0x56, 0xB1, 0xA3, 0x02,
0x52, 0x8A, 0x7C, 0xAA, 0xAF, 0x07, 0xDA, 0x97, 0xC6, 0x0C,
0xA5, 0x8F, 0xED, 0xCB, 0xF5, 0xD8, 0x04, 0x5D, 0x97, 0x0A,
0x5D, 0x5A, 0x2B, 0x49, 0xF5, 0xBD, 0x93, 0xE5, 0x23, 0x9B,
0x99, 0xB5, 0x0C, 0xFF, 0x0C, 0x7E, 0x38, 0x82, 0xB2, 0x6E,
0xAB, 0x8A, 0xC9, 0xA7, 0x45, 0xAB, 0xD6, 0xD7, 0x93, 0x35,
0x70, 0x07, 0x7E, 0xC8, 0x3D, 0xA5, 0xFE, 0x33, 0x8F, 0xD9,
0x85, 0xC0, 0xC7, 0x5A, 0x02, 0xE4, 0x7C, 0xD6, 0x35, 0x9E
};
static const int sizeof_client_cert_der_2048 = sizeof(client_cert_der_2048);
/* ./certs/dh2048.der, 2048-bit */
static const unsigned char dh_key_der_2048[] =
{
0x30, 0x82, 0x01, 0x08, 0x02, 0x82, 0x01, 0x01, 0x00, 0xB0,
0xA1, 0x08, 0x06, 0x9C, 0x08, 0x13, 0xBA, 0x59, 0x06, 0x3C,
0xBC, 0x30, 0xD5, 0xF5, 0x00, 0xC1, 0x4F, 0x44, 0xA7, 0xD6,
0xEF, 0x4A, 0xC6, 0x25, 0x27, 0x1C, 0xE8, 0xD2, 0x96, 0x53,
0x0A, 0x5C, 0x91, 0xDD, 0xA2, 0xC2, 0x94, 0x84, 0xBF, 0x7D,
0xB2, 0x44, 0x9F, 0x9B, 0xD2, 0xC1, 0x8A, 0xC5, 0xBE, 0x72,
0x5C, 0xA7, 0xE7, 0x91, 0xE6, 0xD4, 0x9F, 0x73, 0x07, 0x85,
0x5B, 0x66, 0x48, 0xC7, 0x70, 0xFA, 0xB4, 0xEE, 0x02, 0xC9,
0x3D, 0x9A, 0x4A, 0xDA, 0x3D, 0xC1, 0x46, 0x3E, 0x19, 0x69,
0xD1, 0x17, 0x46, 0x07, 0xA3, 0x4D, 0x9F, 0x2B, 0x96, 0x17,
0x39, 0x6D, 0x30, 0x8D, 0x2A, 0xF3, 0x94, 0xD3, 0x75, 0xCF,
0xA0, 0x75, 0xE6, 0xF2, 0x92, 0x1F, 0x1A, 0x70, 0x05, 0xAA,
0x04, 0x83, 0x57, 0x30, 0xFB, 0xDA, 0x76, 0x93, 0x38, 0x50,
0xE8, 0x27, 0xFD, 0x63, 0xEE, 0x3C, 0xE5, 0xB7, 0xC8, 0x09,
0xAE, 0x6F, 0x50, 0x35, 0x8E, 0x84, 0xCE, 0x4A, 0x00, 0xE9,
0x12, 0x7E, 0x5A, 0x31, 0xD7, 0x33, 0xFC, 0x21, 0x13, 0x76,
0xCC, 0x16, 0x30, 0xDB, 0x0C, 0xFC, 0xC5, 0x62, 0xA7, 0x35,
0xB8, 0xEF, 0xB7, 0xB0, 0xAC, 0xC0, 0x36, 0xF6, 0xD9, 0xC9,
0x46, 0x48, 0xF9, 0x40, 0x90, 0x00, 0x2B, 0x1B, 0xAA, 0x6C,
0xE3, 0x1A, 0xC3, 0x0B, 0x03, 0x9E, 0x1B, 0xC2, 0x46, 0xE4,
0x48, 0x4E, 0x22, 0x73, 0x6F, 0xC3, 0x5F, 0xD4, 0x9A, 0xD6,
0x30, 0x07, 0x48, 0xD6, 0x8C, 0x90, 0xAB, 0xD4, 0xF6, 0xF1,
0xE3, 0x48, 0xD3, 0x58, 0x4B, 0xA6, 0xB9, 0xCD, 0x29, 0xBF,
0x68, 0x1F, 0x08, 0x4B, 0x63, 0x86, 0x2F, 0x5C, 0x6B, 0xD6,
0xB6, 0x06, 0x65, 0xF7, 0xA6, 0xDC, 0x00, 0x67, 0x6B, 0xBB,
0xC3, 0xA9, 0x41, 0x83, 0xFB, 0xC7, 0xFA, 0xC8, 0xE2, 0x1E,
0x7E, 0xAF, 0x00, 0x3F, 0x93, 0x02, 0x01, 0x02
};
static const int sizeof_dh_key_der_2048 = sizeof(dh_key_der_2048);
/* ./certs/dsa2048.der, 2048-bit */
static const unsigned char dsa_key_der_2048[] =
{
0x30, 0x82, 0x03, 0x3F, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01,
0x01, 0x00, 0xCC, 0x8E, 0xC9, 0xA0, 0xD5, 0x9A, 0x27, 0x1C,
0xDA, 0x52, 0xDF, 0xC7, 0xC0, 0xE6, 0x06, 0xA4, 0x3E, 0x8A,
0x66, 0x49, 0xD0, 0x59, 0x33, 0x51, 0x69, 0xC4, 0x9C, 0x5E,
0x64, 0x85, 0xC7, 0xF1, 0xAB, 0xD5, 0xD9, 0x62, 0xAC, 0xFD,
0xA1, 0xE0, 0x1B, 0x57, 0xFF, 0x96, 0xEF, 0x0C, 0x9F, 0xC8,
0x44, 0x87, 0xEB, 0x5C, 0x91, 0xD0, 0x46, 0x42, 0x09, 0x50,
0x6A, 0x23, 0xCB, 0x89, 0x6F, 0x55, 0xE9, 0x6A, 0x11, 0xA9,
0xA8, 0x32, 0xAB, 0x33, 0x0D, 0x51, 0xB5, 0x79, 0x51, 0xB4,
0xAB, 0xA2, 0x25, 0x11, 0x8D, 0xE5, 0x24, 0xBE, 0xD8, 0xF1,
0x9D, 0x4E, 0x12, 0x6F, 0xAC, 0x44, 0x54, 0x80, 0xA9, 0xB4,
0x81, 0x68, 0x4E, 0x44, 0x0E, 0xB8, 0x39, 0xF3, 0xBE, 0x83,
0x08, 0x74, 0xA2, 0xC6, 0x7A, 0xD7, 0x6A, 0x7D, 0x0A, 0x88,
0x57, 0x83, 0x48, 0xDC, 0xCF, 0x5E, 0x6F, 0xEE, 0x68, 0x0C,
0xF7, 0xFF, 0x03, 0x04, 0x90, 0xAA, 0xF7, 0x07, 0x98, 0xF8,
0x67, 0x5A, 0x83, 0x23, 0x66, 0x47, 0x60, 0xC3, 0x43, 0x6E,
0x03, 0x91, 0xAC, 0x28, 0x66, 0xCB, 0xF0, 0xD3, 0x05, 0xC8,
0x09, 0x97, 0xB5, 0xAE, 0x01, 0x5E, 0x80, 0x3B, 0x9D, 0x4F,
0xDE, 0x3E, 0x94, 0xFE, 0xCB, 0x82, 0xB0, 0xB1, 0xFC, 0x91,
0x8B, 0x1D, 0x8A, 0xEE, 0xC6, 0x06, 0x1F, 0x37, 0x91, 0x48,
0xD2, 0xF8, 0x6C, 0x5D, 0x60, 0x13, 0x83, 0xA7, 0x81, 0xAC,
0xCA, 0x8D, 0xD0, 0x6A, 0x04, 0x0A, 0xEA, 0x3E, 0x22, 0x4E,
0x13, 0xF1, 0x0D, 0xBB, 0x60, 0x6B, 0xCD, 0xBC, 0x5C, 0x87,
0xA3, 0x67, 0x2B, 0x42, 0xA1, 0x9F, 0xCD, 0x39, 0x58, 0xBE,
0x55, 0xB1, 0x93, 0x84, 0xCE, 0xB2, 0x10, 0x4E, 0xE4, 0xC3,
0x9F, 0xB2, 0x53, 0x61, 0x01, 0x29, 0xAA, 0x96, 0xCB, 0x20,
0x60, 0x42, 0x1D, 0xBA, 0x75, 0x4B, 0x63, 0xC1, 0x02, 0x15,
0x00, 0xE7, 0xA5, 0x39, 0xD4, 0x6A, 0x37, 0x5E, 0x95, 0x06,
0x39, 0x07, 0x77, 0x0A, 0xEB, 0xA0, 0x03, 0xEB, 0x78, 0x82,
0x9B, 0x02, 0x82, 0x01, 0x01, 0x00, 0x9A, 0xD4, 0x4C, 0x71,
0x2F, 0xEC, 0xFA, 0x32, 0xB2, 0x80, 0x7E, 0x61, 0x4A, 0x6B,
0x5F, 0x18, 0x76, 0x43, 0xC3, 0x69, 0xBA, 0x41, 0xC7, 0xA7,
0x1D, 0x79, 0x01, 0xEC, 0xAF, 0x34, 0x87, 0x67, 0x4F, 0x29,
0x80, 0xA8, 0x3B, 0x87, 0xF6, 0xE8, 0xA1, 0xE8, 0xCD, 0x1B,
0x1C, 0x86, 0x38, 0xF6, 0xD1, 0x0C, 0x46, 0x2E, 0xC8, 0xE0,
0xC9, 0x30, 0x26, 0xD5, 0x2C, 0x7F, 0xC1, 0x08, 0xBF, 0xCC,
0x5A, 0x82, 0x8E, 0xD4, 0xD4, 0x49, 0xAA, 0xA2, 0xFA, 0xE6,
0xC1, 0x9D, 0xF0, 0xD9, 0x96, 0xB0, 0xFF, 0x0C, 0x5B, 0x33,
0x8E, 0x06, 0xDD, 0x9D, 0x28, 0xA9, 0xE9, 0x80, 0x41, 0x3B,
0xD8, 0x7A, 0x94, 0x21, 0x8F, 0x56, 0xF1, 0xA2, 0xB4, 0x2B,
0x89, 0x1C, 0x74, 0xFF, 0x7E, 0x91, 0xDC, 0x1F, 0x91, 0x13,
0x98, 0xAF, 0xC7, 0x06, 0xD2, 0x4C, 0x90, 0xA2, 0xBD, 0xDA,
0x16, 0xBA, 0x65, 0xB0, 0x2D, 0x68, 0x87, 0x3C, 0x6E, 0x25,
0x8D, 0x90, 0xC7, 0xBC, 0x0D, 0xA9, 0x43, 0x03, 0xC9, 0xBE,
0xCF, 0x85, 0x6F, 0xDB, 0x07, 0x7B, 0x8C, 0xF8, 0xB1, 0xC2,
0x49, 0x10, 0x69, 0x63, 0x56, 0x37, 0xC5, 0x30, 0xD2, 0xFB,
0x71, 0x9A, 0xE8, 0x82, 0x07, 0x2E, 0x3E, 0x95, 0x50, 0xF3,
0x73, 0xCF, 0x34, 0x5B, 0xD5, 0xAB, 0x02, 0x15, 0xF2, 0xCC,
0xD7, 0x52, 0xC5, 0x28, 0xD8, 0x41, 0x19, 0x55, 0x6F, 0xB8,
0x5F, 0xF1, 0x99, 0xB3, 0xC7, 0xD9, 0xB3, 0x71, 0xF4, 0x2D,
0xDF, 0x22, 0x59, 0x35, 0x86, 0xDB, 0x39, 0xCA, 0x1B, 0x4D,
0x35, 0x90, 0x19, 0x6B, 0x31, 0xE3, 0xC8, 0xC6, 0x09, 0xBF,
0x7C, 0xED, 0x01, 0xB4, 0xB2, 0xF5, 0x6E, 0xDA, 0x63, 0x41,
0x3C, 0xE6, 0x3A, 0x72, 0x2D, 0x65, 0x48, 0xF6, 0x07, 0xCD,
0x92, 0x84, 0x8B, 0x1D, 0xA7, 0x31, 0x6B, 0xD6, 0xF0, 0xFB,
0xD9, 0xF4, 0x02, 0x82, 0x01, 0x00, 0x66, 0x4B, 0xBB, 0xB7,
0xC9, 0x48, 0x95, 0x0D, 0x5A, 0xA6, 0x2D, 0xA1, 0x7F, 0xDF,
0x1F, 0x67, 0x6D, 0xED, 0x52, 0x4B, 0x16, 0x6C, 0x17, 0xC6,
0xAE, 0xF8, 0x6A, 0xC4, 0x57, 0xED, 0x2F, 0xB3, 0xF0, 0x2A,
0x55, 0xAB, 0xBA, 0xCA, 0xEA, 0x17, 0xE8, 0x35, 0x7C, 0xE5,
0x31, 0x0D, 0x4A, 0x95, 0xFC, 0x43, 0x6F, 0x97, 0x3C, 0x5C,
0x67, 0xAC, 0xBE, 0x67, 0x7F, 0xE9, 0x4E, 0xAA, 0x48, 0xB3,
0x92, 0xA1, 0x76, 0x75, 0xEA, 0x04, 0x34, 0x7F, 0x87, 0x33,
0x2D, 0x24, 0xB6, 0x29, 0x97, 0xE3, 0x04, 0x77, 0x93, 0x89,
0x13, 0xDB, 0x1B, 0x93, 0xB8, 0x2C, 0x90, 0x1A, 0x09, 0x3B,
0x26, 0xD9, 0x59, 0xF3, 0x2A, 0x09, 0x58, 0xDC, 0xAC, 0x25,
0xB4, 0xA9, 0x45, 0x3B, 0xA2, 0x3A, 0x6C, 0x61, 0x84, 0xBF,
0x68, 0xD4, 0xEA, 0x9B, 0xC5, 0x29, 0x48, 0x60, 0x15, 0x10,
0x35, 0x2C, 0x44, 0x1D, 0xB5, 0x9A, 0xEE, 0xAC, 0xC1, 0x68,
0xE8, 0x47, 0xB7, 0x41, 0x34, 0x39, 0x9A, 0xF8, 0xA5, 0x20,
0xE9, 0x24, 0xC4, 0x2C, 0x58, 0x3F, 0x4C, 0x41, 0x30, 0x3A,
0x14, 0x6E, 0x8D, 0xEA, 0xAD, 0xBA, 0x9B, 0x43, 0xD3, 0x98,
0x2F, 0x83, 0xD8, 0x14, 0x67, 0xE8, 0xF8, 0xD5, 0x4F, 0xAC,
0xE0, 0x3B, 0xBF, 0xA7, 0x54, 0x16, 0x5E, 0x49, 0x64, 0x26,
0x54, 0xA4, 0x6B, 0x69, 0x7C, 0xBA, 0x8A, 0x83, 0xD9, 0x2E,
0x65, 0x0A, 0xA2, 0x27, 0xEF, 0x99, 0x99, 0x08, 0xD7, 0xB5,
0x9F, 0xA0, 0x01, 0xEF, 0x7E, 0x17, 0xBF, 0x83, 0x6B, 0x2E,
0xDD, 0xC0, 0x39, 0x38, 0x23, 0x68, 0xB4, 0x76, 0x6B, 0xE5,
0xCA, 0xF7, 0x7C, 0xEE, 0xC0, 0x52, 0xE2, 0xDD, 0xAD, 0x59,
0x3A, 0x42, 0x06, 0x45, 0xB0, 0xC7, 0xC1, 0x77, 0x05, 0xB2,
0x0C, 0x32, 0x40, 0x46, 0xAA, 0xDA, 0x79, 0x77, 0x04, 0x71,
0xDF, 0x7A, 0x02, 0x15, 0x00, 0x98, 0xEE, 0xB9, 0x51, 0x37,
0x3E, 0x75, 0x13, 0x13, 0x06, 0x8F, 0x94, 0xD3, 0xE6, 0xE9,
0x00, 0xCB, 0x62, 0x6D, 0x9A
};
static const int sizeof_dsa_key_der_2048 = sizeof(dsa_key_der_2048);
/* ./certs/rsa2048.der, 2048-bit */
static const unsigned char rsa_key_der_2048[] =
{
0x30, 0x82, 0x04, 0xA3, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01,
0x01, 0x00, 0xE9, 0x8A, 0x5D, 0x15, 0xA4, 0xD4, 0x34, 0xB9,
0x59, 0xA2, 0xDA, 0xAF, 0x74, 0xC8, 0xC9, 0x03, 0x26, 0x38,
0xFA, 0x48, 0xFC, 0x4D, 0x30, 0x6E, 0xEA, 0x76, 0x89, 0xCE,
0x4F, 0xF6, 0x87, 0xDE, 0x32, 0x3A, 0x46, 0x6E, 0x38, 0x12,
0x58, 0x37, 0x22, 0x0D, 0x80, 0xAC, 0x2D, 0xAF, 0x2F, 0x12,
0x3E, 0x62, 0x73, 0x60, 0x66, 0x68, 0x90, 0xB2, 0x6F, 0x47,
0x17, 0x04, 0x2B, 0xCA, 0xB7, 0x26, 0xB7, 0x10, 0xC2, 0x13,
0xF9, 0x7A, 0x62, 0x0A, 0x93, 0x32, 0x90, 0x42, 0x0D, 0x16,
0x2E, 0xFA, 0xD7, 0x29, 0xD7, 0x9F, 0x54, 0xE4, 0xFC, 0x65,
0x74, 0xF8, 0xF6, 0x43, 0x6B, 0x4E, 0x9E, 0x34, 0x7F, 0xCB,
0x6B, 0x1C, 0x1A, 0xDE, 0x82, 0x81, 0xBF, 0x08, 0x5D, 0x3F,
0xC0, 0xB6, 0xB1, 0xA8, 0xA5, 0x9C, 0x81, 0x70, 0xA7, 0x4E,
0x32, 0x87, 0x15, 0x1C, 0x78, 0x0E, 0xF0, 0x18, 0xFE, 0xEB,
0x4B, 0x37, 0x2B, 0xE9, 0xE1, 0xF7, 0xFA, 0x51, 0xC6, 0x58,
0xB9, 0xD8, 0x06, 0x03, 0xED, 0xC0, 0x03, 0x18, 0x55, 0x8B,
0x98, 0xFE, 0xB1, 0xF6, 0xD0, 0x3D, 0xFA, 0x63, 0xC0, 0x38,
0x19, 0xC7, 0x00, 0xEF, 0x4D, 0x99, 0x60, 0xB4, 0xBA, 0xCE,
0xE3, 0xCE, 0xD9, 0x6B, 0x2D, 0x76, 0x94, 0xFF, 0xFB, 0x77,
0x18, 0x4A, 0xFE, 0x65, 0xF0, 0x0A, 0x91, 0x5C, 0x3B, 0x22,
0x94, 0x85, 0xD0, 0x20, 0x18, 0x59, 0x2E, 0xA5, 0x33, 0x03,
0xAC, 0x1B, 0x5F, 0x78, 0x32, 0x11, 0x25, 0xEE, 0x7F, 0x96,
0x21, 0xA9, 0xD6, 0x76, 0x97, 0x8D, 0x66, 0x7E, 0xB2, 0x91,
0xD0, 0x36, 0x2E, 0xA3, 0x1D, 0xBF, 0xF1, 0x85, 0xED, 0xC0,
0x3E, 0x60, 0xB8, 0x5A, 0x9F, 0xAB, 0x80, 0xE0, 0xEA, 0x5D,
0x5F, 0x75, 0x56, 0xC7, 0x4D, 0x51, 0x8E, 0xD4, 0x1F, 0x34,
0xA6, 0x36, 0xF1, 0x30, 0x1F, 0x51, 0x99, 0x2F, 0x02, 0x03,
0x01, 0x00, 0x01, 0x02, 0x82, 0x01, 0x00, 0x52, 0x11, 0x33,
0x40, 0xC5, 0xD9, 0x64, 0x65, 0xB5, 0xE0, 0x0A, 0xA5, 0x19,
0x8E, 0xED, 0x44, 0x54, 0x0C, 0x35, 0xB7, 0xAC, 0x21, 0x9B,
0xE1, 0x7E, 0x37, 0x05, 0x9A, 0x20, 0x73, 0x6B, 0xAF, 0x63,
0x4B, 0x23, 0x30, 0xDC, 0x37, 0x66, 0x14, 0x89, 0xBC, 0xE0,
0xF8, 0xA0, 0x5D, 0x2D, 0x57, 0x65, 0xE0, 0xC6, 0xD6, 0x9B,
0x66, 0x27, 0x62, 0xEC, 0xC3, 0xB8, 0x8C, 0xD8, 0xAE, 0xB5,
0xC9, 0xBF, 0x0E, 0xFE, 0x84, 0x72, 0x68, 0xD5, 0x47, 0x0E,
0x0E, 0xF8, 0xAE, 0x9D, 0x56, 0xAC, 0x4F, 0xAD, 0x88, 0xA0,
0xA2, 0xF6, 0xFC, 0x38, 0xCD, 0x96, 0x5B, 0x5E, 0x7E, 0xB6,
0x98, 0xBB, 0xF3, 0x8A, 0xEC, 0xFA, 0xC8, 0xB7, 0x90, 0x75,
0xA0, 0x0E, 0x77, 0x6B, 0xFD, 0x59, 0x45, 0x5A, 0x0C, 0xFF,
0x95, 0x8D, 0xCE, 0xFE, 0x9B, 0xF6, 0x19, 0x8E, 0x0B, 0xA1,
0x0C, 0xEE, 0xC6, 0x79, 0xDD, 0x9D, 0x61, 0x85, 0x5C, 0x19,
0x6C, 0x47, 0xCC, 0x08, 0xFF, 0xA5, 0x62, 0xDB, 0xE4, 0x2D,
0x2D, 0xDD, 0x14, 0x67, 0xD6, 0x4A, 0x64, 0x2A, 0x66, 0x49,
0x54, 0x9C, 0xE3, 0x85, 0x18, 0xE7, 0x31, 0x42, 0xE2, 0xD0,
0x2C, 0x20, 0xA0, 0x74, 0x0F, 0x1F, 0x20, 0x89, 0xBA, 0xAB,
0x80, 0xD8, 0x38, 0xD9, 0x46, 0x69, 0xBB, 0xEF, 0xCC, 0x8B,
0xA1, 0x73, 0xA7, 0xF2, 0xE4, 0x38, 0x5D, 0xD6, 0x75, 0x9F,
0x88, 0x0E, 0x56, 0xCD, 0xD8, 0x84, 0x59, 0x29, 0x73, 0xF5,
0xA1, 0x79, 0xDA, 0x7A, 0x1F, 0xBF, 0x73, 0x83, 0xC0, 0x6D,
0x9F, 0x8B, 0x34, 0x15, 0xC0, 0x6D, 0x69, 0x6A, 0x20, 0xE6,
0x51, 0xCF, 0x45, 0x6E, 0xCC, 0x05, 0xC4, 0x3A, 0xC0, 0x9E,
0xAA, 0xC1, 0x06, 0x2F, 0xAB, 0x99, 0x30, 0xE1, 0x6E, 0x9D,
0x45, 0x7A, 0xFF, 0xA9, 0xCE, 0x70, 0xB8, 0x16, 0x1A, 0x0E,
0x20, 0xFA, 0xC1, 0x02, 0x81, 0x81, 0x00, 0xFF, 0x30, 0x11,
0xC2, 0x3C, 0x6B, 0xB4, 0xD6, 0x9E, 0x6B, 0xC1, 0x93, 0xD1,
0x48, 0xCE, 0x80, 0x2D, 0xBE, 0xAF, 0xF7, 0xBA, 0xB2, 0xD7,
0xC3, 0xC4, 0x53, 0x6E, 0x15, 0x02, 0xAA, 0x61, 0xB9, 0xEA,
0x05, 0x9B, 0x79, 0x67, 0x0B, 0xCE, 0xD9, 0xFB, 0x98, 0x8C,
0x1D, 0x6B, 0xF4, 0x5A, 0xA7, 0xA0, 0x5E, 0x54, 0x18, 0xE9,
0x31, 0x44, 0x7C, 0xC7, 0x52, 0xD8, 0x6D, 0xA0, 0x3E, 0xD6,
0x14, 0x2D, 0x7B, 0x15, 0x9D, 0x1E, 0x39, 0x87, 0x96, 0xDD,
0xA8, 0x33, 0x55, 0x2A, 0x8E, 0x32, 0xC0, 0xC4, 0xE5, 0xB8,
0xCB, 0xCD, 0x32, 0x8D, 0xAD, 0x7B, 0xE5, 0xC6, 0x7E, 0x4D,
0x6F, 0xF3, 0xA4, 0xC5, 0xA6, 0x40, 0xBE, 0x90, 0x3A, 0x33,
0x6A, 0x24, 0xB2, 0x80, 0x81, 0x12, 0xAC, 0xE3, 0x7B, 0x26,
0x63, 0xCF, 0x88, 0xB9, 0xFF, 0x74, 0x23, 0x37, 0x52, 0xF0,
0xC4, 0x27, 0x5D, 0x45, 0x1F, 0x02, 0x81, 0x81, 0x00, 0xEA,
0x48, 0xA7, 0xDD, 0x73, 0x41, 0x56, 0x21, 0x15, 0xF7, 0x42,
0x45, 0x4D, 0xA9, 0xE1, 0x66, 0x5B, 0xBD, 0x25, 0x7D, 0xF7,
0xA8, 0x65, 0x13, 0xAE, 0x2D, 0x38, 0x11, 0xCD, 0x93, 0xFC,
0x30, 0xA3, 0x2C, 0x44, 0xBB, 0xCF, 0xD0, 0x21, 0x8F, 0xFB,
0xC1, 0xF9, 0xAD, 0x1D, 0xEE, 0x96, 0xCF, 0x97, 0x49, 0x60,
0x53, 0x80, 0xA5, 0xA2, 0xF8, 0xEE, 0xB9, 0xD5, 0x77, 0x44,
0xDD, 0xFD, 0x19, 0x2A, 0xF1, 0x81, 0xF4, 0xD9, 0x3C, 0xEC,
0x73, 0xD0, 0x2A, 0xD8, 0x3C, 0x27, 0x87, 0x79, 0x12, 0x86,
0xE7, 0x57, 0x0C, 0x59, 0xD1, 0x44, 0x55, 0xAE, 0xC3, 0x4D,
0x42, 0xAD, 0xA9, 0xB3, 0x28, 0x61, 0xB4, 0x9C, 0xA6, 0x63,
0xD3, 0x96, 0xB1, 0x75, 0x9F, 0x2A, 0x78, 0x99, 0xE3, 0x1E,
0x71, 0x47, 0x39, 0xF4, 0x52, 0xE3, 0x66, 0xF1, 0xEB, 0x7F,
0xEF, 0xC6, 0x81, 0x93, 0x4C, 0x99, 0xF1, 0x02, 0x81, 0x81,
0x00, 0xC5, 0xB6, 0x20, 0x8C, 0x34, 0xF3, 0xDD, 0xF0, 0x4A,
0x5D, 0x82, 0x65, 0x5C, 0x48, 0xE4, 0x75, 0x3A, 0xFB, 0xFA,
0xAA, 0x1C, 0xE4, 0x63, 0x77, 0x31, 0xAC, 0xD2, 0x25, 0x45,
0x23, 0x6D, 0x03, 0xF5, 0xE4, 0xD2, 0x48, 0x85, 0x26, 0x08,
0xE5, 0xAA, 0xA0, 0xCE, 0x2E, 0x1D, 0x6D, 0xFC, 0xAE, 0xD2,
0xF9, 0x42, 0x7E, 0xEA, 0x6D, 0x59, 0x7A, 0xB3, 0x93, 0xE4,
0x4B, 0x4B, 0x54, 0x63, 0xD8, 0xCE, 0x44, 0x06, 0xC2, 0xEC,
0x9F, 0xF6, 0x05, 0x55, 0x46, 0xF4, 0x3E, 0x8F, 0xF2, 0x0C,
0x30, 0x7E, 0x5C, 0xDD, 0x88, 0x49, 0x3B, 0x59, 0xB9, 0x87,
0xBC, 0xC6, 0xC5, 0x24, 0x8A, 0x10, 0x63, 0x21, 0x1F, 0x66,
0x1A, 0x3E, 0xF4, 0x58, 0xD1, 0x6C, 0x0D, 0x40, 0xB2, 0xC0,
0x1D, 0x63, 0x42, 0x0E, 0xC4, 0x56, 0x0E, 0xC0, 0xCC, 0xC2,
0xD6, 0x66, 0x0E, 0xC4, 0xAB, 0xB5, 0x33, 0xF6, 0x51, 0x02,
0x81, 0x80, 0x19, 0x7E, 0xE6, 0xA5, 0xB6, 0xD1, 0x39, 0x6A,
0x48, 0x55, 0xAC, 0x24, 0x96, 0x9B, 0x12, 0x28, 0x6D, 0x7B,
0x5C, 0x05, 0x25, 0x5A, 0x72, 0x05, 0x7E, 0x42, 0xF5, 0x83,
0x1A, 0x78, 0x2C, 0x4D, 0xAE, 0xB4, 0x36, 0x96, 0xA9, 0xBA,
0xE0, 0xAC, 0x26, 0x9D, 0xA9, 0x6A, 0x29, 0x83, 0xB9, 0x6D,
0xC5, 0xEC, 0xFA, 0x4A, 0x9C, 0x09, 0x6A, 0x7E, 0xE4, 0x9B,
0xDC, 0x9B, 0x2A, 0x27, 0x6E, 0x4F, 0xBA, 0xD8, 0xA5, 0x67,
0xDB, 0xEC, 0x41, 0x5F, 0x29, 0x1C, 0x40, 0x83, 0xEB, 0x59,
0x56, 0xD7, 0xA9, 0x4E, 0xAB, 0xAE, 0x70, 0x67, 0xD1, 0xA3,
0xF1, 0x6C, 0xD7, 0x8F, 0x96, 0x0E, 0x8D, 0xAC, 0xAB, 0x55,
0x58, 0x66, 0xD3, 0x1E, 0x47, 0x9B, 0xF0, 0x4C, 0xED, 0xF6,
0x49, 0xE8, 0xE9, 0x7B, 0x32, 0x61, 0x20, 0x31, 0x95, 0x05,
0xB2, 0xF6, 0x09, 0xEA, 0x32, 0x14, 0x0F, 0xCF, 0x9A, 0x41,
0x02, 0x81, 0x80, 0x77, 0x3F, 0xB6, 0x14, 0x8D, 0xC5, 0x13,
0x08, 0x7E, 0xC9, 0xC4, 0xEA, 0xD4, 0xBA, 0x0D, 0xA4, 0x9E,
0xB3, 0x6E, 0xDE, 0x1A, 0x7A, 0xF8, 0x89, 0x88, 0xEF, 0x36,
0x3C, 0x11, 0xBC, 0x83, 0xE8, 0x30, 0x6C, 0x81, 0x7C, 0x47,
0xF3, 0x4D, 0xCA, 0xEA, 0x56, 0x01, 0x62, 0x55, 0x2E, 0x4B,
0x89, 0xA9, 0xBD, 0x6F, 0x01, 0xF6, 0x74, 0x02, 0xAA, 0xE3,
0x84, 0x66, 0x06, 0x95, 0x34, 0xA1, 0xE2, 0xCA, 0x65, 0xFE,
0xA3, 0x2D, 0x43, 0x97, 0x95, 0x6C, 0x6F, 0xD5, 0xB4, 0x38,
0xF6, 0xF9, 0x95, 0x30, 0xFA, 0xF8, 0x9C, 0x25, 0x2B, 0xB6,
0x14, 0x51, 0xCC, 0x2E, 0xB3, 0x5B, 0xD6, 0xDC, 0x1A, 0xEC,
0x2D, 0x09, 0x5B, 0x3F, 0x3A, 0xD0, 0xB8, 0x4E, 0x27, 0x1F,
0xDC, 0x2A, 0xEE, 0xAC, 0xA9, 0x59, 0x5D, 0x07, 0x63, 0x11,
0x83, 0x0B, 0xD4, 0x74, 0x80, 0xB6, 0x7D, 0x62, 0x45, 0xBF,
0x56
};
static const int sizeof_rsa_key_der_2048 = sizeof(rsa_key_der_2048);
/* ./certs/ca-key.der, 2048-bit */
static const unsigned char ca_key_der_2048[] =
{
0x30, 0x82, 0x04, 0xA4, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01,
0x01, 0x00, 0xBF, 0x0C, 0xCA, 0x2D, 0x14, 0xB2, 0x1E, 0x84,
0x42, 0x5B, 0xCD, 0x38, 0x1F, 0x4A, 0xF2, 0x4D, 0x75, 0x10,
0xF1, 0xB6, 0x35, 0x9F, 0xDF, 0xCA, 0x7D, 0x03, 0x98, 0xD3,
0xAC, 0xDE, 0x03, 0x66, 0xEE, 0x2A, 0xF1, 0xD8, 0xB0, 0x7D,
0x6E, 0x07, 0x54, 0x0B, 0x10, 0x98, 0x21, 0x4D, 0x80, 0xCB,
0x12, 0x20, 0xE7, 0xCC, 0x4F, 0xDE, 0x45, 0x7D, 0xC9, 0x72,
0x77, 0x32, 0xEA, 0xCA, 0x90, 0xBB, 0x69, 0x52, 0x10, 0x03,
0x2F, 0xA8, 0xF3, 0x95, 0xC5, 0xF1, 0x8B, 0x62, 0x56, 0x1B,
0xEF, 0x67, 0x6F, 0xA4, 0x10, 0x41, 0x95, 0xAD, 0x0A, 0x9B,
0xE3, 0xA5, 0xC0, 0xB0, 0xD2, 0x70, 0x76, 0x50, 0x30, 0x5B,
0xA8, 0xE8, 0x08, 0x2C, 0x7C, 0xED, 0xA7, 0xA2, 0x7A, 0x8D,
0x38, 0x29, 0x1C, 0xAC, 0xC7, 0xED, 0xF2, 0x7C, 0x95, 0xB0,
0x95, 0x82, 0x7D, 0x49, 0x5C, 0x38, 0xCD, 0x77, 0x25, 0xEF,
0xBD, 0x80, 0x75, 0x53, 0x94, 0x3C, 0x3D, 0xCA, 0x63, 0x5B,
0x9F, 0x15, 0xB5, 0xD3, 0x1D, 0x13, 0x2F, 0x19, 0xD1, 0x3C,
0xDB, 0x76, 0x3A, 0xCC, 0xB8, 0x7D, 0xC9, 0xE5, 0xC2, 0xD7,
0xDA, 0x40, 0x6F, 0xD8, 0x21, 0xDC, 0x73, 0x1B, 0x42, 0x2D,
0x53, 0x9C, 0xFE, 0x1A, 0xFC, 0x7D, 0xAB, 0x7A, 0x36, 0x3F,
0x98, 0xDE, 0x84, 0x7C, 0x05, 0x67, 0xCE, 0x6A, 0x14, 0x38,
0x87, 0xA9, 0xF1, 0x8C, 0xB5, 0x68, 0xCB, 0x68, 0x7F, 0x71,
0x20, 0x2B, 0xF5, 0xA0, 0x63, 0xF5, 0x56, 0x2F, 0xA3, 0x26,
0xD2, 0xB7, 0x6F, 0xB1, 0x5A, 0x17, 0xD7, 0x38, 0x99, 0x08,
0xFE, 0x93, 0x58, 0x6F, 0xFE, 0xC3, 0x13, 0x49, 0x08, 0x16,
0x0B, 0xA7, 0x4D, 0x67, 0x00, 0x52, 0x31, 0x67, 0x23, 0x4E,
0x98, 0xED, 0x51, 0x45, 0x1D, 0xB9, 0x04, 0xD9, 0x0B, 0xEC,
0xD8, 0x28, 0xB3, 0x4B, 0xBD, 0xED, 0x36, 0x79, 0x02, 0x03,
0x01, 0x00, 0x01, 0x02, 0x82, 0x01, 0x00, 0x3D, 0x6E, 0x4E,
0x60, 0x1A, 0x84, 0x7F, 0x9D, 0x85, 0x7C, 0xE1, 0x4B, 0x07,
0x7C, 0xE0, 0xD6, 0x99, 0x2A, 0xDE, 0x9D, 0xF9, 0x36, 0x34,
0x0E, 0x77, 0x0E, 0x3E, 0x08, 0xEA, 0x4F, 0xE5, 0x06, 0x26,
0xD4, 0xF6, 0x38, 0xF7, 0xDF, 0x0D, 0x0F, 0x1C, 0x2E, 0x06,
0xA2, 0xF4, 0x2A, 0x68, 0x9C, 0x63, 0x72, 0xE3, 0x35, 0xE6,
0x04, 0x91, 0x91, 0xB5, 0xC1, 0xB1, 0xA4, 0x54, 0xAC, 0xD7,
0xC6, 0xFB, 0x41, 0xA0, 0xD6, 0x75, 0x6F, 0xBD, 0x0B, 0x4E,
0xBF, 0xB1, 0x52, 0xE8, 0x5F, 0x49, 0x26, 0x98, 0x56, 0x47,
0xC7, 0xDE, 0xE9, 0xEA, 0x3C, 0x60, 0x01, 0xBF, 0x28, 0xDC,
0x31, 0xBF, 0x49, 0x5F, 0x93, 0x49, 0x87, 0x7A, 0x81, 0x5B,
0x96, 0x4B, 0x4D, 0xCA, 0x5C, 0x38, 0x4F, 0xB7, 0xE1, 0xB2,
0xD3, 0xC7, 0x21, 0xDA, 0x3C, 0x12, 0x87, 0x07, 0xE4, 0x1B,
0xDC, 0x43, 0xEC, 0xE8, 0xEC, 0x54, 0x61, 0xE7, 0xF6, 0xED,
0xA6, 0x0B, 0x2E, 0xF5, 0xDF, 0x82, 0x7F, 0xC6, 0x1F, 0x61,
0x19, 0x9C, 0xA4, 0x83, 0x39, 0xDF, 0x21, 0x85, 0x89, 0x6F,
0x77, 0xAF, 0x86, 0x15, 0x32, 0x08, 0xA2, 0x5A, 0x0B, 0x26,
0x61, 0xFB, 0x70, 0x0C, 0xCA, 0x9C, 0x38, 0x7D, 0xBC, 0x22,
0xEE, 0xEB, 0xA3, 0xA8, 0x16, 0x00, 0xF9, 0x8A, 0x80, 0x1E,
0x00, 0x84, 0xA8, 0x4A, 0x41, 0xF8, 0x84, 0x03, 0x67, 0x2F,
0x23, 0x5B, 0x2F, 0x9B, 0x6B, 0x26, 0xC3, 0x07, 0x34, 0x94,
0xA3, 0x03, 0x3B, 0x72, 0xD5, 0x9F, 0x72, 0xE0, 0xAD, 0xCC,
0x34, 0xAB, 0xBD, 0xC7, 0xD5, 0xF5, 0x26, 0x30, 0x85, 0x0F,
0x30, 0x23, 0x39, 0x52, 0xFF, 0x3C, 0xCB, 0x99, 0x21, 0x4D,
0x88, 0xA5, 0xAB, 0xEE, 0x62, 0xB9, 0xC7, 0xE0, 0xBB, 0x47,
0x87, 0xC1, 0x69, 0xCF, 0x73, 0xF3, 0x30, 0xBE, 0xCE, 0x39,
0x04, 0x9C, 0xE5, 0x02, 0x81, 0x81, 0x00, 0xE1, 0x76, 0x45,
0x80, 0x59, 0xB6, 0xD3, 0x49, 0xDF, 0x0A, 0xEF, 0x12, 0xD6,
0x0F, 0xF0, 0xB7, 0xCB, 0x2A, 0x37, 0xBF, 0xA7, 0xF8, 0xB5,
0x4D, 0xF5, 0x31, 0x35, 0xAD, 0xE4, 0xA3, 0x94, 0xA1, 0xDB,
0xF1, 0x96, 0xAD, 0xB5, 0x05, 0x64, 0x85, 0x83, 0xFC, 0x1B,
0x5B, 0x29, 0xAA, 0xBE, 0xF8, 0x26, 0x3F, 0x76, 0x7E, 0xAD,
0x1C, 0xF0, 0xCB, 0xD7, 0x26, 0xB4, 0x1B, 0x05, 0x8E, 0x56,
0x86, 0x7E, 0x08, 0x62, 0x21, 0xC1, 0x86, 0xD6, 0x47, 0x79,
0x3E, 0xB7, 0x5D, 0xA4, 0xC6, 0x3A, 0xD7, 0xB1, 0x74, 0x20,
0xF6, 0x50, 0x97, 0x41, 0x04, 0x53, 0xED, 0x3F, 0x26, 0xD6,
0x6F, 0x91, 0xFA, 0x68, 0x26, 0xEC, 0x2A, 0xDC, 0x9A, 0xF1,
0xE7, 0xDC, 0xFB, 0x73, 0xF0, 0x79, 0x43, 0x1B, 0x21, 0xA3,
0x59, 0x04, 0x63, 0x52, 0x07, 0xC9, 0xD7, 0xE6, 0xD1, 0x1B,
0x5D, 0x5E, 0x96, 0xFA, 0x53, 0x02, 0x81, 0x81, 0x00, 0xD8,
0xED, 0x4E, 0x64, 0x61, 0x6B, 0x91, 0x0C, 0x61, 0x01, 0xB5,
0x0F, 0xBB, 0x44, 0x67, 0x53, 0x1E, 0xDC, 0x07, 0xC4, 0x24,
0x7E, 0x9E, 0x6C, 0x84, 0x23, 0x91, 0x0C, 0xE4, 0x12, 0x04,
0x16, 0x4D, 0x78, 0x98, 0xCC, 0x96, 0x3D, 0x20, 0x4E, 0x0F,
0x45, 0x9A, 0xB6, 0xF8, 0xB3, 0x93, 0x0D, 0xB2, 0xA2, 0x1B,
0x29, 0xF2, 0x26, 0x79, 0xC8, 0xC5, 0xD2, 0x78, 0x7E, 0x5E,
0x73, 0xF2, 0xD7, 0x70, 0x61, 0xBB, 0x40, 0xCE, 0x61, 0x05,
0xFE, 0x69, 0x1E, 0x82, 0x29, 0xE6, 0x14, 0xB8, 0xA1, 0xE7,
0x96, 0xD0, 0x23, 0x3F, 0x05, 0x93, 0x00, 0xF2, 0xE1, 0x4D,
0x7E, 0xED, 0xB7, 0x96, 0x6C, 0xF7, 0xF0, 0xE4, 0xD1, 0xCF,
0x01, 0x98, 0x4F, 0xDC, 0x74, 0x54, 0xAA, 0x6D, 0x5E, 0x5A,
0x41, 0x31, 0xFE, 0xFF, 0x9A, 0xB6, 0xA0, 0x05, 0xDD, 0xA9,
0x10, 0x54, 0xF8, 0x6B, 0xD0, 0xAA, 0x83, 0x02, 0x81, 0x80,
0x21, 0xD3, 0x04, 0x8A, 0x44, 0xEB, 0x50, 0xB7, 0x7C, 0x66,
0xBF, 0x87, 0x2B, 0xE6, 0x28, 0x4E, 0xEA, 0x83, 0xE2, 0xE9,
0x35, 0xE1, 0xF2, 0x11, 0x47, 0xFF, 0xA1, 0xF5, 0xFC, 0x9F,
0x2D, 0xE5, 0x3A, 0x81, 0xFC, 0x01, 0x03, 0x6F, 0x53, 0xAD,
0x54, 0x27, 0xB6, 0x52, 0xEE, 0xE5, 0x56, 0xD1, 0x13, 0xAB,
0xE1, 0xB3, 0x0F, 0x75, 0x90, 0x0A, 0x84, 0xB4, 0xA1, 0xC0,
0x8C, 0x0C, 0xD6, 0x9E, 0x46, 0xBA, 0x2B, 0x3E, 0xB5, 0x31,
0xED, 0x63, 0xBB, 0xA4, 0xD5, 0x0D, 0x8F, 0x72, 0xCD, 0xD1,
0x1E, 0x26, 0x35, 0xEB, 0xBE, 0x1B, 0x72, 0xFD, 0x9B, 0x39,
0xB4, 0x87, 0xB7, 0x13, 0xF5, 0xEA, 0x83, 0x45, 0x93, 0x98,
0xBA, 0x8F, 0xE4, 0x4A, 0xCC, 0xB4, 0x4C, 0xA8, 0x7F, 0x08,
0xBA, 0x41, 0x49, 0xA8, 0x49, 0x28, 0x3D, 0x5E, 0x3D, 0xC1,
0xCE, 0x37, 0x00, 0xCB, 0xF9, 0x2C, 0xDD, 0x51, 0x02, 0x81,
0x81, 0x00, 0xA1, 0x57, 0x9F, 0x3E, 0xB9, 0xD6, 0xAF, 0x83,
0x6D, 0x83, 0x3F, 0x8F, 0xFB, 0xD0, 0xDC, 0xA8, 0xCE, 0x03,
0x09, 0x23, 0xB1, 0xA1, 0x1B, 0x63, 0xCA, 0xC4, 0x49, 0x56,
0x35, 0x2B, 0xD1, 0x2E, 0x65, 0x60, 0x95, 0x05, 0x55, 0x99,
0x11, 0x35, 0xFD, 0xD5, 0xDF, 0x44, 0xC7, 0xA5, 0x88, 0x72,
0x5F, 0xB2, 0x82, 0x51, 0xA8, 0x71, 0x45, 0x93, 0x36, 0xCF,
0x5C, 0x1F, 0x61, 0x51, 0x0C, 0x05, 0x80, 0xE8, 0xAF, 0xC5,
0x7B, 0xBA, 0x5E, 0x22, 0xE3, 0x3C, 0x75, 0xC3, 0x84, 0x05,
0x55, 0x6D, 0xD6, 0x3A, 0x2D, 0x84, 0x89, 0x93, 0x33, 0xCB,
0x38, 0xDA, 0xAA, 0x31, 0x05, 0xCD, 0xCE, 0x6C, 0x2D, 0xDD,
0x55, 0xD3, 0x57, 0x0B, 0xF0, 0xA5, 0x35, 0x6A, 0xB0, 0xAE,
0x31, 0xBA, 0x43, 0x96, 0xCA, 0x00, 0xC7, 0x4B, 0xE3, 0x19,
0x12, 0x43, 0xD3, 0x42, 0xFA, 0x6F, 0xEA, 0x80, 0xC0, 0xD1,
0x02, 0x81, 0x81, 0x00, 0xB9, 0xDB, 0x89, 0x20, 0x34, 0x27,
0x70, 0x62, 0x34, 0xEA, 0x5F, 0x25, 0x62, 0x12, 0xF3, 0x9D,
0x81, 0xBF, 0x48, 0xEE, 0x9A, 0x0E, 0xC1, 0x8D, 0x10, 0xFF,
0x65, 0x9A, 0x9D, 0x2D, 0x1A, 0x8A, 0x94, 0x5A, 0xC8, 0xC0,
0xA5, 0xA5, 0x84, 0x61, 0x9E, 0xD4, 0x24, 0xB9, 0xEF, 0xA9,
0x9D, 0xC9, 0x77, 0x0B, 0xC7, 0x70, 0x66, 0x3D, 0xBA, 0xC8,
0x54, 0xDF, 0xD2, 0x33, 0xE1, 0xF5, 0x7F, 0xF9, 0x27, 0x61,
0xBE, 0x57, 0x45, 0xDD, 0xB7, 0x45, 0x17, 0x24, 0xF5, 0x23,
0xE4, 0x38, 0x0E, 0x91, 0x27, 0xEE, 0xE3, 0x20, 0xD8, 0x14,
0xC8, 0x94, 0x47, 0x77, 0x40, 0x77, 0x45, 0x18, 0x9E, 0x0D,
0xCE, 0x79, 0x3F, 0x57, 0x31, 0x56, 0x09, 0x49, 0x67, 0xBE,
0x94, 0x58, 0x4F, 0xF6, 0xC4, 0xAB, 0xE2, 0x89, 0xE3, 0xE3,
0x8A, 0xC0, 0x05, 0x55, 0x2C, 0x24, 0xC0, 0x4A, 0x97, 0x04,
0x27, 0x9A
};
static const int sizeof_ca_key_der_2048 = sizeof(ca_key_der_2048);
/* ./certs/ca-cert.der, 2048-bit */
static const unsigned char ca_cert_der_2048[] =
{
0x30, 0x82, 0x04, 0xAA, 0x30, 0x82, 0x03, 0x92, 0xA0, 0x03,
0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0xB7, 0xB6, 0x90, 0x33,
0x66, 0x1B, 0x6B, 0x23, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x30,
0x81, 0x94, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06,
0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74,
0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55,
0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61,
0x6E, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x0A,
0x0C, 0x08, 0x53, 0x61, 0x77, 0x74, 0x6F, 0x6F, 0x74, 0x68,
0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C,
0x0A, 0x43, 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, 0x6E,
0x67, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03,
0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66,
0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30,
0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01,
0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77,
0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D,
0x30, 0x1E, 0x17, 0x0D, 0x31, 0x36, 0x30, 0x38, 0x31, 0x31,
0x32, 0x30, 0x30, 0x37, 0x33, 0x37, 0x5A, 0x17, 0x0D, 0x31,
0x39, 0x30, 0x35, 0x30, 0x38, 0x32, 0x30, 0x30, 0x37, 0x33,
0x37, 0x5A, 0x30, 0x81, 0x94, 0x31, 0x0B, 0x30, 0x09, 0x06,
0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10,
0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D,
0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E,
0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A,
0x65, 0x6D, 0x61, 0x6E, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03,
0x55, 0x04, 0x0A, 0x0C, 0x08, 0x53, 0x61, 0x77, 0x74, 0x6F,
0x6F, 0x74, 0x68, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55,
0x04, 0x0B, 0x0C, 0x0A, 0x43, 0x6F, 0x6E, 0x73, 0x75, 0x6C,
0x74, 0x69, 0x6E, 0x67, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03,
0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77,
0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D,
0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66,
0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E,
0x63, 0x6F, 0x6D, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06,
0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01,
0x05, 0x00, 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01,
0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xBF, 0x0C, 0xCA, 0x2D,
0x14, 0xB2, 0x1E, 0x84, 0x42, 0x5B, 0xCD, 0x38, 0x1F, 0x4A,
0xF2, 0x4D, 0x75, 0x10, 0xF1, 0xB6, 0x35, 0x9F, 0xDF, 0xCA,
0x7D, 0x03, 0x98, 0xD3, 0xAC, 0xDE, 0x03, 0x66, 0xEE, 0x2A,
0xF1, 0xD8, 0xB0, 0x7D, 0x6E, 0x07, 0x54, 0x0B, 0x10, 0x98,
0x21, 0x4D, 0x80, 0xCB, 0x12, 0x20, 0xE7, 0xCC, 0x4F, 0xDE,
0x45, 0x7D, 0xC9, 0x72, 0x77, 0x32, 0xEA, 0xCA, 0x90, 0xBB,
0x69, 0x52, 0x10, 0x03, 0x2F, 0xA8, 0xF3, 0x95, 0xC5, 0xF1,
0x8B, 0x62, 0x56, 0x1B, 0xEF, 0x67, 0x6F, 0xA4, 0x10, 0x41,
0x95, 0xAD, 0x0A, 0x9B, 0xE3, 0xA5, 0xC0, 0xB0, 0xD2, 0x70,
0x76, 0x50, 0x30, 0x5B, 0xA8, 0xE8, 0x08, 0x2C, 0x7C, 0xED,
0xA7, 0xA2, 0x7A, 0x8D, 0x38, 0x29, 0x1C, 0xAC, 0xC7, 0xED,
0xF2, 0x7C, 0x95, 0xB0, 0x95, 0x82, 0x7D, 0x49, 0x5C, 0x38,
0xCD, 0x77, 0x25, 0xEF, 0xBD, 0x80, 0x75, 0x53, 0x94, 0x3C,
0x3D, 0xCA, 0x63, 0x5B, 0x9F, 0x15, 0xB5, 0xD3, 0x1D, 0x13,
0x2F, 0x19, 0xD1, 0x3C, 0xDB, 0x76, 0x3A, 0xCC, 0xB8, 0x7D,
0xC9, 0xE5, 0xC2, 0xD7, 0xDA, 0x40, 0x6F, 0xD8, 0x21, 0xDC,
0x73, 0x1B, 0x42, 0x2D, 0x53, 0x9C, 0xFE, 0x1A, 0xFC, 0x7D,
0xAB, 0x7A, 0x36, 0x3F, 0x98, 0xDE, 0x84, 0x7C, 0x05, 0x67,
0xCE, 0x6A, 0x14, 0x38, 0x87, 0xA9, 0xF1, 0x8C, 0xB5, 0x68,
0xCB, 0x68, 0x7F, 0x71, 0x20, 0x2B, 0xF5, 0xA0, 0x63, 0xF5,
0x56, 0x2F, 0xA3, 0x26, 0xD2, 0xB7, 0x6F, 0xB1, 0x5A, 0x17,
0xD7, 0x38, 0x99, 0x08, 0xFE, 0x93, 0x58, 0x6F, 0xFE, 0xC3,
0x13, 0x49, 0x08, 0x16, 0x0B, 0xA7, 0x4D, 0x67, 0x00, 0x52,
0x31, 0x67, 0x23, 0x4E, 0x98, 0xED, 0x51, 0x45, 0x1D, 0xB9,
0x04, 0xD9, 0x0B, 0xEC, 0xD8, 0x28, 0xB3, 0x4B, 0xBD, 0xED,
0x36, 0x79, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x81, 0xFC,
0x30, 0x81, 0xF9, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E,
0x04, 0x16, 0x04, 0x14, 0x27, 0x8E, 0x67, 0x11, 0x74, 0xC3,
0x26, 0x1D, 0x3F, 0xED, 0x33, 0x63, 0xB3, 0xA4, 0xD8, 0x1D,
0x30, 0xE5, 0xE8, 0xD5, 0x30, 0x81, 0xC9, 0x06, 0x03, 0x55,
0x1D, 0x23, 0x04, 0x81, 0xC1, 0x30, 0x81, 0xBE, 0x80, 0x14,
0x27, 0x8E, 0x67, 0x11, 0x74, 0xC3, 0x26, 0x1D, 0x3F, 0xED,
0x33, 0x63, 0xB3, 0xA4, 0xD8, 0x1D, 0x30, 0xE5, 0xE8, 0xD5,
0xA1, 0x81, 0x9A, 0xA4, 0x81, 0x97, 0x30, 0x81, 0x94, 0x31,
0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04,
0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61,
0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C,
0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x11,
0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x08, 0x53,
0x61, 0x77, 0x74, 0x6F, 0x6F, 0x74, 0x68, 0x31, 0x13, 0x30,
0x11, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0A, 0x43, 0x6F,
0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, 0x6E, 0x67, 0x31, 0x18,
0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77,
0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C,
0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09,
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16,
0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66,
0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82, 0x09, 0x00,
0xB7, 0xB6, 0x90, 0x33, 0x66, 0x1B, 0x6B, 0x23, 0x30, 0x0C,
0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01,
0x01, 0xFF, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x03, 0x82, 0x01,
0x01, 0x00, 0x0E, 0x93, 0x48, 0x44, 0x4A, 0x72, 0x96, 0x60,
0x71, 0x25, 0x82, 0xA9, 0x2C, 0xCA, 0x60, 0x5B, 0xF2, 0x88,
0x3E, 0xCF, 0x11, 0x74, 0x5A, 0x11, 0x4A, 0xDC, 0xD9, 0xD8,
0xF6, 0x58, 0x2C, 0x05, 0xD3, 0x56, 0xD9, 0xE9, 0x8F, 0x37,
0xEF, 0x8E, 0x3E, 0x3B, 0xFF, 0x22, 0x36, 0x00, 0xCA, 0xD8,
0xE2, 0x96, 0x3F, 0xA7, 0xD1, 0xED, 0x1F, 0xDE, 0x7A, 0xB0,
0xD7, 0x8F, 0x36, 0xBD, 0x41, 0x55, 0x1E, 0xD4, 0xB9, 0x86,
0x3B, 0x87, 0x25, 0x69, 0x35, 0x60, 0x48, 0xD6, 0xE4, 0x5A,
0x94, 0xCE, 0xA2, 0xFA, 0x70, 0x38, 0x36, 0xC4, 0x85, 0xB4,
0x4B, 0x23, 0xFE, 0x71, 0x9E, 0x2F, 0xDB, 0x06, 0xC7, 0xB5,
0x9C, 0x21, 0xF0, 0x3E, 0x7C, 0xEB, 0x91, 0xF8, 0x5C, 0x09,
0xFD, 0x84, 0x43, 0xA4, 0xB3, 0x4E, 0x04, 0x0C, 0x22, 0x31,
0x71, 0x6A, 0x48, 0xC8, 0xAB, 0xBB, 0xE8, 0xCE, 0xFA, 0x67,
0x15, 0x1A, 0x3A, 0x82, 0x98, 0x43, 0x33, 0xB5, 0x0E, 0x1F,
0x1E, 0x89, 0xF8, 0x37, 0xDE, 0x1B, 0xE6, 0xB5, 0xA0, 0xF4,
0xA2, 0x8B, 0xB7, 0x1C, 0x90, 0xBA, 0x98, 0x6D, 0x94, 0x21,
0x08, 0x80, 0x5D, 0xF3, 0xBF, 0x66, 0xAD, 0xC9, 0x72, 0x28,
0x7A, 0x6A, 0x48, 0xEE, 0xCF, 0x63, 0x69, 0x31, 0x8C, 0xC5,
0x8E, 0x66, 0xDA, 0x4B, 0x78, 0x65, 0xE8, 0x03, 0x3A, 0x4B,
0xF8, 0xCC, 0x42, 0x54, 0xD3, 0x52, 0x5C, 0x2D, 0x04, 0xAE,
0x26, 0x87, 0xE1, 0x7E, 0x40, 0xCB, 0x45, 0x41, 0x16, 0x4B,
0x6E, 0xA3, 0x2E, 0x4A, 0x76, 0xBD, 0x29, 0x7F, 0x1C, 0x53,
0x37, 0x06, 0xAD, 0xE9, 0x5B, 0x6A, 0xD6, 0xB7, 0x4E, 0x94,
0xA2, 0x7C, 0xE8, 0xAC, 0x4E, 0xA6, 0x50, 0x3E, 0x2B, 0x32,
0x9E, 0x68, 0x42, 0x1B, 0xE4, 0x59, 0x67, 0x61, 0xEA, 0xC7,
0x9A, 0x51, 0x9C, 0x1C, 0x55, 0xA3, 0x77, 0x76
};
static const int sizeof_ca_cert_der_2048 = sizeof(ca_cert_der_2048);
/* ./certs/server-key.der, 2048-bit */
static const unsigned char server_key_der_2048[] =
{
0x30, 0x82, 0x04, 0xA5, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01,
0x01, 0x00, 0xC0, 0x95, 0x08, 0xE1, 0x57, 0x41, 0xF2, 0x71,
0x6D, 0xB7, 0xD2, 0x45, 0x41, 0x27, 0x01, 0x65, 0xC6, 0x45,
0xAE, 0xF2, 0xBC, 0x24, 0x30, 0xB8, 0x95, 0xCE, 0x2F, 0x4E,
0xD6, 0xF6, 0x1C, 0x88, 0xBC, 0x7C, 0x9F, 0xFB, 0xA8, 0x67,
0x7F, 0xFE, 0x5C, 0x9C, 0x51, 0x75, 0xF7, 0x8A, 0xCA, 0x07,
0xE7, 0x35, 0x2F, 0x8F, 0xE1, 0xBD, 0x7B, 0xC0, 0x2F, 0x7C,
0xAB, 0x64, 0xA8, 0x17, 0xFC, 0xCA, 0x5D, 0x7B, 0xBA, 0xE0,
0x21, 0xE5, 0x72, 0x2E, 0x6F, 0x2E, 0x86, 0xD8, 0x95, 0x73,
0xDA, 0xAC, 0x1B, 0x53, 0xB9, 0x5F, 0x3F, 0xD7, 0x19, 0x0D,
0x25, 0x4F, 0xE1, 0x63, 0x63, 0x51, 0x8B, 0x0B, 0x64, 0x3F,
0xAD, 0x43, 0xB8, 0xA5, 0x1C, 0x5C, 0x34, 0xB3, 0xAE, 0x00,
0xA0, 0x63, 0xC5, 0xF6, 0x7F, 0x0B, 0x59, 0x68, 0x78, 0x73,
0xA6, 0x8C, 0x18, 0xA9, 0x02, 0x6D, 0xAF, 0xC3, 0x19, 0x01,
0x2E, 0xB8, 0x10, 0xE3, 0xC6, 0xCC, 0x40, 0xB4, 0x69, 0xA3,
0x46, 0x33, 0x69, 0x87, 0x6E, 0xC4, 0xBB, 0x17, 0xA6, 0xF3,
0xE8, 0xDD, 0xAD, 0x73, 0xBC, 0x7B, 0x2F, 0x21, 0xB5, 0xFD,
0x66, 0x51, 0x0C, 0xBD, 0x54, 0xB3, 0xE1, 0x6D, 0x5F, 0x1C,
0xBC, 0x23, 0x73, 0xD1, 0x09, 0x03, 0x89, 0x14, 0xD2, 0x10,
0xB9, 0x64, 0xC3, 0x2A, 0xD0, 0xA1, 0x96, 0x4A, 0xBC, 0xE1,
0xD4, 0x1A, 0x5B, 0xC7, 0xA0, 0xC0, 0xC1, 0x63, 0x78, 0x0F,
0x44, 0x37, 0x30, 0x32, 0x96, 0x80, 0x32, 0x23, 0x95, 0xA1,
0x77, 0xBA, 0x13, 0xD2, 0x97, 0x73, 0xE2, 0x5D, 0x25, 0xC9,
0x6A, 0x0D, 0xC3, 0x39, 0x60, 0xA4, 0xB4, 0xB0, 0x69, 0x42,
0x42, 0x09, 0xE9, 0xD8, 0x08, 0xBC, 0x33, 0x20, 0xB3, 0x58,
0x22, 0xA7, 0xAA, 0xEB, 0xC4, 0xE1, 0xE6, 0x61, 0x83, 0xC5,
0xD2, 0x96, 0xDF, 0xD9, 0xD0, 0x4F, 0xAD, 0xD7, 0x02, 0x03,
0x01, 0x00, 0x01, 0x02, 0x82, 0x01, 0x01, 0x00, 0x9A, 0xD0,
0x34, 0x0F, 0x52, 0x62, 0x05, 0x50, 0x01, 0xEF, 0x9F, 0xED,
0x64, 0x6E, 0xC2, 0xC4, 0xDA, 0x1A, 0xF2, 0x84, 0xD7, 0x92,
0x10, 0x48, 0x92, 0xC4, 0xE9, 0x6A, 0xEB, 0x8B, 0x75, 0x6C,
0xC6, 0x79, 0x38, 0xF2, 0xC9, 0x72, 0x4A, 0x86, 0x64, 0x54,
0x95, 0x77, 0xCB, 0xC3, 0x9A, 0x9D, 0xB7, 0xD4, 0x1D, 0xA4,
0x00, 0xC8, 0x9E, 0x4E, 0xE4, 0xDD, 0xC7, 0xBA, 0x67, 0x16,
0xC1, 0x74, 0xBC, 0xA9, 0xD6, 0x94, 0x8F, 0x2B, 0x30, 0x1A,
0xFB, 0xED, 0xDF, 0x21, 0x05, 0x23, 0xD9, 0x4A, 0x39, 0xBD,
0x98, 0x6B, 0x65, 0x9A, 0xB8, 0xDC, 0xC4, 0x7D, 0xEE, 0xA6,
0x43, 0x15, 0x2E, 0x3D, 0xBE, 0x1D, 0x22, 0x60, 0x2A, 0x73,
0x30, 0xD5, 0x3E, 0xD8, 0xA2, 0xAC, 0x86, 0x43, 0x2E, 0xC4,
0xF5, 0x64, 0x5E, 0x3F, 0x89, 0x75, 0x0F, 0x11, 0xD8, 0x51,
0x25, 0x4E, 0x9F, 0xD8, 0xAA, 0xA3, 0xCE, 0x60, 0xB3, 0xE2,
0x8A, 0xD9, 0x7E, 0x1B, 0xF0, 0x64, 0xCA, 0x9A, 0x5B, 0x05,
0x0B, 0x5B, 0xAA, 0xCB, 0xE5, 0xE3, 0x3F, 0x6E, 0x32, 0x22,
0x05, 0xF3, 0xD0, 0xFA, 0xEF, 0x74, 0x52, 0x81, 0xE2, 0x5F,
0x74, 0xD3, 0xBD, 0xFF, 0x31, 0x83, 0x45, 0x75, 0xFA, 0x63,
0x7A, 0x97, 0x2E, 0xD6, 0xB6, 0x19, 0xC6, 0x92, 0x26, 0xE4,
0x28, 0x06, 0x50, 0x50, 0x0E, 0x78, 0x2E, 0xA9, 0x78, 0x0D,
0x14, 0x97, 0xB4, 0x12, 0xD8, 0x31, 0x40, 0xAB, 0xA1, 0x01,
0x41, 0xC2, 0x30, 0xF8, 0x07, 0x5F, 0x16, 0xE4, 0x61, 0x77,
0xD2, 0x60, 0xF2, 0x9F, 0x8D, 0xE8, 0xF4, 0xBA, 0xEB, 0x63,
0xDE, 0x2A, 0x97, 0x81, 0xEF, 0x4C, 0x6C, 0xE6, 0x55, 0x34,
0x51, 0x2B, 0x28, 0x34, 0xF4, 0x53, 0x1C, 0xC4, 0x58, 0x0A,
0x3F, 0xBB, 0xAF, 0xB5, 0xF7, 0x4A, 0x85, 0x43, 0x2D, 0x3C,
0xF1, 0x58, 0x58, 0x81, 0x02, 0x81, 0x81, 0x00, 0xF2, 0x2C,
0x54, 0x76, 0x39, 0x23, 0x63, 0xC9, 0x10, 0x32, 0xB7, 0x93,
0xAD, 0xAF, 0xBE, 0x19, 0x75, 0x96, 0x81, 0x64, 0xE6, 0xB5,
0xB8, 0x89, 0x42, 0x41, 0xD1, 0x6D, 0xD0, 0x1C, 0x1B, 0xF8,
0x1B, 0xAC, 0x69, 0xCB, 0x36, 0x3C, 0x64, 0x7D, 0xDC, 0xF4,
0x19, 0xB8, 0xC3, 0x60, 0xB1, 0x57, 0x48, 0x5F, 0x52, 0x4F,
0x59, 0x3A, 0x55, 0x7F, 0x32, 0xC0, 0x19, 0x43, 0x50, 0x3F,
0xAE, 0xCE, 0x6F, 0x17, 0xF3, 0x0E, 0x9F, 0x40, 0xCA, 0x4E,
0xAD, 0x15, 0x3B, 0xC9, 0x79, 0xE9, 0xC0, 0x59, 0x38, 0x73,
0x70, 0x9C, 0x0A, 0x7C, 0xC9, 0x3A, 0x48, 0x32, 0xA7, 0xD8,
0x49, 0x75, 0x0A, 0x85, 0xC2, 0xC2, 0xFD, 0x15, 0x73, 0xDA,
0x99, 0x09, 0x2A, 0x69, 0x9A, 0x9F, 0x0A, 0x71, 0xBF, 0xB0,
0x04, 0xA6, 0x8C, 0x7A, 0x5A, 0x6F, 0x48, 0x5A, 0x54, 0x3B,
0xC6, 0xB1, 0x53, 0x17, 0xDF, 0xE7, 0x02, 0x81, 0x81, 0x00,
0xCB, 0x93, 0xDE, 0x77, 0x15, 0x5D, 0xB7, 0x5C, 0x5C, 0x7C,
0xD8, 0x90, 0xA9, 0x98, 0x2D, 0xD6, 0x69, 0x0E, 0x63, 0xB3,
0xA3, 0xDC, 0xA6, 0xCC, 0x8B, 0x6A, 0xA4, 0xA2, 0x12, 0x8C,
0x8E, 0x7B, 0x48, 0x2C, 0xB2, 0x4B, 0x37, 0xDC, 0x06, 0x18,
0x7D, 0xEA, 0xFE, 0x76, 0xA1, 0xD4, 0xA1, 0xE9, 0x3F, 0x0D,
0xCD, 0x1B, 0x5F, 0xAF, 0x5F, 0x9E, 0x96, 0x5B, 0x5B, 0x0F,
0xA1, 0x7C, 0xAF, 0xB3, 0x9B, 0x90, 0xDB, 0x57, 0x73, 0x3A,
0xED, 0xB0, 0x23, 0x44, 0xAE, 0x41, 0x4F, 0x1F, 0x07, 0x42,
0x13, 0x23, 0x4C, 0xCB, 0xFA, 0xF4, 0x14, 0xA4, 0xD5, 0xF7,
0x9E, 0x36, 0x7C, 0x5B, 0x9F, 0xA8, 0x3C, 0xC1, 0x85, 0x5F,
0x74, 0xD2, 0x39, 0x2D, 0xFF, 0xD0, 0x84, 0xDF, 0xFB, 0xB3,
0x20, 0x7A, 0x2E, 0x9B, 0x17, 0xAE, 0xE6, 0xBA, 0x0B, 0xAE,
0x5F, 0x53, 0xA4, 0x52, 0xED, 0x1B, 0xC4, 0x91, 0x02, 0x81,
0x81, 0x00, 0xEC, 0x98, 0xDA, 0xBB, 0xD5, 0xFE, 0xF9, 0x52,
0x4A, 0x7D, 0x02, 0x55, 0x49, 0x6F, 0x55, 0x6E, 0x52, 0x2F,
0x84, 0xA3, 0x2B, 0xB3, 0x86, 0x62, 0xB3, 0x54, 0xD2, 0x63,
0x52, 0xDA, 0xE3, 0x88, 0x76, 0xA0, 0xEF, 0x8B, 0x15, 0xA5,
0xD3, 0x18, 0x14, 0x72, 0x77, 0x5E, 0xC7, 0xA3, 0x04, 0x1F,
0x9E, 0x19, 0x62, 0xB5, 0x1B, 0x1B, 0x9E, 0xC3, 0xF2, 0xB5,
0x32, 0xF9, 0x4C, 0xC1, 0xAA, 0xEB, 0x0C, 0x26, 0x7D, 0xD4,
0x5F, 0x4A, 0x51, 0x5C, 0xA4, 0x45, 0x06, 0x70, 0x44, 0xA7,
0x56, 0xC0, 0xD4, 0x22, 0x14, 0x76, 0x9E, 0xD8, 0x63, 0x50,
0x89, 0x90, 0xD3, 0xE2, 0xBF, 0x81, 0x95, 0x92, 0x31, 0x41,
0x87, 0x39, 0x1A, 0x43, 0x0B, 0x18, 0xA5, 0x53, 0x1F, 0x39,
0x1A, 0x5F, 0x1F, 0x43, 0xBC, 0x87, 0x6A, 0xDF, 0x6E, 0xD3,
0x22, 0x00, 0xFE, 0x22, 0x98, 0x70, 0x4E, 0x1A, 0x19, 0x29,
0x02, 0x81, 0x81, 0x00, 0x8A, 0x41, 0x56, 0x28, 0x51, 0x9E,
0x5F, 0xD4, 0x9E, 0x0B, 0x3B, 0x98, 0xA3, 0x54, 0xF2, 0x6C,
0x56, 0xD4, 0xAA, 0xE9, 0x69, 0x33, 0x85, 0x24, 0x0C, 0xDA,
0xD4, 0x0C, 0x2D, 0xC4, 0xBF, 0x4F, 0x02, 0x69, 0x38, 0x7C,
0xD4, 0xE6, 0xDC, 0x4C, 0xED, 0xD7, 0x16, 0x11, 0xC3, 0x3E,
0x00, 0xE7, 0xC3, 0x26, 0xC0, 0x51, 0x02, 0xDE, 0xBB, 0x75,
0x9C, 0x6F, 0x56, 0x9C, 0x7A, 0xF3, 0x8E, 0xEF, 0xCF, 0x8A,
0xC5, 0x2B, 0xD2, 0xDA, 0x06, 0x6A, 0x44, 0xC9, 0x73, 0xFE,
0x6E, 0x99, 0x87, 0xF8, 0x5B, 0xBE, 0xF1, 0x7C, 0xE6, 0x65,
0xB5, 0x4F, 0x6C, 0xF0, 0xC9, 0xC5, 0xFF, 0x16, 0xCA, 0x8B,
0x1B, 0x17, 0xE2, 0x58, 0x3D, 0xA2, 0x37, 0xAB, 0x01, 0xBC,
0xBF, 0x40, 0xCE, 0x53, 0x8C, 0x8E, 0xED, 0xEF, 0xEE, 0x59,
0x9D, 0xE0, 0x63, 0xE6, 0x7C, 0x5E, 0xF5, 0x8E, 0x4B, 0xF1,
0x3B, 0xC1, 0x02, 0x81, 0x80, 0x4D, 0x45, 0xF9, 0x40, 0x8C,
0xC5, 0x5B, 0xF4, 0x2A, 0x1A, 0x8A, 0xB4, 0xF2, 0x1C, 0xAC,
0x6B, 0xE9, 0x0C, 0x56, 0x36, 0xB7, 0x4E, 0x72, 0x96, 0xD5,
0xE5, 0x8A, 0xD2, 0xE2, 0xFF, 0xF1, 0xF1, 0x18, 0x13, 0x3D,
0x86, 0x09, 0xB8, 0xD8, 0x76, 0xA7, 0xC9, 0x1C, 0x71, 0x52,
0x94, 0x30, 0x43, 0xE0, 0xF1, 0x78, 0x74, 0xFD, 0x61, 0x1B,
0x4C, 0x09, 0xCC, 0xE6, 0x68, 0x2A, 0x71, 0xAD, 0x1C, 0xDF,
0x43, 0xBC, 0x56, 0xDB, 0xA5, 0xA4, 0xBE, 0x35, 0x70, 0xA4,
0x5E, 0xCF, 0x4F, 0xFC, 0x00, 0x55, 0x99, 0x3A, 0x3D, 0x23,
0xCF, 0x67, 0x5A, 0xF5, 0x22, 0xF8, 0xB5, 0x29, 0xD0, 0x44,
0x11, 0xEB, 0x35, 0x2E, 0x46, 0xBE, 0xFD, 0x8E, 0x18, 0xB2,
0x5F, 0xA8, 0xBF, 0x19, 0x32, 0xA1, 0xF5, 0xDC, 0x03, 0xE6,
0x7C, 0x9A, 0x1F, 0x0C, 0x7C, 0xA9, 0xB0, 0x0E, 0x21, 0x37,
0x3B, 0xF1, 0xB0
};
static const int sizeof_server_key_der_2048 = sizeof(server_key_der_2048);
/* ./certs/server-cert.der, 2048-bit */
static const unsigned char server_cert_der_2048[] =
{
0x30, 0x82, 0x04, 0x9E, 0x30, 0x82, 0x03, 0x86, 0xA0, 0x03,
0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x30, 0x0D, 0x06, 0x09,
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05,
0x00, 0x30, 0x81, 0x94, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03,
0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30,
0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F,
0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06,
0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65,
0x6D, 0x61, 0x6E, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55,
0x04, 0x0A, 0x0C, 0x08, 0x53, 0x61, 0x77, 0x74, 0x6F, 0x6F,
0x74, 0x68, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04,
0x0B, 0x0C, 0x0A, 0x43, 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74,
0x69, 0x6E, 0x67, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55,
0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F,
0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31,
0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7,
0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F,
0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63,
0x6F, 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x36, 0x30, 0x38,
0x31, 0x31, 0x32, 0x30, 0x30, 0x37, 0x33, 0x37, 0x5A, 0x17,
0x0D, 0x31, 0x39, 0x30, 0x35, 0x30, 0x38, 0x32, 0x30, 0x30,
0x37, 0x33, 0x37, 0x5A, 0x30, 0x81, 0x90, 0x31, 0x0B, 0x30,
0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53,
0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C,
0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10,
0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42,
0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x10, 0x30, 0x0E,
0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x07, 0x77, 0x6F, 0x6C,
0x66, 0x53, 0x53, 0x4C, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03,
0x55, 0x04, 0x0B, 0x0C, 0x07, 0x53, 0x75, 0x70, 0x70, 0x6F,
0x72, 0x74, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04,
0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C,
0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F,
0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D,
0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40,
0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F,
0x6D, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A,
0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00,
0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02,
0x82, 0x01, 0x01, 0x00, 0xC0, 0x95, 0x08, 0xE1, 0x57, 0x41,
0xF2, 0x71, 0x6D, 0xB7, 0xD2, 0x45, 0x41, 0x27, 0x01, 0x65,
0xC6, 0x45, 0xAE, 0xF2, 0xBC, 0x24, 0x30, 0xB8, 0x95, 0xCE,
0x2F, 0x4E, 0xD6, 0xF6, 0x1C, 0x88, 0xBC, 0x7C, 0x9F, 0xFB,
0xA8, 0x67, 0x7F, 0xFE, 0x5C, 0x9C, 0x51, 0x75, 0xF7, 0x8A,
0xCA, 0x07, 0xE7, 0x35, 0x2F, 0x8F, 0xE1, 0xBD, 0x7B, 0xC0,
0x2F, 0x7C, 0xAB, 0x64, 0xA8, 0x17, 0xFC, 0xCA, 0x5D, 0x7B,
0xBA, 0xE0, 0x21, 0xE5, 0x72, 0x2E, 0x6F, 0x2E, 0x86, 0xD8,
0x95, 0x73, 0xDA, 0xAC, 0x1B, 0x53, 0xB9, 0x5F, 0x3F, 0xD7,
0x19, 0x0D, 0x25, 0x4F, 0xE1, 0x63, 0x63, 0x51, 0x8B, 0x0B,
0x64, 0x3F, 0xAD, 0x43, 0xB8, 0xA5, 0x1C, 0x5C, 0x34, 0xB3,
0xAE, 0x00, 0xA0, 0x63, 0xC5, 0xF6, 0x7F, 0x0B, 0x59, 0x68,
0x78, 0x73, 0xA6, 0x8C, 0x18, 0xA9, 0x02, 0x6D, 0xAF, 0xC3,
0x19, 0x01, 0x2E, 0xB8, 0x10, 0xE3, 0xC6, 0xCC, 0x40, 0xB4,
0x69, 0xA3, 0x46, 0x33, 0x69, 0x87, 0x6E, 0xC4, 0xBB, 0x17,
0xA6, 0xF3, 0xE8, 0xDD, 0xAD, 0x73, 0xBC, 0x7B, 0x2F, 0x21,
0xB5, 0xFD, 0x66, 0x51, 0x0C, 0xBD, 0x54, 0xB3, 0xE1, 0x6D,
0x5F, 0x1C, 0xBC, 0x23, 0x73, 0xD1, 0x09, 0x03, 0x89, 0x14,
0xD2, 0x10, 0xB9, 0x64, 0xC3, 0x2A, 0xD0, 0xA1, 0x96, 0x4A,
0xBC, 0xE1, 0xD4, 0x1A, 0x5B, 0xC7, 0xA0, 0xC0, 0xC1, 0x63,
0x78, 0x0F, 0x44, 0x37, 0x30, 0x32, 0x96, 0x80, 0x32, 0x23,
0x95, 0xA1, 0x77, 0xBA, 0x13, 0xD2, 0x97, 0x73, 0xE2, 0x5D,
0x25, 0xC9, 0x6A, 0x0D, 0xC3, 0x39, 0x60, 0xA4, 0xB4, 0xB0,
0x69, 0x42, 0x42, 0x09, 0xE9, 0xD8, 0x08, 0xBC, 0x33, 0x20,
0xB3, 0x58, 0x22, 0xA7, 0xAA, 0xEB, 0xC4, 0xE1, 0xE6, 0x61,
0x83, 0xC5, 0xD2, 0x96, 0xDF, 0xD9, 0xD0, 0x4F, 0xAD, 0xD7,
0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x81, 0xFC, 0x30, 0x81,
0xF9, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16,
0x04, 0x14, 0xB3, 0x11, 0x32, 0xC9, 0x92, 0x98, 0x84, 0xE2,
0xC9, 0xF8, 0xD0, 0x3B, 0x6E, 0x03, 0x42, 0xCA, 0x1F, 0x0E,
0x8E, 0x3C, 0x30, 0x81, 0xC9, 0x06, 0x03, 0x55, 0x1D, 0x23,
0x04, 0x81, 0xC1, 0x30, 0x81, 0xBE, 0x80, 0x14, 0x27, 0x8E,
0x67, 0x11, 0x74, 0xC3, 0x26, 0x1D, 0x3F, 0xED, 0x33, 0x63,
0xB3, 0xA4, 0xD8, 0x1D, 0x30, 0xE5, 0xE8, 0xD5, 0xA1, 0x81,
0x9A, 0xA4, 0x81, 0x97, 0x30, 0x81, 0x94, 0x31, 0x0B, 0x30,
0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53,
0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C,
0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10,
0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42,
0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x11, 0x30, 0x0F,
0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x08, 0x53, 0x61, 0x77,
0x74, 0x6F, 0x6F, 0x74, 0x68, 0x31, 0x13, 0x30, 0x11, 0x06,
0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0A, 0x43, 0x6F, 0x6E, 0x73,
0x75, 0x6C, 0x74, 0x69, 0x6E, 0x67, 0x31, 0x18, 0x30, 0x16,
0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77,
0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63,
0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69,
0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73,
0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82, 0x09, 0x00, 0xB7, 0xB6,
0x90, 0x33, 0x66, 0x1B, 0x6B, 0x23, 0x30, 0x0C, 0x06, 0x03,
0x55, 0x1D, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xFF,
0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D,
0x01, 0x01, 0x0B, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00,
0x51, 0xFE, 0x2A, 0xDF, 0x07, 0x7E, 0x43, 0xCA, 0x66, 0x8D,
0x15, 0xC4, 0x2B, 0xDB, 0x57, 0xB2, 0x06, 0x6D, 0x0D, 0x90,
0x66, 0xFF, 0xA5, 0x24, 0x9C, 0x14, 0xEF, 0x81, 0xF2, 0xA4,
0xAB, 0x99, 0xA9, 0x6A, 0x49, 0x20, 0xA5, 0xD2, 0x71, 0xE7,
0x1C, 0x3C, 0x99, 0x07, 0xC7, 0x47, 0xFC, 0xE8, 0x96, 0xB4,
0xF5, 0x42, 0x30, 0xCE, 0x39, 0x01, 0x4B, 0xD1, 0xC2, 0xE8,
0xBC, 0x95, 0x84, 0x87, 0xCE, 0x55, 0x5D, 0x97, 0x9F, 0xCF,
0x78, 0xF3, 0x56, 0x9B, 0xA5, 0x08, 0x6D, 0xAC, 0xF6, 0xA5,
0x5C, 0xC4, 0xEF, 0x3E, 0x2A, 0x39, 0xA6, 0x48, 0x26, 0x29,
0x7B, 0x2D, 0xE0, 0xCD, 0xA6, 0x8C, 0x57, 0x48, 0x0B, 0xBB,
0x31, 0x32, 0xC2, 0xBF, 0xD9, 0x43, 0x4C, 0x47, 0x25, 0x18,
0x81, 0xA8, 0xC9, 0x33, 0x82, 0x41, 0x9B, 0xBA, 0x61, 0x86,
0xD7, 0x84, 0x93, 0x17, 0x24, 0x25, 0x36, 0xCA, 0x4D, 0x63,
0x6B, 0x4F, 0x95, 0x79, 0xD8, 0x60, 0xE0, 0x1E, 0xF5, 0xAC,
0xC1, 0x8A, 0xA1, 0xB1, 0x7E, 0x85, 0x8E, 0x87, 0x20, 0x2F,
0x08, 0x31, 0xAD, 0x5E, 0xC6, 0x4A, 0xC8, 0x61, 0xF4, 0x9E,
0x07, 0x1E, 0xA2, 0x22, 0xED, 0x73, 0x7C, 0x85, 0xEE, 0xFA,
0x62, 0xDC, 0x50, 0x36, 0xAA, 0xFD, 0xC7, 0x9D, 0xAA, 0x18,
0x04, 0xFB, 0xEA, 0xCC, 0x2C, 0x68, 0x9B, 0xB3, 0xA9, 0xC2,
0x96, 0xD8, 0xC1, 0xCC, 0x5A, 0x7E, 0xF7, 0x0D, 0x9E, 0x08,
0xE0, 0x9D, 0x29, 0x8B, 0x84, 0x46, 0x8F, 0xD3, 0x91, 0x6A,
0xB5, 0xB8, 0x7A, 0x5C, 0xCC, 0x4F, 0x55, 0x01, 0xB8, 0x9A,
0x48, 0xA0, 0x94, 0x43, 0xCA, 0x25, 0x47, 0x52, 0x0A, 0xF7,
0xF4, 0xBE, 0xB0, 0xD1, 0x71, 0x6D, 0xA5, 0x52, 0x4A, 0x65,
0x50, 0xB2, 0xAD, 0x4E, 0x1D, 0xE0, 0x6C, 0x01, 0xD8, 0xFB,
0x43, 0x80, 0xE6, 0xE4, 0x0C, 0x37
};
static const int sizeof_server_cert_der_2048 = sizeof(server_cert_der_2048);
#endif /* USE_CERT_BUFFERS_2048 */
#if defined(HAVE_ECC) && defined(USE_CERT_BUFFERS_256)
/* ./certs/ecc-client-key.der, ECC */
static const unsigned char ecc_clikey_der_256[] =
{
0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0xF8, 0xCF, 0x92,
0x6B, 0xBD, 0x1E, 0x28, 0xF1, 0xA8, 0xAB, 0xA1, 0x23, 0x4F,
0x32, 0x74, 0x18, 0x88, 0x50, 0xAD, 0x7E, 0xC7, 0xEC, 0x92,
0xF8, 0x8F, 0x97, 0x4D, 0xAF, 0x56, 0x89, 0x65, 0xC7, 0xA0,
0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01,
0x07, 0xA1, 0x44, 0x03, 0x42, 0x00, 0x04, 0x55, 0xBF, 0xF4,
0x0F, 0x44, 0x50, 0x9A, 0x3D, 0xCE, 0x9B, 0xB7, 0xF0, 0xC5,
0x4D, 0xF5, 0x70, 0x7B, 0xD4, 0xEC, 0x24, 0x8E, 0x19, 0x80,
0xEC, 0x5A, 0x4C, 0xA2, 0x24, 0x03, 0x62, 0x2C, 0x9B, 0xDA,
0xEF, 0xA2, 0x35, 0x12, 0x43, 0x84, 0x76, 0x16, 0xC6, 0x56,
0x95, 0x06, 0xCC, 0x01, 0xA9, 0xBD, 0xF6, 0x75, 0x1A, 0x42,
0xF7, 0xBD, 0xA9, 0xB2, 0x36, 0x22, 0x5F, 0xC7, 0x5D, 0x7F,
0xB4
};
static const int sizeof_ecc_clikey_der_256 = sizeof(ecc_clikey_der_256);
/* ./certs/ecc-client-keyPub.der, ECC */
static const unsigned char ecc_clikeypub_der_256[] =
{
0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE,
0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D,
0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x55, 0xBF, 0xF4,
0x0F, 0x44, 0x50, 0x9A, 0x3D, 0xCE, 0x9B, 0xB7, 0xF0, 0xC5,
0x4D, 0xF5, 0x70, 0x7B, 0xD4, 0xEC, 0x24, 0x8E, 0x19, 0x80,
0xEC, 0x5A, 0x4C, 0xA2, 0x24, 0x03, 0x62, 0x2C, 0x9B, 0xDA,
0xEF, 0xA2, 0x35, 0x12, 0x43, 0x84, 0x76, 0x16, 0xC6, 0x56,
0x95, 0x06, 0xCC, 0x01, 0xA9, 0xBD, 0xF6, 0x75, 0x1A, 0x42,
0xF7, 0xBD, 0xA9, 0xB2, 0x36, 0x22, 0x5F, 0xC7, 0x5D, 0x7F,
0xB4
};
static const int sizeof_ecc_clikeypub_der_256 = sizeof(ecc_clikeypub_der_256);
/* ./certs/client-ecc-cert.der, ECC */
static const unsigned char cliecc_cert_der_256[] =
{
0x30, 0x82, 0x03, 0x09, 0x30, 0x82, 0x02, 0xAF, 0xA0, 0x03,
0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0xE7, 0x72, 0xA6, 0x9E,
0x13, 0x1D, 0x17, 0x5C, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86,
0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x81, 0x8D, 0x31,
0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
0x55, 0x53, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x03, 0x55, 0x04,
0x08, 0x0C, 0x06, 0x4F, 0x72, 0x65, 0x67, 0x6F, 0x6E, 0x31,
0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x05,
0x53, 0x61, 0x6C, 0x65, 0x6D, 0x31, 0x13, 0x30, 0x11, 0x06,
0x03, 0x55, 0x04, 0x0A, 0x0C, 0x0A, 0x43, 0x6C, 0x69, 0x65,
0x6E, 0x74, 0x20, 0x45, 0x43, 0x43, 0x31, 0x0D, 0x30, 0x0B,
0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x04, 0x46, 0x61, 0x73,
0x74, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03,
0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66,
0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30,
0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01,
0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77,
0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D,
0x30, 0x1E, 0x17, 0x0D, 0x31, 0x36, 0x30, 0x38, 0x31, 0x31,
0x32, 0x30, 0x30, 0x37, 0x33, 0x38, 0x5A, 0x17, 0x0D, 0x31,
0x39, 0x30, 0x35, 0x30, 0x38, 0x32, 0x30, 0x30, 0x37, 0x33,
0x38, 0x5A, 0x30, 0x81, 0x8D, 0x31, 0x0B, 0x30, 0x09, 0x06,
0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x0F,
0x30, 0x0D, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x06, 0x4F,
0x72, 0x65, 0x67, 0x6F, 0x6E, 0x31, 0x0E, 0x30, 0x0C, 0x06,
0x03, 0x55, 0x04, 0x07, 0x0C, 0x05, 0x53, 0x61, 0x6C, 0x65,
0x6D, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0A,
0x0C, 0x0A, 0x43, 0x6C, 0x69, 0x65, 0x6E, 0x74, 0x20, 0x45,
0x43, 0x43, 0x31, 0x0D, 0x30, 0x0B, 0x06, 0x03, 0x55, 0x04,
0x0B, 0x0C, 0x04, 0x46, 0x61, 0x73, 0x74, 0x31, 0x18, 0x30,
0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77,
0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E,
0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A,
0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10,
0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73,
0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x59, 0x30, 0x13,
0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06,
0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03,
0x42, 0x00, 0x04, 0x55, 0xBF, 0xF4, 0x0F, 0x44, 0x50, 0x9A,
0x3D, 0xCE, 0x9B, 0xB7, 0xF0, 0xC5, 0x4D, 0xF5, 0x70, 0x7B,
0xD4, 0xEC, 0x24, 0x8E, 0x19, 0x80, 0xEC, 0x5A, 0x4C, 0xA2,
0x24, 0x03, 0x62, 0x2C, 0x9B, 0xDA, 0xEF, 0xA2, 0x35, 0x12,
0x43, 0x84, 0x76, 0x16, 0xC6, 0x56, 0x95, 0x06, 0xCC, 0x01,
0xA9, 0xBD, 0xF6, 0x75, 0x1A, 0x42, 0xF7, 0xBD, 0xA9, 0xB2,
0x36, 0x22, 0x5F, 0xC7, 0x5D, 0x7F, 0xB4, 0xA3, 0x81, 0xF5,
0x30, 0x81, 0xF2, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E,
0x04, 0x16, 0x04, 0x14, 0xEB, 0xD4, 0x4B, 0x59, 0x6B, 0x95,
0x61, 0x3F, 0x51, 0x57, 0xB6, 0x04, 0x4D, 0x89, 0x41, 0x88,
0x44, 0x5C, 0xAB, 0xF2, 0x30, 0x81, 0xC2, 0x06, 0x03, 0x55,
0x1D, 0x23, 0x04, 0x81, 0xBA, 0x30, 0x81, 0xB7, 0x80, 0x14,
0xEB, 0xD4, 0x4B, 0x59, 0x6B, 0x95, 0x61, 0x3F, 0x51, 0x57,
0xB6, 0x04, 0x4D, 0x89, 0x41, 0x88, 0x44, 0x5C, 0xAB, 0xF2,
0xA1, 0x81, 0x93, 0xA4, 0x81, 0x90, 0x30, 0x81, 0x8D, 0x31,
0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
0x55, 0x53, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x03, 0x55, 0x04,
0x08, 0x0C, 0x06, 0x4F, 0x72, 0x65, 0x67, 0x6F, 0x6E, 0x31,
0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x05,
0x53, 0x61, 0x6C, 0x65, 0x6D, 0x31, 0x13, 0x30, 0x11, 0x06,
0x03, 0x55, 0x04, 0x0A, 0x0C, 0x0A, 0x43, 0x6C, 0x69, 0x65,
0x6E, 0x74, 0x20, 0x45, 0x43, 0x43, 0x31, 0x0D, 0x30, 0x0B,
0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x04, 0x46, 0x61, 0x73,
0x74, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03,
0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66,
0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30,
0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01,
0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77,
0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D,
0x82, 0x09, 0x00, 0xE7, 0x72, 0xA6, 0x9E, 0x13, 0x1D, 0x17,
0x5C, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05,
0x30, 0x03, 0x01, 0x01, 0xFF, 0x30, 0x0A, 0x06, 0x08, 0x2A,
0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00,
0x30, 0x45, 0x02, 0x20, 0x43, 0x9A, 0xB6, 0x7E, 0x87, 0x8E,
0x8C, 0xD7, 0x16, 0xF1, 0x0D, 0xD2, 0x50, 0x11, 0xA4, 0xAC,
0xB6, 0xAC, 0x07, 0xEF, 0xE9, 0x60, 0xE1, 0x90, 0xA2, 0x5F,
0xC9, 0x76, 0xE6, 0x54, 0x1A, 0x81, 0x02, 0x21, 0x00, 0xD6,
0x8B, 0x7C, 0xBA, 0x53, 0x12, 0x05, 0x06, 0xFA, 0x8F, 0xC5,
0xC7, 0x58, 0xC3, 0x9A, 0x9F, 0xA1, 0x84, 0x8C, 0xB4, 0x88,
0x83, 0x4D, 0x6A, 0xB4, 0xB7, 0x85, 0x7A, 0xB3, 0x3C, 0xF3,
0xDF
};
static const int sizeof_cliecc_cert_der_256 = sizeof(cliecc_cert_der_256);
/* ./certs/ecc-key.der, ECC */
static const unsigned char ecc_key_der_256[] =
{
0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0x45, 0xB6, 0x69,
0x02, 0x73, 0x9C, 0x6C, 0x85, 0xA1, 0x38, 0x5B, 0x72, 0xE8,
0xE8, 0xC7, 0xAC, 0xC4, 0x03, 0x8D, 0x53, 0x35, 0x04, 0xFA,
0x6C, 0x28, 0xDC, 0x34, 0x8D, 0xE1, 0xA8, 0x09, 0x8C, 0xA0,
0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01,
0x07, 0xA1, 0x44, 0x03, 0x42, 0x00, 0x04, 0xBB, 0x33, 0xAC,
0x4C, 0x27, 0x50, 0x4A, 0xC6, 0x4A, 0xA5, 0x04, 0xC3, 0x3C,
0xDE, 0x9F, 0x36, 0xDB, 0x72, 0x2D, 0xCE, 0x94, 0xEA, 0x2B,
0xFA, 0xCB, 0x20, 0x09, 0x39, 0x2C, 0x16, 0xE8, 0x61, 0x02,
0xE9, 0xAF, 0x4D, 0xD3, 0x02, 0x93, 0x9A, 0x31, 0x5B, 0x97,
0x92, 0x21, 0x7F, 0xF0, 0xCF, 0x18, 0xDA, 0x91, 0x11, 0x02,
0x34, 0x86, 0xE8, 0x20, 0x58, 0x33, 0x0B, 0x80, 0x34, 0x89,
0xD8
};
static const int sizeof_ecc_key_der_256 = sizeof(ecc_key_der_256);
/* ./certs/ecc-keyPub.der, ECC */
static const unsigned char ecc_key_pub_der_256[] =
{
0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE,
0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D,
0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xBB, 0x33, 0xAC,
0x4C, 0x27, 0x50, 0x4A, 0xC6, 0x4A, 0xA5, 0x04, 0xC3, 0x3C,
0xDE, 0x9F, 0x36, 0xDB, 0x72, 0x2D, 0xCE, 0x94, 0xEA, 0x2B,
0xFA, 0xCB, 0x20, 0x09, 0x39, 0x2C, 0x16, 0xE8, 0x61, 0x02,
0xE9, 0xAF, 0x4D, 0xD3, 0x02, 0x93, 0x9A, 0x31, 0x5B, 0x97,
0x92, 0x21, 0x7F, 0xF0, 0xCF, 0x18, 0xDA, 0x91, 0x11, 0x02,
0x34, 0x86, 0xE8, 0x20, 0x58, 0x33, 0x0B, 0x80, 0x34, 0x89,
0xD8
};
static const int sizeof_ecc_key_pub_der_256 = sizeof(ecc_key_pub_der_256);
/* ./certs/server-ecc-comp.der, ECC */
static const unsigned char serv_ecc_comp_der_256[] =
{
0x30, 0x82, 0x03, 0x24, 0x30, 0x82, 0x02, 0xCA, 0xA0, 0x03,
0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0xC3, 0xCD, 0xC5, 0xE4,
0x24, 0x18, 0x70, 0xCA, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86,
0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x81, 0xA0, 0x31,
0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04,
0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61,
0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C,
0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x18,
0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x0F, 0x45,
0x6C, 0x6C, 0x69, 0x70, 0x74, 0x69, 0x63, 0x20, 0x2D, 0x20,
0x63, 0x6F, 0x6D, 0x70, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03,
0x55, 0x04, 0x0B, 0x0C, 0x0F, 0x53, 0x65, 0x72, 0x76, 0x65,
0x72, 0x20, 0x45, 0x43, 0x43, 0x2D, 0x63, 0x6F, 0x6D, 0x70,
0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C,
0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73,
0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D,
0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09,
0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F,
0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x30,
0x1E, 0x17, 0x0D, 0x31, 0x36, 0x30, 0x38, 0x31, 0x31, 0x32,
0x30, 0x30, 0x37, 0x33, 0x38, 0x5A, 0x17, 0x0D, 0x31, 0x39,
0x30, 0x35, 0x30, 0x38, 0x32, 0x30, 0x30, 0x37, 0x33, 0x38,
0x5A, 0x30, 0x81, 0xA0, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03,
0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30,
0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F,
0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06,
0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65,
0x6D, 0x61, 0x6E, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55,
0x04, 0x0A, 0x0C, 0x0F, 0x45, 0x6C, 0x6C, 0x69, 0x70, 0x74,
0x69, 0x63, 0x20, 0x2D, 0x20, 0x63, 0x6F, 0x6D, 0x70, 0x31,
0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0F,
0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x45, 0x43, 0x43,
0x2D, 0x63, 0x6F, 0x6D, 0x70, 0x31, 0x18, 0x30, 0x16, 0x06,
0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E,
0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F,
0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48,
0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E,
0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C,
0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x39, 0x30, 0x13, 0x06, 0x07,
0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A,
0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03, 0x22, 0x00,
0x02, 0xBB, 0x33, 0xAC, 0x4C, 0x27, 0x50, 0x4A, 0xC6, 0x4A,
0xA5, 0x04, 0xC3, 0x3C, 0xDE, 0x9F, 0x36, 0xDB, 0x72, 0x2D,
0xCE, 0x94, 0xEA, 0x2B, 0xFA, 0xCB, 0x20, 0x09, 0x39, 0x2C,
0x16, 0xE8, 0x61, 0xA3, 0x82, 0x01, 0x09, 0x30, 0x82, 0x01,
0x05, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16,
0x04, 0x14, 0x8C, 0x38, 0x3A, 0x6B, 0xB8, 0x24, 0xB7, 0xDF,
0x6E, 0xF4, 0x59, 0xAC, 0x56, 0x4E, 0xAA, 0xE2, 0x58, 0xA6,
0x5A, 0x18, 0x30, 0x81, 0xD5, 0x06, 0x03, 0x55, 0x1D, 0x23,
0x04, 0x81, 0xCD, 0x30, 0x81, 0xCA, 0x80, 0x14, 0x8C, 0x38,
0x3A, 0x6B, 0xB8, 0x24, 0xB7, 0xDF, 0x6E, 0xF4, 0x59, 0xAC,
0x56, 0x4E, 0xAA, 0xE2, 0x58, 0xA6, 0x5A, 0x18, 0xA1, 0x81,
0xA6, 0xA4, 0x81, 0xA3, 0x30, 0x81, 0xA0, 0x31, 0x0B, 0x30,
0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53,
0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C,
0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10,
0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42,
0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x18, 0x30, 0x16,
0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x0F, 0x45, 0x6C, 0x6C,
0x69, 0x70, 0x74, 0x69, 0x63, 0x20, 0x2D, 0x20, 0x63, 0x6F,
0x6D, 0x70, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04,
0x0B, 0x0C, 0x0F, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20,
0x45, 0x43, 0x43, 0x2D, 0x63, 0x6F, 0x6D, 0x70, 0x31, 0x18,
0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77,
0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C,
0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09,
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16,
0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66,
0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82, 0x09, 0x00,
0xC3, 0xCD, 0xC5, 0xE4, 0x24, 0x18, 0x70, 0xCA, 0x30, 0x0C,
0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01,
0x01, 0xFF, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE,
0x3D, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02,
0x21, 0x00, 0xCA, 0x10, 0xEC, 0x8F, 0xF1, 0xEB, 0x92, 0x19,
0x76, 0xD7, 0x16, 0x54, 0xF2, 0x21, 0x1C, 0x38, 0x0E, 0x6E,
0x22, 0x3D, 0x95, 0xA4, 0xBD, 0xC8, 0x8C, 0xD2, 0xD8, 0x28,
0xD3, 0x9C, 0x21, 0x6D, 0x02, 0x20, 0x71, 0x39, 0x0B, 0x0D,
0xEC, 0x68, 0x8C, 0x64, 0xB6, 0x2C, 0x68, 0xDA, 0x03, 0xB1,
0xD8, 0xE7, 0xD4, 0xF7, 0xCB, 0xA6, 0x73, 0x7E, 0x08, 0x00,
0xC6, 0xB8, 0x04, 0x9D, 0x17, 0x3E, 0x66, 0x7F
};
static const int sizeof_serv_ecc_comp_der_256 = sizeof(serv_ecc_comp_der_256);
/* ./certs/server-ecc-rsa.der, ECC */
static const unsigned char serv_ecc_rsa_der_256[] =
{
0x30, 0x82, 0x03, 0xE0, 0x30, 0x82, 0x02, 0xC8, 0xA0, 0x03,
0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x30, 0x0D, 0x06, 0x09,
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05,
0x00, 0x30, 0x81, 0x94, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03,
0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30,
0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F,
0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06,
0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65,
0x6D, 0x61, 0x6E, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55,
0x04, 0x0A, 0x0C, 0x08, 0x53, 0x61, 0x77, 0x74, 0x6F, 0x6F,
0x74, 0x68, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04,
0x0B, 0x0C, 0x0A, 0x43, 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74,
0x69, 0x6E, 0x67, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55,
0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F,
0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31,
0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7,
0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F,
0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63,
0x6F, 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x36, 0x30, 0x38,
0x31, 0x31, 0x32, 0x30, 0x30, 0x37, 0x33, 0x38, 0x5A, 0x17,
0x0D, 0x31, 0x39, 0x30, 0x35, 0x30, 0x38, 0x32, 0x30, 0x30,
0x37, 0x33, 0x38, 0x5A, 0x30, 0x81, 0x9D, 0x31, 0x0B, 0x30,
0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53,
0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C,
0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10,
0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42,
0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x1A, 0x30, 0x18,
0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x11, 0x45, 0x6C, 0x6C,
0x69, 0x70, 0x74, 0x69, 0x63, 0x20, 0x2D, 0x20, 0x52, 0x53,
0x41, 0x73, 0x69, 0x67, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03,
0x55, 0x04, 0x0B, 0x0C, 0x0A, 0x45, 0x43, 0x43, 0x2D, 0x52,
0x53, 0x41, 0x73, 0x69, 0x67, 0x31, 0x18, 0x30, 0x16, 0x06,
0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E,
0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F,
0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48,
0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E,
0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C,
0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07,
0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A,
0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00,
0x04, 0xBB, 0x33, 0xAC, 0x4C, 0x27, 0x50, 0x4A, 0xC6, 0x4A,
0xA5, 0x04, 0xC3, 0x3C, 0xDE, 0x9F, 0x36, 0xDB, 0x72, 0x2D,
0xCE, 0x94, 0xEA, 0x2B, 0xFA, 0xCB, 0x20, 0x09, 0x39, 0x2C,
0x16, 0xE8, 0x61, 0x02, 0xE9, 0xAF, 0x4D, 0xD3, 0x02, 0x93,
0x9A, 0x31, 0x5B, 0x97, 0x92, 0x21, 0x7F, 0xF0, 0xCF, 0x18,
0xDA, 0x91, 0x11, 0x02, 0x34, 0x86, 0xE8, 0x20, 0x58, 0x33,
0x0B, 0x80, 0x34, 0x89, 0xD8, 0xA3, 0x81, 0xFC, 0x30, 0x81,
0xF9, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16,
0x04, 0x14, 0x5D, 0x5D, 0x26, 0xEF, 0xAC, 0x7E, 0x36, 0xF9,
0x9B, 0x76, 0x15, 0x2B, 0x4A, 0x25, 0x02, 0x23, 0xEF, 0xB2,
0x89, 0x30, 0x30, 0x81, 0xC9, 0x06, 0x03, 0x55, 0x1D, 0x23,
0x04, 0x81, 0xC1, 0x30, 0x81, 0xBE, 0x80, 0x14, 0x27, 0x8E,
0x67, 0x11, 0x74, 0xC3, 0x26, 0x1D, 0x3F, 0xED, 0x33, 0x63,
0xB3, 0xA4, 0xD8, 0x1D, 0x30, 0xE5, 0xE8, 0xD5, 0xA1, 0x81,
0x9A, 0xA4, 0x81, 0x97, 0x30, 0x81, 0x94, 0x31, 0x0B, 0x30,
0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53,
0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C,
0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10,
0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42,
0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x11, 0x30, 0x0F,
0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x08, 0x53, 0x61, 0x77,
0x74, 0x6F, 0x6F, 0x74, 0x68, 0x31, 0x13, 0x30, 0x11, 0x06,
0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0A, 0x43, 0x6F, 0x6E, 0x73,
0x75, 0x6C, 0x74, 0x69, 0x6E, 0x67, 0x31, 0x18, 0x30, 0x16,
0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77,
0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63,
0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69,
0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73,
0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82, 0x09, 0x00, 0xB7, 0xB6,
0x90, 0x33, 0x66, 0x1B, 0x6B, 0x23, 0x30, 0x0C, 0x06, 0x03,
0x55, 0x1D, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xFF,
0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D,
0x01, 0x01, 0x0B, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00,
0xAB, 0xB7, 0x78, 0xC8, 0x18, 0x6E, 0x6A, 0x27, 0x5D, 0xBB,
0x16, 0xA1, 0xD3, 0xAE, 0xB5, 0xFD, 0x46, 0x50, 0xCF, 0xDC,
0x82, 0xF9, 0x4A, 0x19, 0xEC, 0xBF, 0x44, 0xCD, 0xF5, 0x1F,
0x15, 0x2C, 0x5A, 0xE9, 0x65, 0x27, 0xB2, 0xE1, 0x88, 0x62,
0x0F, 0xBC, 0xA1, 0x3C, 0x95, 0xFB, 0x62, 0x8A, 0x71, 0xE0,
0xC6, 0x22, 0xCE, 0x2E, 0x00, 0xCA, 0x4E, 0x7A, 0x03, 0x2A,
0x12, 0x90, 0x98, 0x7B, 0x53, 0x9F, 0x46, 0xA0, 0xFF, 0x6B,
0x04, 0xDC, 0x2A, 0x8D, 0xBB, 0x93, 0xE7, 0xB9, 0x0B, 0xD0,
0x61, 0x0F, 0x62, 0x97, 0x18, 0x99, 0xBB, 0xE7, 0x1C, 0xE3,
0xA2, 0xAB, 0x70, 0x8F, 0x32, 0x47, 0x7F, 0x1E, 0x3B, 0xCB,
0x62, 0x55, 0x41, 0xA4, 0xAF, 0x1F, 0x01, 0x2C, 0x9B, 0xB2,
0xCC, 0x06, 0x8D, 0x28, 0x04, 0x57, 0x5B, 0xF6, 0x32, 0xB8,
0xE8, 0x18, 0xB6, 0x6B, 0xA1, 0xB9, 0xAA, 0x3F, 0x49, 0xEA,
0xC1, 0x02, 0xC7, 0x92, 0xD9, 0xC7, 0x23, 0xEA, 0xA2, 0xF7,
0x70, 0xA9, 0xDA, 0x9E, 0x5E, 0x82, 0xEF, 0x30, 0x07, 0xC7,
0x89, 0xDA, 0xC9, 0xE0, 0xCF, 0xED, 0xE9, 0x4C, 0x34, 0xD4,
0x72, 0x0E, 0x16, 0x49, 0x82, 0xC5, 0xA9, 0xB4, 0xA7, 0x05,
0x07, 0xCC, 0x5D, 0xEB, 0xB4, 0xEF, 0x9A, 0x09, 0x73, 0xA2,
0xD4, 0xB6, 0xC5, 0xBE, 0x34, 0xC0, 0xC9, 0x09, 0x29, 0xA5,
0xD5, 0xF1, 0xE4, 0x82, 0x49, 0x70, 0xBF, 0x75, 0x79, 0x15,
0xCD, 0xC1, 0xC8, 0xA3, 0x4D, 0x9B, 0xB4, 0xE2, 0x94, 0x5E,
0x27, 0x61, 0xEA, 0x34, 0x69, 0x88, 0x47, 0xBD, 0x61, 0xE9,
0x0D, 0xF3, 0x95, 0x8F, 0xFF, 0x53, 0xE7, 0x5C, 0x11, 0xE3,
0xF4, 0xD0, 0x70, 0xAD, 0x9A, 0x73, 0x5D, 0x29, 0x30, 0xFC,
0x23, 0x2E, 0xC0, 0x62, 0xD4, 0xD3, 0xA8, 0xCE, 0xB2, 0xE9,
0xD3, 0xB9, 0x3F, 0x10, 0x0A, 0xF2
};
static const int sizeof_serv_ecc_rsa_der_256 = sizeof(serv_ecc_rsa_der_256);
/* ./certs/server-ecc.der, ECC */
static const unsigned char serv_ecc_der_256[] =
{
0x30, 0x82, 0x03, 0x50, 0x30, 0x82, 0x02, 0xF5, 0xA0, 0x03,
0x02, 0x01, 0x02, 0x02, 0x02, 0x10, 0x00, 0x30, 0x0A, 0x06,
0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30,
0x81, 0x97, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06,
0x03, 0x55, 0x04, 0x08, 0x0C, 0x0A, 0x57, 0x61, 0x73, 0x68,
0x69, 0x6E, 0x67, 0x74, 0x6F, 0x6E, 0x31, 0x10, 0x30, 0x0E,
0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x53, 0x65, 0x61,
0x74, 0x74, 0x6C, 0x65, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03,
0x55, 0x04, 0x0A, 0x0C, 0x07, 0x77, 0x6F, 0x6C, 0x66, 0x53,
0x53, 0x4C, 0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04,
0x0B, 0x0C, 0x0B, 0x44, 0x65, 0x76, 0x65, 0x6C, 0x6F, 0x70,
0x6D, 0x65, 0x6E, 0x74, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03,
0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77,
0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D,
0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66,
0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E,
0x63, 0x6F, 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x37, 0x31,
0x30, 0x32, 0x30, 0x31, 0x38, 0x31, 0x39, 0x30, 0x36, 0x5A,
0x17, 0x0D, 0x32, 0x37, 0x31, 0x30, 0x31, 0x38, 0x31, 0x38,
0x31, 0x39, 0x30, 0x36, 0x5A, 0x30, 0x81, 0x8F, 0x31, 0x0B,
0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55,
0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08,
0x0C, 0x0A, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, 0x67, 0x74,
0x6F, 0x6E, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04,
0x07, 0x0C, 0x07, 0x53, 0x65, 0x61, 0x74, 0x74, 0x6C, 0x65,
0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C,
0x07, 0x45, 0x6C, 0x69, 0x70, 0x74, 0x69, 0x63, 0x31, 0x0C,
0x30, 0x0A, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x03, 0x45,
0x43, 0x43, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04,
0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C,
0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F,
0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D,
0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40,
0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F,
0x6D, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48,
0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE,
0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xBB, 0x33,
0xAC, 0x4C, 0x27, 0x50, 0x4A, 0xC6, 0x4A, 0xA5, 0x04, 0xC3,
0x3C, 0xDE, 0x9F, 0x36, 0xDB, 0x72, 0x2D, 0xCE, 0x94, 0xEA,
0x2B, 0xFA, 0xCB, 0x20, 0x09, 0x39, 0x2C, 0x16, 0xE8, 0x61,
0x02, 0xE9, 0xAF, 0x4D, 0xD3, 0x02, 0x93, 0x9A, 0x31, 0x5B,
0x97, 0x92, 0x21, 0x7F, 0xF0, 0xCF, 0x18, 0xDA, 0x91, 0x11,
0x02, 0x34, 0x86, 0xE8, 0x20, 0x58, 0x33, 0x0B, 0x80, 0x34,
0x89, 0xD8, 0xA3, 0x82, 0x01, 0x35, 0x30, 0x82, 0x01, 0x31,
0x30, 0x09, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x02, 0x30,
0x00, 0x30, 0x11, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x86,
0xF8, 0x42, 0x01, 0x01, 0x04, 0x04, 0x03, 0x02, 0x06, 0x40,
0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04,
0x14, 0x5D, 0x5D, 0x26, 0xEF, 0xAC, 0x7E, 0x36, 0xF9, 0x9B,
0x76, 0x15, 0x2B, 0x4A, 0x25, 0x02, 0x23, 0xEF, 0xB2, 0x89,
0x30, 0x30, 0x81, 0xCC, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04,
0x81, 0xC4, 0x30, 0x81, 0xC1, 0x80, 0x14, 0x56, 0x8E, 0x9A,
0xC3, 0xF0, 0x42, 0xDE, 0x18, 0xB9, 0x45, 0x55, 0x6E, 0xF9,
0x93, 0xCF, 0xEA, 0xC3, 0xF3, 0xA5, 0x21, 0xA1, 0x81, 0x9D,
0xA4, 0x81, 0x9A, 0x30, 0x81, 0x97, 0x31, 0x0B, 0x30, 0x09,
0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31,
0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x0A,
0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, 0x67, 0x74, 0x6F, 0x6E,
0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C,
0x07, 0x53, 0x65, 0x61, 0x74, 0x74, 0x6C, 0x65, 0x31, 0x10,
0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x07, 0x77,
0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x31, 0x14, 0x30, 0x12,
0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0B, 0x44, 0x65, 0x76,
0x65, 0x6C, 0x6F, 0x70, 0x6D, 0x65, 0x6E, 0x74, 0x31, 0x18,
0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77,
0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C,
0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09,
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16,
0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66,
0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82, 0x09, 0x00,
0x97, 0xB4, 0xBD, 0x16, 0x78, 0xF8, 0x47, 0xF2, 0x30, 0x0E,
0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04,
0x03, 0x02, 0x03, 0xA8, 0x30, 0x13, 0x06, 0x03, 0x55, 0x1D,
0x25, 0x04, 0x0C, 0x30, 0x0A, 0x06, 0x08, 0x2B, 0x06, 0x01,
0x05, 0x05, 0x07, 0x03, 0x01, 0x30, 0x0A, 0x06, 0x08, 0x2A,
0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x03, 0x49, 0x00,
0x30, 0x46, 0x02, 0x21, 0x00, 0xBE, 0xB8, 0x58, 0xF0, 0xE4,
0x15, 0x01, 0x1F, 0xDF, 0x70, 0x54, 0x73, 0x4A, 0x6C, 0x40,
0x1F, 0x77, 0xA8, 0xB4, 0xEB, 0x52, 0x1E, 0xBF, 0xF5, 0x0D,
0xB1, 0x33, 0xCA, 0x6A, 0xC4, 0x76, 0xB9, 0x02, 0x21, 0x00,
0x97, 0x08, 0xDE, 0x2C, 0x28, 0xC1, 0x45, 0x71, 0xB6, 0x2C,
0x54, 0x87, 0x98, 0x63, 0x76, 0xA8, 0x21, 0x34, 0x90, 0xA8,
0xF7, 0x9E, 0x3F, 0xFC, 0x02, 0xB0, 0xE7, 0xD3, 0x09, 0x31,
0x27, 0xE4
};
static const int sizeof_serv_ecc_der_256 = sizeof(serv_ecc_der_256);
/* ./certs/ca-ecc-key.der, ECC */
static const unsigned char ca_ecc_key_der_256[] =
{
0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0x02, 0xE1, 0x33,
0x98, 0x77, 0x97, 0xAC, 0x4A, 0x59, 0x6D, 0x28, 0x9B, 0x6E,
0xA0, 0x93, 0x9B, 0x07, 0x71, 0x8B, 0x4D, 0x60, 0x63, 0x85,
0x99, 0xE6, 0xBB, 0x16, 0x70, 0xE9, 0x0A, 0xF6, 0x80, 0xA0,
0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01,
0x07, 0xA1, 0x44, 0x03, 0x42, 0x00, 0x04, 0x02, 0xD3, 0xD9,
0x6E, 0xD6, 0x01, 0x8E, 0x45, 0xC8, 0xB9, 0x90, 0x31, 0xE5,
0xC0, 0x4C, 0xE3, 0x9E, 0xAD, 0x29, 0x38, 0x98, 0xBA, 0x10,
0xD6, 0xE9, 0x09, 0x2A, 0x80, 0xA9, 0x2E, 0x17, 0x2A, 0xB9,
0x8A, 0xBF, 0x33, 0x83, 0x46, 0xE3, 0x95, 0x0B, 0xE4, 0x77,
0x40, 0xB5, 0x3B, 0x43, 0x45, 0x33, 0x0F, 0x61, 0x53, 0x7C,
0x37, 0x44, 0xC1, 0xCB, 0xFC, 0x80, 0xCA, 0xE8, 0x43, 0xEA,
0xA7
};
static const int sizeof_ca_ecc_key_der_256 = sizeof(ca_ecc_key_der_256);
/* ./certs/ca-ecc-cert.der, ECC */
static const unsigned char ca_ecc_cert_der_256[] =
{
0x30, 0x82, 0x02, 0x8A, 0x30, 0x82, 0x02, 0x30, 0xA0, 0x03,
0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0x97, 0xB4, 0xBD, 0x16,
0x78, 0xF8, 0x47, 0xF2, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86,
0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x81, 0x97, 0x31,
0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04,
0x08, 0x0C, 0x0A, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, 0x67,
0x74, 0x6F, 0x6E, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55,
0x04, 0x07, 0x0C, 0x07, 0x53, 0x65, 0x61, 0x74, 0x74, 0x6C,
0x65, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x0A,
0x0C, 0x07, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x31,
0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0B,
0x44, 0x65, 0x76, 0x65, 0x6C, 0x6F, 0x70, 0x6D, 0x65, 0x6E,
0x74, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03,
0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66,
0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30,
0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01,
0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77,
0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D,
0x30, 0x1E, 0x17, 0x0D, 0x31, 0x37, 0x31, 0x30, 0x32, 0x30,
0x31, 0x38, 0x31, 0x39, 0x30, 0x36, 0x5A, 0x17, 0x0D, 0x33,
0x37, 0x31, 0x30, 0x31, 0x35, 0x31, 0x38, 0x31, 0x39, 0x30,
0x36, 0x5A, 0x30, 0x81, 0x97, 0x31, 0x0B, 0x30, 0x09, 0x06,
0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13,
0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x0A, 0x57,
0x61, 0x73, 0x68, 0x69, 0x6E, 0x67, 0x74, 0x6F, 0x6E, 0x31,
0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07,
0x53, 0x65, 0x61, 0x74, 0x74, 0x6C, 0x65, 0x31, 0x10, 0x30,
0x0E, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x07, 0x77, 0x6F,
0x6C, 0x66, 0x53, 0x53, 0x4C, 0x31, 0x14, 0x30, 0x12, 0x06,
0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0B, 0x44, 0x65, 0x76, 0x65,
0x6C, 0x6F, 0x70, 0x6D, 0x65, 0x6E, 0x74, 0x31, 0x18, 0x30,
0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77,
0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E,
0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A,
0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10,
0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73,
0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x59, 0x30, 0x13,
0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06,
0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03,
0x42, 0x00, 0x04, 0x02, 0xD3, 0xD9, 0x6E, 0xD6, 0x01, 0x8E,
0x45, 0xC8, 0xB9, 0x90, 0x31, 0xE5, 0xC0, 0x4C, 0xE3, 0x9E,
0xAD, 0x29, 0x38, 0x98, 0xBA, 0x10, 0xD6, 0xE9, 0x09, 0x2A,
0x80, 0xA9, 0x2E, 0x17, 0x2A, 0xB9, 0x8A, 0xBF, 0x33, 0x83,
0x46, 0xE3, 0x95, 0x0B, 0xE4, 0x77, 0x40, 0xB5, 0x3B, 0x43,
0x45, 0x33, 0x0F, 0x61, 0x53, 0x7C, 0x37, 0x44, 0xC1, 0xCB,
0xFC, 0x80, 0xCA, 0xE8, 0x43, 0xEA, 0xA7, 0xA3, 0x63, 0x30,
0x61, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16,
0x04, 0x14, 0x56, 0x8E, 0x9A, 0xC3, 0xF0, 0x42, 0xDE, 0x18,
0xB9, 0x45, 0x55, 0x6E, 0xF9, 0x93, 0xCF, 0xEA, 0xC3, 0xF3,
0xA5, 0x21, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04,
0x18, 0x30, 0x16, 0x80, 0x14, 0x56, 0x8E, 0x9A, 0xC3, 0xF0,
0x42, 0xDE, 0x18, 0xB9, 0x45, 0x55, 0x6E, 0xF9, 0x93, 0xCF,
0xEA, 0xC3, 0xF3, 0xA5, 0x21, 0x30, 0x0F, 0x06, 0x03, 0x55,
0x1D, 0x13, 0x01, 0x01, 0xFF, 0x04, 0x05, 0x30, 0x03, 0x01,
0x01, 0xFF, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01,
0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x01, 0x86, 0x30, 0x0A,
0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02,
0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x20, 0x32, 0x26, 0x81,
0xE4, 0x15, 0xEC, 0xE3, 0xAA, 0xD3, 0xE5, 0xB8, 0x2A, 0xCA,
0xA3, 0x06, 0xA7, 0x04, 0x97, 0xD8, 0x43, 0x7F, 0xD4, 0x94,
0x47, 0xF8, 0x18, 0x0D, 0x93, 0x52, 0x23, 0x8B, 0x08, 0x02,
0x21, 0x00, 0xE1, 0x9E, 0x34, 0xD0, 0x92, 0xEE, 0x56, 0x0D,
0x23, 0x38, 0x4A, 0x20, 0xBC, 0xCF, 0x11, 0xC3, 0x33, 0x77,
0x96, 0x81, 0x56, 0x2B, 0xCA, 0xC4, 0xD5, 0xC6, 0x65, 0x5D,
0x36, 0x73, 0x2F, 0xBA
};
static const int sizeof_ca_ecc_cert_der_256 = sizeof(ca_ecc_cert_der_256);
/* ./certs/ca-ecc384-key.der, ECC */
static const unsigned char ca_ecc_key_der_384[] =
{
0x30, 0x81, 0xA4, 0x02, 0x01, 0x01, 0x04, 0x30, 0x7B, 0x16,
0xE3, 0xD6, 0xD2, 0x81, 0x94, 0x6C, 0x8A, 0xDD, 0xA8, 0x78,
0xEE, 0xC7, 0x7E, 0xB3, 0xC5, 0xD1, 0xDB, 0x2E, 0xF3, 0xED,
0x0E, 0x48, 0x85, 0xB1, 0xF2, 0xE1, 0x7A, 0x39, 0x56, 0xC0,
0xF1, 0x62, 0x12, 0x0F, 0x35, 0xB7, 0x39, 0xBC, 0x9C, 0x25,
0xC0, 0x76, 0xEB, 0xFE, 0x55, 0x70, 0xA0, 0x07, 0x06, 0x05,
0x2B, 0x81, 0x04, 0x00, 0x22, 0xA1, 0x64, 0x03, 0x62, 0x00,
0x04, 0xEE, 0x82, 0xD4, 0x39, 0x9A, 0xB1, 0x27, 0x82, 0xF4,
0xD7, 0xEA, 0xC6, 0xBC, 0x03, 0x1D, 0x4D, 0x83, 0x61, 0xF4,
0x03, 0xAE, 0x7E, 0xBD, 0xD8, 0x5A, 0xA5, 0xB9, 0xF0, 0x8E,
0xA2, 0xA5, 0xDA, 0xCE, 0x87, 0x3B, 0x5A, 0xAB, 0x44, 0x16,
0x9C, 0xF5, 0x9F, 0x62, 0xDD, 0xF6, 0x20, 0xCD, 0x9C, 0x76,
0x3C, 0x40, 0xB1, 0x3F, 0x97, 0x17, 0xDF, 0x59, 0xF6, 0xCD,
0xDE, 0xCD, 0x46, 0x35, 0xC0, 0xED, 0x5E, 0x2E, 0x48, 0xB6,
0x66, 0x91, 0x71, 0x74, 0xB7, 0x0C, 0x3F, 0xB9, 0x9A, 0xB7,
0x83, 0xBD, 0x93, 0x3F, 0x5F, 0x50, 0x2D, 0x70, 0x3F, 0xDE,
0x35, 0x25, 0xE1, 0x90, 0x3B, 0x86, 0xE0
};
static const int sizeof_ca_ecc_key_der_384 = sizeof(ca_ecc_key_der_384);
/* ./certs/ca-ecc384-cert.der, ECC */
static const unsigned char ca_ecc_cert_der_384[] =
{
0x30, 0x82, 0x02, 0xC7, 0x30, 0x82, 0x02, 0x4D, 0xA0, 0x03,
0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0xF5, 0xE1, 0x8F, 0xF1,
0x4B, 0xA6, 0x83, 0x8E, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86,
0x48, 0xCE, 0x3D, 0x04, 0x03, 0x03, 0x30, 0x81, 0x97, 0x31,
0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04,
0x08, 0x0C, 0x0A, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, 0x67,
0x74, 0x6F, 0x6E, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55,
0x04, 0x07, 0x0C, 0x07, 0x53, 0x65, 0x61, 0x74, 0x74, 0x6C,
0x65, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x0A,
0x0C, 0x07, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x31,
0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0B,
0x44, 0x65, 0x76, 0x65, 0x6C, 0x6F, 0x70, 0x6D, 0x65, 0x6E,
0x74, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03,
0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66,
0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30,
0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01,
0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77,
0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D,
0x30, 0x1E, 0x17, 0x0D, 0x31, 0x37, 0x31, 0x30, 0x32, 0x30,
0x31, 0x38, 0x31, 0x39, 0x30, 0x36, 0x5A, 0x17, 0x0D, 0x33,
0x37, 0x31, 0x30, 0x31, 0x35, 0x31, 0x38, 0x31, 0x39, 0x30,
0x36, 0x5A, 0x30, 0x81, 0x97, 0x31, 0x0B, 0x30, 0x09, 0x06,
0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13,
0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x0A, 0x57,
0x61, 0x73, 0x68, 0x69, 0x6E, 0x67, 0x74, 0x6F, 0x6E, 0x31,
0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07,
0x53, 0x65, 0x61, 0x74, 0x74, 0x6C, 0x65, 0x31, 0x10, 0x30,
0x0E, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x07, 0x77, 0x6F,
0x6C, 0x66, 0x53, 0x53, 0x4C, 0x31, 0x14, 0x30, 0x12, 0x06,
0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0B, 0x44, 0x65, 0x76, 0x65,
0x6C, 0x6F, 0x70, 0x6D, 0x65, 0x6E, 0x74, 0x31, 0x18, 0x30,
0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77,
0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E,
0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A,
0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10,
0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73,
0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x76, 0x30, 0x10,
0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06,
0x05, 0x2B, 0x81, 0x04, 0x00, 0x22, 0x03, 0x62, 0x00, 0x04,
0xEE, 0x82, 0xD4, 0x39, 0x9A, 0xB1, 0x27, 0x82, 0xF4, 0xD7,
0xEA, 0xC6, 0xBC, 0x03, 0x1D, 0x4D, 0x83, 0x61, 0xF4, 0x03,
0xAE, 0x7E, 0xBD, 0xD8, 0x5A, 0xA5, 0xB9, 0xF0, 0x8E, 0xA2,
0xA5, 0xDA, 0xCE, 0x87, 0x3B, 0x5A, 0xAB, 0x44, 0x16, 0x9C,
0xF5, 0x9F, 0x62, 0xDD, 0xF6, 0x20, 0xCD, 0x9C, 0x76, 0x3C,
0x40, 0xB1, 0x3F, 0x97, 0x17, 0xDF, 0x59, 0xF6, 0xCD, 0xDE,
0xCD, 0x46, 0x35, 0xC0, 0xED, 0x5E, 0x2E, 0x48, 0xB6, 0x66,
0x91, 0x71, 0x74, 0xB7, 0x0C, 0x3F, 0xB9, 0x9A, 0xB7, 0x83,
0xBD, 0x93, 0x3F, 0x5F, 0x50, 0x2D, 0x70, 0x3F, 0xDE, 0x35,
0x25, 0xE1, 0x90, 0x3B, 0x86, 0xE0, 0xA3, 0x63, 0x30, 0x61,
0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04,
0x14, 0xAB, 0xE0, 0xC3, 0x26, 0x4C, 0x18, 0xD4, 0x72, 0xBB,
0xD2, 0x84, 0x8C, 0x9C, 0x0A, 0x05, 0x92, 0x80, 0x12, 0x53,
0x52, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18,
0x30, 0x16, 0x80, 0x14, 0xAB, 0xE0, 0xC3, 0x26, 0x4C, 0x18,
0xD4, 0x72, 0xBB, 0xD2, 0x84, 0x8C, 0x9C, 0x0A, 0x05, 0x92,
0x80, 0x12, 0x53, 0x52, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x1D,
0x13, 0x01, 0x01, 0xFF, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01,
0xFF, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01,
0xFF, 0x04, 0x04, 0x03, 0x02, 0x01, 0x86, 0x30, 0x0A, 0x06,
0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x03, 0x03,
0x68, 0x00, 0x30, 0x65, 0x02, 0x30, 0x17, 0xDD, 0xB9, 0xA5,
0xE0, 0xEC, 0x8A, 0x03, 0x8B, 0x66, 0x45, 0x69, 0xAD, 0x5E,
0xAD, 0x32, 0xBC, 0x45, 0x4C, 0x89, 0x85, 0x3F, 0xA1, 0xDD,
0xA4, 0x74, 0x4B, 0x5D, 0x08, 0x65, 0x1B, 0xD8, 0x07, 0x00,
0x49, 0x5D, 0xEF, 0x10, 0xFC, 0xEB, 0x8F, 0x64, 0xA8, 0x62,
0x99, 0x88, 0x20, 0x59, 0x02, 0x31, 0x00, 0x94, 0x40, 0x64,
0x29, 0x86, 0xD0, 0x00, 0x76, 0x1C, 0x98, 0x23, 0x9C, 0xB7,
0x9B, 0xBE, 0x78, 0x73, 0x3A, 0x88, 0xBE, 0x52, 0x00, 0x3F,
0xE3, 0x81, 0x36, 0xD9, 0x14, 0x22, 0x3D, 0x9E, 0xA2, 0x8A,
0x4A, 0x56, 0x9C, 0xC4, 0x3F, 0x5F, 0x88, 0x2E, 0xB1, 0xA7,
0x6C, 0x4D, 0x0E, 0xCC, 0x92
};
static const int sizeof_ca_ecc_cert_der_384 = sizeof(ca_ecc_cert_der_384);
#endif /* HAVE_ECC && USE_CERT_BUFFERS_256 */
/* dh1024 p */
static const unsigned char dh_p[] =
{
0xE6, 0x96, 0x9D, 0x3D, 0x49, 0x5B, 0xE3, 0x2C, 0x7C, 0xF1, 0x80, 0xC3,
0xBD, 0xD4, 0x79, 0x8E, 0x91, 0xB7, 0x81, 0x82, 0x51, 0xBB, 0x05, 0x5E,
0x2A, 0x20, 0x64, 0x90, 0x4A, 0x79, 0xA7, 0x70, 0xFA, 0x15, 0xA2, 0x59,
0xCB, 0xD5, 0x23, 0xA6, 0xA6, 0xEF, 0x09, 0xC4, 0x30, 0x48, 0xD5, 0xA2,
0x2F, 0x97, 0x1F, 0x3C, 0x20, 0x12, 0x9B, 0x48, 0x00, 0x0E, 0x6E, 0xDD,
0x06, 0x1C, 0xBC, 0x05, 0x3E, 0x37, 0x1D, 0x79, 0x4E, 0x53, 0x27, 0xDF,
0x61, 0x1E, 0xBB, 0xBE, 0x1B, 0xAC, 0x9B, 0x5C, 0x60, 0x44, 0xCF, 0x02,
0x3D, 0x76, 0xE0, 0x5E, 0xEA, 0x9B, 0xAD, 0x99, 0x1B, 0x13, 0xA6, 0x3C,
0x97, 0x4E, 0x9E, 0xF1, 0x83, 0x9E, 0xB5, 0xDB, 0x12, 0x51, 0x36, 0xF7,
0x26, 0x2E, 0x56, 0xA8, 0x87, 0x15, 0x38, 0xDF, 0xD8, 0x23, 0xC6, 0x50,
0x50, 0x85, 0xE2, 0x1F, 0x0D, 0xD5, 0xC8, 0x6B,
};
/* dh1024 g */
static const unsigned char dh_g[] =
{
0x02,
};
#if defined(HAVE_ED25519)
/* ./certs/ed25519/server-ed25519.der, ED25519 */
static const unsigned char server_ed25519_cert[] =
{
0x30, 0x82, 0x02, 0x4B, 0x30, 0x82, 0x01, 0xFD, 0xA0, 0x03,
0x02, 0x01, 0x02, 0x02, 0x08, 0x01, 0xD0, 0x92, 0x10, 0x6A,
0x5A, 0x46, 0x57, 0x30, 0x05, 0x06, 0x03, 0x2B, 0x65, 0x70,
0x30, 0x81, 0x9D, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55,
0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E,
0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E,
0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03,
0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D,
0x61, 0x6E, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
0x04, 0x0C, 0x02, 0x43, 0x41, 0x31, 0x10, 0x30, 0x0E, 0x06,
0x03, 0x55, 0x04, 0x0A, 0x0C, 0x07, 0x77, 0x6F, 0x6C, 0x66,
0x53, 0x53, 0x4C, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55,
0x04, 0x0B, 0x0C, 0x07, 0x45, 0x44, 0x32, 0x35, 0x35, 0x31,
0x39, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03,
0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66,
0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30,
0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01,
0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77,
0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D,
0x30, 0x22, 0x18, 0x0F, 0x32, 0x30, 0x31, 0x37, 0x30, 0x35,
0x32, 0x38, 0x32, 0x33, 0x32, 0x36, 0x32, 0x39, 0x5A, 0x18,
0x0F, 0x32, 0x30, 0x31, 0x39, 0x30, 0x35, 0x32, 0x39, 0x32,
0x33, 0x32, 0x36, 0x32, 0x39, 0x5A, 0x30, 0x81, 0x9F, 0x31,
0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04,
0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61,
0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C,
0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x0D,
0x30, 0x0B, 0x06, 0x03, 0x55, 0x04, 0x04, 0x0C, 0x04, 0x4C,
0x65, 0x61, 0x66, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55,
0x04, 0x0A, 0x0C, 0x07, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53,
0x4C, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x0B,
0x0C, 0x07, 0x45, 0x44, 0x32, 0x35, 0x35, 0x31, 0x39, 0x31,
0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F,
0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73,
0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06,
0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01,
0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C,
0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x2A,
0x30, 0x05, 0x06, 0x03, 0x2B, 0x65, 0x70, 0x03, 0x21, 0x00,
0x1A, 0x30, 0x88, 0x18, 0x47, 0x2F, 0x97, 0xDA, 0x04, 0xF4,
0xA4, 0xE3, 0xBD, 0x6C, 0x0C, 0x16, 0xB9, 0x48, 0xC1, 0xD1,
0x42, 0xD7, 0x8E, 0x92, 0x84, 0xA0, 0x74, 0x2A, 0x43, 0x9E,
0x0E, 0x29, 0xA3, 0x53, 0x30, 0x51, 0x30, 0x1D, 0x06, 0x03,
0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0xF6, 0xB2, 0x84,
0x1A, 0x95, 0xB4, 0x70, 0x32, 0x53, 0xFE, 0xD9, 0xEB, 0x9B,
0x29, 0x80, 0x4B, 0xD6, 0xB5, 0xF1, 0xC0, 0x30, 0x1F, 0x06,
0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14,
0x92, 0xD5, 0x0B, 0xDA, 0xF1, 0x04, 0x8B, 0xB9, 0xA1, 0x8B,
0x03, 0x02, 0x9F, 0x58, 0x00, 0x35, 0x36, 0x07, 0x7A, 0xC9,
0x30, 0x0F, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF,
0x04, 0x05, 0x03, 0x02, 0x06, 0xC0, 0x00, 0x30, 0x05, 0x06,
0x03, 0x2B, 0x65, 0x70, 0x03, 0x41, 0x00, 0x12, 0x56, 0x77,
0x0C, 0x96, 0x42, 0x98, 0xDA, 0xC9, 0x15, 0x6C, 0x4E, 0x48,
0x95, 0x05, 0x1D, 0xD0, 0x78, 0x32, 0xF8, 0x86, 0x46, 0x9A,
0x46, 0x9B, 0x64, 0x8B, 0x31, 0xB0, 0x19, 0x6B, 0x77, 0x99,
0x8B, 0xFF, 0xFC, 0x02, 0x36, 0x05, 0x0B, 0x69, 0x37, 0x87,
0x62, 0x75, 0xDA, 0x50, 0x2C, 0x2D, 0x5D, 0x52, 0x94, 0x3F,
0x00, 0x9D, 0x18, 0x45, 0x6F, 0x37, 0x12, 0x8E, 0xF4, 0xE4,
0x00
};
static const int sizeof_server_ed25519_cert = sizeof(server_ed25519_cert);
/* ./certs/ed25519/ca-ed25519.der, ED25519 */
static const unsigned char ca_ed25519_cert[] =
{
0x30, 0x82, 0x02, 0x59, 0x30, 0x82, 0x02, 0x0B, 0xA0, 0x03,
0x02, 0x01, 0x02, 0x02, 0x08, 0x01, 0xF6, 0xE1, 0x3E, 0xBC,
0x79, 0xA1, 0x85, 0x30, 0x05, 0x06, 0x03, 0x2B, 0x65, 0x70,
0x30, 0x81, 0x9F, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55,
0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E,
0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E,
0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03,
0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D,
0x61, 0x6E, 0x31, 0x0D, 0x30, 0x0B, 0x06, 0x03, 0x55, 0x04,
0x04, 0x0C, 0x04, 0x52, 0x6F, 0x6F, 0x74, 0x31, 0x10, 0x30,
0x0E, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x07, 0x77, 0x6F,
0x6C, 0x66, 0x53, 0x53, 0x4C, 0x31, 0x10, 0x30, 0x0E, 0x06,
0x03, 0x55, 0x04, 0x0B, 0x0C, 0x07, 0x45, 0x44, 0x32, 0x35,
0x35, 0x31, 0x39, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55,
0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F,
0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31,
0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7,
0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F,
0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63,
0x6F, 0x6D, 0x30, 0x22, 0x18, 0x0F, 0x32, 0x30, 0x31, 0x37,
0x30, 0x35, 0x32, 0x38, 0x32, 0x33, 0x32, 0x36, 0x32, 0x39,
0x5A, 0x18, 0x0F, 0x32, 0x30, 0x31, 0x39, 0x30, 0x35, 0x32,
0x39, 0x32, 0x33, 0x32, 0x36, 0x32, 0x39, 0x5A, 0x30, 0x81,
0x9D, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06,
0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03,
0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61,
0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04,
0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E,
0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x04, 0x0C,
0x02, 0x43, 0x41, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55,
0x04, 0x0A, 0x0C, 0x07, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53,
0x4C, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x0B,
0x0C, 0x07, 0x45, 0x44, 0x32, 0x35, 0x35, 0x31, 0x39, 0x31,
0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F,
0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73,
0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06,
0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01,
0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C,
0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x2A,
0x30, 0x05, 0x06, 0x03, 0x2B, 0x65, 0x70, 0x03, 0x21, 0x00,
0x41, 0x07, 0xEC, 0x75, 0x0C, 0x68, 0x72, 0x12, 0x3C, 0x04,
0x82, 0x07, 0x6E, 0x16, 0x6F, 0x40, 0x41, 0x6D, 0xA4, 0x8F,
0x08, 0xF2, 0xE2, 0x9D, 0xA7, 0x43, 0xC2, 0x24, 0x28, 0x98,
0x7E, 0xAC, 0xA3, 0x61, 0x30, 0x5F, 0x30, 0x0C, 0x06, 0x03,
0x55, 0x1D, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xFF,
0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04,
0x14, 0x92, 0xD5, 0x0B, 0xDA, 0xF1, 0x04, 0x8B, 0xB9, 0xA1,
0x8B, 0x03, 0x02, 0x9F, 0x58, 0x00, 0x35, 0x36, 0x07, 0x7A,
0xC9, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18,
0x30, 0x16, 0x80, 0x14, 0x86, 0xC0, 0x27, 0xE9, 0x9E, 0xFA,
0x85, 0xC1, 0xFD, 0xE3, 0x6F, 0xFC, 0x54, 0x59, 0x72, 0x37,
0xC7, 0x33, 0x92, 0xBB, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x1D,
0x0F, 0x01, 0x01, 0xFF, 0x04, 0x05, 0x03, 0x02, 0x01, 0xC6,
0x00, 0x30, 0x05, 0x06, 0x03, 0x2B, 0x65, 0x70, 0x03, 0x41,
0x00, 0x22, 0x1B, 0x06, 0x17, 0xC0, 0x11, 0x74, 0x1F, 0x64,
0xD1, 0xA3, 0xF6, 0x7B, 0x06, 0x00, 0x1A, 0x0B, 0x50, 0x8E,
0xEB, 0xB1, 0x63, 0x92, 0x45, 0xBA, 0xDC, 0xE2, 0xC1, 0x68,
0x14, 0x23, 0x0C, 0x6E, 0x2C, 0x95, 0x3C, 0xB1, 0x1C, 0x19,
0x27, 0x98, 0x50, 0x3E, 0x55, 0x51, 0xCC, 0xC4, 0x49, 0x58,
0xAF, 0xB9, 0x46, 0x4F, 0xED, 0x9C, 0x57, 0x38, 0x04, 0x29,
0xD4, 0xA9, 0x12, 0xFE, 0x08
};
static const int sizeof_ca_ed25519_cert = sizeof(ca_ed25519_cert);
#endif /* HAVE_ED25519 */
#endif /* WOLFSSL_CERTS_TEST_H */
| 58.155309 | 80 | 0.650064 |
651b1e9929a4b01d745a92f818e6d4637781c4b5 | 175 | c | C | d/darkwood/tabor/obj/c_kameez.c | Dbevan/SunderingShadows | 6c15ec56cef43c36361899bae6dc08d0ee907304 | [
"MIT"
] | 13 | 2019-07-19T05:24:44.000Z | 2021-11-18T04:08:19.000Z | d/darkwood/tabor/obj/c_kameez.c | Dbevan/SunderingShadows | 6c15ec56cef43c36361899bae6dc08d0ee907304 | [
"MIT"
] | 4 | 2021-03-15T18:56:39.000Z | 2021-08-17T17:08:22.000Z | d/darkwood/tabor/obj/c_kameez.c | Dbevan/SunderingShadows | 6c15ec56cef43c36361899bae6dc08d0ee907304 | [
"MIT"
] | 13 | 2019-09-12T06:22:38.000Z | 2022-01-31T01:15:12.000Z | //by Circe 6/7/04 for Tabor tailor, desc by Shar
#include <std.h>
inherit "/std/armour";
void create()
{
::create();
"/d/darkwood/tabor/obj/d_kameez"->create_kameez(TO);
}
| 17.5 | 53 | 0.674286 |
aa66a33d5842934ca16025fd90a8f0e4ac756eb1 | 95 | h | C | react-native-minapp-sdk/ios/MinappSdkTest.h | ifanrx/hydrogen-js-sdk | ac9a3ec12da33a591973bf0dbfd1ae893744ab11 | [
"Apache-2.0"
] | 61 | 2017-05-12T08:30:59.000Z | 2021-11-07T06:05:41.000Z | react-native-minapp-sdk/ios/MinappSdkTest.h | ifanrx/hydrogen-js-sdk | ac9a3ec12da33a591973bf0dbfd1ae893744ab11 | [
"Apache-2.0"
] | 20 | 2017-06-25T14:25:01.000Z | 2022-02-12T06:49:05.000Z | react-native-minapp-sdk/ios/MinappSdkTest.h | ifanrx/hydrogen-js-sdk | ac9a3ec12da33a591973bf0dbfd1ae893744ab11 | [
"Apache-2.0"
] | 24 | 2017-05-22T09:57:20.000Z | 2020-08-03T07:21:11.000Z | #import <React/RCTBridgeModule.h>
@interface MinappSdkTest : NSObject <RCTBridgeModule>
@end
| 15.833333 | 53 | 0.789474 |
c83d3d01f3c021715aea951d6cd8ae5ba4d11263 | 23,694 | h | C | AnalyticX/libs/cocos2dx/base_nodes/CCNode.h | jotel/AnalyticX | 8ec8a9aebe2f23e88246f45a609e67c2414aeffd | [
"MIT"
] | 1 | 2019-11-17T09:03:34.000Z | 2019-11-17T09:03:34.000Z | AnalyticX/libs/cocos2dx/base_nodes/CCNode.h | jotel/AnalyticX | 8ec8a9aebe2f23e88246f45a609e67c2414aeffd | [
"MIT"
] | null | null | null | AnalyticX/libs/cocos2dx/base_nodes/CCNode.h | jotel/AnalyticX | 8ec8a9aebe2f23e88246f45a609e67c2414aeffd | [
"MIT"
] | null | null | null | /****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2009 Valentin Milea
Copyright (c) 2011 Zynga Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __PLATFOMR_CCNODE_H__
#define __PLATFOMR_CCNODE_H__
#include "ccMacros.h"
#include "CCAffineTransform.h"
#include "CCArray.h"
#include "CCGL.h"
#include "ccGLStateCache.h"
#include "CCGLProgram.h"
#include "kazmath/kazmath.h"
NS_CC_BEGIN
class CCCamera;
class CCGridBase;
class CCPoint;
class CCTouch;
class CCAction;
class CCRGBAProtocol;
class CCLabelProtocol;
class CCScheduler;
class CCActionManager;
enum {
kCCNodeTagInvalid = -1,
};
enum {
kCCNodeOnEnter,
kCCNodeOnExit
};
#define arrayMakeObjectsPerformSelector(pArray, func, elementType) \
do { \
if(pArray && pArray->count() > 0) \
{ \
CCObject* child; \
CCARRAY_FOREACH(pArray, child) \
{ \
elementType pNode = (elementType) child; \
if(pNode) \
{ \
pNode->func(); \
} \
} \
} \
} \
while(false)
#define arrayMakeObjectsPerformSelectorWithObject(pArray, func, pObject, elementType) \
do { \
if(pArray && pArray->count() > 0) \
{ \
CCObject* child = NULL; \
CCARRAY_FOREACH(pArray, child) \
{ \
elementType pNode = (elementType) child; \
if(pNode) \
{ \
pNode->func(pObject); \
} \
} \
} \
} \
while(false)
/** @brief CCNode is the main element. Anything thats gets drawn or contains things that get drawn is a CCNode.
The most popular CCNodes are: CCScene, CCLayer, CCSprite, CCMenu.
The main features of a CCNode are:
- They can contain other CCNode nodes (addChild, getChildByTag, removeChild, etc)
- They can schedule periodic callback (schedule, unschedule, etc)
- They can execute actions (runAction, stopAction, etc)
Some CCNode nodes provide extra functionality for them or their children.
Subclassing a CCNode usually means (one/all) of:
- overriding init to initialize resources and schedule callbacks
- create callbacks to handle the advancement of time
- overriding draw to render the node
Features of CCNode:
- position
- scale (x, y)
- rotation (in degrees, clockwise)
- CCCamera (an interface to gluLookAt )
- CCGridBase (to do mesh transformations)
- anchor point
- size
- visible
- z-order
- openGL z position
Default values:
- rotation: 0
- position: (x=0,y=0)
- scale: (x=1,y=1)
- contentSize: (x=0,y=0)
- anchorPoint: (x=0,y=0)
Limitations:
- A CCNode is a "void" object. It doesn't have a texture
Order in transformations with grid disabled
-# The node will be translated (position)
-# The node will be rotated (rotation)
-# The node will be scaled (scale)
-# The node will be moved according to the camera values (camera)
Order in transformations with grid enabled
-# The node will be translated (position)
-# The node will be rotated (rotation)
-# The node will be scaled (scale)
-# The grid will capture the screen
-# The node will be moved according to the camera values (camera)
-# The grid will render the captured screen
Camera:
- Each node has a camera. By default it points to the center of the CCNode.
*/
class CC_DLL CCNode : public CCObject
{
// variable property
/** The z order of the node relative to it's "brothers": children of the same parent */
CC_PROPERTY_READONLY(int, m_nZOrder, ZOrder)
/** The real openGL Z vertex.
Differences between openGL Z vertex and cocos2d Z order:
- OpenGL Z modifies the Z vertex, and not the Z order in the relation between parent-children
- OpenGL Z might require to set 2D projection
- cocos2d Z order works OK if all the nodes uses the same openGL Z vertex. eg: vertexZ = 0
@warning: Use it at your own risk since it might break the cocos2d parent-children z order
@since v0.8
*/
CC_PROPERTY(float, m_fVertexZ, VertexZ)
/** The rotation (angle) of the node in degrees. 0 is the default rotation angle. Positive values rotate node CW. */
CC_PROPERTY(float, m_fRotation, Rotation)
/** Get the scale factor of the node.
@warning: Assert when m_fScaleX != m_fScaleY.
*/
float getScale();
/** The scale factor of the node. 1.0 is the default scale factor. It modifies the X and Y scale at the same time. */
void setScale(float scale);
/** The scale factor of the node. 1.0 is the default scale factor. It only modifies the X scale factor. */
CC_PROPERTY(float, m_fScaleX, ScaleX)
/** The scale factor of the node. 1.0 is the default scale factor. It only modifies the Y scale factor. */
CC_PROPERTY(float, m_fScaleY, ScaleY)
/** Position (x,y) of the node in OpenGL coordinates. (0,0) is the left-bottom corner. */
CC_PROPERTY_PASS_BY_REF(CCPoint, m_tPosition, Position)
/** get/set Position for Lua (pass number faster than CCPoint object)
lua code:
local pos = node:getPositionLua() -- return CCPoint object from C++
local x, y = node:getPosition() -- return x, y values from C++
local x = node:getPositionX()
local y = node:getPositionY()
node:setPosition(x, y) -- pass x, y values to C++
node:setPositionX(x)
node:setPositionY(y)
node:setPositionInPixels(x, y) -- pass x, y values to C++
*/
const CCPoint& getPositionLua(void);
void getPosition(float* x, float* y);
float getPositionX(void);
float getPositionY(void);
void setPositionX(float x);
void setPositionY(float y);
void setPosition(float x, float y);
void _setZOrder(int z);
/** The X skew angle of the node in degrees.
This angle describes the shear distortion in the X direction.
Thus, it is the angle between the Y axis and the left edge of the shape
The default skewX angle is 0. Positive values distort the node in a CW direction.
*/
CC_PROPERTY(float, m_fSkewX, SkewX)
/** The Y skew angle of the node in degrees.
This angle describes the shear distortion in the Y direction.
Thus, it is the angle between the X axis and the bottom edge of the shape
The default skewY angle is 0. Positive values distort the node in a CCW direction.
*/
CC_PROPERTY(float, m_fSkewY, SkewY)
CC_PROPERTY_READONLY(CCArray*, m_pChildren, Children)
/** Get children count */
unsigned int getChildrenCount(void);
/** A CCCamera object that lets you move the node using a gluLookAt
*/
CC_PROPERTY_READONLY(CCCamera *, m_pCamera, Camera)
/** A CCGrid object that is used when applying effects */
CC_PROPERTY(CCGridBase *, m_pGrid, Grid)
/** Whether of not the node is visible. Default is true */
CC_PROPERTY(bool, m_bIsVisible, IsVisible)
/** anchorPoint is the point around which all transformations and positioning manipulations take place.
It's like a pin in the node where it is "attached" to its parent.
The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner.
But you can use values higher than (1,1) and lower than (0,0) too.
The default anchorPoint is (0.5,0.5), so it starts in the center of the node.
@since v0.8
*/
CC_PROPERTY_PASS_BY_REF(CCPoint, m_tAnchorPoint, AnchorPoint)
/** The anchorPoint in absolute pixels.
Since v0.8 you can only read it. If you wish to modify it, use anchorPoint instead
*/
CC_PROPERTY_READONLY_PASS_BY_REF(CCPoint, m_tAnchorPointInPoints, AnchorPointInPoints)
/** The untransformed size of the node.
The contentSize remains the same no matter the node is scaled or rotated.
All nodes has a size. Layer and Scene has the same size of the screen.
@since v0.8
*/
CC_PROPERTY_PASS_BY_REF(CCSize, m_tContentSize, ContentSize)
/** whether or not the node is running */
CC_PROPERTY_READONLY(bool, m_bIsRunning, IsRunning)
/** A weak reference to the parent */
CC_PROPERTY(CCNode *, m_pParent, Parent)
/** If true the transformtions will be relative to it's anchor point.
* Sprites, Labels and any other sizeble object use it have it enabled by default.
* Scenes, Layers and other "whole screen" object don't use it, have it disabled by default.
*/
CC_PROPERTY(bool, m_bIsRelativeAnchorPoint, IsRelativeAnchorPoint)
/** A tag used to identify the node easily */
CC_PROPERTY(int, m_nTag, Tag)
/** A custom user data pointer */
CC_PROPERTY(void *, m_pUserData, UserData)
/** Similar to userData, but instead of holding a void* it holds an id */
CC_SYNTHESIZE_RETAIN(CCObject*, m_pUserObject, UserObject);
/** Shader Program
@since v2.0
*/
CC_SYNTHESIZE_RETAIN(CCGLProgram*, m_pShaderProgram, ShaderProgram);
/** used internally for zOrder sorting, don't change this manually */
CC_SYNTHESIZE(int, m_nOrderOfArrival, OrderOfArrival);
/** GL server side state
@since v2.0
*/
CC_SYNTHESIZE(ccGLServerState, m_glServerState, GLServerState);
/** CCActionManager used by all the actions.
IMPORTANT: If you set a new CCActionManager, then previously created actions are going to be removed.
@since v2.0
*/
CC_PROPERTY(CCActionManager*, m_pActionManager, ActionManager);
/** CCScheduler used to schedule all "updates" and timers.
IMPORTANT: If you set a new CCScheduler, then previously created timers/update are going to be removed.
@since v2.0
*/
CC_PROPERTY(CCScheduler*, m_pScheduler, Scheduler);
protected:
// transform
CCAffineTransform m_tTransform, m_tInverse;
// To reduce memory, place bools that are not properties here:
bool m_bIsTransformDirty;
bool m_bIsInverseDirty;
bool m_bReorderChildDirty;
int m_nScriptHandler;
private:
//! lazy allocs
void childrenAlloc(void);
//! helper that reorder a child
void insertChild(CCNode* child, int z);
//! used internally to alter the zOrder variable. DON'T call this method manually
void setZOrder(int z);
void detachChild(CCNode *child, bool doCleanup);
CCPoint convertToWindowSpace(const CCPoint& nodePoint);
public:
CCNode(void);
virtual ~CCNode(void);
const char* description(void);
/** allocates and initializes a node.
The node will be created as "autorelease".
*/
static CCNode * node(void);
//scene managment
/** callback that is called every time the CCNode enters the 'stage'.
If the CCNode enters the 'stage' with a transition, this callback is called when the transition starts.
During onEnter you can't a "sister/brother" node.
*/
virtual void onEnter();
/** callback that is called when the CCNode enters in the 'stage'.
If the CCNode enters the 'stage' with a transition, this callback is called when the transition finishes.
@since v0.8
*/
virtual void onEnterTransitionDidFinish();
/** callback that is called every time the CCNode leaves the 'stage'.
If the CCNode leaves the 'stage' with a transition, this callback is called when the transition finishes.
During onExit you can't access a sibling node.
*/
virtual void onExit();
/** callback that is called every time the CCNode leaves the 'stage'.
If the CCNode leaves the 'stage' with a transition, this callback is called when the transition starts.
*/
virtual void onExitTransitionDidStart();
/** Register onEnter/onExit handler script function
Script handler auto unregister after onEnter().
*/
virtual void registerScriptHandler(int nHandler);
virtual void unregisterScriptHandler(void);
// composition: ADD
/** Adds a child to the container with z-order as 0.
If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
@since v0.7.1
*/
virtual void addChild(CCNode * child);
/** Adds a child to the container with a z-order
If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
@since v0.7.1
*/
virtual void addChild(CCNode * child, int zOrder);
/** Adds a child to the container with z order and tag
If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
@since v0.7.1
*/
virtual void addChild(CCNode * child, int zOrder, int tag);
// composition: REMOVE
/** Remove itself from its parent node. If cleanup is true, then also remove all actions and callbacks.
If the node orphan, then nothing happens.
@since v0.99.3
*/
void removeFromParentAndCleanup(bool cleanup);
/** Removes a child from the container. It will also cleanup all running actions depending on the cleanup parameter.
@since v0.7.1
*/
virtual void removeChild(CCNode* child, bool cleanup);
/** Removes a child from the container by tag value. It will also cleanup all running actions depending on the cleanup parameter
@since v0.7.1
*/
void removeChildByTag(int tag, bool cleanup);
/** Removes all children from the container and do a cleanup all running actions depending on the cleanup parameter.
@since v0.7.1
*/
virtual void removeAllChildrenWithCleanup(bool cleanup);
// composition: GET
/** Gets a child from the container given its tag
@return returns a CCNode object
@since v0.7.1
*/
CCNode * getChildByTag(int tag);
/** Reorders a child according to a new z value.
* The child MUST be already added.
*/
virtual void reorderChild(CCNode * child, int zOrder);
/** performance improvement, Sort the children array once before drawing, instead of every time when a child is added or reordered
don't call this manually unless a child added needs to be removed in the same frame */
virtual void sortAllChildren();
/** Stops all running actions and schedulers
@since v0.8
*/
virtual void cleanup(void);
// draw
/** Override this method to draw your own node.
The following GL states will be enabled by default:
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_COLOR_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glEnable(GL_TEXTURE_2D);
AND YOU SHOULD NOT DISABLE THEM AFTER DRAWING YOUR NODE
But if you enable any other GL state, you should disable it after drawing your node.
*/
virtual void draw(void);
/** recursive method that visit its children and draw them */
virtual void visit(void);
// transformations
/** performs OpenGL view-matrix transformation based on position, scale, rotation and other attributes. */
void transform(void);
/** performs OpenGL view-matrix transformation of it's ancestors.
Generally the ancestors are already transformed, but in certain cases (eg: attaching a FBO)
it's necessary to transform the ancestors again.
@since v0.7.2
*/
void transformAncestors(void);
/** returns a "local" axis aligned bounding box of the node.
The returned box is relative only to its parent.
@since v0.8.2
*/
CCRect boundingBox(void);
// actions
/** Executes an action, and returns the action that is executed.
The node becomes the action's target.
@warning Starting from v0.8 actions don't retain their target anymore.
@since v0.7.1
@return An Action pointer
*/
CCAction* runAction(CCAction* action);
/** Removes all actions from the running action list */
void stopAllActions(void);
/** Removes an action from the running action list */
void stopAction(CCAction* action);
/** Removes an action from the running action list given its tag
@since v0.7.1
*/
void stopActionByTag(int tag);
/** Gets an action from the running action list given its tag
@since v0.7.1
@return the Action the with the given tag
*/
CCAction* getActionByTag(int tag);
/** Returns the numbers of actions that are running plus the ones that are schedule to run (actions in actionsToAdd and actions arrays).
* Composable actions are counted as 1 action. Example:
* If you are running 1 Sequence of 7 actions, it will return 1.
* If you are running 7 Sequences of 2 actions, it will return 7.
*/
unsigned int numberOfRunningActions(void);
// timers
/** check whether a selector is scheduled. */
bool isScheduled(SEL_SCHEDULE selector);
/** schedules the "update" method. It will use the order number 0. This method will be called every frame.
Scheduled methods with a lower order value will be called before the ones that have a higher order value.
Only one "update" method could be scheduled per node.
@since v0.99.3
*/
void scheduleUpdate(void);
/** schedules the "update" selector with a custom priority. This selector will be called every frame.
Scheduled selectors with a lower priority will be called before the ones that have a higher value.
Only one "update" selector could be scheduled per node (You can't have 2 'update' selectors).
@since v0.99.3
*/
void scheduleUpdateWithPriority(int priority);
/* unschedules the "update" method.
@since v0.99.3
*/
void unscheduleUpdate(void);
/** schedules a selector.
The scheduled selector will be ticked every frame
*/
void schedule(SEL_SCHEDULE selector);
/** schedules a custom selector with an interval time in seconds.
If time is 0 it will be ticked every frame.
If time is 0, it is recommended to use 'scheduleUpdate' instead.
If the selector is already scheduled, then the interval parameter
will be updated without scheduling it again.
*/
void schedule(SEL_SCHEDULE selector, ccTime interval);
/**
repeat will execute the action repeat + 1 times, for a continues action use kCCRepeatForever
delay is the amount of time the action will wait before execution
*/
void schedule(SEL_SCHEDULE selector, ccTime interval, unsigned int repeat, ccTime delay);
/**
Schedules a selector that runs only once, with a delay of 0 or larger
*/
void scheduleOnce(SEL_SCHEDULE selector, ccTime delay);
/** unschedules a custom selector.*/
void unschedule(SEL_SCHEDULE selector);
/** unschedule all scheduled selectors: custom selectors, and the 'update' selector.
Actions are not affected by this method.
@since v0.99.3
*/
void unscheduleAllSelectors(void);
/** resumes all scheduled selectors and actions.
Called internally by onEnter
*/
void resumeSchedulerAndActions(void);
/** pauses all scheduled selectors and actions.
Called internally by onExit
*/
void pauseSchedulerAndActions(void);
// transformation methods
/** Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates.
The matrix is in Pixels.
@since v0.7.1
*/
virtual CCAffineTransform nodeToParentTransform(void);
/** Returns the matrix that transform parent's space coordinates to the node's (local) space coordinates.
The matrix is in Pixels.
@since v0.7.1
*/
virtual CCAffineTransform parentToNodeTransform(void);
/** Retrusn the world affine transform matrix. The matrix is in Pixels.
@since v0.7.1
*/
virtual CCAffineTransform nodeToWorldTransform(void);
/** Returns the inverse world affine transform matrix. The matrix is in Pixels.
@since v0.7.1
*/
virtual CCAffineTransform worldToNodeTransform(void);
/** Converts a Point to node (local) space coordinates. The result is in Points.
@since v0.7.1
*/
CCPoint convertToNodeSpace(const CCPoint& worldPoint);
/** Converts a Point to world space coordinates. The result is in Points.
@since v0.7.1
*/
CCPoint convertToWorldSpace(const CCPoint& nodePoint);
/** Converts a Point to node (local) space coordinates. The result is in Points.
treating the returned/received node point as anchor relative.
@since v0.7.1
*/
CCPoint convertToNodeSpaceAR(const CCPoint& worldPoint);
/** Converts a local Point to world space coordinates.The result is in Points.
treating the returned/received node point as anchor relative.
@since v0.7.1
*/
CCPoint convertToWorldSpaceAR(const CCPoint& nodePoint);
/** convenience methods which take a CCTouch instead of CCPoint
@since v0.7.1
*/
CCPoint convertTouchToNodeSpace(CCTouch * touch);
/** converts a CCTouch (world coordinates) into a local coordiante. This method is AR (Anchor Relative).
@since v0.7.1
*/
CCPoint convertTouchToNodeSpaceAR(CCTouch * touch);
};
NS_CC_END
#endif // __PLATFOMR_CCNODE_H__
| 37.137931 | 140 | 0.648814 |
ec6f09f1bc5cf0bd8e9e1d8f57f49571d9340c86 | 1,172 | h | C | Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderPhilipsDICOMFileReader.h | maleike/MITK | 83b0c35625dfaed99147f357dbd798b1dc19815b | [
"BSD-3-Clause"
] | 5 | 2015-05-27T06:57:53.000Z | 2020-03-12T21:08:23.000Z | Modules/DiffusionImaging/DiffusionCore/include/DicomImport/mitkDiffusionHeaderPhilipsDICOMFileReader.h | kometa-dev/MITK | 984b5f7ac8ea614e80f303381ef1fc77d8ca4c3d | [
"BSD-3-Clause"
] | 141 | 2015-03-03T06:52:01.000Z | 2020-12-10T07:28:14.000Z | Modules/DiffusionImaging/DiffusionCore/include/DicomImport/mitkDiffusionHeaderPhilipsDICOMFileReader.h | kometa-dev/MITK | 984b5f7ac8ea614e80f303381ef1fc77d8ca4c3d | [
"BSD-3-Clause"
] | 4 | 2015-02-19T06:48:13.000Z | 2020-06-19T16:20:25.000Z | /*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKDIFFUSIONHEADERPHILIPSDICOMREADER_H
#define MITKDIFFUSIONHEADERPHILIPSDICOMREADER_H
#include <MitkDiffusionCoreExports.h>
#include "mitkDiffusionHeaderDICOMFileReader.h"
namespace mitk
{
class MITKDIFFUSIONCORE_EXPORT DiffusionHeaderPhilipsDICOMFileReader
: public DiffusionHeaderDICOMFileReader
{
public:
mitkClassMacro( DiffusionHeaderPhilipsDICOMFileReader, DiffusionHeaderDICOMFileReader )
itkNewMacro( Self )
virtual bool ReadDiffusionHeader(std::string filename) override;
protected:
DiffusionHeaderPhilipsDICOMFileReader();
virtual ~DiffusionHeaderPhilipsDICOMFileReader();
};
}
#endif // MITKDIFFUSIONHEADERPHILIPSDICOMREADER_H
| 25.478261 | 89 | 0.734642 |
ae7d7e33a646b1b158582148bef773422550d63a | 3,495 | h | C | Source/Scripting/bsfScript/RTTI/BsManagedSerializableArrayRTTI.h | InsaneZeroGame/bsf | d8d964270b20ae532a03532de7f4cb406a06bc73 | [
"MIT"
] | null | null | null | Source/Scripting/bsfScript/RTTI/BsManagedSerializableArrayRTTI.h | InsaneZeroGame/bsf | d8d964270b20ae532a03532de7f4cb406a06bc73 | [
"MIT"
] | null | null | null | Source/Scripting/bsfScript/RTTI/BsManagedSerializableArrayRTTI.h | InsaneZeroGame/bsf | d8d964270b20ae532a03532de7f4cb406a06bc73 | [
"MIT"
] | null | null | null | //********************************* bs::framework - Copyright 2018-2019 Marko Pintera ************************************//
//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
#pragma once
#include "BsScriptEnginePrerequisites.h"
#include "Reflection/BsRTTIType.h"
#include "Scene/BsGameObjectManager.h"
#include "Serialization/BsManagedSerializableArray.h"
#include "Serialization/BsScriptAssemblyManager.h"
#include "BsMonoManager.h"
#include "BsMonoClass.h"
namespace bs
{
/** @cond RTTI */
/** @addtogroup RTTI-Impl-SEngine
* @{
*/
class BS_SCR_BE_EXPORT ManagedSerializableArrayRTTI : public RTTIType<ManagedSerializableArray, IReflectable, ManagedSerializableArrayRTTI>
{
private:
SPtr<ManagedSerializableTypeInfoArray> getTypeInfo(ManagedSerializableArray* obj)
{
return obj->mArrayTypeInfo;
}
void setTypeInfo(ManagedSerializableArray* obj, SPtr<ManagedSerializableTypeInfoArray> val)
{
obj->mArrayTypeInfo = val;
}
UINT32& getElementSize(ManagedSerializableArray* obj)
{
return (UINT32&)obj->mElemSize;
}
void setElementSize(ManagedSerializableArray* obj, UINT32& numElements)
{
obj->mElemSize = numElements;
}
UINT32& getNumElements(ManagedSerializableArray* obj, UINT32 arrayIdx)
{
return (UINT32&)obj->mNumElements[arrayIdx];
}
void setNumElements(ManagedSerializableArray* obj, UINT32 arrayIdx, UINT32& numElements)
{
obj->mNumElements[arrayIdx] = numElements;
}
UINT32 getNumElementsNumEntries(ManagedSerializableArray* obj)
{
return (UINT32)obj->mNumElements.size();
}
void setNumElementsNumEntries(ManagedSerializableArray* obj, UINT32 numEntries)
{
obj->mNumElements.resize(numEntries);
}
SPtr<ManagedSerializableFieldData> getArrayEntry(ManagedSerializableArray* obj, UINT32 arrayIdx)
{
return obj->getFieldData(arrayIdx);
}
void setArrayEntry(ManagedSerializableArray* obj, UINT32 arrayIdx, SPtr<ManagedSerializableFieldData> val)
{
obj->setFieldData(arrayIdx, val);
}
UINT32 getNumArrayEntries(ManagedSerializableArray* obj)
{
return obj->getTotalLength();
}
void setNumArrayEntries(ManagedSerializableArray* obj, UINT32 numEntries)
{
obj->mCachedEntries = Vector<SPtr<ManagedSerializableFieldData>>(numEntries);
}
public:
ManagedSerializableArrayRTTI()
{
addReflectablePtrField("mArrayTypeInfo", 0, &ManagedSerializableArrayRTTI::getTypeInfo, &ManagedSerializableArrayRTTI::setTypeInfo);
addPlainField("mElementSize", 1, &ManagedSerializableArrayRTTI::getElementSize, &ManagedSerializableArrayRTTI::setElementSize);
addPlainArrayField("mNumElements", 2, &ManagedSerializableArrayRTTI::getNumElements, &ManagedSerializableArrayRTTI::getNumElementsNumEntries,
&ManagedSerializableArrayRTTI::setNumElements, &ManagedSerializableArrayRTTI::setNumElementsNumEntries);
addReflectablePtrArrayField("mArrayEntries", 3, &ManagedSerializableArrayRTTI::getArrayEntry, &ManagedSerializableArrayRTTI::getNumArrayEntries,
&ManagedSerializableArrayRTTI::setArrayEntry, &ManagedSerializableArrayRTTI::setNumArrayEntries);
}
const String& getRTTIName() override
{
static String name = "ScriptSerializableArray";
return name;
}
UINT32 getRTTIId() override
{
return TID_ScriptSerializableArray;
}
SPtr<IReflectable> newRTTIObject() override
{
return ManagedSerializableArray::createNew();
}
};
/** @} */
/** @endcond */
}
| 30.657895 | 147 | 0.752217 |
08daca8d7d25cea889979b76c83b821ca545a69c | 4,080 | h | C | chrome/test/ui/ui_perf_test.h | Gitman1989/chromium | 2b1cceae1075ef012fb225deec8b4c8bbe4bc897 | [
"BSD-3-Clause"
] | 2 | 2017-09-02T19:08:28.000Z | 2021-11-15T15:15:14.000Z | chrome/test/ui/ui_perf_test.h | meego-tablet-ux/meego-app-browser | 0f4ef17bd4b399c9c990a2f6ca939099495c2b9c | [
"BSD-3-Clause"
] | null | null | null | chrome/test/ui/ui_perf_test.h | meego-tablet-ux/meego-app-browser | 0f4ef17bd4b399c9c990a2f6ca939099495c2b9c | [
"BSD-3-Clause"
] | 1 | 2020-11-04T07:22:28.000Z | 2020-11-04T07:22:28.000Z | // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_TEST_UI_UI_PERF_TEST_H_
#define CHROME_TEST_UI_UI_PERF_TEST_H_
#pragma once
#include <string>
#include "chrome/test/ui/ui_test.h"
class UIPerfTest : public UITest {
protected:
// Prints numerical information to stdout in a controlled format, for
// post-processing. |measurement| is a description of the quantity being
// measured, e.g. "vm_peak"; |modifier| is provided as a convenience and
// will be appended directly to the name of the |measurement|, e.g.
// "_browser"; |trace| is a description of the particular data point, e.g.
// "reference"; |value| is the measured value; and |units| is a description
// of the units of measure, e.g. "bytes". If |important| is true, the output
// line will be specially marked, to notify the post-processor. The strings
// may be empty. They should not contain any colons (:) or equals signs (=).
// A typical post-processing step would be to produce graphs of the data
// produced for various builds, using the combined |measurement| + |modifier|
// string to specify a particular graph and the |trace| to identify a trace
// (i.e., data series) on that graph.
void PrintResult(const std::string& measurement,
const std::string& modifier,
const std::string& trace,
size_t value,
const std::string& units,
bool important);
// Like the above version of PrintResult(), but takes a std::string value
// instead of a size_t.
void PrintResult(const std::string& measurement,
const std::string& modifier,
const std::string& trace,
const std::string& value,
const std::string& units,
bool important);
// Like PrintResult(), but prints a (mean, standard deviation) result pair.
// The |<values>| should be two comma-seaprated numbers, the mean and
// standard deviation (or other error metric) of the measurement.
void PrintResultMeanAndError(const std::string& measurement,
const std::string& modifier,
const std::string& trace,
const std::string& mean_and_error,
const std::string& units,
bool important);
// Like PrintResult(), but prints an entire list of results. The |values|
// will generally be a list of comma-separated numbers. A typical
// post-processing step might produce plots of their mean and standard
// deviation.
void PrintResultList(const std::string& measurement,
const std::string& modifier,
const std::string& trace,
const std::string& values,
const std::string& units,
bool important);
// Prints IO performance data for use by perf graphs.
void PrintIOPerfInfo(const char* test_name);
// Prints memory usage data for use by perf graphs.
void PrintMemoryUsageInfo(const char* test_name);
// Prints memory commit charge stats for use by perf graphs.
void PrintSystemCommitCharge(const char* test_name,
size_t charge,
bool important);
// Configures the test to use the reference build.
void UseReferenceBuild();
private:
// Common functionality for the public PrintResults methods.
void PrintResultsImpl(const std::string& measurement,
const std::string& modifier,
const std::string& trace,
const std::string& values,
const std::string& prefix,
const std::string& suffix,
const std::string& units,
bool important);
};
#endif // CHROME_TEST_UI_UI_PERF_TEST_H_
| 44.347826 | 79 | 0.616912 |
835f3c16cb29d5f24440945b8f4884753ecd0529 | 1,353 | h | C | source/agent/audio/audioMixer/AudioMixerWrapper.h | RayanWang/owt-server | 43f42dea3a89f086bc425f6b26da51ef6d91af6d | [
"Apache-2.0"
] | 890 | 2019-03-08T08:04:10.000Z | 2022-03-30T03:07:44.000Z | source/agent/audio/audioMixer/AudioMixerWrapper.h | RayanWang/owt-server | 43f42dea3a89f086bc425f6b26da51ef6d91af6d | [
"Apache-2.0"
] | 583 | 2019-03-11T10:27:42.000Z | 2022-03-29T01:41:28.000Z | source/agent/audio/audioMixer/AudioMixerWrapper.h | RayanWang/owt-server | 43f42dea3a89f086bc425f6b26da51ef6d91af6d | [
"Apache-2.0"
] | 385 | 2019-03-08T07:50:13.000Z | 2022-03-29T06:36:28.000Z | // Copyright (C) <2019> Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
#ifndef AUDIOMIXERWRAPPER_H
#define AUDIOMIXERWRAPPER_H
#include "../../addons/common/MediaFramePipelineWrapper.h"
#include "../../addons/common/NodeEventRegistry.h"
#include "AudioMixer.h"
#include <nan.h>
/*
* Wrapper class of mcu::AudioMixer
*/
class AudioMixer : public node::ObjectWrap, public NodeEventRegistry {
public:
static void Init(v8::Local<v8::Object>, v8::Local<v8::Object>);
mcu::AudioMixer* me;
private:
AudioMixer();
~AudioMixer();
static v8::Persistent<v8::Function> constructor;
static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
static void close(const v8::FunctionCallbackInfo<v8::Value>& args);
static void enableVAD(const v8::FunctionCallbackInfo<v8::Value>& args);
static void disableVAD(const v8::FunctionCallbackInfo<v8::Value>& args);
static void resetVAD(const v8::FunctionCallbackInfo<v8::Value>& args);
static void addInput(const v8::FunctionCallbackInfo<v8::Value>& args);
static void removeInput(const v8::FunctionCallbackInfo<v8::Value>& args);
static void setInputActive(const v8::FunctionCallbackInfo<v8::Value>& args);
static void addOutput(const v8::FunctionCallbackInfo<v8::Value>& args);
static void removeOutput(const v8::FunctionCallbackInfo<v8::Value>& args);
};
#endif
| 33.825 | 78 | 0.746489 |
2fe5c19b900f93c13dbeba5f99ccebc07893c50d | 2,393 | h | C | Infovis/Layout/vtkEdgeLayout.h | forestGzh/VTK | bc98327275bd5cfa95c5825f80a2755a458b6da8 | [
"BSD-3-Clause"
] | 3 | 2015-07-28T18:07:50.000Z | 2018-02-28T20:59:58.000Z | Infovis/Layout/vtkEdgeLayout.h | forestGzh/VTK | bc98327275bd5cfa95c5825f80a2755a458b6da8 | [
"BSD-3-Clause"
] | 4 | 2018-10-25T09:46:11.000Z | 2019-01-17T16:49:17.000Z | Infovis/Layout/vtkEdgeLayout.h | forestGzh/VTK | bc98327275bd5cfa95c5825f80a2755a458b6da8 | [
"BSD-3-Clause"
] | 4 | 2016-09-08T02:11:00.000Z | 2019-08-15T02:38:39.000Z | /*=========================================================================
Program: Visualization Toolkit
Module: vtkEdgeLayout.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*----------------------------------------------------------------------------
Copyright (c) Sandia Corporation
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
----------------------------------------------------------------------------*/
/**
* @class vtkEdgeLayout
* @brief layout graph edges
*
*
* This class is a shell for many edge layout strategies which may be set
* using the SetLayoutStrategy() function. The layout strategies do the
* actual work.
*/
#ifndef vtkEdgeLayout_h
#define vtkEdgeLayout_h
#include "vtkInfovisLayoutModule.h" // For export macro
#include "vtkGraphAlgorithm.h"
class vtkEdgeLayoutStrategy;
class vtkEventForwarderCommand;
class VTKINFOVISLAYOUT_EXPORT vtkEdgeLayout : public vtkGraphAlgorithm
{
public:
static vtkEdgeLayout *New();
vtkTypeMacro(vtkEdgeLayout, vtkGraphAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent) override;
//@{
/**
* The layout strategy to use during graph layout.
*/
void SetLayoutStrategy(vtkEdgeLayoutStrategy *strategy);
vtkGetObjectMacro(LayoutStrategy, vtkEdgeLayoutStrategy);
//@}
/**
* Get the modification time of the layout algorithm.
*/
vtkMTimeType GetMTime() override;
protected:
vtkEdgeLayout();
~vtkEdgeLayout() override;
vtkEdgeLayoutStrategy* LayoutStrategy;
//@{
/**
* This intercepts events from the strategy object and re-emits them
* as if they came from the layout engine itself.
*/
vtkEventForwarderCommand *EventForwarder;
unsigned long ObserverTag;
//@}
int RequestData(
vtkInformation *,
vtkInformationVector **,
vtkInformationVector *) override;
private:
vtkGraph *InternalGraph;
vtkEdgeLayout(const vtkEdgeLayout&) = delete;
void operator=(const vtkEdgeLayout&) = delete;
};
#endif
| 27.505747 | 78 | 0.646887 |
d990bdf7845f8a36076e2ed67e95309564d4d0dd | 1,203 | h | C | System/Library/PrivateFrameworks/AvatarKit.framework/AVTStickerImageProp.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | 2 | 2021-11-02T09:23:27.000Z | 2022-03-28T08:21:57.000Z | System/Library/PrivateFrameworks/AvatarKit.framework/AVTStickerImageProp.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | null | null | null | System/Library/PrivateFrameworks/AvatarKit.framework/AVTStickerImageProp.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | 1 | 2022-03-28T08:21:59.000Z | 2022-03-28T08:21:59.000Z | /*
* This header is generated by classdump-dyld 1.5
* on Wednesday, October 27, 2021 at 3:17:06 PM Mountain Standard Time
* Operating System: Version 13.5.1 (Build 17F80)
* Image Source: /System/Library/PrivateFrameworks/AvatarKit.framework/AvatarKit
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. Updated by Kevin Bradley.
*/
#import <AvatarKit/AvatarKit-Structs.h>
#import <AvatarKit/AVTStickerProp.h>
@class UIImage;
@interface AVTStickerImageProp : AVTStickerProp {
UIImage* _image;
}
@property (nonatomic,readonly) UIImage * image; //@synthesize image=_image - In the implementation block
-(id)copyWithZone:(NSZone*)arg1 ;
-(UIImage *)image;
-(void)buildNodeForAvatar:(id)arg1 withCamera:(id)arg2 forExport:(BOOL)arg3 completionHandler:(/*^block*/id)arg4 ;
-(id)initWithImage:(id)arg1 size:(CGSize)arg2 scale:(SCNVector3)arg3 position:(SCNVector3)arg4 renderLast:(BOOL)arg5 orientToCamera:(BOOL)arg6 rotation:(SCNVector3)arg7 palettesDescriptions:(id)arg8 modifiers:(id)arg9 adjustments:(id)arg10 ;
@end
| 44.555556 | 241 | 0.678304 |
96f984cebd5e5cf9d5ab52d75b925c3840c6ea6d | 32,960 | h | C | Source/ThirdParty/embree/common/simd/vfloat4_sse2.h | vinhig/rbfx | 884de45c623d591f346a2abd5e52edaa84bcc137 | [
"MIT"
] | 441 | 2018-12-26T14:50:23.000Z | 2021-11-05T03:13:27.000Z | Source/ThirdParty/embree/common/simd/vfloat4_sse2.h | vinhig/rbfx | 884de45c623d591f346a2abd5e52edaa84bcc137 | [
"MIT"
] | 221 | 2018-12-29T17:40:23.000Z | 2021-11-06T21:41:55.000Z | Source/ThirdParty/embree/common/simd/vfloat4_sse2.h | vinhig/rbfx | 884de45c623d591f346a2abd5e52edaa84bcc137 | [
"MIT"
] | 101 | 2018-12-29T13:08:10.000Z | 2021-11-02T09:58:37.000Z | // Copyright 2009-2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#pragma once
namespace embree
{
/* 4-wide SSE float type */
template<>
struct vfloat<4>
{
ALIGNED_STRUCT_(16);
typedef vboolf4 Bool;
typedef vint4 Int;
typedef vfloat4 Float;
enum { size = 4 }; // number of SIMD elements
union { __m128 v; float f[4]; int i[4]; }; // data
////////////////////////////////////////////////////////////////////////////////
/// Constructors, Assignment & Cast Operators
////////////////////////////////////////////////////////////////////////////////
__forceinline vfloat() {}
__forceinline vfloat(const vfloat4& other) { v = other.v; }
__forceinline vfloat4& operator =(const vfloat4& other) { v = other.v; return *this; }
__forceinline vfloat(__m128 a) : v(a) {}
__forceinline operator const __m128&() const { return v; }
__forceinline operator __m128&() { return v; }
__forceinline vfloat(float a) : v(_mm_set1_ps(a)) {}
__forceinline vfloat(float a, float b, float c, float d) : v(_mm_set_ps(d, c, b, a)) {}
__forceinline explicit vfloat(const vint4& a) : v(_mm_cvtepi32_ps(a)) {}
__forceinline explicit vfloat(const vuint4& x) {
const __m128i a = _mm_and_si128(x,_mm_set1_epi32(0x7FFFFFFF));
const __m128i b = _mm_and_si128(_mm_srai_epi32(x,31),_mm_set1_epi32(0x4F000000)); //0x4F000000 = 2^31
const __m128 af = _mm_cvtepi32_ps(a);
const __m128 bf = _mm_castsi128_ps(b);
v = _mm_add_ps(af,bf);
}
////////////////////////////////////////////////////////////////////////////////
/// Constants
////////////////////////////////////////////////////////////////////////////////
__forceinline vfloat(ZeroTy) : v(_mm_setzero_ps()) {}
__forceinline vfloat(OneTy) : v(_mm_set1_ps(1.0f)) {}
__forceinline vfloat(PosInfTy) : v(_mm_set1_ps(pos_inf)) {}
__forceinline vfloat(NegInfTy) : v(_mm_set1_ps(neg_inf)) {}
__forceinline vfloat(StepTy) : v(_mm_set_ps(3.0f, 2.0f, 1.0f, 0.0f)) {}
__forceinline vfloat(NaNTy) : v(_mm_set1_ps(nan)) {}
__forceinline vfloat(UndefinedTy) : v(_mm_undefined_ps()) {}
////////////////////////////////////////////////////////////////////////////////
/// Loads and Stores
////////////////////////////////////////////////////////////////////////////////
static __forceinline vfloat4 load (const void* a) { return _mm_load_ps((float*)a); }
static __forceinline vfloat4 loadu(const void* a) { return _mm_loadu_ps((float*)a); }
static __forceinline void store (void* ptr, const vfloat4& v) { _mm_store_ps((float*)ptr,v); }
static __forceinline void storeu(void* ptr, const vfloat4& v) { _mm_storeu_ps((float*)ptr,v); }
#if defined(__AVX512VL__)
static __forceinline vfloat4 compact(const vboolf4& mask, vfloat4 &v) {
return _mm_mask_compress_ps(v, mask, v);
}
static __forceinline vfloat4 compact(const vboolf4& mask, vfloat4 &a, const vfloat4& b) {
return _mm_mask_compress_ps(a, mask, b);
}
static __forceinline vfloat4 load (const vboolf4& mask, const void* ptr) { return _mm_mask_load_ps (_mm_setzero_ps(),mask,(float*)ptr); }
static __forceinline vfloat4 loadu(const vboolf4& mask, const void* ptr) { return _mm_mask_loadu_ps(_mm_setzero_ps(),mask,(float*)ptr); }
static __forceinline void store (const vboolf4& mask, void* ptr, const vfloat4& v) { _mm_mask_store_ps ((float*)ptr,mask,v); }
static __forceinline void storeu(const vboolf4& mask, void* ptr, const vfloat4& v) { _mm_mask_storeu_ps((float*)ptr,mask,v); }
#elif defined(__AVX__)
static __forceinline vfloat4 load (const vboolf4& mask, const void* ptr) { return _mm_maskload_ps((float*)ptr,mask); }
static __forceinline vfloat4 loadu(const vboolf4& mask, const void* ptr) { return _mm_maskload_ps((float*)ptr,mask); }
static __forceinline void store (const vboolf4& mask, void* ptr, const vfloat4& v) { _mm_maskstore_ps((float*)ptr,(__m128i)mask,v); }
static __forceinline void storeu(const vboolf4& mask, void* ptr, const vfloat4& v) { _mm_maskstore_ps((float*)ptr,(__m128i)mask,v); }
#else
static __forceinline vfloat4 load (const vboolf4& mask, const void* ptr) { return _mm_and_ps(_mm_load_ps ((float*)ptr),mask); }
static __forceinline vfloat4 loadu(const vboolf4& mask, const void* ptr) { return _mm_and_ps(_mm_loadu_ps((float*)ptr),mask); }
static __forceinline void store (const vboolf4& mask, void* ptr, const vfloat4& v) { store (ptr,select(mask,v,load (ptr))); }
static __forceinline void storeu(const vboolf4& mask, void* ptr, const vfloat4& v) { storeu(ptr,select(mask,v,loadu(ptr))); }
#endif
#if defined(__AVX__)
static __forceinline vfloat4 broadcast(const void* a) { return _mm_broadcast_ss((float*)a); }
#else
static __forceinline vfloat4 broadcast(const void* a) { return _mm_set1_ps(*(float*)a); }
#endif
static __forceinline vfloat4 load_nt (const float* ptr) {
#if defined (__SSE4_1__)
return _mm_castsi128_ps(_mm_stream_load_si128((__m128i*)ptr));
#else
return _mm_load_ps(ptr);
#endif
}
#if defined(__SSE4_1__)
static __forceinline vfloat4 load(const char* ptr) {
return _mm_cvtepi32_ps(_mm_cvtepi8_epi32(_mm_loadu_si128((__m128i*)ptr)));
}
#else
static __forceinline vfloat4 load(const char* ptr) {
return vfloat4(ptr[0],ptr[1],ptr[2],ptr[3]);
}
#endif
#if defined(__SSE4_1__)
static __forceinline vfloat4 load(const unsigned char* ptr) {
return _mm_cvtepi32_ps(_mm_cvtepu8_epi32(_mm_loadu_si128((__m128i*)ptr)));
}
#else
static __forceinline vfloat4 load(const unsigned char* ptr) {
//return _mm_cvtpu8_ps(*(__m64*)ptr); // don't enable, will use MMX instructions
return vfloat4(ptr[0],ptr[1],ptr[2],ptr[3]);
}
#endif
#if defined(__SSE4_1__)
static __forceinline vfloat4 load(const short* ptr) {
return _mm_cvtepi32_ps(_mm_cvtepi16_epi32(_mm_loadu_si128((__m128i*)ptr)));
}
#else
static __forceinline vfloat4 load(const short* ptr) {
return vfloat4(ptr[0],ptr[1],ptr[2],ptr[3]);
}
#endif
static __forceinline vfloat4 load(const unsigned short* ptr) {
return _mm_mul_ps(vfloat4(vint4::load(ptr)),vfloat4(1.0f/65535.0f));
}
static __forceinline void store_nt(void* ptr, const vfloat4& v)
{
#if defined (__SSE4_1__)
_mm_stream_ps((float*)ptr,v);
#else
_mm_store_ps((float*)ptr,v);
#endif
}
template<int scale = 4>
static __forceinline vfloat4 gather(const float* ptr, const vint4& index) {
#if defined(__AVX2__)
return _mm_i32gather_ps(ptr, index, scale);
#else
return vfloat4(
*(float*)(((char*)ptr)+scale*index[0]),
*(float*)(((char*)ptr)+scale*index[1]),
*(float*)(((char*)ptr)+scale*index[2]),
*(float*)(((char*)ptr)+scale*index[3]));
#endif
}
template<int scale = 4>
static __forceinline vfloat4 gather(const vboolf4& mask, const float* ptr, const vint4& index) {
vfloat4 r = zero;
#if defined(__AVX512VL__)
return _mm_mmask_i32gather_ps(r, mask, index, ptr, scale);
#elif defined(__AVX2__)
return _mm_mask_i32gather_ps(r, ptr, index, mask, scale);
#else
if (likely(mask[0])) r[0] = *(float*)(((char*)ptr)+scale*index[0]);
if (likely(mask[1])) r[1] = *(float*)(((char*)ptr)+scale*index[1]);
if (likely(mask[2])) r[2] = *(float*)(((char*)ptr)+scale*index[2]);
if (likely(mask[3])) r[3] = *(float*)(((char*)ptr)+scale*index[3]);
return r;
#endif
}
template<int scale = 4>
static __forceinline void scatter(void* ptr, const vint4& index, const vfloat4& v)
{
#if defined(__AVX512VL__)
_mm_i32scatter_ps((float*)ptr, index, v, scale);
#else
*(float*)(((char*)ptr)+scale*index[0]) = v[0];
*(float*)(((char*)ptr)+scale*index[1]) = v[1];
*(float*)(((char*)ptr)+scale*index[2]) = v[2];
*(float*)(((char*)ptr)+scale*index[3]) = v[3];
#endif
}
template<int scale = 4>
static __forceinline void scatter(const vboolf4& mask, void* ptr, const vint4& index, const vfloat4& v)
{
#if defined(__AVX512VL__)
_mm_mask_i32scatter_ps((float*)ptr ,mask, index, v, scale);
#else
if (likely(mask[0])) *(float*)(((char*)ptr)+scale*index[0]) = v[0];
if (likely(mask[1])) *(float*)(((char*)ptr)+scale*index[1]) = v[1];
if (likely(mask[2])) *(float*)(((char*)ptr)+scale*index[2]) = v[2];
if (likely(mask[3])) *(float*)(((char*)ptr)+scale*index[3]) = v[3];
#endif
}
static __forceinline void store(const vboolf4& mask, char* ptr, const vint4& ofs, const vfloat4& v) {
scatter<1>(mask,ptr,ofs,v);
}
static __forceinline void store(const vboolf4& mask, float* ptr, const vint4& ofs, const vfloat4& v) {
scatter<4>(mask,ptr,ofs,v);
}
////////////////////////////////////////////////////////////////////////////////
/// Array Access
////////////////////////////////////////////////////////////////////////////////
__forceinline const float& operator [](size_t index) const { assert(index < 4); return f[index]; }
__forceinline float& operator [](size_t index) { assert(index < 4); return f[index]; }
friend __forceinline vfloat4 select(const vboolf4& m, const vfloat4& t, const vfloat4& f) {
#if defined(__AVX512VL__)
return _mm_mask_blend_ps(m, f, t);
#elif defined(__SSE4_1__)
return _mm_blendv_ps(f, t, m);
#else
return _mm_or_ps(_mm_and_ps(m, t), _mm_andnot_ps(m, f));
#endif
}
};
////////////////////////////////////////////////////////////////////////////////
/// Unary Operators
////////////////////////////////////////////////////////////////////////////////
__forceinline vfloat4 asFloat(const vint4& a) { return _mm_castsi128_ps(a); }
__forceinline vint4 asInt (const vfloat4& a) { return _mm_castps_si128(a); }
__forceinline vuint4 asUInt (const vfloat4& a) { return _mm_castps_si128(a); }
__forceinline vint4 toInt (const vfloat4& a) { return vint4(a); }
__forceinline vfloat4 toFloat(const vint4& a) { return vfloat4(a); }
__forceinline vfloat4 operator +(const vfloat4& a) { return a; }
__forceinline vfloat4 operator -(const vfloat4& a) { return _mm_xor_ps(a, _mm_castsi128_ps(_mm_set1_epi32(0x80000000))); }
__forceinline vfloat4 abs(const vfloat4& a) { return _mm_and_ps(a, _mm_castsi128_ps(_mm_set1_epi32(0x7fffffff))); }
#if defined(__AVX512VL__)
__forceinline vfloat4 sign(const vfloat4& a) { return _mm_mask_blend_ps(_mm_cmp_ps_mask(a, vfloat4(zero), _CMP_LT_OQ), vfloat4(one), -vfloat4(one)); }
#else
__forceinline vfloat4 sign(const vfloat4& a) { return blendv_ps(vfloat4(one), -vfloat4(one), _mm_cmplt_ps(a, vfloat4(zero))); }
#endif
__forceinline vfloat4 signmsk(const vfloat4& a) { return _mm_and_ps(a,_mm_castsi128_ps(_mm_set1_epi32(0x80000000))); }
__forceinline vfloat4 rcp(const vfloat4& a)
{
#if defined(__AVX512VL__)
const vfloat4 r = _mm_rcp14_ps(a);
#else
const vfloat4 r = _mm_rcp_ps(a);
#endif
#if defined(__AVX2__)
return _mm_mul_ps(r,_mm_fnmadd_ps(r, a, vfloat4(2.0f)));
#else
return _mm_mul_ps(r,_mm_sub_ps(vfloat4(2.0f), _mm_mul_ps(r, a)));
#endif
}
__forceinline vfloat4 sqr (const vfloat4& a) { return _mm_mul_ps(a,a); }
__forceinline vfloat4 sqrt(const vfloat4& a) { return _mm_sqrt_ps(a); }
__forceinline vfloat4 rsqrt(const vfloat4& a)
{
#if defined(__AVX512VL__)
const vfloat4 r = _mm_rsqrt14_ps(a);
#else
const vfloat4 r = _mm_rsqrt_ps(a);
#endif
#if defined(__AVX2__)
return _mm_fmadd_ps(_mm_set1_ps(1.5f), r,
_mm_mul_ps(_mm_mul_ps(_mm_mul_ps(a, _mm_set1_ps(-0.5f)), r), _mm_mul_ps(r, r)));
#else
return _mm_add_ps(_mm_mul_ps(_mm_set1_ps(1.5f), r),
_mm_mul_ps(_mm_mul_ps(_mm_mul_ps(a, _mm_set1_ps(-0.5f)), r), _mm_mul_ps(r, r)));
#endif
}
__forceinline vboolf4 isnan(const vfloat4& a) {
const vfloat4 b = _mm_and_ps(a, _mm_castsi128_ps(_mm_set1_epi32(0x7fffffff)));
#if defined(__AVX512VL__)
return _mm_cmp_epi32_mask(_mm_castps_si128(b), _mm_set1_epi32(0x7f800000), _MM_CMPINT_GT);
#else
return _mm_castsi128_ps(_mm_cmpgt_epi32(_mm_castps_si128(b), _mm_set1_epi32(0x7f800000)));
#endif
}
////////////////////////////////////////////////////////////////////////////////
/// Binary Operators
////////////////////////////////////////////////////////////////////////////////
__forceinline vfloat4 operator +(const vfloat4& a, const vfloat4& b) { return _mm_add_ps(a, b); }
__forceinline vfloat4 operator +(const vfloat4& a, float b) { return a + vfloat4(b); }
__forceinline vfloat4 operator +(float a, const vfloat4& b) { return vfloat4(a) + b; }
__forceinline vfloat4 operator -(const vfloat4& a, const vfloat4& b) { return _mm_sub_ps(a, b); }
__forceinline vfloat4 operator -(const vfloat4& a, float b) { return a - vfloat4(b); }
__forceinline vfloat4 operator -(float a, const vfloat4& b) { return vfloat4(a) - b; }
__forceinline vfloat4 operator *(const vfloat4& a, const vfloat4& b) { return _mm_mul_ps(a, b); }
__forceinline vfloat4 operator *(const vfloat4& a, float b) { return a * vfloat4(b); }
__forceinline vfloat4 operator *(float a, const vfloat4& b) { return vfloat4(a) * b; }
__forceinline vfloat4 operator /(const vfloat4& a, const vfloat4& b) { return _mm_div_ps(a,b); }
__forceinline vfloat4 operator /(const vfloat4& a, float b) { return a/vfloat4(b); }
__forceinline vfloat4 operator /(float a, const vfloat4& b) { return vfloat4(a)/b; }
__forceinline vfloat4 operator &(const vfloat4& a, const vfloat4& b) { return _mm_and_ps(a,b); }
__forceinline vfloat4 operator |(const vfloat4& a, const vfloat4& b) { return _mm_or_ps(a,b); }
__forceinline vfloat4 operator ^(const vfloat4& a, const vfloat4& b) { return _mm_xor_ps(a,b); }
__forceinline vfloat4 operator ^(const vfloat4& a, const vint4& b) { return _mm_xor_ps(a,_mm_castsi128_ps(b)); }
__forceinline vfloat4 min(const vfloat4& a, const vfloat4& b) { return _mm_min_ps(a,b); }
__forceinline vfloat4 min(const vfloat4& a, float b) { return _mm_min_ps(a,vfloat4(b)); }
__forceinline vfloat4 min(float a, const vfloat4& b) { return _mm_min_ps(vfloat4(a),b); }
__forceinline vfloat4 max(const vfloat4& a, const vfloat4& b) { return _mm_max_ps(a,b); }
__forceinline vfloat4 max(const vfloat4& a, float b) { return _mm_max_ps(a,vfloat4(b)); }
__forceinline vfloat4 max(float a, const vfloat4& b) { return _mm_max_ps(vfloat4(a),b); }
#if defined(__SSE4_1__)
__forceinline vfloat4 mini(const vfloat4& a, const vfloat4& b) {
const vint4 ai = _mm_castps_si128(a);
const vint4 bi = _mm_castps_si128(b);
const vint4 ci = _mm_min_epi32(ai,bi);
return _mm_castsi128_ps(ci);
}
__forceinline vfloat4 maxi(const vfloat4& a, const vfloat4& b) {
const vint4 ai = _mm_castps_si128(a);
const vint4 bi = _mm_castps_si128(b);
const vint4 ci = _mm_max_epi32(ai,bi);
return _mm_castsi128_ps(ci);
}
__forceinline vfloat4 minui(const vfloat4& a, const vfloat4& b) {
const vint4 ai = _mm_castps_si128(a);
const vint4 bi = _mm_castps_si128(b);
const vint4 ci = _mm_min_epu32(ai,bi);
return _mm_castsi128_ps(ci);
}
__forceinline vfloat4 maxui(const vfloat4& a, const vfloat4& b) {
const vint4 ai = _mm_castps_si128(a);
const vint4 bi = _mm_castps_si128(b);
const vint4 ci = _mm_max_epu32(ai,bi);
return _mm_castsi128_ps(ci);
}
#else
__forceinline vfloat4 mini(const vfloat4& a, const vfloat4& b) {
return min(a,b);
}
__forceinline vfloat4 maxi(const vfloat4& a, const vfloat4& b) {
return max(a,b);
}
#endif
////////////////////////////////////////////////////////////////////////////////
/// Ternary Operators
////////////////////////////////////////////////////////////////////////////////
#if defined(__AVX2__)
__forceinline vfloat4 madd (const vfloat4& a, const vfloat4& b, const vfloat4& c) { return _mm_fmadd_ps(a,b,c); }
__forceinline vfloat4 msub (const vfloat4& a, const vfloat4& b, const vfloat4& c) { return _mm_fmsub_ps(a,b,c); }
__forceinline vfloat4 nmadd(const vfloat4& a, const vfloat4& b, const vfloat4& c) { return _mm_fnmadd_ps(a,b,c); }
__forceinline vfloat4 nmsub(const vfloat4& a, const vfloat4& b, const vfloat4& c) { return _mm_fnmsub_ps(a,b,c); }
#else
__forceinline vfloat4 madd (const vfloat4& a, const vfloat4& b, const vfloat4& c) { return a*b+c; }
__forceinline vfloat4 msub (const vfloat4& a, const vfloat4& b, const vfloat4& c) { return a*b-c; }
__forceinline vfloat4 nmadd(const vfloat4& a, const vfloat4& b, const vfloat4& c) { return -a*b+c;}
__forceinline vfloat4 nmsub(const vfloat4& a, const vfloat4& b, const vfloat4& c) { return -a*b-c; }
#endif
////////////////////////////////////////////////////////////////////////////////
/// Assignment Operators
////////////////////////////////////////////////////////////////////////////////
__forceinline vfloat4& operator +=(vfloat4& a, const vfloat4& b) { return a = a + b; }
__forceinline vfloat4& operator +=(vfloat4& a, float b) { return a = a + b; }
__forceinline vfloat4& operator -=(vfloat4& a, const vfloat4& b) { return a = a - b; }
__forceinline vfloat4& operator -=(vfloat4& a, float b) { return a = a - b; }
__forceinline vfloat4& operator *=(vfloat4& a, const vfloat4& b) { return a = a * b; }
__forceinline vfloat4& operator *=(vfloat4& a, float b) { return a = a * b; }
__forceinline vfloat4& operator /=(vfloat4& a, const vfloat4& b) { return a = a / b; }
__forceinline vfloat4& operator /=(vfloat4& a, float b) { return a = a / b; }
////////////////////////////////////////////////////////////////////////////////
/// Comparison Operators + Select
////////////////////////////////////////////////////////////////////////////////
#if defined(__AVX512VL__)
__forceinline vboolf4 operator ==(const vfloat4& a, const vfloat4& b) { return _mm_cmp_ps_mask(a, b, _MM_CMPINT_EQ); }
__forceinline vboolf4 operator !=(const vfloat4& a, const vfloat4& b) { return _mm_cmp_ps_mask(a, b, _MM_CMPINT_NE); }
__forceinline vboolf4 operator < (const vfloat4& a, const vfloat4& b) { return _mm_cmp_ps_mask(a, b, _MM_CMPINT_LT); }
__forceinline vboolf4 operator >=(const vfloat4& a, const vfloat4& b) { return _mm_cmp_ps_mask(a, b, _MM_CMPINT_GE); }
__forceinline vboolf4 operator > (const vfloat4& a, const vfloat4& b) { return _mm_cmp_ps_mask(a, b, _MM_CMPINT_GT); }
__forceinline vboolf4 operator <=(const vfloat4& a, const vfloat4& b) { return _mm_cmp_ps_mask(a, b, _MM_CMPINT_LE); }
#else
__forceinline vboolf4 operator ==(const vfloat4& a, const vfloat4& b) { return _mm_cmpeq_ps (a, b); }
__forceinline vboolf4 operator !=(const vfloat4& a, const vfloat4& b) { return _mm_cmpneq_ps(a, b); }
__forceinline vboolf4 operator < (const vfloat4& a, const vfloat4& b) { return _mm_cmplt_ps (a, b); }
__forceinline vboolf4 operator >=(const vfloat4& a, const vfloat4& b) { return _mm_cmpnlt_ps(a, b); }
__forceinline vboolf4 operator > (const vfloat4& a, const vfloat4& b) { return _mm_cmpnle_ps(a, b); }
__forceinline vboolf4 operator <=(const vfloat4& a, const vfloat4& b) { return _mm_cmple_ps (a, b); }
#endif
__forceinline vboolf4 operator ==(const vfloat4& a, float b) { return a == vfloat4(b); }
__forceinline vboolf4 operator ==(float a, const vfloat4& b) { return vfloat4(a) == b; }
__forceinline vboolf4 operator !=(const vfloat4& a, float b) { return a != vfloat4(b); }
__forceinline vboolf4 operator !=(float a, const vfloat4& b) { return vfloat4(a) != b; }
__forceinline vboolf4 operator < (const vfloat4& a, float b) { return a < vfloat4(b); }
__forceinline vboolf4 operator < (float a, const vfloat4& b) { return vfloat4(a) < b; }
__forceinline vboolf4 operator >=(const vfloat4& a, float b) { return a >= vfloat4(b); }
__forceinline vboolf4 operator >=(float a, const vfloat4& b) { return vfloat4(a) >= b; }
__forceinline vboolf4 operator > (const vfloat4& a, float b) { return a > vfloat4(b); }
__forceinline vboolf4 operator > (float a, const vfloat4& b) { return vfloat4(a) > b; }
__forceinline vboolf4 operator <=(const vfloat4& a, float b) { return a <= vfloat4(b); }
__forceinline vboolf4 operator <=(float a, const vfloat4& b) { return vfloat4(a) <= b; }
__forceinline vboolf4 eq(const vfloat4& a, const vfloat4& b) { return a == b; }
__forceinline vboolf4 ne(const vfloat4& a, const vfloat4& b) { return a != b; }
__forceinline vboolf4 lt(const vfloat4& a, const vfloat4& b) { return a < b; }
__forceinline vboolf4 ge(const vfloat4& a, const vfloat4& b) { return a >= b; }
__forceinline vboolf4 gt(const vfloat4& a, const vfloat4& b) { return a > b; }
__forceinline vboolf4 le(const vfloat4& a, const vfloat4& b) { return a <= b; }
#if defined(__AVX512VL__)
__forceinline vboolf4 eq(const vboolf4& mask, const vfloat4& a, const vfloat4& b) { return _mm_mask_cmp_ps_mask(mask, a, b, _MM_CMPINT_EQ); }
__forceinline vboolf4 ne(const vboolf4& mask, const vfloat4& a, const vfloat4& b) { return _mm_mask_cmp_ps_mask(mask, a, b, _MM_CMPINT_NE); }
__forceinline vboolf4 lt(const vboolf4& mask, const vfloat4& a, const vfloat4& b) { return _mm_mask_cmp_ps_mask(mask, a, b, _MM_CMPINT_LT); }
__forceinline vboolf4 ge(const vboolf4& mask, const vfloat4& a, const vfloat4& b) { return _mm_mask_cmp_ps_mask(mask, a, b, _MM_CMPINT_GE); }
__forceinline vboolf4 gt(const vboolf4& mask, const vfloat4& a, const vfloat4& b) { return _mm_mask_cmp_ps_mask(mask, a, b, _MM_CMPINT_GT); }
__forceinline vboolf4 le(const vboolf4& mask, const vfloat4& a, const vfloat4& b) { return _mm_mask_cmp_ps_mask(mask, a, b, _MM_CMPINT_LE); }
#else
__forceinline vboolf4 eq(const vboolf4& mask, const vfloat4& a, const vfloat4& b) { return mask & (a == b); }
__forceinline vboolf4 ne(const vboolf4& mask, const vfloat4& a, const vfloat4& b) { return mask & (a != b); }
__forceinline vboolf4 lt(const vboolf4& mask, const vfloat4& a, const vfloat4& b) { return mask & (a < b); }
__forceinline vboolf4 ge(const vboolf4& mask, const vfloat4& a, const vfloat4& b) { return mask & (a >= b); }
__forceinline vboolf4 gt(const vboolf4& mask, const vfloat4& a, const vfloat4& b) { return mask & (a > b); }
__forceinline vboolf4 le(const vboolf4& mask, const vfloat4& a, const vfloat4& b) { return mask & (a <= b); }
#endif
template<int mask>
__forceinline vfloat4 select(const vfloat4& t, const vfloat4& f)
{
#if defined(__SSE4_1__)
return _mm_blend_ps(f, t, mask);
#else
return select(vboolf4(mask), t, f);
#endif
}
__forceinline vfloat4 lerp(const vfloat4& a, const vfloat4& b, const vfloat4& t) {
return madd(t,b-a,a);
}
__forceinline bool isvalid(const vfloat4& v) {
return all((v > vfloat4(-FLT_LARGE)) & (v < vfloat4(+FLT_LARGE)));
}
__forceinline bool is_finite(const vfloat4& a) {
return all((a >= vfloat4(-FLT_MAX)) & (a <= vfloat4(+FLT_MAX)));
}
__forceinline bool is_finite(const vboolf4& valid, const vfloat4& a) {
return all(valid, (a >= vfloat4(-FLT_MAX)) & (a <= vfloat4(+FLT_MAX)));
}
////////////////////////////////////////////////////////////////////////////////
/// Rounding Functions
////////////////////////////////////////////////////////////////////////////////
#if defined (__SSE4_1__)
__forceinline vfloat4 floor(const vfloat4& a) { return _mm_round_ps(a, _MM_FROUND_TO_NEG_INF ); }
__forceinline vfloat4 ceil (const vfloat4& a) { return _mm_round_ps(a, _MM_FROUND_TO_POS_INF ); }
__forceinline vfloat4 trunc(const vfloat4& a) { return _mm_round_ps(a, _MM_FROUND_TO_ZERO ); }
__forceinline vfloat4 round(const vfloat4& a) { return _mm_round_ps(a, _MM_FROUND_TO_NEAREST_INT); }
#else
__forceinline vfloat4 floor(const vfloat4& a) { return vfloat4(floorf(a[0]),floorf(a[1]),floorf(a[2]),floorf(a[3])); }
__forceinline vfloat4 ceil (const vfloat4& a) { return vfloat4(ceilf (a[0]),ceilf (a[1]),ceilf (a[2]),ceilf (a[3])); }
__forceinline vfloat4 trunc(const vfloat4& a) { return vfloat4(truncf(a[0]),truncf(a[1]),truncf(a[2]),truncf(a[3])); }
__forceinline vfloat4 round(const vfloat4& a) { return vfloat4(roundf(a[0]),roundf(a[1]),roundf(a[2]),roundf(a[3])); }
#endif
__forceinline vfloat4 frac(const vfloat4& a) { return a-floor(a); }
__forceinline vint4 floori(const vfloat4& a) {
#if defined(__SSE4_1__)
return vint4(floor(a));
#else
return vint4(a-vfloat4(0.5f));
#endif
}
////////////////////////////////////////////////////////////////////////////////
/// Movement/Shifting/Shuffling Functions
////////////////////////////////////////////////////////////////////////////////
__forceinline vfloat4 unpacklo(const vfloat4& a, const vfloat4& b) { return _mm_unpacklo_ps(a, b); }
__forceinline vfloat4 unpackhi(const vfloat4& a, const vfloat4& b) { return _mm_unpackhi_ps(a, b); }
template<int i0, int i1, int i2, int i3>
__forceinline vfloat4 shuffle(const vfloat4& v) {
return _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(v), _MM_SHUFFLE(i3, i2, i1, i0)));
}
template<int i0, int i1, int i2, int i3>
__forceinline vfloat4 shuffle(const vfloat4& a, const vfloat4& b) {
return _mm_shuffle_ps(a, b, _MM_SHUFFLE(i3, i2, i1, i0));
}
#if defined (__SSSE3__)
__forceinline vfloat4 shuffle8(const vfloat4& a, const vint4& shuf) {
return _mm_castsi128_ps(_mm_shuffle_epi8(_mm_castps_si128(a), shuf));
}
#endif
#if defined(__SSE3__)
template<> __forceinline vfloat4 shuffle<0, 0, 2, 2>(const vfloat4& v) { return _mm_moveldup_ps(v); }
template<> __forceinline vfloat4 shuffle<1, 1, 3, 3>(const vfloat4& v) { return _mm_movehdup_ps(v); }
template<> __forceinline vfloat4 shuffle<0, 1, 0, 1>(const vfloat4& v) { return _mm_castpd_ps(_mm_movedup_pd(_mm_castps_pd(v))); }
#endif
template<int i>
__forceinline vfloat4 shuffle(const vfloat4& v) {
return shuffle<i,i,i,i>(v);
}
#if defined (__SSE4_1__) && !defined(__GNUC__)
template<int i> __forceinline float extract(const vfloat4& a) { return _mm_cvtss_f32(_mm_extract_ps(a,i)); }
#else
template<int i> __forceinline float extract(const vfloat4& a) { return _mm_cvtss_f32(shuffle<i,i,i,i>(a)); }
#endif
template<> __forceinline float extract<0>(const vfloat4& a) { return _mm_cvtss_f32(a); }
#if defined (__SSE4_1__)
template<int dst, int src, int clr> __forceinline vfloat4 insert(const vfloat4& a, const vfloat4& b) { return _mm_insert_ps(a, b, (dst << 4) | (src << 6) | clr); }
template<int dst, int src> __forceinline vfloat4 insert(const vfloat4& a, const vfloat4& b) { return insert<dst, src, 0>(a, b); }
template<int dst> __forceinline vfloat4 insert(const vfloat4& a, const float b) { return insert<dst, 0>(a, _mm_set_ss(b)); }
#else
template<int dst, int src> __forceinline vfloat4 insert(const vfloat4& a, const vfloat4& b) { vfloat4 c = a; c[dst&3] = b[src&3]; return c; }
template<int dst> __forceinline vfloat4 insert(const vfloat4& a, float b) { vfloat4 c = a; c[dst&3] = b; return c; }
#endif
__forceinline float toScalar(const vfloat4& v) { return _mm_cvtss_f32(v); }
__forceinline vfloat4 broadcast4f(const vfloat4& a, size_t k) {
return vfloat4::broadcast(&a[k]);
}
__forceinline vfloat4 shift_right_1(const vfloat4& x) {
return _mm_castsi128_ps(_mm_srli_si128(_mm_castps_si128(x), 4));
}
#if defined (__AVX2__)
__forceinline vfloat4 permute(const vfloat4 &a, const __m128i &index) {
return _mm_permutevar_ps(a,index);
}
__forceinline vfloat4 broadcast1f(const void* a) { return _mm_broadcast_ss((float*)a); }
#endif
#if defined(__AVX512VL__)
template<int i>
__forceinline vfloat4 align_shift_right(const vfloat4& a, const vfloat4& b) {
return _mm_castsi128_ps(_mm_alignr_epi32(_mm_castps_si128(a), _mm_castps_si128(b), i));
}
#endif
////////////////////////////////////////////////////////////////////////////////
/// Sorting Network
////////////////////////////////////////////////////////////////////////////////
__forceinline vfloat4 sort_ascending(const vfloat4& v)
{
const vfloat4 a0 = v;
const vfloat4 b0 = shuffle<1,0,3,2>(a0);
const vfloat4 c0 = min(a0,b0);
const vfloat4 d0 = max(a0,b0);
const vfloat4 a1 = select<0x5 /* 0b0101 */>(c0,d0);
const vfloat4 b1 = shuffle<2,3,0,1>(a1);
const vfloat4 c1 = min(a1,b1);
const vfloat4 d1 = max(a1,b1);
const vfloat4 a2 = select<0x3 /* 0b0011 */>(c1,d1);
const vfloat4 b2 = shuffle<0,2,1,3>(a2);
const vfloat4 c2 = min(a2,b2);
const vfloat4 d2 = max(a2,b2);
const vfloat4 a3 = select<0x2 /* 0b0010 */>(c2,d2);
return a3;
}
__forceinline vfloat4 sort_descending(const vfloat4& v)
{
const vfloat4 a0 = v;
const vfloat4 b0 = shuffle<1,0,3,2>(a0);
const vfloat4 c0 = max(a0,b0);
const vfloat4 d0 = min(a0,b0);
const vfloat4 a1 = select<0x5 /* 0b0101 */>(c0,d0);
const vfloat4 b1 = shuffle<2,3,0,1>(a1);
const vfloat4 c1 = max(a1,b1);
const vfloat4 d1 = min(a1,b1);
const vfloat4 a2 = select<0x3 /* 0b0011 */>(c1,d1);
const vfloat4 b2 = shuffle<0,2,1,3>(a2);
const vfloat4 c2 = max(a2,b2);
const vfloat4 d2 = min(a2,b2);
const vfloat4 a3 = select<0x2 /* 0b0010 */>(c2,d2);
return a3;
}
////////////////////////////////////////////////////////////////////////////////
/// Transpose
////////////////////////////////////////////////////////////////////////////////
__forceinline void transpose(const vfloat4& r0, const vfloat4& r1, const vfloat4& r2, const vfloat4& r3, vfloat4& c0, vfloat4& c1, vfloat4& c2, vfloat4& c3)
{
vfloat4 l02 = unpacklo(r0,r2);
vfloat4 h02 = unpackhi(r0,r2);
vfloat4 l13 = unpacklo(r1,r3);
vfloat4 h13 = unpackhi(r1,r3);
c0 = unpacklo(l02,l13);
c1 = unpackhi(l02,l13);
c2 = unpacklo(h02,h13);
c3 = unpackhi(h02,h13);
}
__forceinline void transpose(const vfloat4& r0, const vfloat4& r1, const vfloat4& r2, const vfloat4& r3, vfloat4& c0, vfloat4& c1, vfloat4& c2)
{
vfloat4 l02 = unpacklo(r0,r2);
vfloat4 h02 = unpackhi(r0,r2);
vfloat4 l13 = unpacklo(r1,r3);
vfloat4 h13 = unpackhi(r1,r3);
c0 = unpacklo(l02,l13);
c1 = unpackhi(l02,l13);
c2 = unpacklo(h02,h13);
}
////////////////////////////////////////////////////////////////////////////////
/// Reductions
////////////////////////////////////////////////////////////////////////////////
__forceinline vfloat4 vreduce_min(const vfloat4& v) { vfloat4 h = min(shuffle<1,0,3,2>(v),v); return min(shuffle<2,3,0,1>(h),h); }
__forceinline vfloat4 vreduce_max(const vfloat4& v) { vfloat4 h = max(shuffle<1,0,3,2>(v),v); return max(shuffle<2,3,0,1>(h),h); }
__forceinline vfloat4 vreduce_add(const vfloat4& v) { vfloat4 h = shuffle<1,0,3,2>(v) + v ; return shuffle<2,3,0,1>(h) + h ; }
__forceinline float reduce_min(const vfloat4& v) { return _mm_cvtss_f32(vreduce_min(v)); }
__forceinline float reduce_max(const vfloat4& v) { return _mm_cvtss_f32(vreduce_max(v)); }
__forceinline float reduce_add(const vfloat4& v) { return _mm_cvtss_f32(vreduce_add(v)); }
__forceinline size_t select_min(const vboolf4& valid, const vfloat4& v)
{
const vfloat4 a = select(valid,v,vfloat4(pos_inf));
const vbool4 valid_min = valid & (a == vreduce_min(a));
return bsf(movemask(any(valid_min) ? valid_min : valid));
}
__forceinline size_t select_max(const vboolf4& valid, const vfloat4& v)
{
const vfloat4 a = select(valid,v,vfloat4(neg_inf));
const vbool4 valid_max = valid & (a == vreduce_max(a));
return bsf(movemask(any(valid_max) ? valid_max : valid));
}
////////////////////////////////////////////////////////////////////////////////
/// Euclidian Space Operators
////////////////////////////////////////////////////////////////////////////////
__forceinline float dot(const vfloat4& a, const vfloat4& b) {
return reduce_add(a*b);
}
__forceinline vfloat4 cross(const vfloat4& a, const vfloat4& b)
{
const vfloat4 a0 = a;
const vfloat4 b0 = shuffle<1,2,0,3>(b);
const vfloat4 a1 = shuffle<1,2,0,3>(a);
const vfloat4 b1 = b;
return shuffle<1,2,0,3>(msub(a0,b0,a1*b1));
}
////////////////////////////////////////////////////////////////////////////////
/// Output Operators
////////////////////////////////////////////////////////////////////////////////
__forceinline embree_ostream operator <<(embree_ostream cout, const vfloat4& a) {
return cout << "<" << a[0] << ", " << a[1] << ", " << a[2] << ", " << a[3] << ">";
}
}
| 46.488011 | 165 | 0.623028 |
88f18968e2f3311c937e66bb1bc7dd15d1531299 | 745 | h | C | code/engine/xrRenderCommon/dxApplicationRender.h | InNoHurryToCode/xray-162 | fff9feb9ffb681b3c6ba1dc7c4534fe80006f87e | [
"Apache-2.0"
] | 58 | 2016-11-20T19:14:35.000Z | 2021-12-27T21:03:35.000Z | code/engine/xrRenderCommon/dxApplicationRender.h | InNoHurryToCode/xray-162 | fff9feb9ffb681b3c6ba1dc7c4534fe80006f87e | [
"Apache-2.0"
] | 59 | 2016-09-10T10:44:20.000Z | 2018-09-03T19:07:30.000Z | code/engine/xrRenderCommon/dxApplicationRender.h | InNoHurryToCode/xray-162 | fff9feb9ffb681b3c6ba1dc7c4534fe80006f87e | [
"Apache-2.0"
] | 39 | 2017-02-05T13:35:37.000Z | 2022-03-14T11:00:12.000Z | #ifndef dxApplicationRender_included
#define dxApplicationRender_included
#pragma once
#include "xrRender\ApplicationRender.h"
class dxApplicationRender : public IApplicationRender {
public:
virtual void Copy(IApplicationRender& _in);
virtual void LoadBegin();
virtual void destroy_loading_shaders();
virtual void setLevelLogo(LPCSTR pszLogoName);
virtual void load_draw_internal(CApplication& owner);
// ?????
virtual void KillHW();
private:
ref_shader hLevelLogo;
ref_shader hLevelLogo_Add;
ref_geom ll_hGeom;
ref_geom ll_hGeom2;
ref_shader sh_progress;
void draw_face(ref_shader& sh, Frect& coords, Frect& tex_coords, const Fvector2& tex_size);
};
#endif // ApplicationRender_included | 26.607143 | 95 | 0.759732 |
5322cd1916f6c2fbb06088e7d6d0625a7f5f3a2d | 405 | h | C | Source/GAS_Example/Public/Engine/CustomEngineSubsystem.h | reidsanders/Narxim-GAS-Example | ed9858673a0a5756b30e8fb5e3dd8144ec9f0c21 | [
"MIT"
] | 59 | 2021-02-09T19:36:59.000Z | 2022-03-24T13:05:18.000Z | Source/GAS_Example/Public/Engine/CustomEngineSubsystem.h | reidsanders/Narxim-GAS-Example | ed9858673a0a5756b30e8fb5e3dd8144ec9f0c21 | [
"MIT"
] | 1 | 2021-05-07T02:31:42.000Z | 2021-05-07T02:41:33.000Z | Source/GAS_Example/Public/Engine/CustomEngineSubsystem.h | reidsanders/Narxim-GAS-Example | ed9858673a0a5756b30e8fb5e3dd8144ec9f0c21 | [
"MIT"
] | 7 | 2021-02-24T01:32:03.000Z | 2022-03-28T14:08:07.000Z | // Copyright 2021 Joseph "Narxim" Thigpen.
#pragma once
#include "CoreMinimal.h"
#include "Subsystems/EngineSubsystem.h"
#include "CustomEngineSubsystem.generated.h"
// Initializes the UAbilitySystemGlobals module.
UCLASS()
class GAS_EXAMPLE_API UCustomEngineSubsystem : public UEngineSubsystem
{
GENERATED_BODY()
public:
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
}; | 21.315789 | 72 | 0.804938 |
63ec190d19366f1cdab9649444c5afae7a57f5f8 | 2,984 | h | C | Source/T1ProjectEditor/SMyRowEditor.h | BaekTaehyun/T1Project | d7d98c7cfc88e57513631124c32dfee8794307db | [
"MIT"
] | 3 | 2019-06-25T05:09:47.000Z | 2020-09-30T18:06:17.000Z | Source/T1ProjectEditor/SMyRowEditor.h | BaekTaehyun/T1Project | d7d98c7cfc88e57513631124c32dfee8794307db | [
"MIT"
] | null | null | null | Source/T1ProjectEditor/SMyRowEditor.h | BaekTaehyun/T1Project | d7d98c7cfc88e57513631124c32dfee8794307db | [
"MIT"
] | 2 | 2018-10-15T08:09:16.000Z | 2020-04-07T05:25:52.000Z | // Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Input/Reply.h"
#include "Widgets/SWidget.h"
#include "Widgets/DeclarativeSyntaxSupport.h"
#include "Widgets/SCompoundWidget.h"
#include "Kismet2/StructureEditorUtils.h"
#include "DataTableEditorUtils.h"
#include "Misc/NotifyHook.h"
#include "Widgets/Input/SComboBox.h"
class IStructureDetailsView;
class SEditableTextBox;
class FStructOnScope;
DECLARE_DELEGATE_OneParam(FOnRowModified, FName /*Row name*/);
DECLARE_DELEGATE_OneParam(FOnRowSelected, FName /*Row name*/);
class SMyRowEditor : public SCompoundWidget
, public FNotifyHook
, public FStructureEditorUtils::INotifyOnStructChanged
, public FDataTableEditorUtils::INotifyOnDataTableChanged
{
public:
SLATE_BEGIN_ARGS(SMyRowEditor) {}
SLATE_END_ARGS()
SMyRowEditor();
virtual ~SMyRowEditor();
// FNotifyHook
virtual void NotifyPreChange( UProperty* PropertyAboutToChange ) override;
virtual void NotifyPostChange( const FPropertyChangedEvent& PropertyChangedEvent, UProperty* PropertyThatChanged ) override;
// INotifyOnStructChanged
virtual void PreChange(const class UUserDefinedStruct* Struct, FStructureEditorUtils::EStructureEditorChangeInfo Info) override;
virtual void PostChange(const class UUserDefinedStruct* Struct, FStructureEditorUtils::EStructureEditorChangeInfo Info) override;
// INotifyOnDataTableChanged
virtual void PreChange(const UDataTable* Changed, FDataTableEditorUtils::EDataTableChangeInfo Info) override;
virtual void PostChange(const UDataTable* Changed, FDataTableEditorUtils::EDataTableChangeInfo Info) override;
FOnRowSelected RowSelectedCallback;
private:
TArray<TSharedPtr<FName>> CachedRowNames;
TSharedPtr<FStructOnScope> CurrentRow;
TSoftObjectPtr<UDataTable> DataTable; // weak obj ptr couldn't handle reimporting
TSharedPtr<class IStructureDetailsView> StructureDetailsView;
TSharedPtr<FName> SelectedName;
TSharedPtr<SComboBox<TSharedPtr<FName>>> RowComboBox;
TSharedPtr<SEditableTextBox> RenameTextBox;
void RefreshNameList();
void CleanBeforeChange();
void Restore();
UScriptStruct* GetScriptStruct() const;
FName GetCurrentName() const;
FText GetCurrentNameAsText() const;
FString GetStructureDisplayName() const;
TSharedRef<SWidget> OnGenerateWidget(TSharedPtr<FName> InItem);
void OnSelectionChanged(TSharedPtr<FName> InItem, ESelectInfo::Type InSeletionInfo);
FReply OnAddClicked();
FReply OnRemoveClicked();
FReply OnMoveRowClicked(FDataTableEditorUtils::ERowMoveDirection MoveDirection);
FReply OnMoveToExtentClicked(FDataTableEditorUtils::ERowMoveDirection MoveDirection);
void OnRowRenamed(const FText& Text, ETextCommit::Type CommitType);
FReply OnResetToDefaultClicked();
EVisibility GetResetToDefaultVisibility()const ;
public:
//void AllRemove();
void Construct(const FArguments& InArgs, UDataTable* Changed);
void Construct(UDataTable* Changed);
void SelectRow(FName Name);
void HandleUndoRedo();
};
| 34.298851 | 130 | 0.82071 |
63f87e1260349bcea41190798752512f6fe71ea9 | 237 | h | C | JKAlertX/Classes/View/ActionSheet/JKAlertTableActionView.h | Dilrvvr/JKAlertX | 8104fc0e9b488edc6b8f95f8f92f0602845d5f2a | [
"MIT"
] | 13 | 2020-08-12T03:53:30.000Z | 2022-03-28T05:10:30.000Z | JKAlertX/Classes/View/ActionSheet/JKAlertTableActionView.h | Dilrvvr/JKAlertX | 8104fc0e9b488edc6b8f95f8f92f0602845d5f2a | [
"MIT"
] | 2 | 2020-07-29T06:39:56.000Z | 2020-08-17T09:29:44.000Z | JKAlertX/Classes/View/ActionSheet/JKAlertTableActionView.h | Dilrvvr/JKAlertX | 8104fc0e9b488edc6b8f95f8f92f0602845d5f2a | [
"MIT"
] | 1 | 2021-12-17T05:44:31.000Z | 2021-12-17T05:44:31.000Z | //
// JKAlertTableActionView.h
// JKAlertX
//
// Created by Albert on 2020/5/10.
// Copyright © 2020 Albert. All rights reserved.
//
#import "JKAlertBaseActionView.h"
@interface JKAlertTableActionView : JKAlertBaseActionView
@end
| 16.928571 | 57 | 0.734177 |
762c740b533679e377bda7c65dc36985e57746cf | 1,924 | c | C | isr_gpio/btn.c | chethanmaurian/CatchTheColour | fd22a59a87892face995e800324f3a867d28e867 | [
"MIT"
] | null | null | null | isr_gpio/btn.c | chethanmaurian/CatchTheColour | fd22a59a87892face995e800324f3a867d28e867 | [
"MIT"
] | null | null | null | isr_gpio/btn.c | chethanmaurian/CatchTheColour | fd22a59a87892face995e800324f3a867d28e867 | [
"MIT"
] | null | null | null | #include <linux/init.h> // Macros used to mark up functions e.g. __init __exit
#include <linux/module.h> // Core header for loading LKMs into the kernel
#include <linux/device.h> // Header to support the kernel Driver Model
#include <linux/kernel.h> // Contains types, macros, functions for the kernel
#include <linux/fs.h> // Header for the Linux file system support
#include <linux/uaccess.h> // Required for the copy to user function
#include <linux/gpio/driver.h>
#include <linux/gpio.h>
#include <linux/irq.h>
#include <linux/gpio.h>
#include <linux/interrupt.h>
#define YELLOW 200 //GPIO7_8
#define SWITCH 91 //GPIO3_27
static irqreturn_t btn_press(void);
//static const struct file_operations btn_fops = {
// .open = btn_open,
// .release = btn_close,
//.read = btn_read,
//.unlocked_ioctl = btn_unlocked_ioctl,
//};
static irqreturn_t btn_press(void){
printk(KERN_INFO "Int received\n");
gpio_direction_output(YELLOW,1);
return (irqreturn_t)IRQ_HANDLED;
}
static int __init open_init(void)
{
int ret;
int irq_number;
int d_ret;
printk(KERN_INFO "Init GPIO91 switch\n");
/* Turn off LED first */
gpio_direction_input(SWITCH);
gpio_direction_output(YELLOW,0);
d_ret = gpio_set_debounce(SWITCH, 1500);
printk(KERN_INFO "debounce return %d", d_ret);
/* Create IRQ request */
irq_number = gpio_to_irq(91);
printk("number %d\n", irq_number);
ret = request_irq(gpio_to_irq(91), (irq_handler_t)btn_press, IRQF_TRIGGER_FALLING, "btn", NULL);
if (ret < 0){
printk("Error with requset_irq");
printk(KERN_ALERT "%s: request_irg failed with %d\n",__func__, ret);
}
return 0;
}
static void __exit close_exit(void)
{
gpio_direction_output(YELLOW,0);
/*Free the IRQ*/
free_irq(gpio_to_irq(91), NULL);
printk(KERN_INFO "Exit GPIO91 switch\n");
}
module_init(open_init);
module_exit(close_exit);
MODULE_LICENSE("GPL");
| 27.884058 | 97 | 0.705301 |
17e71eb2f74ce473faf97972b8e00ec8c74c6d39 | 285 | h | C | libc/include/errno.h | shockkolate/shockk-os | 1cbe2e14be6a8dd4bbe808e199284b6979dacdff | [
"Apache-2.0"
] | 2 | 2015-11-16T07:30:38.000Z | 2016-03-26T21:14:42.000Z | libc/include/errno.h | shockkolate/shockk-os | 1cbe2e14be6a8dd4bbe808e199284b6979dacdff | [
"Apache-2.0"
] | null | null | null | libc/include/errno.h | shockkolate/shockk-os | 1cbe2e14be6a8dd4bbe808e199284b6979dacdff | [
"Apache-2.0"
] | null | null | null | #ifndef _ERRNO_H
#define _ERRNO_H 1
enum _errno_e {
EACCES,
EAFNOSUPPORT,
EAGAIN,
EBADF,
EBUSY,
ECHILD,
EEXIST,
EINTR,
EINVAL,
EIO,
EISDIR,
ELOOP,
ENAMETOOLONG,
ENOENT,
ENOEXEC,
ENOMEM,
ENOSYS,
ENOTTY,
ENOTDIR,
ERANGE,
ESPIPE,
EWOULDBLOCK
};
int errno;
#endif
| 8.90625 | 18 | 0.694737 |
c0ee89ec7ff22b1e3932d71a438d2a5cf7ce290d | 79 | h | C | server/inc/upload.h | Xudmud/CSCI3763_Lab2 | 617df2502f8f0fd00939508a78aa7cc24f5bac7d | [
"MIT"
] | null | null | null | server/inc/upload.h | Xudmud/CSCI3763_Lab2 | 617df2502f8f0fd00939508a78aa7cc24f5bac7d | [
"MIT"
] | 1 | 2019-04-17T22:54:30.000Z | 2019-04-17T22:54:30.000Z | server/inc/upload.h | Xudmud/CSCI3763_Lab2 | 617df2502f8f0fd00939508a78aa7cc24f5bac7d | [
"MIT"
] | null | null | null | #ifndef SERVUL_H
#define SERVUL_H
void servul(int sockfd, char* comm);
#endif | 13.166667 | 36 | 0.759494 |
9949132d46328ecb2e07adc3c992497845091b92 | 4,920 | h | C | test/test_vk/mesh_data.h | deepmining7/RadeonRays_SDK | c8890b96b1f976bedd2cd280cc170dff5d655e0a | [
"MIT"
] | 706 | 2016-07-27T01:07:30.000Z | 2022-03-30T18:46:21.000Z | test/test_vk/mesh_data.h | deepmining7/RadeonRays_SDK | c8890b96b1f976bedd2cd280cc170dff5d655e0a | [
"MIT"
] | 100 | 2016-07-27T13:13:15.000Z | 2022-02-21T09:25:46.000Z | test/test_vk/mesh_data.h | deepmining7/RadeonRays_SDK | c8890b96b1f976bedd2cd280cc170dff5d655e0a | [
"MIT"
] | 168 | 2016-08-06T23:29:56.000Z | 2022-02-19T21:26:42.000Z | /**********************************************************************
Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
********************************************************************/
#pragma once
#include <map>
#include <string>
#include <vector>
#include "tiny_obj_loader.h"
struct MeshData
{
MeshData(const std::string& fileName)
{
tinyobj::attrib_t attrib;
std::vector<tinyobj::shape_t> shapes;
std::vector<tinyobj::material_t> objmaterials;
std::string warn;
std::string err;
bool ret = tinyobj::LoadObj(
&attrib, &shapes, &objmaterials, &warn, &err, fileName.c_str(), "");
if (!err.empty())
{
throw std::runtime_error(err);
}
if (!ret)
{
throw std::runtime_error(err);
}
Init(shapes.begin(), shapes.end(), attrib);
}
MeshData(std::vector<tinyobj::shape_t>::const_iterator begin,
std::vector<tinyobj::shape_t>::const_iterator end,
tinyobj::attrib_t const& attrib)
{
Init(begin, end, attrib);
}
void Init(std::vector<tinyobj::shape_t>::const_iterator begin,
std::vector<tinyobj::shape_t>::const_iterator end,
tinyobj::attrib_t const& attrib)
{
struct IndexLess
{
bool operator()(tinyobj::index_t const& lhs,
tinyobj::index_t const& rhs) const
{
return lhs.vertex_index != rhs.vertex_index
? lhs.vertex_index < rhs.vertex_index
: lhs.normal_index != rhs.normal_index
? lhs.normal_index < rhs.normal_index
: lhs.texcoord_index != rhs.texcoord_index
? lhs.texcoord_index < rhs.texcoord_index
: false;
}
};
std::map<tinyobj::index_t, uint32_t, IndexLess> indexCache;
uint32_t shapeIndex = 0;
for (auto it = begin; it < end; it++)
{
for (uint32_t i = 0u; i < it->mesh.indices.size(); ++i)
{
auto index = it->mesh.indices[i];
auto iter = indexCache.find(index);
if (iter != indexCache.cend())
{
indices.push_back(iter->second);
}
else
{
uint32_t vertexIndex = (uint32_t)positions.size() / 3;
indices.push_back(vertexIndex);
indexCache[index] = vertexIndex;
positions.push_back(
attrib.vertices[3 * index.vertex_index]);
positions.push_back(
attrib.vertices[3 * index.vertex_index + 1]);
positions.push_back(
attrib.vertices[3 * index.vertex_index + 2]);
}
}
++shapeIndex;
}
}
std::vector<float> positions;
std::vector<std::uint32_t> indices;
};
struct SceneData
{
SceneData(const std::string& fileName)
{
tinyobj::attrib_t attrib;
std::vector<tinyobj::shape_t> shapes;
std::vector<tinyobj::material_t> objmaterials;
std::string warn;
std::string err;
bool ret = tinyobj::LoadObj(
&attrib, &shapes, &objmaterials, &warn, &err, fileName.c_str(), "");
if (!err.empty())
{
throw std::runtime_error(err);
}
if (!ret)
{
throw std::runtime_error(err);
}
for (auto it = shapes.begin(); it < shapes.end(); it++)
{
meshes.emplace_back(MeshData(it, it + 1, attrib));
}
}
std::vector<MeshData> meshes;
}; | 33.931034 | 80 | 0.547764 |
8597060db4e9fa9affe69a97faf8b7490d4af122 | 2,671 | c | C | 11marzo/planificador.c | chrigarc/computo_evolutivo_20212 | 9a67173d1194063678788e1638e0a548985d77a2 | [
"MIT"
] | null | null | null | 11marzo/planificador.c | chrigarc/computo_evolutivo_20212 | 9a67173d1194063678788e1638e0a548985d77a2 | [
"MIT"
] | null | null | null | 11marzo/planificador.c | chrigarc/computo_evolutivo_20212 | 9a67173d1194063678788e1638e0a548985d77a2 | [
"MIT"
] | null | null | null | #include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/wait.h>
#include <sys/types.h>
int main(int argc, char **argv) {
char *machinesFile = argv[1];
char *tasksFile = argv[2];
int totalRecursos = atoi(argv[3]);
int totalTareas = atoi(argv[4]);
FILE *fTasks, *fMachines; //Variables para manejo de archivos
fTasks = fopen(tasksFile, "r"); //Abre para lectura
fMachines = fopen(machinesFile, "r"); //Abre para lectura
size_t bufsize = 2000;
char tareaActual[bufsize];
char *buffer = tareaActual;
// Init lista de recursos disponibles
char *machines[totalRecursos];
int lista_recursos[totalRecursos];
// printf("Leyendo lista de recuros disponibles...\n");
ssize_t read;
size_t len = 0;
for(int i =0; i < totalRecursos; i++) {
machines[i] = malloc(sizeof(char)*bufsize);
read = getline(&machines[i], &len, fMachines);
machines[i][strlen(machines[i]) - 1] = '\0';
lista_recursos[i] = 0;
}
fclose(fMachines);
char buffArg[2000];
char *args[] = {"/bin/sh", "-c", buffArg, NULL};
int status;
pid_t pidActual, recurso_disp;
int numProcesos = 0;
int enEjecucion = 0;
while ( numProcesos < totalTareas) {
getline(&buffer, &bufsize, fTasks);
buffer[strlen(buffer) - 1] = '\0';
// Buscar un recurso disponible
recurso_disp = -1;
for(int i=0; i < totalRecursos; i++ ) {
if (lista_recursos[i] == 0) {
recurso_disp = i;
break;
}
}
if (recurso_disp < 0) {
// Espera a que se libere un recurso:
pid_t idTermino = wait(&status);
//printf("Termino de ejecutar el proceso: %d \n", pidActual);
enEjecucion--;
// Una vez que un proceso termino, buscamos el recurso libre
// Y lo liberamos:
for(int i=0; i < totalRecursos; i++) {
if (lista_recursos[i] == idTermino) {
recurso_disp = i;
lista_recursos[i] = 0;
}
}
}
usleep(10000); // Espera 0.01 segundos
pidActual = fork();
if ( pidActual == 0 ) { /* hijo */
sprintf(args[2], "%s", buffer); //esta linea es para no depender del ssh y ejecutar directamente en local
// Ejecuta el programa usando recurso_dis
execv(args[0], args);
} else { /* padre */
// registra el proceso creado:
numProcesos++;
enEjecucion++;
// Registra recurso_dis ocupado por el proceso creado:
lista_recursos[recurso_disp] = pidActual;
}
}
for(int i=0; i < enEjecucion; i++) {
pidActual = wait(&status);
}
fclose(fTasks);
for(int i =0; i < totalRecursos; i++) {
free(machines[i]);
}
return 0;
}
| 23.848214 | 112 | 0.603894 |
389e824fcca654aef313db23327df03eabb88bef | 277 | c | C | net/junkbuster/files/patch-encode.c | davidlrichmond/macports-ports | c79eda419c3963c074e4e9ce31a95296636bd500 | [
"BSD-3-Clause"
] | 1,199 | 2016-10-16T01:55:27.000Z | 2022-03-28T17:07:12.000Z | net/junkbuster/files/patch-encode.c | davidlrichmond/macports-ports | c79eda419c3963c074e4e9ce31a95296636bd500 | [
"BSD-3-Clause"
] | 11,428 | 2016-10-31T16:54:32.000Z | 2022-03-31T22:58:45.000Z | net/junkbuster/files/patch-encode.c | davidlrichmond/macports-ports | c79eda419c3963c074e4e9ce31a95296636bd500 | [
"BSD-3-Clause"
] | 1,772 | 2016-10-16T22:28:33.000Z | 2022-03-31T08:52:24.000Z | diff -urN ../ijb-zlib-11.orig/encode.c ./encode.c
--- ../ijb-zlib-11.orig/encode.c Thu Aug 3 23:38:38 2000
+++ ./encode.c Thu Jan 6 15:05:14 2005
@@ -13,7 +13,7 @@
#include <ctype.h>
#ifdef REGEX
-#include "gnu_regex.h"
+#include <gnuregex.h>
#endif
#include "jcc.h"
| 21.307692 | 57 | 0.624549 |
75a86411643a62c6a8686c2be383f29860add0e8 | 1,071 | h | C | llvm/include/llvm/DebugInfo/PDB/PDBSymbolCustom.h | medismailben/llvm-project | e334a839032fe500c3bba22bf976ab7af13ce1c1 | [
"Apache-2.0"
] | 4,812 | 2015-01-02T19:38:10.000Z | 2022-03-27T12:42:24.000Z | llvm/include/llvm/DebugInfo/PDB/PDBSymbolCustom.h | medismailben/llvm-project | e334a839032fe500c3bba22bf976ab7af13ce1c1 | [
"Apache-2.0"
] | 11,789 | 2015-01-05T04:50:15.000Z | 2022-03-31T23:39:19.000Z | llvm/include/llvm/DebugInfo/PDB/PDBSymbolCustom.h | medismailben/llvm-project | e334a839032fe500c3bba22bf976ab7af13ce1c1 | [
"Apache-2.0"
] | 2,543 | 2015-01-01T11:18:36.000Z | 2022-03-22T21:32:36.000Z | //===- PDBSymbolCustom.h - compiler-specific types --------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_DEBUGINFO_PDB_PDBSYMBOLCUSTOM_H
#define LLVM_DEBUGINFO_PDB_PDBSYMBOLCUSTOM_H
#include "PDBSymbol.h"
#include "PDBTypes.h"
#include "llvm/ADT/SmallVector.h"
namespace llvm {
class raw_ostream;
namespace pdb {
/// PDBSymbolCustom represents symbols that are compiler-specific and do not
/// fit anywhere else in the lexical hierarchy.
/// https://msdn.microsoft.com/en-us/library/d88sf09h.aspx
class PDBSymbolCustom : public PDBSymbol {
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Custom)
public:
void dump(PDBSymDumper &Dumper) const override;
void getDataBytes(llvm::SmallVector<uint8_t, 32> &bytes);
};
} // namespace llvm
}
#endif // LLVM_DEBUGINFO_PDB_PDBSYMBOLCUSTOM_H
| 29.75 | 80 | 0.697479 |
55f2407f6363a984ea00371a5dc17aac5272fbd0 | 162 | h | C | src/include/container/init.h | alecdotninja/paranoid | 1c72ad1f681b2023561a76459b7443e3ca63b3ec | [
"MIT"
] | 2 | 2018-09-02T22:49:57.000Z | 2020-09-16T07:40:47.000Z | src/include/container/init.h | alecdotninja/paranoid | 1c72ad1f681b2023561a76459b7443e3ca63b3ec | [
"MIT"
] | null | null | null | src/include/container/init.h | alecdotninja/paranoid | 1c72ad1f681b2023561a76459b7443e3ca63b3ec | [
"MIT"
] | null | null | null | #ifndef PARANOID_INIT_H
#define PARANOID_INIT_H
#include "container.h"
container_error_t container_init_exec(container_t *container);
#endif //PARANOID_INIT_H
| 18 | 62 | 0.833333 |
3604f7afc0104806c1671a1805f03d3f26e0734b | 254 | h | C | src/boards/mcu/spi_board.h | luisgcu/SX126x-Arduino | 072acaa9f5cdcc8cdf582bd4d2248c232b1c2b08 | [
"MIT"
] | 118 | 2019-10-02T14:30:43.000Z | 2022-03-25T10:31:04.000Z | src/boards/mcu/spi_board.h | luisgcu/SX126x-Arduino | 072acaa9f5cdcc8cdf582bd4d2248c232b1c2b08 | [
"MIT"
] | 58 | 2019-08-21T15:30:41.000Z | 2022-03-04T02:42:14.000Z | src/boards/mcu/spi_board.h | luisgcu/SX126x-Arduino | 072acaa9f5cdcc8cdf582bd4d2248c232b1c2b08 | [
"MIT"
] | 49 | 2019-09-08T15:44:00.000Z | 2022-03-20T22:42:41.000Z | #ifndef _SPI_BOARD_H
#define _SPI_BOARD_H
#if defined ESP8266 || defined ESP32
#include "boards/mcu/espressif/spi_board.h"
#elif defined(NRF52_SERIES)
#include "boards/mcu/nrf52832/spi_board.h"
#else
#include "boards/mcu/rp2040/spi_board.h"
#endif
#endif | 25.4 | 43 | 0.795276 |
d9cdd2d091627fcea2191f7c2459938453defd73 | 3,386 | h | C | SpatialGDKEditorToolbar/Source/Public/SpatialGDKEditorToolbarSettings.h | kevinimprobable/UnrealGDK | 9dc0ac6a7fa21ca2b96deff9a2721c0ae1a03d49 | [
"FTL",
"OGTSL"
] | null | null | null | SpatialGDKEditorToolbar/Source/Public/SpatialGDKEditorToolbarSettings.h | kevinimprobable/UnrealGDK | 9dc0ac6a7fa21ca2b96deff9a2721c0ae1a03d49 | [
"FTL",
"OGTSL"
] | null | null | null | SpatialGDKEditorToolbar/Source/Public/SpatialGDKEditorToolbarSettings.h | kevinimprobable/UnrealGDK | 9dc0ac6a7fa21ca2b96deff9a2721c0ae1a03d49 | [
"FTL",
"OGTSL"
] | null | null | null | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved
#pragma once
#include "Engine/EngineTypes.h"
#include "SpatialGDKEditorToolbarSettings.generated.h"
USTRUCT()
struct FInteropTypebindingInfo
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, config, Category = "Configuration", meta = (ConfigRestartRequired = false))
UClass* ReplicatedClass;
UPROPERTY(EditAnywhere, config, Category = "Configuration", meta = (ConfigRestartRequired = false))
TArray<FString> IncludeList;
};
UCLASS(config = EditorPerProjectUserSettings, defaultconfig)
class USpatialGDKEditorToolbarSettings : public UObject
{
GENERATED_BODY()
public:
USpatialGDKEditorToolbarSettings(const FObjectInitializer& ObjectInitializer);
private:
/** Root folder of your SpatialOS Unreal GDK project. */
UPROPERTY(EditAnywhere, config, Category = "Configuration", meta = (ConfigRestartRequired = false))
FDirectoryPath ProjectRootFolder;
public:
/** Launch configuration file used for `spatial local launch`. */
UPROPERTY(EditAnywhere, config, Category = "Configuration", meta = (ConfigRestartRequired = false, DisplayName = "Launch Configuration"))
FString SpatialOSLaunchConfig;
/** Stop `spatial local launch` when shutting down editor. */
UPROPERTY(EditAnywhere, config, Category = "Configuration", meta = (ConfigRestartRequired = false, DisplayName = "Stop on Exit"))
bool bStopSpatialOnExit;
/** Generate schema for all classes supported by the GDK */
UPROPERTY(EditAnywhere, config, Category = "Schema Generation", meta = (ConfigRestartRequired = false, DisplayName = "Generate Schema for all Supported Classes"))
bool bGenerateSchemaForAllSupportedClasses;
private:
/** Path to your SpatialOS snapshot. */
UPROPERTY(EditAnywhere, config, Category = "Configuration", meta = (ConfigRestartRequired = false, DisplayName = "Snapshot path"))
FDirectoryPath SpatialOSSnapshotPath;
/** Name of your SpatialOS snapshot file. */
UPROPERTY(EditAnywhere, config, Category = "Configuration", meta = (ConfigRestartRequired = false, DisplayName = "Snapshot file name"))
FString SpatialOSSnapshotFile;
/** Generated schema output path */
UPROPERTY(EditAnywhere, config, Category = "Schema Generation", meta = (ConfigRestartRequired = false, DisplayName = "Output path for the generated schemas"))
FDirectoryPath GeneratedSchemaOutputFolder;
public:
UFUNCTION()
FORCEINLINE FString GetProjectRoot() const
{
return ProjectRootFolder.Path.IsEmpty()
? FPaths::ConvertRelativePathToFull(FPaths::GetPath(FPaths::GetProjectFilePath()) + FString(TEXT("/../spatial/")))
: ProjectRootFolder.Path;
}
UFUNCTION()
FORCEINLINE FString GetGeneratedSchemaOutputFolder() const
{
return GeneratedSchemaOutputFolder.Path.IsEmpty()
? FPaths::ConvertRelativePathToFull(FPaths::Combine(GetProjectRoot(), FString(TEXT("schema/improbable/unreal/generated/"))))
: GeneratedSchemaOutputFolder.Path;
}
UFUNCTION()
FORCEINLINE FString GetSpatialOSSnapshotPath() const
{
return SpatialOSSnapshotPath.Path.IsEmpty()
? FPaths::ConvertRelativePathToFull(FPaths::Combine(GetProjectRoot(), FString(TEXT("../spatial/snapshots/"))))
: SpatialOSSnapshotPath.Path;
}
UFUNCTION()
FORCEINLINE FString GetSpatialOSSnapshotFile() const
{
return SpatialOSSnapshotFile.IsEmpty()
? FString(TEXT("default.snapshot"))
: SpatialOSSnapshotFile;
}
UFUNCTION()
FString ToString();
};
| 35.270833 | 163 | 0.773479 |
3307701a5191e36accafdde0c5f970f48406f31c | 2,145 | h | C | Source/WebCore/platform/FrameRateMonitor.h | jacadcaps/webkitty | 9aebd2081349f9a7b5d168673c6f676a1450a66d | [
"BSD-2-Clause"
] | 6 | 2021-07-05T16:09:39.000Z | 2022-03-06T22:44:42.000Z | Source/WebCore/platform/FrameRateMonitor.h | jacadcaps/webkitty | 9aebd2081349f9a7b5d168673c6f676a1450a66d | [
"BSD-2-Clause"
] | 7 | 2022-03-15T13:25:39.000Z | 2022-03-15T13:25:44.000Z | Source/WebCore/platform/FrameRateMonitor.h | jacadcaps/webkitty | 9aebd2081349f9a7b5d168673c6f676a1450a66d | [
"BSD-2-Clause"
] | null | null | null | /*
* Copyright (C) 2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 APPLE INC. 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.
*/
#pragma once
#include <wtf/Deque.h>
#include <wtf/Function.h>
#include <wtf/MonotonicTime.h>
namespace WebCore {
class FrameRateMonitor {
public:
struct LateFrameInfo {
MonotonicTime frameTime;
MonotonicTime lastFrameTime;
};
using LateFrameCallback = Function<void(LateFrameInfo)>;
explicit FrameRateMonitor(LateFrameCallback&&);
void update();
double observedFrameRate() const { return m_observedFrameRate; }
size_t frameCount() const { return m_frameCount; }
private:
LateFrameCallback m_lateFrameCallback;
Deque<double, 120> m_observedFrameTimeStamps;
double m_observedFrameRate { 0 };
uint64_t m_frameCount { 0 };
};
inline FrameRateMonitor::FrameRateMonitor(LateFrameCallback&& callback)
: m_lateFrameCallback(WTFMove(callback))
{
}
}
| 35.163934 | 74 | 0.750583 |
81df1b8f38c859804ca114bdc43e95d58c2f0f02 | 799,481 | c | C | evoMPS/matmul.c | ftranschel/evoMPS | b9e8d13066d12ee779376fdfd24ac2b34ac73ba2 | [
"BSD-3-Clause"
] | 1 | 2017-02-26T12:36:40.000Z | 2017-02-26T12:36:40.000Z | evoMPS/matmul.c | ftranschel/evoMPS | b9e8d13066d12ee779376fdfd24ac2b34ac73ba2 | [
"BSD-3-Clause"
] | null | null | null | evoMPS/matmul.c | ftranschel/evoMPS | b9e8d13066d12ee779376fdfd24ac2b34ac73ba2 | [
"BSD-3-Clause"
] | null | null | null | /* Generated by Cython 0.18-pre on Thu May 23 12:21:47 2013 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
#error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02040000
#error Cython requires Python 2.4+.
#else
#include <stddef.h> /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
#ifndef __stdcall
#define __stdcall
#endif
#ifndef __cdecl
#define __cdecl
#endif
#ifndef __fastcall
#define __fastcall
#endif
#endif
#ifndef DL_IMPORT
#define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
#define DL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
#define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
#define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if PY_VERSION_HEX < 0x02050000
typedef int Py_ssize_t;
#define PY_SSIZE_T_MAX INT_MAX
#define PY_SSIZE_T_MIN INT_MIN
#define PY_FORMAT_SIZE_T ""
#define CYTHON_FORMAT_SSIZE_T ""
#define PyInt_FromSsize_t(z) PyInt_FromLong(z)
#define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o)
#define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
(PyErr_Format(PyExc_TypeError, \
"expected index value, got %.200s", Py_TYPE(o)->tp_name), \
(PyObject*)0))
#define PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o))
#define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
#define __PYX_BUILD_PY_SSIZE_T "i"
#else
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#endif
#if PY_VERSION_HEX < 0x02060000
#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
#define PyVarObject_HEAD_INIT(type, size) \
PyObject_HEAD_INIT(type) size,
#define PyType_Modified(t)
typedef struct {
void *buf;
PyObject *obj;
Py_ssize_t len;
Py_ssize_t itemsize;
int readonly;
int ndim;
char *format;
Py_ssize_t *shape;
Py_ssize_t *strides;
Py_ssize_t *suboffsets;
void *internal;
} Py_buffer;
#define PyBUF_SIMPLE 0
#define PyBUF_WRITABLE 0x0001
#define PyBUF_FORMAT 0x0004
#define PyBUF_ND 0x0008
#define PyBUF_STRIDES (0x0010 | PyBUF_ND)
#define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
#define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
#define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
#define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
#define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
#define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
#endif
#if PY_MAJOR_VERSION < 3
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6
#define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
#endif
#if PY_MAJOR_VERSION >= 3
#define Py_TPFLAGS_CHECKTYPES 0
#define Py_TPFLAGS_HAVE_INDEX 0
#endif
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
#define CYTHON_PEP393_ENABLED 1
#define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
0 : _PyUnicode_Ready((PyObject *)(op)))
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
#define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
#else
#define CYTHON_PEP393_ENABLED 0
#define __Pyx_PyUnicode_READY(op) (0)
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
#define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBaseString_Type PyUnicode_Type
#define PyStringObject PyUnicodeObject
#define PyString_Type PyUnicode_Type
#define PyString_Check PyUnicode_Check
#define PyString_CheckExact PyUnicode_CheckExact
#endif
#if PY_VERSION_HEX < 0x02060000
#define PyBytesObject PyStringObject
#define PyBytes_Type PyString_Type
#define PyBytes_Check PyString_Check
#define PyBytes_CheckExact PyString_CheckExact
#define PyBytes_FromString PyString_FromString
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
#define PyBytes_FromFormat PyString_FromFormat
#define PyBytes_DecodeEscape PyString_DecodeEscape
#define PyBytes_AsString PyString_AsString
#define PyBytes_AsStringAndSize PyString_AsStringAndSize
#define PyBytes_Size PyString_Size
#define PyBytes_AS_STRING PyString_AS_STRING
#define PyBytes_GET_SIZE PyString_GET_SIZE
#define PyBytes_Repr PyString_Repr
#define PyBytes_Concat PyString_Concat
#define PyBytes_ConcatAndDel PyString_ConcatAndDel
#endif
#if PY_VERSION_HEX < 0x02060000
#define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
#define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
#define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
#define PyIntObject PyLongObject
#define PyInt_Type PyLong_Type
#define PyInt_Check(op) PyLong_Check(op)
#define PyInt_CheckExact(op) PyLong_CheckExact(op)
#define PyInt_FromString PyLong_FromString
#define PyInt_FromUnicode PyLong_FromUnicode
#define PyInt_FromLong PyLong_FromLong
#define PyInt_FromSize_t PyLong_FromSize_t
#define PyInt_FromSsize_t PyLong_FromSsize_t
#define PyInt_AsLong PyLong_AsLong
#define PyInt_AS_LONG PyLong_AS_LONG
#define PyInt_AsSsize_t PyLong_AsSsize_t
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBoolObject PyLongObject
#endif
#if PY_VERSION_HEX < 0x03020000
typedef long Py_hash_t;
#define __Pyx_PyInt_FromHash_t PyInt_FromLong
#define __Pyx_PyInt_AsHash_t PyInt_AsLong
#else
#define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
#define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
#endif
#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
#define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
#define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
#define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
#define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
(PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
#define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
(PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
#define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
(PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif
#if PY_MAJOR_VERSION >= 3
#define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif
#if PY_VERSION_HEX < 0x02050000
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
#else
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
#endif
#if PY_VERSION_HEX < 0x02050000
#define __Pyx_NAMESTR(n) ((char *)(n))
#define __Pyx_DOCSTR(n) ((char *)(n))
#else
#define __Pyx_NAMESTR(n) (n)
#define __Pyx_DOCSTR(n) (n)
#endif
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
#else
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
#endif
#ifndef __PYX_EXTERN_C
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#endif
#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__evoMPS__matmul
#define __PYX_HAVE_API__evoMPS__matmul
#include "stdio.h"
#include "stdlib.h"
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */
#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif
/* inline attribute */
#ifndef CYTHON_INLINE
#if defined(__GNUC__)
#define CYTHON_INLINE __inline__
#elif defined(_MSC_VER)
#define CYTHON_INLINE __inline
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define CYTHON_INLINE inline
#else
#define CYTHON_INLINE
#endif
#endif
/* unused attribute */
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
# define CYTHON_UNUSED __attribute__ ((__unused__))
# else
# define CYTHON_UNUSED
# endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
# define CYTHON_UNUSED __attribute__ ((__unused__))
# else
# define CYTHON_UNUSED
# endif
#endif
typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
/* Type Conversion Predeclarations */
#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s))
#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
#if CYTHON_COMPILING_IN_CPYTHON
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#ifdef __GNUC__
/* Test for GCC > 2.95 */
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ > 2 ... */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;
#if !defined(CYTHON_CCOMPLEX)
#if defined(__cplusplus)
#define CYTHON_CCOMPLEX 1
#elif defined(_Complex_I)
#define CYTHON_CCOMPLEX 1
#else
#define CYTHON_CCOMPLEX 0
#endif
#endif
#if CYTHON_CCOMPLEX
#ifdef __cplusplus
#include <complex>
#else
#include <complex.h>
#endif
#endif
#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
#undef _Complex_I
#define _Complex_I 1.0fj
#endif
static const char *__pyx_f[] = {
"matmul.py",
"numpy.pxd",
"type.pxd",
};
/* "numpy.pxd":723
* # in Cython to enable them only on the right systems.
*
* ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
* ctypedef npy_int16 int16_t
* ctypedef npy_int32 int32_t
*/
typedef npy_int8 __pyx_t_5numpy_int8_t;
/* "numpy.pxd":724
*
* ctypedef npy_int8 int8_t
* ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
* ctypedef npy_int32 int32_t
* ctypedef npy_int64 int64_t
*/
typedef npy_int16 __pyx_t_5numpy_int16_t;
/* "numpy.pxd":725
* ctypedef npy_int8 int8_t
* ctypedef npy_int16 int16_t
* ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
* ctypedef npy_int64 int64_t
* #ctypedef npy_int96 int96_t
*/
typedef npy_int32 __pyx_t_5numpy_int32_t;
/* "numpy.pxd":726
* ctypedef npy_int16 int16_t
* ctypedef npy_int32 int32_t
* ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
* #ctypedef npy_int96 int96_t
* #ctypedef npy_int128 int128_t
*/
typedef npy_int64 __pyx_t_5numpy_int64_t;
/* "numpy.pxd":730
* #ctypedef npy_int128 int128_t
*
* ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
* ctypedef npy_uint16 uint16_t
* ctypedef npy_uint32 uint32_t
*/
typedef npy_uint8 __pyx_t_5numpy_uint8_t;
/* "numpy.pxd":731
*
* ctypedef npy_uint8 uint8_t
* ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
* ctypedef npy_uint32 uint32_t
* ctypedef npy_uint64 uint64_t
*/
typedef npy_uint16 __pyx_t_5numpy_uint16_t;
/* "numpy.pxd":732
* ctypedef npy_uint8 uint8_t
* ctypedef npy_uint16 uint16_t
* ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
* ctypedef npy_uint64 uint64_t
* #ctypedef npy_uint96 uint96_t
*/
typedef npy_uint32 __pyx_t_5numpy_uint32_t;
/* "numpy.pxd":733
* ctypedef npy_uint16 uint16_t
* ctypedef npy_uint32 uint32_t
* ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
* #ctypedef npy_uint96 uint96_t
* #ctypedef npy_uint128 uint128_t
*/
typedef npy_uint64 __pyx_t_5numpy_uint64_t;
/* "numpy.pxd":737
* #ctypedef npy_uint128 uint128_t
*
* ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
* ctypedef npy_float64 float64_t
* #ctypedef npy_float80 float80_t
*/
typedef npy_float32 __pyx_t_5numpy_float32_t;
/* "numpy.pxd":738
*
* ctypedef npy_float32 float32_t
* ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
* #ctypedef npy_float80 float80_t
* #ctypedef npy_float128 float128_t
*/
typedef npy_float64 __pyx_t_5numpy_float64_t;
/* "numpy.pxd":747
* # The int types are mapped a bit surprising --
* # numpy.int corresponds to 'l' and numpy.long to 'q'
* ctypedef npy_long int_t # <<<<<<<<<<<<<<
* ctypedef npy_longlong long_t
* ctypedef npy_longlong longlong_t
*/
typedef npy_long __pyx_t_5numpy_int_t;
/* "numpy.pxd":748
* # numpy.int corresponds to 'l' and numpy.long to 'q'
* ctypedef npy_long int_t
* ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
* ctypedef npy_longlong longlong_t
*
*/
typedef npy_longlong __pyx_t_5numpy_long_t;
/* "numpy.pxd":749
* ctypedef npy_long int_t
* ctypedef npy_longlong long_t
* ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
*
* ctypedef npy_ulong uint_t
*/
typedef npy_longlong __pyx_t_5numpy_longlong_t;
/* "numpy.pxd":751
* ctypedef npy_longlong longlong_t
*
* ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
* ctypedef npy_ulonglong ulong_t
* ctypedef npy_ulonglong ulonglong_t
*/
typedef npy_ulong __pyx_t_5numpy_uint_t;
/* "numpy.pxd":752
*
* ctypedef npy_ulong uint_t
* ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
* ctypedef npy_ulonglong ulonglong_t
*
*/
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
/* "numpy.pxd":753
* ctypedef npy_ulong uint_t
* ctypedef npy_ulonglong ulong_t
* ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
*
* ctypedef npy_intp intp_t
*/
typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
/* "numpy.pxd":755
* ctypedef npy_ulonglong ulonglong_t
*
* ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
* ctypedef npy_uintp uintp_t
*
*/
typedef npy_intp __pyx_t_5numpy_intp_t;
/* "numpy.pxd":756
*
* ctypedef npy_intp intp_t
* ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
*
* ctypedef npy_double float_t
*/
typedef npy_uintp __pyx_t_5numpy_uintp_t;
/* "numpy.pxd":758
* ctypedef npy_uintp uintp_t
*
* ctypedef npy_double float_t # <<<<<<<<<<<<<<
* ctypedef npy_double double_t
* ctypedef npy_longdouble longdouble_t
*/
typedef npy_double __pyx_t_5numpy_float_t;
/* "numpy.pxd":759
*
* ctypedef npy_double float_t
* ctypedef npy_double double_t # <<<<<<<<<<<<<<
* ctypedef npy_longdouble longdouble_t
*
*/
typedef npy_double __pyx_t_5numpy_double_t;
/* "numpy.pxd":760
* ctypedef npy_double float_t
* ctypedef npy_double double_t
* ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
*
* ctypedef npy_cfloat cfloat_t
*/
typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
#if CYTHON_CCOMPLEX
#ifdef __cplusplus
typedef ::std::complex< double > __pyx_t_double_complex;
#else
typedef double _Complex __pyx_t_double_complex;
#endif
#else
typedef struct { double real, imag; } __pyx_t_double_complex;
#endif
#if CYTHON_CCOMPLEX
#ifdef __cplusplus
typedef ::std::complex< float > __pyx_t_float_complex;
#else
typedef float _Complex __pyx_t_float_complex;
#endif
#else
typedef struct { float real, imag; } __pyx_t_float_complex;
#endif
/*--- Type declarations ---*/
/* "numpy.pxd":762
* ctypedef npy_longdouble longdouble_t
*
* ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
* ctypedef npy_cdouble cdouble_t
* ctypedef npy_clongdouble clongdouble_t
*/
typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
/* "numpy.pxd":763
*
* ctypedef npy_cfloat cfloat_t
* ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
* ctypedef npy_clongdouble clongdouble_t
*
*/
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
/* "numpy.pxd":764
* ctypedef npy_cfloat cfloat_t
* ctypedef npy_cdouble cdouble_t
* ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
*
* ctypedef npy_cdouble complex_t
*/
typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
/* "numpy.pxd":766
* ctypedef npy_clongdouble clongdouble_t
*
* ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
*
* cdef inline object PyArray_MultiIterNew1(a):
*/
typedef npy_cdouble __pyx_t_5numpy_complex_t;
struct __pyx_defaults;
typedef struct __pyx_defaults __pyx_defaults;
struct __pyx_defaults1;
typedef struct __pyx_defaults1 __pyx_defaults1;
struct __pyx_defaults2;
typedef struct __pyx_defaults2 __pyx_defaults2;
struct __pyx_defaults3;
typedef struct __pyx_defaults3 __pyx_defaults3;
struct __pyx_defaults4;
typedef struct __pyx_defaults4 __pyx_defaults4;
struct __pyx_defaults5;
typedef struct __pyx_defaults5 __pyx_defaults5;
struct __pyx_defaults6;
typedef struct __pyx_defaults6 __pyx_defaults6;
struct __pyx_defaults7;
typedef struct __pyx_defaults7 __pyx_defaults7;
struct __pyx_defaults {
PyObject *__pyx_arg_dtype;
};
struct __pyx_defaults1 {
PyObject *__pyx_arg_a;
PyObject *__pyx_arg_b;
PyObject *__pyx_arg_aj;
PyObject *__pyx_arg_bj;
};
struct __pyx_defaults2 {
PyObject *__pyx_arg_ret_evd;
};
struct __pyx_defaults3 {
PyObject *__pyx_arg_act_right;
};
struct __pyx_defaults4 {
PyObject *__pyx_arg_ret_evd;
};
struct __pyx_defaults5 {
PyObject *__pyx_arg_overwrite;
PyObject *__pyx_arg_lower;
};
struct __pyx_defaults6 {
PyObject *__pyx_arg_lower;
};
struct __pyx_defaults7 {
PyObject *__pyx_arg_atol;
PyObject *__pyx_arg_rtol;
};
#ifndef CYTHON_REFNANNY
#define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
typedef struct {
void (*INCREF)(void*, PyObject*, int);
void (*DECREF)(void*, PyObject*, int);
void (*GOTREF)(void*, PyObject*, int);
void (*GIVEREF)(void*, PyObject*, int);
void* (*SetupContext)(const char*, int, const char*);
void (*FinishContext)(void**);
} __Pyx_RefNannyAPIStruct;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
#define __Pyx_RefNannySetupContext(name, acquire_gil) \
if (acquire_gil) { \
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
PyGILState_Release(__pyx_gilstate_save); \
} else { \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
}
#else
#define __Pyx_RefNannySetupContext(name, acquire_gil) \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
#define __Pyx_RefNannyFinishContext() \
__Pyx_RefNanny->FinishContext(&__pyx_refnanny)
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
#define __Pyx_RefNannyDeclarations
#define __Pyx_RefNannySetupContext(name, acquire_gil)
#define __Pyx_RefNannyFinishContext()
#define __Pyx_INCREF(r) Py_INCREF(r)
#define __Pyx_DECREF(r) Py_DECREF(r)
#define __Pyx_GOTREF(r)
#define __Pyx_GIVEREF(r)
#define __Pyx_XINCREF(r) Py_XINCREF(r)
#define __Pyx_XDECREF(r) Py_XDECREF(r)
#define __Pyx_XGOTREF(r)
#define __Pyx_XGIVEREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
const char* function_name); /*proto*/
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
PyObject *r;
if (!j) return NULL;
r = PyObject_GetItem(o, j);
Py_DECREF(j);
return r;
}
#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
__Pyx_GetItemInt_List_Fast(o, i) : \
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
#if CYTHON_COMPILING_IN_CPYTHON
if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
PyObject *r = PyList_GET_ITEM(o, i);
Py_INCREF(r);
return r;
}
else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
Py_INCREF(r);
return r;
}
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
return PySequence_GetItem(o, i);
#endif
}
#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
__Pyx_GetItemInt_Tuple_Fast(o, i) : \
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
#if CYTHON_COMPILING_IN_CPYTHON
if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
PyObject *r = PyTuple_GET_ITEM(o, i);
Py_INCREF(r);
return r;
}
else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
Py_INCREF(r);
return r;
}
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
return PySequence_GetItem(o, i);
#endif
}
#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
__Pyx_GetItemInt_Fast(o, i) : \
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
#if CYTHON_COMPILING_IN_CPYTHON
if (PyList_CheckExact(o)) {
Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
PyObject *r = PyList_GET_ITEM(o, n);
Py_INCREF(r);
return r;
}
}
else if (PyTuple_CheckExact(o)) {
Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
PyObject *r = PyTuple_GET_ITEM(o, n);
Py_INCREF(r);
return r;
}
} else { /* inlined PySequence_GetItem() */
PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
if (likely(m && m->sq_item)) {
if (unlikely(i < 0) && likely(m->sq_length)) {
Py_ssize_t l = m->sq_length(o);
if (unlikely(l < 0)) return NULL;
i += l;
}
return m->sq_item(o, i);
}
}
#else
if (PySequence_Check(o)) {
return PySequence_GetItem(o, i);
}
#endif
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/
static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/
static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/
static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
PyObject *modname); /*proto*/
#define __Pyx_CyFunction_USED 1
#include <structmember.h>
#define __Pyx_CYFUNCTION_STATICMETHOD 0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
#define __Pyx_CYFUNCTION_CCLASS 0x04
#define __Pyx_CyFunction_GetClosure(f) \
(((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f) \
(((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f) \
((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g) \
((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
PyCFunctionObject func;
int flags;
PyObject *func_dict;
PyObject *func_weakreflist;
PyObject *func_name;
PyObject *func_doc;
PyObject *func_code;
PyObject *func_closure;
PyObject *func_classobj; /* No-args super() class cell */
void *defaults;
int defaults_pyobjects;
PyObject *defaults_tuple; /* Const defaults tuple */
PyObject *(*defaults_getter)(PyObject *);
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_NewEx(ml, flags, self, module, code) \
__Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, self, module, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *,
PyMethodDef *ml, int flags,
PyObject *self, PyObject *module,
PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
size_t size,
int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
PyObject *tuple);
static int __Pyx_CyFunction_init(void);
#if CYTHON_CCOMPLEX
#ifdef __cplusplus
#define __Pyx_CREAL(z) ((z).real())
#define __Pyx_CIMAG(z) ((z).imag())
#else
#define __Pyx_CREAL(z) (__real__(z))
#define __Pyx_CIMAG(z) (__imag__(z))
#endif
#else
#define __Pyx_CREAL(z) ((z).real)
#define __Pyx_CIMAG(z) ((z).imag)
#endif
#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX
#define __Pyx_SET_CREAL(z,x) ((z).real(x))
#define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
#else
#define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
#define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
#endif
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
#if CYTHON_CCOMPLEX
#define __Pyx_c_eq(a, b) ((a)==(b))
#define __Pyx_c_sum(a, b) ((a)+(b))
#define __Pyx_c_diff(a, b) ((a)-(b))
#define __Pyx_c_prod(a, b) ((a)*(b))
#define __Pyx_c_quot(a, b) ((a)/(b))
#define __Pyx_c_neg(a) (-(a))
#ifdef __cplusplus
#define __Pyx_c_is_zero(z) ((z)==(double)0)
#define __Pyx_c_conj(z) (::std::conj(z))
#if 1
#define __Pyx_c_abs(z) (::std::abs(z))
#define __Pyx_c_pow(a, b) (::std::pow(a, b))
#endif
#else
#define __Pyx_c_is_zero(z) ((z)==0)
#define __Pyx_c_conj(z) (conj(z))
#if 1
#define __Pyx_c_abs(z) (cabs(z))
#define __Pyx_c_pow(a, b) (cpow(a, b))
#endif
#endif
#else
static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex);
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex);
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex);
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex);
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex);
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex);
static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex);
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex);
#if 1
static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex);
#endif
#endif
static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/
#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
static PyObject* __pyx_print = 0;
static PyObject* __pyx_print_kwargs = 0;
#endif
static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
#if CYTHON_CCOMPLEX
#define __Pyx_c_eqf(a, b) ((a)==(b))
#define __Pyx_c_sumf(a, b) ((a)+(b))
#define __Pyx_c_difff(a, b) ((a)-(b))
#define __Pyx_c_prodf(a, b) ((a)*(b))
#define __Pyx_c_quotf(a, b) ((a)/(b))
#define __Pyx_c_negf(a) (-(a))
#ifdef __cplusplus
#define __Pyx_c_is_zerof(z) ((z)==(float)0)
#define __Pyx_c_conjf(z) (::std::conj(z))
#if 1
#define __Pyx_c_absf(z) (::std::abs(z))
#define __Pyx_c_powf(a, b) (::std::pow(a, b))
#endif
#else
#define __Pyx_c_is_zerof(z) ((z)==0)
#define __Pyx_c_conjf(z) (conjf(z))
#if 1
#define __Pyx_c_absf(z) (cabsf(z))
#define __Pyx_c_powf(a, b) (cpowf(a, b))
#endif
#endif
#else
static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex);
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex);
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex);
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex);
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex);
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex);
static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex);
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex);
#if 1
static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex);
#endif
#endif
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
static int __Pyx_check_binary_version(void);
#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
#define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif
static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/
typedef struct {
int code_line;
PyCodeObject* code_object;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
int count;
int max_count;
__Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
static void __Pyx_AddTraceback(const char *funcname, int c_line,
int py_line, const char *filename); /*proto*/
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
/* Module declarations from 'cython' */
/* Module declarations from 'cpython.buffer' */
/* Module declarations from 'cpython.ref' */
/* Module declarations from 'libc.stdio' */
/* Module declarations from 'cpython.object' */
/* Module declarations from '__builtin__' */
/* Module declarations from 'cpython.type' */
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
/* Module declarations from 'libc.stdlib' */
/* Module declarations from 'numpy' */
/* Module declarations from 'numpy' */
static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
/* Module declarations from 'evoMPS.matmul' */
#define __Pyx_MODULE_NAME "evoMPS.matmul"
int __pyx_module_is_main_evoMPS__matmul = 0;
/* Implementation of 'evoMPS.matmul' */
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_NotImplemented;
static PyObject *__pyx_builtin_BaseException;
static PyObject *__pyx_builtin_AttributeError;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_xrange;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_42__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_D, PyObject *__pyx_v_dtype); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_2__array__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_4toarray(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_6__mul__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_8__rmul__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_10__add__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_12__radd__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_14__sub__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_16__rsub__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_18__coerce__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_20dot(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_22dot_left(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_24conj(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_26transpose(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_28trace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_offset); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_30diagonal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_32sqrt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_34inv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_36ravel(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_38copy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_order); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_40__getattr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_diag, PyObject *__pyx_v_dtype); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_2__array__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_4dot(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_6dot_left(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_a); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_8conj(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_10transpose(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_12inv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_14sqrt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_16ravel(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_18diagonal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_20trace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_offset); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_22toarray(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_24copy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_order); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_26__mul__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_28__rmul__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_30__add__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_32__radd__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_34__sub__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_36__rsub__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_38__coerce__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_40__getattr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_mmul(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_2adot(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_4adot_noconj(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_6H(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_m, PyObject *__pyx_v_out); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_24__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_8randomize_cmplx(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_aj, PyObject *__pyx_v_bj); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_26__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_10sqrtmh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_ret_evd, PyObject *__pyx_v_evd); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_28__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_12mmul_diag(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_Adiag, PyObject *__pyx_v_B, PyObject *__pyx_v_act_right); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_30__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_14invmh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_ret_evd, PyObject *__pyx_v_evd); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_16sqrtmpo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, CYTHON_UNUSED PyObject *__pyx_v_out); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_32__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_18invtr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_overwrite, PyObject *__pyx_v_lower); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_34__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_20invpo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, CYTHON_UNUSED PyObject *__pyx_v_out, PyObject *__pyx_v_lower); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_36__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_6evoMPS_6matmul_22bicgstab_iso(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_x, PyObject *__pyx_v_b, PyObject *__pyx_v_MVop, PyObject *__pyx_v_VVop, PyObject *__pyx_v_max_itr, PyObject *__pyx_v_atol, PyObject *__pyx_v_rtol); /* proto */
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
static char __pyx_k_1[] = " not found";
static char __pyx_k_3[] = "%d-th diagonal element of the matrix is zero";
static char __pyx_k_4[] = "illegal value in %d-th argument of internal potri";
static char __pyx_k_6[] = "%d-th diagonal element of the Cholesky factor is zero";
static char __pyx_k_7[] = "ndarray is not C contiguous";
static char __pyx_k_9[] = "ndarray is not Fortran contiguous";
static char __pyx_k_11[] = "Non-native byte order not supported";
static char __pyx_k_13[] = "unknown dtype code in numpy.pxd (%d)";
static char __pyx_k_14[] = "Format string allocated too short, see comment in numpy.pxd";
static char __pyx_k_17[] = "Format string allocated too short.";
static char __pyx_k_19[] = "\nCreated on Fri Nov 4 13:05:59 2011\n\n@author: Ashley Milsted\n\nTODO:\n Look into using e.g. sp.linalg.fblas.zgemm._cpointer from cython? Or\n link it to blas at compile time using distutils...\n";
static char __pyx_k_20[] = "scipy.linalg";
static char __pyx_k_21[] = "*";
static char __pyx_k_24[] = "/home/ash/qigitp/mps/code/evoMPS/evoMPS/matmul.py";
static char __pyx_k_25[] = "evoMPS.matmul";
static char __pyx_k__A[] = "A";
static char __pyx_k__B[] = "B";
static char __pyx_k__C[] = "C";
static char __pyx_k__D[] = "D";
static char __pyx_k__H[] = "H";
static char __pyx_k__I[] = "I";
static char __pyx_k__L[] = "L";
static char __pyx_k__O[] = "O";
static char __pyx_k__Q[] = "Q";
static char __pyx_k__R[] = "R";
static char __pyx_k__T[] = "T";
static char __pyx_k__a[] = "a";
static char __pyx_k__b[] = "b";
static char __pyx_k__d[] = "d";
static char __pyx_k__f[] = "f";
static char __pyx_k__g[] = "g";
static char __pyx_k__h[] = "h";
static char __pyx_k__i[] = "i";
static char __pyx_k__l[] = "l";
static char __pyx_k__m[] = "m";
static char __pyx_k__p[] = "p";
static char __pyx_k__q[] = "q";
static char __pyx_k__r[] = "r";
static char __pyx_k__s[] = "s";
static char __pyx_k__t[] = "t";
static char __pyx_k__v[] = "v";
static char __pyx_k__x[] = "x";
static char __pyx_k__EV[] = "EV";
static char __pyx_k__Zd[] = "Zd";
static char __pyx_k__Zf[] = "Zf";
static char __pyx_k__Zg[] = "Zg";
static char __pyx_k__aj[] = "aj";
static char __pyx_k__bj[] = "bj";
static char __pyx_k__ev[] = "ev";
static char __pyx_k__la[] = "la";
static char __pyx_k__qr[] = "qr";
static char __pyx_k__r0[] = "r0";
static char __pyx_k__sp[] = "sp";
static char __pyx_k__dot[] = "dot";
static char __pyx_k__evd[] = "evd";
static char __pyx_k__eye[] = "eye";
static char __pyx_k__inv[] = "inv";
static char __pyx_k__out[] = "out";
static char __pyx_k__res[] = "res";
static char __pyx_k__rho[] = "rho";
static char __pyx_k__sum[] = "sum";
static char __pyx_k__tmp[] = "tmp";
static char __pyx_k__MVop[] = "MVop";
static char __pyx_k__VVop[] = "VVop";
static char __pyx_k__adot[] = "adot";
static char __pyx_k__args[] = "args";
static char __pyx_k__atol[] = "atol";
static char __pyx_k__attr[] = "attr";
static char __pyx_k__beta[] = "beta";
static char __pyx_k__conj[] = "conj";
static char __pyx_k__copy[] = "copy";
static char __pyx_k__data[] = "data";
static char __pyx_k__diag[] = "diag";
static char __pyx_k__eigh[] = "eigh";
static char __pyx_k__info[] = "info";
static char __pyx_k__mmul[] = "mmul";
static char __pyx_k__mode[] = "mode";
static char __pyx_k__ndim[] = "ndim";
static char __pyx_k__ones[] = "ones";
static char __pyx_k__ranf[] = "ranf";
static char __pyx_k__rtol[] = "rtol";
static char __pyx_k__self[] = "self";
static char __pyx_k__sqrt[] = "sqrt";
static char __pyx_k__Adiag[] = "Adiag";
static char __pyx_k__alpha[] = "alpha";
static char __pyx_k__convg[] = "convg";
static char __pyx_k__dtype[] = "dtype";
static char __pyx_k__inner[] = "inner";
static char __pyx_k__inv_A[] = "inv_A";
static char __pyx_k__invmh[] = "invmh";
static char __pyx_k__invpo[] = "invpo";
static char __pyx_k__invtr[] = "invtr";
static char __pyx_k__lower[] = "lower";
static char __pyx_k__omega[] = "omega";
static char __pyx_k__order[] = "order";
static char __pyx_k__other[] = "other";
static char __pyx_k__p_prv[] = "p_prv";
static char __pyx_k__potri[] = "potri";
static char __pyx_k__r_prv[] = "r_prv";
static char __pyx_k__range[] = "range";
static char __pyx_k__ravel[] = "ravel";
static char __pyx_k__scipy[] = "scipy";
static char __pyx_k__shape[] = "shape";
static char __pyx_k__trace[] = "trace";
static char __pyx_k__trtri[] = "trtri";
static char __pyx_k__v_prv[] = "v_prv";
static char __pyx_k__eyemat[] = "eyemat";
static char __pyx_k__lapack[] = "lapack";
static char __pyx_k__object[] = "object";
static char __pyx_k__offset[] = "offset";
static char __pyx_k__random[] = "random";
static char __pyx_k__sqrtmh[] = "sqrtmh";
static char __pyx_k__xrange[] = "xrange";
static char __pyx_k____add__[] = "__add__";
static char __pyx_k____mul__[] = "__mul__";
static char __pyx_k____sub__[] = "__sub__";
static char __pyx_k__float64[] = "float64";
static char __pyx_k__max_itr[] = "max_itr";
static char __pyx_k__ret_evd[] = "ret_evd";
static char __pyx_k__rho_prv[] = "rho_prv";
static char __pyx_k__sqrtmpo[] = "sqrtmpo";
static char __pyx_k__toarray[] = "toarray";
static char __pyx_k____init__[] = "__init__";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____radd__[] = "__radd__";
static char __pyx_k____rmul__[] = "__rmul__";
static char __pyx_k____rsub__[] = "__rsub__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__allclose[] = "allclose";
static char __pyx_k__cholesky[] = "cholesky";
static char __pyx_k__diagonal[] = "diagonal";
static char __pyx_k__dot_left[] = "dot_left";
static char __pyx_k__isscalar[] = "isscalar";
static char __pyx_k__rowmajor[] = "rowmajor";
static char __pyx_k__Exception[] = "Exception";
static char __pyx_k____array__[] = "__array__";
static char __pyx_k__act_right[] = "act_right";
static char __pyx_k__conjugate[] = "conjugate";
static char __pyx_k__mmul_diag[] = "mmul_diag";
static char __pyx_k__omega_prv[] = "omega_prv";
static char __pyx_k__overwrite[] = "overwrite";
static char __pyx_k__transpose[] = "transpose";
static char __pyx_k__ValueError[] = "ValueError";
static char __pyx_k____coerce__[] = "__coerce__";
static char __pyx_k__asanyarray[] = "asanyarray";
static char __pyx_k__zeros_like[] = "zeros_like";
static char __pyx_k__LinAlgError[] = "LinAlgError";
static char __pyx_k____getattr__[] = "__getattr__";
static char __pyx_k__adot_noconj[] = "adot_noconj";
static char __pyx_k__overwrite_a[] = "overwrite_a";
static char __pyx_k__overwrite_c[] = "overwrite_c";
static char __pyx_k__RuntimeError[] = "RuntimeError";
static char __pyx_k__bicgstab_iso[] = "bicgstab_iso";
static char __pyx_k__BaseException[] = "BaseException";
static char __pyx_k__AttributeError[] = "AttributeError";
static char __pyx_k__NotImplemented[] = "NotImplemented";
static char __pyx_k__randomize_cmplx[] = "randomize_cmplx";
static char __pyx_k__get_lapack_funcs[] = "get_lapack_funcs";
static char __pyx_k____array_priority__[] = "__array_priority__";
static char __pyx_k__simple_diag_matrix[] = "simple_diag_matrix";
static PyObject *__pyx_kp_s_1;
static PyObject *__pyx_kp_u_11;
static PyObject *__pyx_kp_u_13;
static PyObject *__pyx_kp_u_14;
static PyObject *__pyx_kp_u_17;
static PyObject *__pyx_n_s_20;
static PyObject *__pyx_n_s_21;
static PyObject *__pyx_kp_s_24;
static PyObject *__pyx_n_s_25;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_kp_s_4;
static PyObject *__pyx_kp_s_6;
static PyObject *__pyx_kp_u_7;
static PyObject *__pyx_kp_u_9;
static PyObject *__pyx_n_s__A;
static PyObject *__pyx_n_s__Adiag;
static PyObject *__pyx_n_s__AttributeError;
static PyObject *__pyx_n_s__B;
static PyObject *__pyx_n_s__BaseException;
static PyObject *__pyx_n_s__C;
static PyObject *__pyx_n_s__D;
static PyObject *__pyx_n_s__EV;
static PyObject *__pyx_n_s__Exception;
static PyObject *__pyx_n_s__H;
static PyObject *__pyx_n_s__LinAlgError;
static PyObject *__pyx_n_s__MVop;
static PyObject *__pyx_n_s__NotImplemented;
static PyObject *__pyx_n_s__R;
static PyObject *__pyx_n_s__RuntimeError;
static PyObject *__pyx_n_s__T;
static PyObject *__pyx_n_s__VVop;
static PyObject *__pyx_n_s__ValueError;
static PyObject *__pyx_n_s____add__;
static PyObject *__pyx_n_s____array__;
static PyObject *__pyx_n_s____array_priority__;
static PyObject *__pyx_n_s____coerce__;
static PyObject *__pyx_n_s____getattr__;
static PyObject *__pyx_n_s____init__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____mul__;
static PyObject *__pyx_n_s____radd__;
static PyObject *__pyx_n_s____rmul__;
static PyObject *__pyx_n_s____rsub__;
static PyObject *__pyx_n_s____sub__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s__a;
static PyObject *__pyx_n_s__act_right;
static PyObject *__pyx_n_s__adot;
static PyObject *__pyx_n_s__adot_noconj;
static PyObject *__pyx_n_s__aj;
static PyObject *__pyx_n_s__allclose;
static PyObject *__pyx_n_s__alpha;
static PyObject *__pyx_n_s__args;
static PyObject *__pyx_n_s__asanyarray;
static PyObject *__pyx_n_s__atol;
static PyObject *__pyx_n_s__attr;
static PyObject *__pyx_n_s__b;
static PyObject *__pyx_n_s__beta;
static PyObject *__pyx_n_s__bicgstab_iso;
static PyObject *__pyx_n_s__bj;
static PyObject *__pyx_n_s__cholesky;
static PyObject *__pyx_n_s__conj;
static PyObject *__pyx_n_s__conjugate;
static PyObject *__pyx_n_s__convg;
static PyObject *__pyx_n_s__copy;
static PyObject *__pyx_n_s__data;
static PyObject *__pyx_n_s__diag;
static PyObject *__pyx_n_s__diagonal;
static PyObject *__pyx_n_s__dot;
static PyObject *__pyx_n_s__dot_left;
static PyObject *__pyx_n_s__dtype;
static PyObject *__pyx_n_s__eigh;
static PyObject *__pyx_n_s__ev;
static PyObject *__pyx_n_s__evd;
static PyObject *__pyx_n_s__eye;
static PyObject *__pyx_n_s__eyemat;
static PyObject *__pyx_n_s__float64;
static PyObject *__pyx_n_s__get_lapack_funcs;
static PyObject *__pyx_n_s__i;
static PyObject *__pyx_n_s__info;
static PyObject *__pyx_n_s__inner;
static PyObject *__pyx_n_s__inv;
static PyObject *__pyx_n_s__inv_A;
static PyObject *__pyx_n_s__invmh;
static PyObject *__pyx_n_s__invpo;
static PyObject *__pyx_n_s__invtr;
static PyObject *__pyx_n_s__isscalar;
static PyObject *__pyx_n_s__la;
static PyObject *__pyx_n_s__lapack;
static PyObject *__pyx_n_s__lower;
static PyObject *__pyx_n_s__m;
static PyObject *__pyx_n_s__max_itr;
static PyObject *__pyx_n_s__mmul;
static PyObject *__pyx_n_s__mmul_diag;
static PyObject *__pyx_n_s__mode;
static PyObject *__pyx_n_s__ndim;
static PyObject *__pyx_n_s__object;
static PyObject *__pyx_n_s__offset;
static PyObject *__pyx_n_s__omega;
static PyObject *__pyx_n_s__omega_prv;
static PyObject *__pyx_n_s__ones;
static PyObject *__pyx_n_s__order;
static PyObject *__pyx_n_s__other;
static PyObject *__pyx_n_s__out;
static PyObject *__pyx_n_s__overwrite;
static PyObject *__pyx_n_s__overwrite_a;
static PyObject *__pyx_n_s__overwrite_c;
static PyObject *__pyx_n_s__p;
static PyObject *__pyx_n_s__p_prv;
static PyObject *__pyx_n_s__potri;
static PyObject *__pyx_n_s__qr;
static PyObject *__pyx_n_s__r;
static PyObject *__pyx_n_s__r0;
static PyObject *__pyx_n_s__r_prv;
static PyObject *__pyx_n_s__random;
static PyObject *__pyx_n_s__randomize_cmplx;
static PyObject *__pyx_n_s__ranf;
static PyObject *__pyx_n_s__range;
static PyObject *__pyx_n_s__ravel;
static PyObject *__pyx_n_s__res;
static PyObject *__pyx_n_s__ret_evd;
static PyObject *__pyx_n_s__rho;
static PyObject *__pyx_n_s__rho_prv;
static PyObject *__pyx_n_s__rowmajor;
static PyObject *__pyx_n_s__rtol;
static PyObject *__pyx_n_s__s;
static PyObject *__pyx_n_s__scipy;
static PyObject *__pyx_n_s__self;
static PyObject *__pyx_n_s__shape;
static PyObject *__pyx_n_s__simple_diag_matrix;
static PyObject *__pyx_n_s__sp;
static PyObject *__pyx_n_s__sqrt;
static PyObject *__pyx_n_s__sqrtmh;
static PyObject *__pyx_n_s__sqrtmpo;
static PyObject *__pyx_n_s__sum;
static PyObject *__pyx_n_s__t;
static PyObject *__pyx_n_s__tmp;
static PyObject *__pyx_n_s__toarray;
static PyObject *__pyx_n_s__trace;
static PyObject *__pyx_n_s__transpose;
static PyObject *__pyx_n_s__trtri;
static PyObject *__pyx_n_s__v;
static PyObject *__pyx_n_s__v_prv;
static PyObject *__pyx_n_s__x;
static PyObject *__pyx_n_s__xrange;
static PyObject *__pyx_n_s__zeros_like;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_15;
static PyObject *__pyx_int_500;
static PyObject *__pyx_k_tuple_2;
static PyObject *__pyx_k_tuple_5;
static PyObject *__pyx_k_tuple_8;
static PyObject *__pyx_k_tuple_10;
static PyObject *__pyx_k_tuple_12;
static PyObject *__pyx_k_tuple_15;
static PyObject *__pyx_k_tuple_16;
static PyObject *__pyx_k_tuple_18;
static PyObject *__pyx_k_tuple_22;
static PyObject *__pyx_k_tuple_26;
static PyObject *__pyx_k_tuple_28;
static PyObject *__pyx_k_tuple_30;
static PyObject *__pyx_k_tuple_32;
static PyObject *__pyx_k_tuple_34;
static PyObject *__pyx_k_tuple_36;
static PyObject *__pyx_k_tuple_38;
static PyObject *__pyx_k_tuple_40;
static PyObject *__pyx_k_tuple_42;
static PyObject *__pyx_k_tuple_44;
static PyObject *__pyx_k_tuple_46;
static PyObject *__pyx_k_tuple_48;
static PyObject *__pyx_k_tuple_50;
static PyObject *__pyx_k_tuple_52;
static PyObject *__pyx_k_tuple_54;
static PyObject *__pyx_k_tuple_55;
static PyObject *__pyx_k_tuple_57;
static PyObject *__pyx_k_tuple_59;
static PyObject *__pyx_k_tuple_61;
static PyObject *__pyx_k_tuple_63;
static PyObject *__pyx_k_tuple_65;
static PyObject *__pyx_k_tuple_66;
static PyObject *__pyx_k_tuple_68;
static PyObject *__pyx_k_tuple_70;
static PyObject *__pyx_k_tuple_71;
static PyObject *__pyx_k_tuple_73;
static PyObject *__pyx_k_tuple_75;
static PyObject *__pyx_k_tuple_77;
static PyObject *__pyx_k_tuple_79;
static PyObject *__pyx_k_tuple_81;
static PyObject *__pyx_k_tuple_83;
static PyObject *__pyx_k_tuple_85;
static PyObject *__pyx_k_tuple_87;
static PyObject *__pyx_k_tuple_89;
static PyObject *__pyx_k_tuple_91;
static PyObject *__pyx_k_tuple_92;
static PyObject *__pyx_k_tuple_94;
static PyObject *__pyx_k_tuple_96;
static PyObject *__pyx_k_tuple_97;
static PyObject *__pyx_k_tuple_99;
static PyObject *__pyx_k_tuple_101;
static PyObject *__pyx_k_tuple_103;
static PyObject *__pyx_k_tuple_105;
static PyObject *__pyx_k_tuple_107;
static PyObject *__pyx_k_tuple_109;
static PyObject *__pyx_k_tuple_111;
static PyObject *__pyx_k_tuple_113;
static PyObject *__pyx_k_tuple_115;
static PyObject *__pyx_k_tuple_117;
static PyObject *__pyx_k_tuple_119;
static PyObject *__pyx_k_tuple_121;
static PyObject *__pyx_k_tuple_122;
static PyObject *__pyx_k_tuple_124;
static PyObject *__pyx_k_tuple_126;
static PyObject *__pyx_k_tuple_128;
static PyObject *__pyx_k_tuple_130;
static PyObject *__pyx_k_tuple_132;
static PyObject *__pyx_k_tuple_133;
static PyObject *__pyx_k_tuple_135;
static PyObject *__pyx_k_tuple_137;
static PyObject *__pyx_k_codeobj_23;
static PyObject *__pyx_k_codeobj_27;
static PyObject *__pyx_k_codeobj_29;
static PyObject *__pyx_k_codeobj_31;
static PyObject *__pyx_k_codeobj_33;
static PyObject *__pyx_k_codeobj_35;
static PyObject *__pyx_k_codeobj_37;
static PyObject *__pyx_k_codeobj_39;
static PyObject *__pyx_k_codeobj_41;
static PyObject *__pyx_k_codeobj_43;
static PyObject *__pyx_k_codeobj_45;
static PyObject *__pyx_k_codeobj_47;
static PyObject *__pyx_k_codeobj_49;
static PyObject *__pyx_k_codeobj_51;
static PyObject *__pyx_k_codeobj_53;
static PyObject *__pyx_k_codeobj_56;
static PyObject *__pyx_k_codeobj_58;
static PyObject *__pyx_k_codeobj_60;
static PyObject *__pyx_k_codeobj_62;
static PyObject *__pyx_k_codeobj_64;
static PyObject *__pyx_k_codeobj_67;
static PyObject *__pyx_k_codeobj_69;
static PyObject *__pyx_k_codeobj_72;
static PyObject *__pyx_k_codeobj_74;
static PyObject *__pyx_k_codeobj_76;
static PyObject *__pyx_k_codeobj_78;
static PyObject *__pyx_k_codeobj_80;
static PyObject *__pyx_k_codeobj_82;
static PyObject *__pyx_k_codeobj_84;
static PyObject *__pyx_k_codeobj_86;
static PyObject *__pyx_k_codeobj_88;
static PyObject *__pyx_k_codeobj_90;
static PyObject *__pyx_k_codeobj_93;
static PyObject *__pyx_k_codeobj_95;
static PyObject *__pyx_k_codeobj_98;
static PyObject *__pyx_k_codeobj_100;
static PyObject *__pyx_k_codeobj_102;
static PyObject *__pyx_k_codeobj_104;
static PyObject *__pyx_k_codeobj_106;
static PyObject *__pyx_k_codeobj_108;
static PyObject *__pyx_k_codeobj_110;
static PyObject *__pyx_k_codeobj_112;
static PyObject *__pyx_k_codeobj_114;
static PyObject *__pyx_k_codeobj_116;
static PyObject *__pyx_k_codeobj_118;
static PyObject *__pyx_k_codeobj_120;
static PyObject *__pyx_k_codeobj_123;
static PyObject *__pyx_k_codeobj_125;
static PyObject *__pyx_k_codeobj_127;
static PyObject *__pyx_k_codeobj_129;
static PyObject *__pyx_k_codeobj_131;
static PyObject *__pyx_k_codeobj_134;
static PyObject *__pyx_k_codeobj_136;
static PyObject *__pyx_k_codeobj_138;
/* "evoMPS/matmul.py":20
* __array_priority__ = 10.1 #makes right-ops work, ala sparse
*
* def __init__(self, D, dtype=sp.float64): # <<<<<<<<<<<<<<
* self.shape = (D, D)
* self.dtype = dtype
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_42__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__defaults__", 0);
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_dtype);
PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_dtype);
__Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_dtype);
__pyx_r = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_6eyemat_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_6eyemat_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_D = 0;
PyObject *__pyx_v_dtype = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__D,&__pyx_n_s__dtype,0};
PyObject* values[3] = {0,0,0};
__pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self);
values[2] = __pyx_dynamic_args->__pyx_arg_dtype;
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dtype);
if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_self = values[0];
__pyx_v_D = values[1];
__pyx_v_dtype = values[2];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_6eyemat___init__(__pyx_self, __pyx_v_self, __pyx_v_D, __pyx_v_dtype);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_D, PyObject *__pyx_v_dtype) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
/* "evoMPS/matmul.py":21
*
* def __init__(self, D, dtype=sp.float64):
* self.shape = (D, D) # <<<<<<<<<<<<<<
* self.dtype = dtype
* self.data = None
*/
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_D);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_D);
__Pyx_GIVEREF(__pyx_v_D);
__Pyx_INCREF(__pyx_v_D);
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_D);
__Pyx_GIVEREF(__pyx_v_D);
if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__shape, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":22
* def __init__(self, D, dtype=sp.float64):
* self.shape = (D, D)
* self.dtype = dtype # <<<<<<<<<<<<<<
* self.data = None
*
*/
if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__dtype, __pyx_v_dtype) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":23
* self.shape = (D, D)
* self.dtype = dtype
* self.data = None # <<<<<<<<<<<<<<
*
* def __array__(self):
*/
if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__data, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_3__array__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_6eyemat_3__array__ = {__Pyx_NAMESTR("__array__"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_6eyemat_3__array__, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_3__array__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__array__ (wrapper)", 0);
__pyx_r = __pyx_pf_6evoMPS_6matmul_6eyemat_2__array__(__pyx_self, ((PyObject *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":25
* self.data = None
*
* def __array__(self): # <<<<<<<<<<<<<<
* return self.toarray()
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_2__array__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__array__", 0);
/* "evoMPS/matmul.py":26
*
* def __array__(self):
* return self.toarray() # <<<<<<<<<<<<<<
*
* def toarray(self):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__toarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__array__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_5toarray(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_6eyemat_5toarray = {__Pyx_NAMESTR("toarray"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_6eyemat_5toarray, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_5toarray(PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("toarray (wrapper)", 0);
__pyx_r = __pyx_pf_6evoMPS_6matmul_6eyemat_4toarray(__pyx_self, ((PyObject *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":28
* return self.toarray()
*
* def toarray(self): # <<<<<<<<<<<<<<
* return sp.eye(self.shape[0], dtype=self.dtype)
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_4toarray(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("toarray", 0);
/* "evoMPS/matmul.py":29
*
* def toarray(self):
* return sp.eye(self.shape[0], dtype=self.dtype) # <<<<<<<<<<<<<<
*
* def __mul__(self, other):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__eye); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__dtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("evoMPS.matmul.eyemat.toarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_7__mul__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_6eyemat_7__mul__ = {__Pyx_NAMESTR("__mul__"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_6eyemat_7__mul__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_7__mul__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_other = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__mul__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__other,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__mul__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__mul__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_other = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__mul__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_6eyemat_6__mul__(__pyx_self, __pyx_v_self, __pyx_v_other);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":31
* return sp.eye(self.shape[0], dtype=self.dtype)
*
* def __mul__(self, other): # <<<<<<<<<<<<<<
* if sp.isscalar(other):
* return simple_diag_matrix(sp.ones(self.shape[0], self.dtype) * other)
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_6__mul__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_t_4;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
PyObject *__pyx_t_8 = NULL;
PyObject *__pyx_t_9 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__mul__", 0);
/* "evoMPS/matmul.py":32
*
* def __mul__(self, other):
* if sp.isscalar(other): # <<<<<<<<<<<<<<
* return simple_diag_matrix(sp.ones(self.shape[0], self.dtype) * other)
*
*/
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__isscalar); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_other);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_other);
__Pyx_GIVEREF(__pyx_v_other);
__pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_4) {
/* "evoMPS/matmul.py":33
* def __mul__(self, other):
* if sp.isscalar(other):
* return simple_diag_matrix(sp.ones(self.shape[0], self.dtype) * other) # <<<<<<<<<<<<<<
*
* try:
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__simple_diag_matrix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ones); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_5 = 0;
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
__pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_v_other); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
__Pyx_GIVEREF(__pyx_t_6);
__pyx_t_6 = 0;
__pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_r = __pyx_t_6;
__pyx_t_6 = 0;
goto __pyx_L0;
goto __pyx_L3;
}
__pyx_L3:;
/* "evoMPS/matmul.py":35
* return simple_diag_matrix(sp.ones(self.shape[0], self.dtype) * other)
*
* try: # <<<<<<<<<<<<<<
* if other.shape == self.shape:
* return simple_diag_matrix(other.diagonal())
*/
{
__Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
__Pyx_XGOTREF(__pyx_t_7);
__Pyx_XGOTREF(__pyx_t_8);
__Pyx_XGOTREF(__pyx_t_9);
/*try:*/ {
/* "evoMPS/matmul.py":36
*
* try:
* if other.shape == self.shape: # <<<<<<<<<<<<<<
* return simple_diag_matrix(other.diagonal())
* except:
*/
__pyx_t_6 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__shape); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_4) {
/* "evoMPS/matmul.py":37
* try:
* if other.shape == self.shape:
* return simple_diag_matrix(other.diagonal()) # <<<<<<<<<<<<<<
* except:
* return NotImplemented
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__simple_diag_matrix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__diagonal); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
__Pyx_GIVEREF(__pyx_t_6);
__pyx_t_6 = 0;
__pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_r = __pyx_t_6;
__pyx_t_6 = 0;
goto __pyx_L8_try_return;
goto __pyx_L12;
}
__pyx_L12:;
}
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
goto __pyx_L11_try_end;
__pyx_L8_try_return:;
__Pyx_XGIVEREF(__pyx_t_7);
__Pyx_XGIVEREF(__pyx_t_8);
__Pyx_XGIVEREF(__pyx_t_9);
__Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
goto __pyx_L0;
__pyx_L4_error:;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
/* "evoMPS/matmul.py":38
* if other.shape == self.shape:
* return simple_diag_matrix(other.diagonal())
* except: # <<<<<<<<<<<<<<
* return NotImplemented
*
*/
/*except:*/ {
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_1, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_t_3);
/* "evoMPS/matmul.py":39
* return simple_diag_matrix(other.diagonal())
* except:
* return NotImplemented # <<<<<<<<<<<<<<
*
* return self.toarray() * other
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_builtin_NotImplemented);
__pyx_r = __pyx_builtin_NotImplemented;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L7_except_return;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L5_exception_handled;
}
__pyx_L6_except_error:;
__Pyx_XGIVEREF(__pyx_t_7);
__Pyx_XGIVEREF(__pyx_t_8);
__Pyx_XGIVEREF(__pyx_t_9);
__Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
goto __pyx_L1_error;
__pyx_L7_except_return:;
__Pyx_XGIVEREF(__pyx_t_7);
__Pyx_XGIVEREF(__pyx_t_8);
__Pyx_XGIVEREF(__pyx_t_9);
__Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
goto __pyx_L0;
__pyx_L5_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_7);
__Pyx_XGIVEREF(__pyx_t_8);
__Pyx_XGIVEREF(__pyx_t_9);
__Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
__pyx_L11_try_end:;
}
/* "evoMPS/matmul.py":41
* return NotImplemented
*
* return self.toarray() * other # <<<<<<<<<<<<<<
*
* def __rmul__(self, other):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__toarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_v_other); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_9__rmul__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_6eyemat_9__rmul__ = {__Pyx_NAMESTR("__rmul__"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_6eyemat_9__rmul__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_9__rmul__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_other = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__rmul__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__other,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__rmul__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__rmul__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_other = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__rmul__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__rmul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_6eyemat_8__rmul__(__pyx_self, __pyx_v_self, __pyx_v_other);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":43
* return self.toarray() * other
*
* def __rmul__(self, other): # <<<<<<<<<<<<<<
* return self.__mul__(self, other)
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_8__rmul__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__rmul__", 0);
/* "evoMPS/matmul.py":44
*
* def __rmul__(self, other):
* return self.__mul__(self, other) # <<<<<<<<<<<<<<
*
* def __add__(self, other):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____mul__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_self);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
__Pyx_GIVEREF(__pyx_v_self);
__Pyx_INCREF(__pyx_v_other);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_other);
__Pyx_GIVEREF(__pyx_v_other);
__pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__rmul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_11__add__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_6eyemat_11__add__ = {__Pyx_NAMESTR("__add__"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_6eyemat_11__add__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_11__add__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_other = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__add__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__other,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__add__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__add__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_other = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__add__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_6eyemat_10__add__(__pyx_self, __pyx_v_self, __pyx_v_other);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":46
* return self.__mul__(self, other)
*
* def __add__(self, other): # <<<<<<<<<<<<<<
* try:
* return self.toarray() + other
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_10__add__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__add__", 0);
/* "evoMPS/matmul.py":47
*
* def __add__(self, other):
* try: # <<<<<<<<<<<<<<
* return self.toarray() + other
* except:
*/
{
__Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
__Pyx_XGOTREF(__pyx_t_1);
__Pyx_XGOTREF(__pyx_t_2);
__Pyx_XGOTREF(__pyx_t_3);
/*try:*/ {
/* "evoMPS/matmul.py":48
* def __add__(self, other):
* try:
* return self.toarray() + other # <<<<<<<<<<<<<<
* except:
* return NotImplemented
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__toarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_v_other); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L7_try_return;
}
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L10_try_end;
__pyx_L7_try_return:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L0;
__pyx_L3_error:;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":49
* try:
* return self.toarray() + other
* except: # <<<<<<<<<<<<<<
* return NotImplemented
*
*/
/*except:*/ {
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_t_6);
/* "evoMPS/matmul.py":50
* return self.toarray() + other
* except:
* return NotImplemented # <<<<<<<<<<<<<<
*
* def __radd__(self, other):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_builtin_NotImplemented);
__pyx_r = __pyx_builtin_NotImplemented;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L6_except_return;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L4_exception_handled;
}
__pyx_L5_except_error:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L1_error;
__pyx_L6_except_return:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L0;
__pyx_L4_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
__pyx_L10_try_end:;
}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_13__radd__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_6eyemat_13__radd__ = {__Pyx_NAMESTR("__radd__"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_6eyemat_13__radd__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_13__radd__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_other = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__radd__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__other,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__radd__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__radd__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_other = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__radd__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__radd__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_6eyemat_12__radd__(__pyx_self, __pyx_v_self, __pyx_v_other);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":52
* return NotImplemented
*
* def __radd__(self, other): # <<<<<<<<<<<<<<
* try:
* return other + self.toarray()
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_12__radd__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__radd__", 0);
/* "evoMPS/matmul.py":53
*
* def __radd__(self, other):
* try: # <<<<<<<<<<<<<<
* return other + self.toarray()
* except:
*/
{
__Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
__Pyx_XGOTREF(__pyx_t_1);
__Pyx_XGOTREF(__pyx_t_2);
__Pyx_XGOTREF(__pyx_t_3);
/*try:*/ {
/* "evoMPS/matmul.py":54
* def __radd__(self, other):
* try:
* return other + self.toarray() # <<<<<<<<<<<<<<
* except:
* return NotImplemented
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__toarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyNumber_Add(__pyx_v_other, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L7_try_return;
}
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L10_try_end;
__pyx_L7_try_return:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L0;
__pyx_L3_error:;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":55
* try:
* return other + self.toarray()
* except: # <<<<<<<<<<<<<<
* return NotImplemented
*
*/
/*except:*/ {
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__radd__", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_t_6);
/* "evoMPS/matmul.py":56
* return other + self.toarray()
* except:
* return NotImplemented # <<<<<<<<<<<<<<
*
* def __sub__(self, other):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_builtin_NotImplemented);
__pyx_r = __pyx_builtin_NotImplemented;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L6_except_return;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L4_exception_handled;
}
__pyx_L5_except_error:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L1_error;
__pyx_L6_except_return:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L0;
__pyx_L4_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
__pyx_L10_try_end:;
}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__radd__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_15__sub__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_6eyemat_15__sub__ = {__Pyx_NAMESTR("__sub__"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_6eyemat_15__sub__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_15__sub__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_other = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__sub__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__other,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__sub__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__sub__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_other = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__sub__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_6eyemat_14__sub__(__pyx_self, __pyx_v_self, __pyx_v_other);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":58
* return NotImplemented
*
* def __sub__(self, other): # <<<<<<<<<<<<<<
* try:
* return self.toarray() - other
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_14__sub__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__sub__", 0);
/* "evoMPS/matmul.py":59
*
* def __sub__(self, other):
* try: # <<<<<<<<<<<<<<
* return self.toarray() - other
* except:
*/
{
__Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
__Pyx_XGOTREF(__pyx_t_1);
__Pyx_XGOTREF(__pyx_t_2);
__Pyx_XGOTREF(__pyx_t_3);
/*try:*/ {
/* "evoMPS/matmul.py":60
* def __sub__(self, other):
* try:
* return self.toarray() - other # <<<<<<<<<<<<<<
* except:
* return NotImplemented
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__toarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyNumber_Subtract(__pyx_t_5, __pyx_v_other); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L7_try_return;
}
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L10_try_end;
__pyx_L7_try_return:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L0;
__pyx_L3_error:;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":61
* try:
* return self.toarray() - other
* except: # <<<<<<<<<<<<<<
* return NotImplemented
*
*/
/*except:*/ {
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_t_6);
/* "evoMPS/matmul.py":62
* return self.toarray() - other
* except:
* return NotImplemented # <<<<<<<<<<<<<<
*
* def __rsub__(self, other):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_builtin_NotImplemented);
__pyx_r = __pyx_builtin_NotImplemented;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L6_except_return;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L4_exception_handled;
}
__pyx_L5_except_error:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L1_error;
__pyx_L6_except_return:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L0;
__pyx_L4_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
__pyx_L10_try_end:;
}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_17__rsub__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_6eyemat_17__rsub__ = {__Pyx_NAMESTR("__rsub__"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_6eyemat_17__rsub__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_17__rsub__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_other = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__rsub__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__other,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__rsub__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__rsub__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_other = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__rsub__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__rsub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_6eyemat_16__rsub__(__pyx_self, __pyx_v_self, __pyx_v_other);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":64
* return NotImplemented
*
* def __rsub__(self, other): # <<<<<<<<<<<<<<
* try:
* return other - self.toarray()
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_16__rsub__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__rsub__", 0);
/* "evoMPS/matmul.py":65
*
* def __rsub__(self, other):
* try: # <<<<<<<<<<<<<<
* return other - self.toarray()
* except:
*/
{
__Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
__Pyx_XGOTREF(__pyx_t_1);
__Pyx_XGOTREF(__pyx_t_2);
__Pyx_XGOTREF(__pyx_t_3);
/*try:*/ {
/* "evoMPS/matmul.py":66
* def __rsub__(self, other):
* try:
* return other - self.toarray() # <<<<<<<<<<<<<<
* except:
* return NotImplemented
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__toarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyNumber_Subtract(__pyx_v_other, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L7_try_return;
}
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L10_try_end;
__pyx_L7_try_return:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L0;
__pyx_L3_error:;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":67
* try:
* return other - self.toarray()
* except: # <<<<<<<<<<<<<<
* return NotImplemented
*
*/
/*except:*/ {
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__rsub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_t_6);
/* "evoMPS/matmul.py":68
* return other - self.toarray()
* except:
* return NotImplemented # <<<<<<<<<<<<<<
*
* def __coerce__(self, other):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_builtin_NotImplemented);
__pyx_r = __pyx_builtin_NotImplemented;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L6_except_return;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L4_exception_handled;
}
__pyx_L5_except_error:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L1_error;
__pyx_L6_except_return:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L0;
__pyx_L4_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
__pyx_L10_try_end:;
}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__rsub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_19__coerce__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_6eyemat_19__coerce__ = {__Pyx_NAMESTR("__coerce__"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_6eyemat_19__coerce__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_19__coerce__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_other = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__coerce__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__other,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__coerce__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__coerce__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_other = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__coerce__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__coerce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_6eyemat_18__coerce__(__pyx_self, __pyx_v_self, __pyx_v_other);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":70
* return NotImplemented
*
* def __coerce__(self, other): # <<<<<<<<<<<<<<
* try:
* other = sp.asanyarray(other)
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_18__coerce__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
int __pyx_t_7;
int __pyx_t_8;
int __pyx_t_9;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__coerce__", 0);
__Pyx_INCREF(__pyx_v_other);
/* "evoMPS/matmul.py":71
*
* def __coerce__(self, other):
* try: # <<<<<<<<<<<<<<
* other = sp.asanyarray(other)
* if other.shape == self.shape or sp.isscalar(other):
*/
{
__Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
__Pyx_XGOTREF(__pyx_t_1);
__Pyx_XGOTREF(__pyx_t_2);
__Pyx_XGOTREF(__pyx_t_3);
/*try:*/ {
/* "evoMPS/matmul.py":72
* def __coerce__(self, other):
* try:
* other = sp.asanyarray(other) # <<<<<<<<<<<<<<
* if other.shape == self.shape or sp.isscalar(other):
* return (self.toarray(), other)
*/
__pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__asanyarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_other);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_other);
__Pyx_GIVEREF(__pyx_v_other);
__pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_v_other);
__pyx_v_other = __pyx_t_6;
__pyx_t_6 = 0;
/* "evoMPS/matmul.py":73
* try:
* other = sp.asanyarray(other)
* if other.shape == self.shape or sp.isscalar(other): # <<<<<<<<<<<<<<
* return (self.toarray(), other)
* else:
*/
__pyx_t_6 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__shape); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (!__pyx_t_7) {
__pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__isscalar); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_INCREF(__pyx_v_other);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_other);
__Pyx_GIVEREF(__pyx_v_other);
__pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_9 = __pyx_t_8;
} else {
__pyx_t_9 = __pyx_t_7;
}
if (__pyx_t_9) {
/* "evoMPS/matmul.py":74
* other = sp.asanyarray(other)
* if other.shape == self.shape or sp.isscalar(other):
* return (self.toarray(), other) # <<<<<<<<<<<<<<
* else:
* return NotImplemented
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__toarray); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_6);
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__Pyx_INCREF(__pyx_v_other);
PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_other);
__Pyx_GIVEREF(__pyx_v_other);
__pyx_t_5 = 0;
__pyx_r = ((PyObject *)__pyx_t_6);
__pyx_t_6 = 0;
goto __pyx_L7_try_return;
goto __pyx_L11;
}
/*else*/ {
/* "evoMPS/matmul.py":76
* return (self.toarray(), other)
* else:
* return NotImplemented # <<<<<<<<<<<<<<
* except:
* return NotImplemented
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_builtin_NotImplemented);
__pyx_r = __pyx_builtin_NotImplemented;
goto __pyx_L7_try_return;
}
__pyx_L11:;
}
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L10_try_end;
__pyx_L7_try_return:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L0;
__pyx_L3_error:;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
/* "evoMPS/matmul.py":77
* else:
* return NotImplemented
* except: # <<<<<<<<<<<<<<
* return NotImplemented
*
*/
/*except:*/ {
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__coerce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_GOTREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_t_4);
/* "evoMPS/matmul.py":78
* return NotImplemented
* except:
* return NotImplemented # <<<<<<<<<<<<<<
*
* def dot(self, other):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_builtin_NotImplemented);
__pyx_r = __pyx_builtin_NotImplemented;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L6_except_return;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L4_exception_handled;
}
__pyx_L5_except_error:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L1_error;
__pyx_L6_except_return:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L0;
__pyx_L4_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
__pyx_L10_try_end:;
}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__coerce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_other);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_21dot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_6eyemat_21dot = {__Pyx_NAMESTR("dot"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_6eyemat_21dot, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_21dot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_other = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("dot (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__other,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("dot", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dot") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_other = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("dot", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.eyemat.dot", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_6eyemat_20dot(__pyx_self, __pyx_v_self, __pyx_v_other);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":80
* return NotImplemented
*
* def dot(self, other): # <<<<<<<<<<<<<<
* if self.shape[1] == other.shape[0]:
* return other
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_20dot(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_t_4;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("dot", 0);
/* "evoMPS/matmul.py":81
*
* def dot(self, other):
* if self.shape[1] == other.shape[0]: # <<<<<<<<<<<<<<
* return other
* else:
*/
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_4) {
/* "evoMPS/matmul.py":82
* def dot(self, other):
* if self.shape[1] == other.shape[0]:
* return other # <<<<<<<<<<<<<<
* else:
* raise BaseException
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_other);
__pyx_r = __pyx_v_other;
goto __pyx_L0;
goto __pyx_L3;
}
/*else*/ {
/* "evoMPS/matmul.py":84
* return other
* else:
* raise BaseException # <<<<<<<<<<<<<<
*
* def dot_left(self, other):
*/
__Pyx_Raise(__pyx_builtin_BaseException, 0, 0, 0);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("evoMPS.matmul.eyemat.dot", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_23dot_left(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_6eyemat_23dot_left = {__Pyx_NAMESTR("dot_left"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_6eyemat_23dot_left, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_23dot_left(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_other = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("dot_left (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__other,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("dot_left", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dot_left") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_other = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("dot_left", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.eyemat.dot_left", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_6eyemat_22dot_left(__pyx_self, __pyx_v_self, __pyx_v_other);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":86
* raise BaseException
*
* def dot_left(self, other): # <<<<<<<<<<<<<<
* if self.shape[0] == other.shape[1]:
* return other
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_22dot_left(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_t_4;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("dot_left", 0);
/* "evoMPS/matmul.py":87
*
* def dot_left(self, other):
* if self.shape[0] == other.shape[1]: # <<<<<<<<<<<<<<
* return other
* else:
*/
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_4) {
/* "evoMPS/matmul.py":88
* def dot_left(self, other):
* if self.shape[0] == other.shape[1]:
* return other # <<<<<<<<<<<<<<
* else:
* raise BaseException
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_other);
__pyx_r = __pyx_v_other;
goto __pyx_L0;
goto __pyx_L3;
}
/*else*/ {
/* "evoMPS/matmul.py":90
* return other
* else:
* raise BaseException # <<<<<<<<<<<<<<
*
* def conj(self):
*/
__Pyx_Raise(__pyx_builtin_BaseException, 0, 0, 0);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("evoMPS.matmul.eyemat.dot_left", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_25conj(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_6eyemat_25conj = {__Pyx_NAMESTR("conj"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_6eyemat_25conj, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_25conj(PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("conj (wrapper)", 0);
__pyx_r = __pyx_pf_6evoMPS_6matmul_6eyemat_24conj(__pyx_self, ((PyObject *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":92
* raise BaseException
*
* def conj(self): # <<<<<<<<<<<<<<
* return self
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_24conj(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("conj", 0);
/* "evoMPS/matmul.py":93
*
* def conj(self):
* return self # <<<<<<<<<<<<<<
*
* def transpose(self):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self);
__pyx_r = __pyx_v_self;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_27transpose(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_6eyemat_27transpose = {__Pyx_NAMESTR("transpose"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_6eyemat_27transpose, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_27transpose(PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("transpose (wrapper)", 0);
__pyx_r = __pyx_pf_6evoMPS_6matmul_6eyemat_26transpose(__pyx_self, ((PyObject *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":95
* return self
*
* def transpose(self): # <<<<<<<<<<<<<<
* return self
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_26transpose(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("transpose", 0);
/* "evoMPS/matmul.py":96
*
* def transpose(self):
* return self # <<<<<<<<<<<<<<
*
* def trace(self, offset=0):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self);
__pyx_r = __pyx_v_self;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_29trace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_6eyemat_29trace = {__Pyx_NAMESTR("trace"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_6eyemat_29trace, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_29trace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_offset = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("trace (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__offset,0};
PyObject* values[2] = {0,0};
values[1] = ((PyObject *)((PyObject *)__pyx_int_0));
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset);
if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trace") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_self = values[0];
__pyx_v_offset = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("trace", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.eyemat.trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_6eyemat_28trace(__pyx_self, __pyx_v_self, __pyx_v_offset);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":98
* return self
*
* def trace(self, offset=0): # <<<<<<<<<<<<<<
* if offset == 0:
* return self.shape[0]
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_28trace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_offset) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("trace", 0);
/* "evoMPS/matmul.py":99
*
* def trace(self, offset=0):
* if offset == 0: # <<<<<<<<<<<<<<
* return self.shape[0]
* else:
*/
__pyx_t_1 = PyObject_RichCompare(__pyx_v_offset, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
/* "evoMPS/matmul.py":100
* def trace(self, offset=0):
* if offset == 0:
* return self.shape[0] # <<<<<<<<<<<<<<
* else:
* return 0
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
goto __pyx_L3;
}
/*else*/ {
/* "evoMPS/matmul.py":102
* return self.shape[0]
* else:
* return 0 # <<<<<<<<<<<<<<
*
* def diagonal(self):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_int_0);
__pyx_r = __pyx_int_0;
goto __pyx_L0;
}
__pyx_L3:;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("evoMPS.matmul.eyemat.trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_31diagonal(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_6eyemat_31diagonal = {__Pyx_NAMESTR("diagonal"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_6eyemat_31diagonal, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_31diagonal(PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("diagonal (wrapper)", 0);
__pyx_r = __pyx_pf_6evoMPS_6matmul_6eyemat_30diagonal(__pyx_self, ((PyObject *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":104
* return 0
*
* def diagonal(self): # <<<<<<<<<<<<<<
* return sp.ones((self.shape[0]), dtype=self.dtype)
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_30diagonal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("diagonal", 0);
/* "evoMPS/matmul.py":105
*
* def diagonal(self):
* return sp.ones((self.shape[0]), dtype=self.dtype) # <<<<<<<<<<<<<<
*
* def sqrt(self):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ones); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__dtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("evoMPS.matmul.eyemat.diagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_33sqrt(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_6eyemat_33sqrt = {__Pyx_NAMESTR("sqrt"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_6eyemat_33sqrt, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_33sqrt(PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sqrt (wrapper)", 0);
__pyx_r = __pyx_pf_6evoMPS_6matmul_6eyemat_32sqrt(__pyx_self, ((PyObject *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":107
* return sp.ones((self.shape[0]), dtype=self.dtype)
*
* def sqrt(self): # <<<<<<<<<<<<<<
* return self
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_32sqrt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sqrt", 0);
/* "evoMPS/matmul.py":108
*
* def sqrt(self):
* return self # <<<<<<<<<<<<<<
*
* def inv(self):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self);
__pyx_r = __pyx_v_self;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_35inv(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_6eyemat_35inv = {__Pyx_NAMESTR("inv"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_6eyemat_35inv, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_35inv(PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("inv (wrapper)", 0);
__pyx_r = __pyx_pf_6evoMPS_6matmul_6eyemat_34inv(__pyx_self, ((PyObject *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":110
* return self
*
* def inv(self): # <<<<<<<<<<<<<<
* return self
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_34inv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("inv", 0);
/* "evoMPS/matmul.py":111
*
* def inv(self):
* return self # <<<<<<<<<<<<<<
*
* def ravel(self):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self);
__pyx_r = __pyx_v_self;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_37ravel(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_6eyemat_37ravel = {__Pyx_NAMESTR("ravel"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_6eyemat_37ravel, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_37ravel(PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("ravel (wrapper)", 0);
__pyx_r = __pyx_pf_6evoMPS_6matmul_6eyemat_36ravel(__pyx_self, ((PyObject *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":113
* return self
*
* def ravel(self): # <<<<<<<<<<<<<<
* return self.toarray().ravel()
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_36ravel(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("ravel", 0);
/* "evoMPS/matmul.py":114
*
* def ravel(self):
* return self.toarray().ravel() # <<<<<<<<<<<<<<
*
* def copy(self, order='C'):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__toarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("evoMPS.matmul.eyemat.ravel", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_39copy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_6eyemat_39copy = {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_6eyemat_39copy, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_39copy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
CYTHON_UNUSED PyObject *__pyx_v_order = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("copy (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__order,0};
PyObject* values[2] = {0,0};
values[1] = ((PyObject *)((PyObject*)__pyx_n_s__C));
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__order);
if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_self = values[0];
__pyx_v_order = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("copy", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.eyemat.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_6eyemat_38copy(__pyx_self, __pyx_v_self, __pyx_v_order);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":116
* return self.toarray().ravel()
*
* def copy(self, order='C'): # <<<<<<<<<<<<<<
* return eyemat(self.shape[0], dtype=self.dtype)
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_38copy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_order) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("copy", 0);
/* "evoMPS/matmul.py":117
*
* def copy(self, order='C'):
* return eyemat(self.shape[0], dtype=self.dtype) # <<<<<<<<<<<<<<
*
* def __getattr__(self, attr):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__eyemat); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__dtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("evoMPS.matmul.eyemat.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_41__getattr__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_6eyemat_41__getattr__ = {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_6eyemat_41__getattr__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_6eyemat_41__getattr__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_attr = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__attr,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__attr)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__getattr__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__getattr__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_attr = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__getattr__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_6eyemat_40__getattr__(__pyx_self, __pyx_v_self, __pyx_v_attr);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":119
* return eyemat(self.shape[0], dtype=self.dtype)
*
* def __getattr__(self, attr): # <<<<<<<<<<<<<<
* if attr == 'A':
* return self.toarray()
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_6eyemat_40__getattr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getattr__", 0);
/* "evoMPS/matmul.py":120
*
* def __getattr__(self, attr):
* if attr == 'A': # <<<<<<<<<<<<<<
* return self.toarray()
* elif attr == 'T':
*/
__pyx_t_1 = PyObject_RichCompare(__pyx_v_attr, ((PyObject *)__pyx_n_s__A), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
/* "evoMPS/matmul.py":121
* def __getattr__(self, attr):
* if attr == 'A':
* return self.toarray() # <<<<<<<<<<<<<<
* elif attr == 'T':
* return self.transpose()
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__toarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
goto __pyx_L3;
}
/* "evoMPS/matmul.py":122
* if attr == 'A':
* return self.toarray()
* elif attr == 'T': # <<<<<<<<<<<<<<
* return self.transpose()
* else:
*/
__pyx_t_3 = PyObject_RichCompare(__pyx_v_attr, ((PyObject *)__pyx_n_s__T), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_2) {
/* "evoMPS/matmul.py":123
* return self.toarray()
* elif attr == 'T':
* return self.transpose() # <<<<<<<<<<<<<<
* else:
* raise AttributeError(attr + " not found")
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__transpose); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
goto __pyx_L3;
}
/*else*/ {
/* "evoMPS/matmul.py":125
* return self.transpose()
* else:
* raise AttributeError(attr + " not found") # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_1 = PyNumber_Add(__pyx_v_attr, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("evoMPS.matmul.eyemat.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_diag = 0;
PyObject *__pyx_v_dtype = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__diag,&__pyx_n_s__dtype,0};
PyObject* values[3] = {0,0,0};
/* "evoMPS/matmul.py":135
* dtype = None
*
* def __init__(self, diag, dtype=None): # <<<<<<<<<<<<<<
* self.dtype = dtype
* diag = sp.asanyarray(diag, dtype=dtype)
*/
values[2] = ((PyObject *)((PyObject *)Py_None));
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__diag)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dtype);
if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_self = values[0];
__pyx_v_diag = values[1];
__pyx_v_dtype = values[2];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_18simple_diag_matrix___init__(__pyx_self, __pyx_v_self, __pyx_v_diag, __pyx_v_dtype);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_diag, PyObject *__pyx_v_dtype) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_t_5;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
__Pyx_INCREF(__pyx_v_diag);
/* "evoMPS/matmul.py":136
*
* def __init__(self, diag, dtype=None):
* self.dtype = dtype # <<<<<<<<<<<<<<
* diag = sp.asanyarray(diag, dtype=dtype)
* assert diag.ndim == 1
*/
if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__dtype, __pyx_v_dtype) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":137
* def __init__(self, diag, dtype=None):
* self.dtype = dtype
* diag = sp.asanyarray(diag, dtype=dtype) # <<<<<<<<<<<<<<
* assert diag.ndim == 1
* self.diag = diag
*/
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asanyarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_diag);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_diag);
__Pyx_GIVEREF(__pyx_v_diag);
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_v_dtype) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_v_diag);
__pyx_v_diag = __pyx_t_4;
__pyx_t_4 = 0;
/* "evoMPS/matmul.py":138
* self.dtype = dtype
* diag = sp.asanyarray(diag, dtype=dtype)
* assert diag.ndim == 1 # <<<<<<<<<<<<<<
* self.diag = diag
* self.shape = (diag.shape[0], diag.shape[0])
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
__pyx_t_4 = PyObject_GetAttr(__pyx_v_diag, __pyx_n_s__ndim); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_5)) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
/* "evoMPS/matmul.py":139
* diag = sp.asanyarray(diag, dtype=dtype)
* assert diag.ndim == 1
* self.diag = diag # <<<<<<<<<<<<<<
* self.shape = (diag.shape[0], diag.shape[0])
*
*/
if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__diag, __pyx_v_diag) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":140
* assert diag.ndim == 1
* self.diag = diag
* self.shape = (diag.shape[0], diag.shape[0]) # <<<<<<<<<<<<<<
*
* def __array__(self):
*/
__pyx_t_3 = PyObject_GetAttr(__pyx_v_diag, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyObject_GetAttr(__pyx_v_diag, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_4 = 0;
__pyx_t_1 = 0;
if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__shape, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_diag);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_3__array__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_3__array__ = {__Pyx_NAMESTR("__array__"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_3__array__, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_3__array__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__array__ (wrapper)", 0);
__pyx_r = __pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_2__array__(__pyx_self, ((PyObject *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":142
* self.shape = (diag.shape[0], diag.shape[0])
*
* def __array__(self): # <<<<<<<<<<<<<<
* return self.toarray()
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_2__array__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__array__", 0);
/* "evoMPS/matmul.py":143
*
* def __array__(self):
* return self.toarray() # <<<<<<<<<<<<<<
*
* def dot(self, b):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__toarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__array__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_5dot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_5dot = {__Pyx_NAMESTR("dot"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_5dot, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_5dot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_b = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("dot (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__b,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__b)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("dot", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dot") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_b = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("dot", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.dot", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_4dot(__pyx_self, __pyx_v_self, __pyx_v_b);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":145
* return self.toarray()
*
* def dot(self, b): # <<<<<<<<<<<<<<
* if isinstance(b, simple_diag_matrix):
* return simple_diag_matrix(self.diag * b.diag)
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_4dot(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_b) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("dot", 0);
/* "evoMPS/matmul.py":146
*
* def dot(self, b):
* if isinstance(b, simple_diag_matrix): # <<<<<<<<<<<<<<
* return simple_diag_matrix(self.diag * b.diag)
*
*/
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__simple_diag_matrix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_IsInstance(__pyx_v_b, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
/* "evoMPS/matmul.py":147
* def dot(self, b):
* if isinstance(b, simple_diag_matrix):
* return simple_diag_matrix(self.diag * b.diag) # <<<<<<<<<<<<<<
*
* return mmul_diag(self.diag, b)
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__simple_diag_matrix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__diag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyObject_GetAttr(__pyx_v_b, __pyx_n_s__diag); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
__pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__pyx_r = __pyx_t_5;
__pyx_t_5 = 0;
goto __pyx_L0;
goto __pyx_L3;
}
__pyx_L3:;
/* "evoMPS/matmul.py":149
* return simple_diag_matrix(self.diag * b.diag)
*
* return mmul_diag(self.diag, b) # <<<<<<<<<<<<<<
*
* def dot_left(self, a):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__mmul_diag); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__diag); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_b);
__Pyx_GIVEREF(__pyx_v_b);
__pyx_t_4 = 0;
__pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.dot", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_7dot_left(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_7dot_left = {__Pyx_NAMESTR("dot_left"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_7dot_left, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_7dot_left(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_a = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("dot_left (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__a,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("dot_left", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dot_left") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_a = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("dot_left", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.dot_left", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_6dot_left(__pyx_self, __pyx_v_self, __pyx_v_a);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":151
* return mmul_diag(self.diag, b)
*
* def dot_left(self, a): # <<<<<<<<<<<<<<
* if isinstance(a, simple_diag_matrix):
* return simple_diag_matrix(self.diag * a.diag)
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_6dot_left(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_a) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("dot_left", 0);
/* "evoMPS/matmul.py":152
*
* def dot_left(self, a):
* if isinstance(a, simple_diag_matrix): # <<<<<<<<<<<<<<
* return simple_diag_matrix(self.diag * a.diag)
*
*/
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__simple_diag_matrix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_IsInstance(__pyx_v_a, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
/* "evoMPS/matmul.py":153
* def dot_left(self, a):
* if isinstance(a, simple_diag_matrix):
* return simple_diag_matrix(self.diag * a.diag) # <<<<<<<<<<<<<<
*
* return mmul_diag(self.diag, a, act_right=False)
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__simple_diag_matrix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__diag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__diag); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
__pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__pyx_r = __pyx_t_5;
__pyx_t_5 = 0;
goto __pyx_L0;
goto __pyx_L3;
}
__pyx_L3:;
/* "evoMPS/matmul.py":155
* return simple_diag_matrix(self.diag * a.diag)
*
* return mmul_diag(self.diag, a, act_right=False) # <<<<<<<<<<<<<<
*
* def conj(self):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__mmul_diag); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__diag); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_a);
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_a);
__Pyx_GIVEREF(__pyx_v_a);
__pyx_t_4 = 0;
__pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
__pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__act_right), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.dot_left", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_9conj(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_9conj = {__Pyx_NAMESTR("conj"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_9conj, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_9conj(PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("conj (wrapper)", 0);
__pyx_r = __pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_8conj(__pyx_self, ((PyObject *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":157
* return mmul_diag(self.diag, a, act_right=False)
*
* def conj(self): # <<<<<<<<<<<<<<
* return simple_diag_matrix(self.diag.conj())
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_8conj(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("conj", 0);
/* "evoMPS/matmul.py":158
*
* def conj(self):
* return simple_diag_matrix(self.diag.conj()) # <<<<<<<<<<<<<<
*
* def transpose(self):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__simple_diag_matrix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__diag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__conj); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.conj", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_11transpose(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_11transpose = {__Pyx_NAMESTR("transpose"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_11transpose, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_11transpose(PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("transpose (wrapper)", 0);
__pyx_r = __pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_10transpose(__pyx_self, ((PyObject *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":160
* return simple_diag_matrix(self.diag.conj())
*
* def transpose(self): # <<<<<<<<<<<<<<
* return self
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_10transpose(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("transpose", 0);
/* "evoMPS/matmul.py":161
*
* def transpose(self):
* return self # <<<<<<<<<<<<<<
*
* def inv(self):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self);
__pyx_r = __pyx_v_self;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_13inv(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_13inv = {__Pyx_NAMESTR("inv"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_13inv, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_13inv(PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("inv (wrapper)", 0);
__pyx_r = __pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_12inv(__pyx_self, ((PyObject *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":163
* return self
*
* def inv(self): # <<<<<<<<<<<<<<
* return simple_diag_matrix(1. / self.diag)
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_12inv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("inv", 0);
/* "evoMPS/matmul.py":164
*
* def inv(self):
* return simple_diag_matrix(1. / self.diag) # <<<<<<<<<<<<<<
*
* def sqrt(self):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__simple_diag_matrix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyFloat_FromDouble(1.); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__diag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
__pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.inv", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_15sqrt(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_15sqrt = {__Pyx_NAMESTR("sqrt"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_15sqrt, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_15sqrt(PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sqrt (wrapper)", 0);
__pyx_r = __pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_14sqrt(__pyx_self, ((PyObject *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":166
* return simple_diag_matrix(1. / self.diag)
*
* def sqrt(self): # <<<<<<<<<<<<<<
* return simple_diag_matrix(sp.sqrt(self.diag))
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_14sqrt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("sqrt", 0);
/* "evoMPS/matmul.py":167
*
* def sqrt(self):
* return simple_diag_matrix(sp.sqrt(self.diag)) # <<<<<<<<<<<<<<
*
* def ravel(self):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__simple_diag_matrix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__diag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.sqrt", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_17ravel(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_17ravel = {__Pyx_NAMESTR("ravel"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_17ravel, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_17ravel(PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("ravel (wrapper)", 0);
__pyx_r = __pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_16ravel(__pyx_self, ((PyObject *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":169
* return simple_diag_matrix(sp.sqrt(self.diag))
*
* def ravel(self): # <<<<<<<<<<<<<<
* return sp.diag(self.diag).ravel()
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_16ravel(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("ravel", 0);
/* "evoMPS/matmul.py":170
*
* def ravel(self):
* return sp.diag(self.diag).ravel() # <<<<<<<<<<<<<<
*
* def diagonal(self):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__diag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__diag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.ravel", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_19diagonal(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_19diagonal = {__Pyx_NAMESTR("diagonal"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_19diagonal, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_19diagonal(PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("diagonal (wrapper)", 0);
__pyx_r = __pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_18diagonal(__pyx_self, ((PyObject *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":172
* return sp.diag(self.diag).ravel()
*
* def diagonal(self): # <<<<<<<<<<<<<<
* return self.diag
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_18diagonal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("diagonal", 0);
/* "evoMPS/matmul.py":173
*
* def diagonal(self):
* return self.diag # <<<<<<<<<<<<<<
*
* def trace(self, offset=0):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__diag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.diagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_21trace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_21trace = {__Pyx_NAMESTR("trace"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_21trace, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_21trace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_offset = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("trace (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__offset,0};
PyObject* values[2] = {0,0};
values[1] = ((PyObject *)((PyObject *)__pyx_int_0));
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset);
if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trace") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_self = values[0];
__pyx_v_offset = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("trace", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_20trace(__pyx_self, __pyx_v_self, __pyx_v_offset);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":175
* return self.diag
*
* def trace(self, offset=0): # <<<<<<<<<<<<<<
* if offset == 0:
* return self.diag.sum()
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_20trace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_offset) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("trace", 0);
/* "evoMPS/matmul.py":176
*
* def trace(self, offset=0):
* if offset == 0: # <<<<<<<<<<<<<<
* return self.diag.sum()
* else:
*/
__pyx_t_1 = PyObject_RichCompare(__pyx_v_offset, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
/* "evoMPS/matmul.py":177
* def trace(self, offset=0):
* if offset == 0:
* return self.diag.sum() # <<<<<<<<<<<<<<
* else:
* return 0
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__diag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sum); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
goto __pyx_L3;
}
/*else*/ {
/* "evoMPS/matmul.py":179
* return self.diag.sum()
* else:
* return 0 # <<<<<<<<<<<<<<
*
* def toarray(self):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_int_0);
__pyx_r = __pyx_int_0;
goto __pyx_L0;
}
__pyx_L3:;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_23toarray(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_23toarray = {__Pyx_NAMESTR("toarray"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_23toarray, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_23toarray(PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("toarray (wrapper)", 0);
__pyx_r = __pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_22toarray(__pyx_self, ((PyObject *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":181
* return 0
*
* def toarray(self): # <<<<<<<<<<<<<<
* return sp.diag(self.diag)
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_22toarray(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("toarray", 0);
/* "evoMPS/matmul.py":182
*
* def toarray(self):
* return sp.diag(self.diag) # <<<<<<<<<<<<<<
*
* def copy(self, order='C'):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__diag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__diag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.toarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_25copy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_25copy = {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_25copy, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_25copy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
CYTHON_UNUSED PyObject *__pyx_v_order = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("copy (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__order,0};
PyObject* values[2] = {0,0};
values[1] = ((PyObject *)((PyObject*)__pyx_n_s__C));
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__order);
if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_self = values[0];
__pyx_v_order = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("copy", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_24copy(__pyx_self, __pyx_v_self, __pyx_v_order);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":184
* return sp.diag(self.diag)
*
* def copy(self, order='C'): # <<<<<<<<<<<<<<
* return simple_diag_matrix(self.diag.copy())
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_24copy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_order) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("copy", 0);
/* "evoMPS/matmul.py":185
*
* def copy(self, order='C'):
* return simple_diag_matrix(self.diag.copy()) # <<<<<<<<<<<<<<
*
* def __mul__(self, other):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__simple_diag_matrix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__diag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__copy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_27__mul__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_27__mul__ = {__Pyx_NAMESTR("__mul__"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_27__mul__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_27__mul__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_other = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__mul__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__other,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__mul__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__mul__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_other = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__mul__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_26__mul__(__pyx_self, __pyx_v_self, __pyx_v_other);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":187
* return simple_diag_matrix(self.diag.copy())
*
* def __mul__(self, other): # <<<<<<<<<<<<<<
* if sp.isscalar(other):
* return simple_diag_matrix(self.diag * other)
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_26__mul__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_t_4;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
PyObject *__pyx_t_8 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__mul__", 0);
__Pyx_INCREF(__pyx_v_other);
/* "evoMPS/matmul.py":188
*
* def __mul__(self, other):
* if sp.isscalar(other): # <<<<<<<<<<<<<<
* return simple_diag_matrix(self.diag * other)
*
*/
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__isscalar); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_other);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_other);
__Pyx_GIVEREF(__pyx_v_other);
__pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_4) {
/* "evoMPS/matmul.py":189
* def __mul__(self, other):
* if sp.isscalar(other):
* return simple_diag_matrix(self.diag * other) # <<<<<<<<<<<<<<
*
* try:
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__simple_diag_matrix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__diag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_other); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L3;
}
__pyx_L3:;
/* "evoMPS/matmul.py":191
* return simple_diag_matrix(self.diag * other)
*
* try: # <<<<<<<<<<<<<<
* other = sp.asanyarray(other)
*
*/
{
__Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
__Pyx_XGOTREF(__pyx_t_5);
__Pyx_XGOTREF(__pyx_t_6);
__Pyx_XGOTREF(__pyx_t_7);
/*try:*/ {
/* "evoMPS/matmul.py":192
*
* try:
* other = sp.asanyarray(other) # <<<<<<<<<<<<<<
*
* if other.shape == self.shape:
*/
__pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__asanyarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_other);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_other);
__Pyx_GIVEREF(__pyx_v_other);
__pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_v_other);
__pyx_v_other = __pyx_t_3;
__pyx_t_3 = 0;
/* "evoMPS/matmul.py":194
* other = sp.asanyarray(other)
*
* if other.shape == self.shape: # <<<<<<<<<<<<<<
* return simple_diag_matrix(self.diag * other.diagonal())
*
*/
__pyx_t_3 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_4) {
/* "evoMPS/matmul.py":195
*
* if other.shape == self.shape:
* return simple_diag_matrix(self.diag * other.diagonal()) # <<<<<<<<<<<<<<
*
* return self.toarray() * other
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__simple_diag_matrix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__diag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__diagonal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_8);
PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L8_try_return;
goto __pyx_L12;
}
__pyx_L12:;
/* "evoMPS/matmul.py":197
* return simple_diag_matrix(self.diag * other.diagonal())
*
* return self.toarray() * other # <<<<<<<<<<<<<<
* except:
* return NotImplemented
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__toarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyNumber_Multiply(__pyx_t_8, __pyx_v_other); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L8_try_return;
}
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
goto __pyx_L11_try_end;
__pyx_L8_try_return:;
__Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
__Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
goto __pyx_L0;
__pyx_L4_error:;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "evoMPS/matmul.py":198
*
* return self.toarray() * other
* except: # <<<<<<<<<<<<<<
* return NotImplemented
*
*/
/*except:*/ {
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_8, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_GOTREF(__pyx_t_8);
__Pyx_GOTREF(__pyx_t_1);
/* "evoMPS/matmul.py":199
* return self.toarray() * other
* except:
* return NotImplemented # <<<<<<<<<<<<<<
*
* def __rmul__(self, other):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_builtin_NotImplemented);
__pyx_r = __pyx_builtin_NotImplemented;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L7_except_return;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L5_exception_handled;
}
__pyx_L6_except_error:;
__Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
__Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
goto __pyx_L1_error;
__pyx_L7_except_return:;
__Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
__Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
goto __pyx_L0;
__pyx_L5_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
__Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
__pyx_L11_try_end:;
}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_other);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_29__rmul__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_29__rmul__ = {__Pyx_NAMESTR("__rmul__"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_29__rmul__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_29__rmul__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_other = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__rmul__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__other,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__rmul__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__rmul__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_other = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__rmul__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__rmul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_28__rmul__(__pyx_self, __pyx_v_self, __pyx_v_other);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":201
* return NotImplemented
*
* def __rmul__(self, other): # <<<<<<<<<<<<<<
* return self.__mul__(self, other)
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_28__rmul__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__rmul__", 0);
/* "evoMPS/matmul.py":202
*
* def __rmul__(self, other):
* return self.__mul__(self, other) # <<<<<<<<<<<<<<
*
* def __add__(self, other):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____mul__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_self);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
__Pyx_GIVEREF(__pyx_v_self);
__Pyx_INCREF(__pyx_v_other);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_other);
__Pyx_GIVEREF(__pyx_v_other);
__pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__rmul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_31__add__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_31__add__ = {__Pyx_NAMESTR("__add__"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_31__add__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_31__add__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_other = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__add__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__other,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__add__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__add__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_other = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__add__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_30__add__(__pyx_self, __pyx_v_self, __pyx_v_other);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":204
* return self.__mul__(self, other)
*
* def __add__(self, other): # <<<<<<<<<<<<<<
* try:
* return self.toarray() + other
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_30__add__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__add__", 0);
/* "evoMPS/matmul.py":205
*
* def __add__(self, other):
* try: # <<<<<<<<<<<<<<
* return self.toarray() + other
* except:
*/
{
__Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
__Pyx_XGOTREF(__pyx_t_1);
__Pyx_XGOTREF(__pyx_t_2);
__Pyx_XGOTREF(__pyx_t_3);
/*try:*/ {
/* "evoMPS/matmul.py":206
* def __add__(self, other):
* try:
* return self.toarray() + other # <<<<<<<<<<<<<<
* except:
* return NotImplemented
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__toarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_v_other); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L7_try_return;
}
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L10_try_end;
__pyx_L7_try_return:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L0;
__pyx_L3_error:;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":207
* try:
* return self.toarray() + other
* except: # <<<<<<<<<<<<<<
* return NotImplemented
*
*/
/*except:*/ {
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_t_6);
/* "evoMPS/matmul.py":208
* return self.toarray() + other
* except:
* return NotImplemented # <<<<<<<<<<<<<<
*
* def __radd__(self, other):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_builtin_NotImplemented);
__pyx_r = __pyx_builtin_NotImplemented;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L6_except_return;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L4_exception_handled;
}
__pyx_L5_except_error:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L1_error;
__pyx_L6_except_return:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L0;
__pyx_L4_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
__pyx_L10_try_end:;
}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_33__radd__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_33__radd__ = {__Pyx_NAMESTR("__radd__"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_33__radd__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_33__radd__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_other = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__radd__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__other,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__radd__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__radd__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_other = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__radd__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__radd__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_32__radd__(__pyx_self, __pyx_v_self, __pyx_v_other);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":210
* return NotImplemented
*
* def __radd__(self, other): # <<<<<<<<<<<<<<
* try:
* return other + self.toarray()
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_32__radd__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__radd__", 0);
/* "evoMPS/matmul.py":211
*
* def __radd__(self, other):
* try: # <<<<<<<<<<<<<<
* return other + self.toarray()
* except:
*/
{
__Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
__Pyx_XGOTREF(__pyx_t_1);
__Pyx_XGOTREF(__pyx_t_2);
__Pyx_XGOTREF(__pyx_t_3);
/*try:*/ {
/* "evoMPS/matmul.py":212
* def __radd__(self, other):
* try:
* return other + self.toarray() # <<<<<<<<<<<<<<
* except:
* return NotImplemented
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__toarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyNumber_Add(__pyx_v_other, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L7_try_return;
}
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L10_try_end;
__pyx_L7_try_return:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L0;
__pyx_L3_error:;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":213
* try:
* return other + self.toarray()
* except: # <<<<<<<<<<<<<<
* return NotImplemented
*
*/
/*except:*/ {
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__radd__", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_t_6);
/* "evoMPS/matmul.py":214
* return other + self.toarray()
* except:
* return NotImplemented # <<<<<<<<<<<<<<
*
* def __sub__(self, other):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_builtin_NotImplemented);
__pyx_r = __pyx_builtin_NotImplemented;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L6_except_return;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L4_exception_handled;
}
__pyx_L5_except_error:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L1_error;
__pyx_L6_except_return:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L0;
__pyx_L4_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
__pyx_L10_try_end:;
}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__radd__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_35__sub__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_35__sub__ = {__Pyx_NAMESTR("__sub__"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_35__sub__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_35__sub__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_other = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__sub__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__other,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__sub__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__sub__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_other = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__sub__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_34__sub__(__pyx_self, __pyx_v_self, __pyx_v_other);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":216
* return NotImplemented
*
* def __sub__(self, other): # <<<<<<<<<<<<<<
* try:
* return self.toarray() - other
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_34__sub__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__sub__", 0);
/* "evoMPS/matmul.py":217
*
* def __sub__(self, other):
* try: # <<<<<<<<<<<<<<
* return self.toarray() - other
* except:
*/
{
__Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
__Pyx_XGOTREF(__pyx_t_1);
__Pyx_XGOTREF(__pyx_t_2);
__Pyx_XGOTREF(__pyx_t_3);
/*try:*/ {
/* "evoMPS/matmul.py":218
* def __sub__(self, other):
* try:
* return self.toarray() - other # <<<<<<<<<<<<<<
* except:
* return NotImplemented
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__toarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyNumber_Subtract(__pyx_t_5, __pyx_v_other); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L7_try_return;
}
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L10_try_end;
__pyx_L7_try_return:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L0;
__pyx_L3_error:;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":219
* try:
* return self.toarray() - other
* except: # <<<<<<<<<<<<<<
* return NotImplemented
*
*/
/*except:*/ {
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_t_6);
/* "evoMPS/matmul.py":220
* return self.toarray() - other
* except:
* return NotImplemented # <<<<<<<<<<<<<<
*
* def __rsub__(self, other):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_builtin_NotImplemented);
__pyx_r = __pyx_builtin_NotImplemented;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L6_except_return;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L4_exception_handled;
}
__pyx_L5_except_error:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L1_error;
__pyx_L6_except_return:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L0;
__pyx_L4_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
__pyx_L10_try_end:;
}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_37__rsub__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_37__rsub__ = {__Pyx_NAMESTR("__rsub__"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_37__rsub__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_37__rsub__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_other = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__rsub__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__other,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__rsub__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__rsub__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_other = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__rsub__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__rsub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_36__rsub__(__pyx_self, __pyx_v_self, __pyx_v_other);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":222
* return NotImplemented
*
* def __rsub__(self, other): # <<<<<<<<<<<<<<
* try:
* return other - self.toarray()
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_36__rsub__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__rsub__", 0);
/* "evoMPS/matmul.py":223
*
* def __rsub__(self, other):
* try: # <<<<<<<<<<<<<<
* return other - self.toarray()
* except:
*/
{
__Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
__Pyx_XGOTREF(__pyx_t_1);
__Pyx_XGOTREF(__pyx_t_2);
__Pyx_XGOTREF(__pyx_t_3);
/*try:*/ {
/* "evoMPS/matmul.py":224
* def __rsub__(self, other):
* try:
* return other - self.toarray() # <<<<<<<<<<<<<<
* except:
* return NotImplemented
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__toarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyNumber_Subtract(__pyx_v_other, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L7_try_return;
}
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L10_try_end;
__pyx_L7_try_return:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L0;
__pyx_L3_error:;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":225
* try:
* return other - self.toarray()
* except: # <<<<<<<<<<<<<<
* return NotImplemented
*
*/
/*except:*/ {
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__rsub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_t_6);
/* "evoMPS/matmul.py":226
* return other - self.toarray()
* except:
* return NotImplemented # <<<<<<<<<<<<<<
*
* def __coerce__(self, other):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_builtin_NotImplemented);
__pyx_r = __pyx_builtin_NotImplemented;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L6_except_return;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L4_exception_handled;
}
__pyx_L5_except_error:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L1_error;
__pyx_L6_except_return:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L0;
__pyx_L4_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
__pyx_L10_try_end:;
}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__rsub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_39__coerce__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_39__coerce__ = {__Pyx_NAMESTR("__coerce__"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_39__coerce__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_39__coerce__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_other = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__coerce__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__other,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__coerce__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__coerce__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_other = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__coerce__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__coerce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_38__coerce__(__pyx_self, __pyx_v_self, __pyx_v_other);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":228
* return NotImplemented
*
* def __coerce__(self, other): # <<<<<<<<<<<<<<
* try:
* other = sp.asanyarray(other)
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_38__coerce__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
int __pyx_t_7;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__coerce__", 0);
__Pyx_INCREF(__pyx_v_other);
/* "evoMPS/matmul.py":229
*
* def __coerce__(self, other):
* try: # <<<<<<<<<<<<<<
* other = sp.asanyarray(other)
* if other.shape == self.shape:
*/
{
__Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
__Pyx_XGOTREF(__pyx_t_1);
__Pyx_XGOTREF(__pyx_t_2);
__Pyx_XGOTREF(__pyx_t_3);
/*try:*/ {
/* "evoMPS/matmul.py":230
* def __coerce__(self, other):
* try:
* other = sp.asanyarray(other) # <<<<<<<<<<<<<<
* if other.shape == self.shape:
* return (self.toarray(), other)
*/
__pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__asanyarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_other);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_other);
__Pyx_GIVEREF(__pyx_v_other);
__pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_v_other);
__pyx_v_other = __pyx_t_6;
__pyx_t_6 = 0;
/* "evoMPS/matmul.py":231
* try:
* other = sp.asanyarray(other)
* if other.shape == self.shape: # <<<<<<<<<<<<<<
* return (self.toarray(), other)
* else:
*/
__pyx_t_6 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__shape); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
/* "evoMPS/matmul.py":232
* other = sp.asanyarray(other)
* if other.shape == self.shape:
* return (self.toarray(), other) # <<<<<<<<<<<<<<
* else:
* return None
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__toarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_other);
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_other);
__Pyx_GIVEREF(__pyx_v_other);
__pyx_t_4 = 0;
__pyx_r = ((PyObject *)__pyx_t_5);
__pyx_t_5 = 0;
goto __pyx_L7_try_return;
goto __pyx_L11;
}
/*else*/ {
/* "evoMPS/matmul.py":234
* return (self.toarray(), other)
* else:
* return None # <<<<<<<<<<<<<<
* except:
* return None
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(Py_None);
__pyx_r = Py_None;
goto __pyx_L7_try_return;
}
__pyx_L11:;
}
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L10_try_end;
__pyx_L7_try_return:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L0;
__pyx_L3_error:;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "evoMPS/matmul.py":235
* else:
* return None
* except: # <<<<<<<<<<<<<<
* return None
*
*/
/*except:*/ {
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__coerce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_t_6);
/* "evoMPS/matmul.py":236
* return None
* except:
* return None # <<<<<<<<<<<<<<
*
* def __getattr__(self, attr):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(Py_None);
__pyx_r = Py_None;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L6_except_return;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L4_exception_handled;
}
__pyx_L5_except_error:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L1_error;
__pyx_L6_except_return:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L0;
__pyx_L4_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
__pyx_L10_try_end:;
}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__coerce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_other);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_41__getattr__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_41__getattr__ = {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_41__getattr__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_18simple_diag_matrix_41__getattr__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_attr = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__attr,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__attr)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__getattr__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__getattr__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_attr = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__getattr__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_40__getattr__(__pyx_self, __pyx_v_self, __pyx_v_attr);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":238
* return None
*
* def __getattr__(self, attr): # <<<<<<<<<<<<<<
* if attr == 'A':
* return self.toarray()
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_18simple_diag_matrix_40__getattr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getattr__", 0);
/* "evoMPS/matmul.py":239
*
* def __getattr__(self, attr):
* if attr == 'A': # <<<<<<<<<<<<<<
* return self.toarray()
* elif attr == 'T':
*/
__pyx_t_1 = PyObject_RichCompare(__pyx_v_attr, ((PyObject *)__pyx_n_s__A), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
/* "evoMPS/matmul.py":240
* def __getattr__(self, attr):
* if attr == 'A':
* return self.toarray() # <<<<<<<<<<<<<<
* elif attr == 'T':
* return self.transpose()
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__toarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
goto __pyx_L3;
}
/* "evoMPS/matmul.py":241
* if attr == 'A':
* return self.toarray()
* elif attr == 'T': # <<<<<<<<<<<<<<
* return self.transpose()
* else:
*/
__pyx_t_3 = PyObject_RichCompare(__pyx_v_attr, ((PyObject *)__pyx_n_s__T), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_2) {
/* "evoMPS/matmul.py":242
* return self.toarray()
* elif attr == 'T':
* return self.transpose() # <<<<<<<<<<<<<<
* else:
* raise AttributeError(attr + " not found")
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__transpose); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
goto __pyx_L3;
}
/*else*/ {
/* "evoMPS/matmul.py":244
* return self.transpose()
* else:
* raise AttributeError(attr + " not found") # <<<<<<<<<<<<<<
*
* def mmul(*args):
*/
__pyx_t_1 = PyNumber_Add(__pyx_v_attr, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("evoMPS.matmul.simple_diag_matrix.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_1mmul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6evoMPS_6matmul_mmul[] = "Multiplies a chain of matrices (2-d ndarrays)\n \n All matrices must have dimensions compatible with matrix multiplication.\n This function actually calls the dot() method of the objects passed in\n as arguments. It thus handles any object that provides a dot() method\n that accepts 2D ndarrays.\n \n We also try to call dot_left(), in case an optimized left-acting\n dot operation is available.\n \n This function is intended to work nicely with the above defined \"sparse\"\n matrix objects.\n \n Parameters\n ----------\n *args : ndarray\n The chain of matrices to multiply together.\n\n Returns\n -------\n out : ndarray\n The result.\n ";
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_1mmul = {__Pyx_NAMESTR("mmul"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_1mmul, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6evoMPS_6matmul_mmul)};
static PyObject *__pyx_pw_6evoMPS_6matmul_1mmul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_args = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mmul (wrapper)", 0);
if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "mmul", 0))) return NULL;
__Pyx_INCREF(__pyx_args);
__pyx_v_args = __pyx_args;
__pyx_r = __pyx_pf_6evoMPS_6matmul_mmul(__pyx_self, __pyx_v_args);
__Pyx_XDECREF(__pyx_v_args);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":246
* raise AttributeError(attr + " not found")
*
* def mmul(*args): # <<<<<<<<<<<<<<
* """Multiplies a chain of matrices (2-d ndarrays)
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_mmul(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_args) {
PyObject *__pyx_v_res = NULL;
PyObject *__pyx_v_x = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
Py_ssize_t __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
PyObject *__pyx_t_8 = NULL;
PyObject *__pyx_t_9 = NULL;
PyObject *__pyx_t_10 = NULL;
PyObject *__pyx_t_11 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("mmul", 0);
/* "evoMPS/matmul.py":273
* # raise
*
* res = args[0] # <<<<<<<<<<<<<<
*
* for x in args[1:]:
*/
__pyx_t_1 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_args), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_res = __pyx_t_1;
__pyx_t_1 = 0;
/* "evoMPS/matmul.py":275
* res = args[0]
*
* for x in args[1:]: # <<<<<<<<<<<<<<
* try:
* res = x.dot_left(res)
*/
__pyx_t_1 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_args), 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
if (unlikely(((PyObject *)__pyx_t_1) == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_2 = ((PyObject *)__pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
for (;;) {
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
__Pyx_XDECREF(__pyx_v_x);
__pyx_v_x = __pyx_t_1;
__pyx_t_1 = 0;
/* "evoMPS/matmul.py":276
*
* for x in args[1:]:
* try: # <<<<<<<<<<<<<<
* res = x.dot_left(res)
* except:
*/
{
__Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
__Pyx_XGOTREF(__pyx_t_4);
__Pyx_XGOTREF(__pyx_t_5);
__Pyx_XGOTREF(__pyx_t_6);
/*try:*/ {
/* "evoMPS/matmul.py":277
* for x in args[1:]:
* try:
* res = x.dot_left(res) # <<<<<<<<<<<<<<
* except:
* res = res.dot(x)
*/
__pyx_t_1 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__dot_left); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_INCREF(__pyx_v_res);
PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_res);
__Pyx_GIVEREF(__pyx_v_res);
__pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_v_res);
__pyx_v_res = __pyx_t_8;
__pyx_t_8 = 0;
}
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L12_try_end;
__pyx_L5_error:;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
/* "evoMPS/matmul.py":278
* try:
* res = x.dot_left(res)
* except: # <<<<<<<<<<<<<<
* res = res.dot(x)
*
*/
/*except:*/ {
__Pyx_AddTraceback("evoMPS.matmul.mmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_GOTREF(__pyx_t_7);
__Pyx_GOTREF(__pyx_t_1);
/* "evoMPS/matmul.py":279
* res = x.dot_left(res)
* except:
* res = res.dot(x) # <<<<<<<<<<<<<<
*
* #Since, for some reason, the method version of dot() does not generally
*/
__pyx_t_9 = PyObject_GetAttr(__pyx_v_res, __pyx_n_s__dot); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_INCREF(__pyx_v_x);
PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_x);
__Pyx_GIVEREF(__pyx_v_x);
__pyx_t_11 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
__Pyx_DECREF(__pyx_v_res);
__pyx_v_res = __pyx_t_11;
__pyx_t_11 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L6_exception_handled;
}
__pyx_L7_except_error:;
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
goto __pyx_L1_error;
__pyx_L6_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
__pyx_L12_try_end:;
}
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "evoMPS/matmul.py":283
* #Since, for some reason, the method version of dot() does not generally
* #take an "out" argument, I ignored this (for now, minor) optimization.
* return res # <<<<<<<<<<<<<<
*
* # if out is None:
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_res);
__pyx_r = __pyx_v_res;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_XDECREF(__pyx_t_11);
__Pyx_AddTraceback("evoMPS.matmul.mmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_res);
__Pyx_XDECREF(__pyx_v_x);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_3adot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6evoMPS_6matmul_2adot[] = "\n Calculates the scalar product for the ancilla, expecting\n the arguments in matrix form.\n Equivalent to trace(dot(H(a), b))\n ";
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_3adot = {__Pyx_NAMESTR("adot"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_3adot, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6evoMPS_6matmul_2adot)};
static PyObject *__pyx_pw_6evoMPS_6matmul_3adot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_a = 0;
PyObject *__pyx_v_b = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("adot (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__a,&__pyx_n_s__b,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__b)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("adot", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "adot") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_a = values[0];
__pyx_v_b = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("adot", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.adot", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_2adot(__pyx_self, __pyx_v_a, __pyx_v_b);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":293
* # return sp.dot(res, args[-1], out=out)
*
* def adot(a, b): # <<<<<<<<<<<<<<
* """
* Calculates the scalar product for the ancilla, expecting
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_2adot(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("adot", 0);
/* "evoMPS/matmul.py":299
* Equivalent to trace(dot(H(a), b))
* """
* return sp.inner(a.ravel().conj(), b.ravel()) # <<<<<<<<<<<<<<
*
* def adot_noconj(a, b):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__inner); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__conj); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_v_b, __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_3 = 0;
__pyx_t_4 = 0;
__pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("evoMPS.matmul.adot", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_5adot_noconj(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6evoMPS_6matmul_4adot_noconj[] = "\n Calculates the scalar product for the ancilla, expecting\n the arguments in matrix form.\n Equivalent to trace(dot(a, b))\n ";
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_5adot_noconj = {__Pyx_NAMESTR("adot_noconj"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_5adot_noconj, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6evoMPS_6matmul_4adot_noconj)};
static PyObject *__pyx_pw_6evoMPS_6matmul_5adot_noconj(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_a = 0;
PyObject *__pyx_v_b = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("adot_noconj (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__a,&__pyx_n_s__b,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__b)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("adot_noconj", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "adot_noconj") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_a = values[0];
__pyx_v_b = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("adot_noconj", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.adot_noconj", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_4adot_noconj(__pyx_self, __pyx_v_a, __pyx_v_b);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":301
* return sp.inner(a.ravel().conj(), b.ravel())
*
* def adot_noconj(a, b): # <<<<<<<<<<<<<<
* """
* Calculates the scalar product for the ancilla, expecting
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_4adot_noconj(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("adot_noconj", 0);
/* "evoMPS/matmul.py":307
* Equivalent to trace(dot(a, b))
* """
* return sp.inner(a.T.ravel(), b.ravel()) # <<<<<<<<<<<<<<
*
* def H(m, out=None):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__inner); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__T); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyObject_GetAttr(__pyx_v_b, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_1 = 0;
__pyx_t_4 = 0;
__pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("evoMPS.matmul.adot_noconj", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_7H(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6evoMPS_6matmul_6H[] = "Matrix conjugate transpose (adjoint).\n \n This is just a shortcut for performing this operation on normal ndarrays.\n \n Parameters\n ----------\n m : ndarray\n The input matrix.\n out : ndarray\n A matrix to hold the final result (dimensions must be correct). May be None.\n May also be the same object as m.\n\n Returns\n -------\n out : ndarray\n The result. \n ";
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_7H = {__Pyx_NAMESTR("H"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_7H, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6evoMPS_6matmul_6H)};
static PyObject *__pyx_pw_6evoMPS_6matmul_7H(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_m = 0;
PyObject *__pyx_v_out = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("H (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__m,&__pyx_n_s__out,0};
PyObject* values[2] = {0,0};
/* "evoMPS/matmul.py":309
* return sp.inner(a.T.ravel(), b.ravel())
*
* def H(m, out=None): # <<<<<<<<<<<<<<
* """Matrix conjugate transpose (adjoint).
*
*/
values[1] = ((PyObject *)((PyObject *)Py_None));
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__m)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "H") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_m = values[0];
__pyx_v_out = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("H", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.H", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_6H(__pyx_self, __pyx_v_m, __pyx_v_out);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6evoMPS_6matmul_6H(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_m, PyObject *__pyx_v_out) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("H", 0);
__Pyx_INCREF(__pyx_v_out);
/* "evoMPS/matmul.py":327
* The result.
* """
* if out is None: # <<<<<<<<<<<<<<
* return m.T.conj()
* else:
*/
__pyx_t_1 = (__pyx_v_out == Py_None);
if (__pyx_t_1) {
/* "evoMPS/matmul.py":328
* """
* if out is None:
* return m.T.conj() # <<<<<<<<<<<<<<
* else:
* out = sp.conjugate(m.T, out)
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_2 = PyObject_GetAttr(__pyx_v_m, __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__conj); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L3;
}
/*else*/ {
/* "evoMPS/matmul.py":330
* return m.T.conj()
* else:
* out = sp.conjugate(m.T, out) # <<<<<<<<<<<<<<
* return out
*
*/
__pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__conjugate); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyObject_GetAttr(__pyx_v_m, __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_out);
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_out);
__Pyx_GIVEREF(__pyx_v_out);
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_v_out);
__pyx_v_out = __pyx_t_2;
__pyx_t_2 = 0;
/* "evoMPS/matmul.py":331
* else:
* out = sp.conjugate(m.T, out)
* return out # <<<<<<<<<<<<<<
*
* def randomize_cmplx(x, a=-0.5, b=0.5, aj=-0.5, bj=0.5):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_out);
__pyx_r = __pyx_v_out;
goto __pyx_L0;
}
__pyx_L3:;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("evoMPS.matmul.H", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_out);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":333
* return out
*
* def randomize_cmplx(x, a=-0.5, b=0.5, aj=-0.5, bj=0.5): # <<<<<<<<<<<<<<
* """Randomizes a complex matrix in place.
* """
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_24__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__defaults__", 0);
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_a);
PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_a);
__Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_a);
__Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_b);
PyTuple_SET_ITEM(__pyx_t_1, 1, __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_b);
__Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_b);
__Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_aj);
PyTuple_SET_ITEM(__pyx_t_1, 2, __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_aj);
__Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_aj);
__Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_bj);
PyTuple_SET_ITEM(__pyx_t_1, 3, __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_bj);
__Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_bj);
__pyx_r = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("evoMPS.matmul.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_9randomize_cmplx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6evoMPS_6matmul_8randomize_cmplx[] = "Randomizes a complex matrix in place.\n ";
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_9randomize_cmplx = {__Pyx_NAMESTR("randomize_cmplx"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_9randomize_cmplx, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6evoMPS_6matmul_8randomize_cmplx)};
static PyObject *__pyx_pw_6evoMPS_6matmul_9randomize_cmplx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_x = 0;
PyObject *__pyx_v_a = 0;
PyObject *__pyx_v_b = 0;
PyObject *__pyx_v_aj = 0;
PyObject *__pyx_v_bj = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("randomize_cmplx (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__a,&__pyx_n_s__b,&__pyx_n_s__aj,&__pyx_n_s__bj,0};
PyObject* values[5] = {0,0,0,0,0};
__pyx_defaults1 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self);
values[1] = __pyx_dynamic_args->__pyx_arg_a;
values[2] = __pyx_dynamic_args->__pyx_arg_b;
values[3] = __pyx_dynamic_args->__pyx_arg_aj;
values[4] = __pyx_dynamic_args->__pyx_arg_bj;
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a);
if (value) { values[1] = value; kw_args--; }
}
case 2:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__b);
if (value) { values[2] = value; kw_args--; }
}
case 3:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__aj);
if (value) { values[3] = value; kw_args--; }
}
case 4:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bj);
if (value) { values[4] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "randomize_cmplx") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_x = values[0];
__pyx_v_a = values[1];
__pyx_v_b = values[2];
__pyx_v_aj = values[3];
__pyx_v_bj = values[4];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("randomize_cmplx", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.randomize_cmplx", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_8randomize_cmplx(__pyx_self, __pyx_v_x, __pyx_v_a, __pyx_v_b, __pyx_v_aj, __pyx_v_bj);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6evoMPS_6matmul_8randomize_cmplx(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_aj, PyObject *__pyx_v_bj) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("randomize_cmplx", 0);
/* "evoMPS/matmul.py":336
* """Randomizes a complex matrix in place.
* """
* x[:] = (((b - a) * sp.random.ranf(x.shape) + a) # <<<<<<<<<<<<<<
* + 1.j * ((bj - aj) * sp.random.ranf(x.shape) + aj))
* return x
*/
__pyx_t_1 = PyNumber_Subtract(__pyx_v_b, __pyx_v_a); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__random); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ranf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_v_a); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":337
* """
* x[:] = (((b - a) * sp.random.ranf(x.shape) + a)
* + 1.j * ((bj - aj) * sp.random.ranf(x.shape) + aj)) # <<<<<<<<<<<<<<
* return x
*
*/
__pyx_t_4 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_1 = PyNumber_Subtract(__pyx_v_bj, __pyx_v_aj); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__random); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ranf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
__pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
__pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_v_aj); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_6 = PyNumber_Multiply(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
/* "evoMPS/matmul.py":336
* """Randomizes a complex matrix in place.
* """
* x[:] = (((b - a) * sp.random.ranf(x.shape) + a) # <<<<<<<<<<<<<<
* + 1.j * ((bj - aj) * sp.random.ranf(x.shape) + aj))
* return x
*/
if (__Pyx_PySequence_SetSlice(__pyx_v_x, 0, PY_SSIZE_T_MAX, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "evoMPS/matmul.py":338
* x[:] = (((b - a) * sp.random.ranf(x.shape) + a)
* + 1.j * ((bj - aj) * sp.random.ranf(x.shape) + aj))
* return x # <<<<<<<<<<<<<<
*
* def sqrtmh(A, ret_evd=False, evd=None):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_x);
__pyx_r = __pyx_v_x;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("evoMPS.matmul.randomize_cmplx", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":340
* return x
*
* def sqrtmh(A, ret_evd=False, evd=None): # <<<<<<<<<<<<<<
* """Return the matrix square root of a hermitian or symmetric matrix
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_26__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__defaults__", 0);
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_ret_evd);
PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_ret_evd);
__Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_ret_evd);
__Pyx_INCREF(((PyObject *)Py_None));
PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)Py_None));
__Pyx_GIVEREF(((PyObject *)Py_None));
__pyx_r = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("evoMPS.matmul.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_11sqrtmh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6evoMPS_6matmul_10sqrtmh[] = "Return the matrix square root of a hermitian or symmetric matrix\n\n Uses scipy.linalg.eigh() to diagonalize the input efficiently.\n\n Parameters\n ----------\n A : ndarray\n A hermitian or symmetric two-dimensional square array (a matrix).\n evd : (ev, EV)\n A tuple containing the 1D array of eigenvalues ev and the matrix of eigenvectors EV.\n ret_evd : Boolean\n Return the eigenvalue decomposition of the result.\n\n Returns\n -------\n sqrt_A : ndarray\n An array of the same shape and type as A containing the matrix square root of A.\n (ev, EV) : (ndarray, ndarray)\n A 1D array of eigenvalues and the matrix of eigenvectors.\n \n Notes\n -----\n The result is also Hermitian.\n\n ";
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_11sqrtmh = {__Pyx_NAMESTR("sqrtmh"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_11sqrtmh, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6evoMPS_6matmul_10sqrtmh)};
static PyObject *__pyx_pw_6evoMPS_6matmul_11sqrtmh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_A = 0;
PyObject *__pyx_v_ret_evd = 0;
PyObject *__pyx_v_evd = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sqrtmh (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__ret_evd,&__pyx_n_s__evd,0};
PyObject* values[3] = {0,0,0};
__pyx_defaults2 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self);
values[1] = __pyx_dynamic_args->__pyx_arg_ret_evd;
values[2] = ((PyObject *)((PyObject *)Py_None));
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ret_evd);
if (value) { values[1] = value; kw_args--; }
}
case 2:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__evd);
if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sqrtmh") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_A = values[0];
__pyx_v_ret_evd = values[1];
__pyx_v_evd = values[2];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("sqrtmh", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.sqrtmh", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_10sqrtmh(__pyx_self, __pyx_v_A, __pyx_v_ret_evd, __pyx_v_evd);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6evoMPS_6matmul_10sqrtmh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_ret_evd, PyObject *__pyx_v_evd) {
PyObject *__pyx_v_ev = NULL;
PyObject *__pyx_v_EV = NULL;
PyObject *__pyx_v_B = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *(*__pyx_t_6)(PyObject *);
PyObject *__pyx_t_7 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("sqrtmh", 0);
/* "evoMPS/matmul.py":366
*
* """
* if not evd is None: # <<<<<<<<<<<<<<
* (ev, EV) = evd
* else:
*/
__pyx_t_1 = (__pyx_v_evd == Py_None);
__pyx_t_2 = (!__pyx_t_1);
if (__pyx_t_2) {
/* "evoMPS/matmul.py":367
* """
* if not evd is None:
* (ev, EV) = evd # <<<<<<<<<<<<<<
* else:
* ev, EV = la.eigh(A) #uses LAPACK ***EVR
*/
if ((likely(PyTuple_CheckExact(__pyx_v_evd))) || (PyList_CheckExact(__pyx_v_evd))) {
PyObject* sequence = __pyx_v_evd;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_3 = PyList_GET_ITEM(sequence, 0);
__pyx_t_4 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
#else
__pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
#endif
} else
{
Py_ssize_t index = -1;
__pyx_t_5 = PyObject_GetIter(__pyx_v_evd); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
__Pyx_GOTREF(__pyx_t_4);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_6 = NULL;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
goto __pyx_L5_unpacking_done;
__pyx_L4_unpacking_failed:;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_6 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L5_unpacking_done:;
}
__pyx_v_ev = __pyx_t_3;
__pyx_t_3 = 0;
__pyx_v_EV = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L3;
}
/*else*/ {
/* "evoMPS/matmul.py":369
* (ev, EV) = evd
* else:
* ev, EV = la.eigh(A) #uses LAPACK ***EVR # <<<<<<<<<<<<<<
*
* ev = sp.sqrt(ev) #we don't require positive (semi) definiteness, so we need the scipy sqrt here
*/
__pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__la); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__eigh); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_A);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_A);
__Pyx_GIVEREF(__pyx_v_A);
__pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
PyObject* sequence = __pyx_t_5;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_4 = PyList_GET_ITEM(sequence, 0);
__pyx_t_3 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
#else
__pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
#endif
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
} else
{
Py_ssize_t index = -1;
__pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_6 = Py_TYPE(__pyx_t_7)->tp_iternext;
index = 0; __pyx_t_4 = __pyx_t_6(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
__Pyx_GOTREF(__pyx_t_4);
index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_6 = NULL;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
goto __pyx_L7_unpacking_done;
__pyx_L6_unpacking_failed:;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_6 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L7_unpacking_done:;
}
__pyx_v_ev = __pyx_t_4;
__pyx_t_4 = 0;
__pyx_v_EV = __pyx_t_3;
__pyx_t_3 = 0;
}
__pyx_L3:;
/* "evoMPS/matmul.py":371
* ev, EV = la.eigh(A) #uses LAPACK ***EVR
*
* ev = sp.sqrt(ev) #we don't require positive (semi) definiteness, so we need the scipy sqrt here # <<<<<<<<<<<<<<
*
* #Carry out multiplication with the diagonal matrix of eigenvalue square roots with H(EV)
*/
__pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_INCREF(__pyx_v_ev);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_ev);
__Pyx_GIVEREF(__pyx_v_ev);
__pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_v_ev);
__pyx_v_ev = __pyx_t_4;
__pyx_t_4 = 0;
/* "evoMPS/matmul.py":374
*
* #Carry out multiplication with the diagonal matrix of eigenvalue square roots with H(EV)
* B = mmul_diag(ev, H(EV)) # <<<<<<<<<<<<<<
*
* if ret_evd:
*/
__pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__mmul_diag); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__H); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_EV);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_EV);
__Pyx_GIVEREF(__pyx_v_EV);
__pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_ev);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_ev);
__Pyx_GIVEREF(__pyx_v_ev);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7);
__Pyx_GIVEREF(__pyx_t_7);
__pyx_t_7 = 0;
__pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_v_B = __pyx_t_7;
__pyx_t_7 = 0;
/* "evoMPS/matmul.py":376
* B = mmul_diag(ev, H(EV))
*
* if ret_evd: # <<<<<<<<<<<<<<
* return mmul(EV, B), (ev, EV)
* else:
*/
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_ret_evd); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
/* "evoMPS/matmul.py":377
*
* if ret_evd:
* return mmul(EV, B), (ev, EV) # <<<<<<<<<<<<<<
* else:
* return mmul(EV, B)
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__mmul); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_EV);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_EV);
__Pyx_GIVEREF(__pyx_v_EV);
__Pyx_INCREF(__pyx_v_B);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_B);
__Pyx_GIVEREF(__pyx_v_B);
__pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_ev);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_ev);
__Pyx_GIVEREF(__pyx_v_ev);
__Pyx_INCREF(__pyx_v_EV);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_EV);
__Pyx_GIVEREF(__pyx_v_EV);
__pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_t_3));
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
__pyx_t_4 = 0;
__pyx_t_3 = 0;
__pyx_r = ((PyObject *)__pyx_t_7);
__pyx_t_7 = 0;
goto __pyx_L0;
goto __pyx_L8;
}
/*else*/ {
/* "evoMPS/matmul.py":379
* return mmul(EV, B), (ev, EV)
* else:
* return mmul(EV, B) # <<<<<<<<<<<<<<
*
* def mmul_diag(Adiag, B, act_right=True):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__mmul); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_EV);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_EV);
__Pyx_GIVEREF(__pyx_v_EV);
__Pyx_INCREF(__pyx_v_B);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_B);
__Pyx_GIVEREF(__pyx_v_B);
__pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
}
__pyx_L8:;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("evoMPS.matmul.sqrtmh", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_ev);
__Pyx_XDECREF(__pyx_v_EV);
__Pyx_XDECREF(__pyx_v_B);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":381
* return mmul(EV, B)
*
* def mmul_diag(Adiag, B, act_right=True): # <<<<<<<<<<<<<<
* if act_right:
* assert B.shape[0] == Adiag.shape[0]
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_28__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__defaults__", 0);
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_self)->__pyx_arg_act_right);
PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_self)->__pyx_arg_act_right);
__Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_self)->__pyx_arg_act_right);
__pyx_r = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("evoMPS.matmul.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_13mmul_diag(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_13mmul_diag = {__Pyx_NAMESTR("mmul_diag"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_13mmul_diag, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_13mmul_diag(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_Adiag = 0;
PyObject *__pyx_v_B = 0;
PyObject *__pyx_v_act_right = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mmul_diag (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Adiag,&__pyx_n_s__B,&__pyx_n_s__act_right,0};
PyObject* values[3] = {0,0,0};
__pyx_defaults3 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_self);
values[2] = __pyx_dynamic_args->__pyx_arg_act_right;
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Adiag)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("mmul_diag", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__act_right);
if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mmul_diag") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_Adiag = values[0];
__pyx_v_B = values[1];
__pyx_v_act_right = values[2];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("mmul_diag", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.mmul_diag", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_12mmul_diag(__pyx_self, __pyx_v_Adiag, __pyx_v_B, __pyx_v_act_right);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6evoMPS_6matmul_12mmul_diag(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_Adiag, PyObject *__pyx_v_B, PyObject *__pyx_v_act_right) {
PyObject *__pyx_v_tmp = NULL;
PyObject *__pyx_v_out = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("mmul_diag", 0);
/* "evoMPS/matmul.py":382
*
* def mmul_diag(Adiag, B, act_right=True):
* if act_right: # <<<<<<<<<<<<<<
* assert B.shape[0] == Adiag.shape[0]
* else:
*/
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_act_right); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_1) {
/* "evoMPS/matmul.py":383
* def mmul_diag(Adiag, B, act_right=True):
* if act_right:
* assert B.shape[0] == Adiag.shape[0] # <<<<<<<<<<<<<<
* else:
* assert B.shape[1] == Adiag.shape[0]
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
__pyx_t_2 = PyObject_GetAttr(__pyx_v_B, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyObject_GetAttr(__pyx_v_Adiag, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (unlikely(!__pyx_t_1)) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
goto __pyx_L3;
}
/*else*/ {
/* "evoMPS/matmul.py":385
* assert B.shape[0] == Adiag.shape[0]
* else:
* assert B.shape[1] == Adiag.shape[0] # <<<<<<<<<<<<<<
*
* assert Adiag.ndim == 1
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
__pyx_t_2 = PyObject_GetAttr(__pyx_v_B, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyObject_GetAttr(__pyx_v_Adiag, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (unlikely(!__pyx_t_1)) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
}
__pyx_L3:;
/* "evoMPS/matmul.py":387
* assert B.shape[1] == Adiag.shape[0]
*
* assert Adiag.ndim == 1 # <<<<<<<<<<<<<<
* assert B.ndim == 2
*
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
__pyx_t_2 = PyObject_GetAttr(__pyx_v_Adiag, __pyx_n_s__ndim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
/* "evoMPS/matmul.py":388
*
* assert Adiag.ndim == 1
* assert B.ndim == 2 # <<<<<<<<<<<<<<
*
* if act_right:
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
__pyx_t_3 = PyObject_GetAttr(__pyx_v_B, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (unlikely(!__pyx_t_1)) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
/* "evoMPS/matmul.py":390
* assert B.ndim == 2
*
* if act_right: # <<<<<<<<<<<<<<
* #B = sp.asarray(B, order='F')
* tmp = Adiag * B.T
*/
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_act_right); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_1) {
/* "evoMPS/matmul.py":392
* if act_right:
* #B = sp.asarray(B, order='F')
* tmp = Adiag * B.T # <<<<<<<<<<<<<<
* out = tmp.T
* else:
*/
__pyx_t_2 = PyObject_GetAttr(__pyx_v_B, __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyNumber_Multiply(__pyx_v_Adiag, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_tmp = __pyx_t_3;
__pyx_t_3 = 0;
/* "evoMPS/matmul.py":393
* #B = sp.asarray(B, order='F')
* tmp = Adiag * B.T
* out = tmp.T # <<<<<<<<<<<<<<
* else:
* out = Adiag * B
*/
__pyx_t_3 = PyObject_GetAttr(__pyx_v_tmp, __pyx_n_s__T); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_out = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L4;
}
/*else*/ {
/* "evoMPS/matmul.py":395
* out = tmp.T
* else:
* out = Adiag * B # <<<<<<<<<<<<<<
*
* return out
*/
__pyx_t_3 = PyNumber_Multiply(__pyx_v_Adiag, __pyx_v_B); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_out = __pyx_t_3;
__pyx_t_3 = 0;
}
__pyx_L4:;
/* "evoMPS/matmul.py":397
* out = Adiag * B
*
* return out # <<<<<<<<<<<<<<
*
* def invmh(A, ret_evd=False, evd=None):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_out);
__pyx_r = __pyx_v_out;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("evoMPS.matmul.mmul_diag", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_tmp);
__Pyx_XDECREF(__pyx_v_out);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":399
* return out
*
* def invmh(A, ret_evd=False, evd=None): # <<<<<<<<<<<<<<
* if not evd is None:
* (ev, EV) = evd
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_30__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__defaults__", 0);
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults4, __pyx_self)->__pyx_arg_ret_evd);
PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults4, __pyx_self)->__pyx_arg_ret_evd);
__Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults4, __pyx_self)->__pyx_arg_ret_evd);
__Pyx_INCREF(((PyObject *)Py_None));
PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)Py_None));
__Pyx_GIVEREF(((PyObject *)Py_None));
__pyx_r = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("evoMPS.matmul.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_15invmh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_15invmh = {__Pyx_NAMESTR("invmh"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_15invmh, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6evoMPS_6matmul_15invmh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_A = 0;
PyObject *__pyx_v_ret_evd = 0;
PyObject *__pyx_v_evd = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("invmh (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__ret_evd,&__pyx_n_s__evd,0};
PyObject* values[3] = {0,0,0};
__pyx_defaults4 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults4, __pyx_self);
values[1] = __pyx_dynamic_args->__pyx_arg_ret_evd;
values[2] = ((PyObject *)((PyObject *)Py_None));
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ret_evd);
if (value) { values[1] = value; kw_args--; }
}
case 2:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__evd);
if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "invmh") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_A = values[0];
__pyx_v_ret_evd = values[1];
__pyx_v_evd = values[2];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("invmh", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.invmh", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_14invmh(__pyx_self, __pyx_v_A, __pyx_v_ret_evd, __pyx_v_evd);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6evoMPS_6matmul_14invmh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_ret_evd, PyObject *__pyx_v_evd) {
PyObject *__pyx_v_ev = NULL;
PyObject *__pyx_v_EV = NULL;
PyObject *__pyx_v_B = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *(*__pyx_t_6)(PyObject *);
PyObject *__pyx_t_7 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("invmh", 0);
/* "evoMPS/matmul.py":400
*
* def invmh(A, ret_evd=False, evd=None):
* if not evd is None: # <<<<<<<<<<<<<<
* (ev, EV) = evd
* else:
*/
__pyx_t_1 = (__pyx_v_evd == Py_None);
__pyx_t_2 = (!__pyx_t_1);
if (__pyx_t_2) {
/* "evoMPS/matmul.py":401
* def invmh(A, ret_evd=False, evd=None):
* if not evd is None:
* (ev, EV) = evd # <<<<<<<<<<<<<<
* else:
* ev, EV = la.eigh(A)
*/
if ((likely(PyTuple_CheckExact(__pyx_v_evd))) || (PyList_CheckExact(__pyx_v_evd))) {
PyObject* sequence = __pyx_v_evd;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_3 = PyList_GET_ITEM(sequence, 0);
__pyx_t_4 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
#else
__pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
#endif
} else
{
Py_ssize_t index = -1;
__pyx_t_5 = PyObject_GetIter(__pyx_v_evd); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
__Pyx_GOTREF(__pyx_t_4);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_6 = NULL;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
goto __pyx_L5_unpacking_done;
__pyx_L4_unpacking_failed:;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_6 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L5_unpacking_done:;
}
__pyx_v_ev = __pyx_t_3;
__pyx_t_3 = 0;
__pyx_v_EV = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L3;
}
/*else*/ {
/* "evoMPS/matmul.py":403
* (ev, EV) = evd
* else:
* ev, EV = la.eigh(A) # <<<<<<<<<<<<<<
*
* ev = 1. / ev
*/
__pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__la); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__eigh); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_A);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_A);
__Pyx_GIVEREF(__pyx_v_A);
__pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
PyObject* sequence = __pyx_t_5;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_4 = PyList_GET_ITEM(sequence, 0);
__pyx_t_3 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
#else
__pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
#endif
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
} else
{
Py_ssize_t index = -1;
__pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_6 = Py_TYPE(__pyx_t_7)->tp_iternext;
index = 0; __pyx_t_4 = __pyx_t_6(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
__Pyx_GOTREF(__pyx_t_4);
index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_6 = NULL;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
goto __pyx_L7_unpacking_done;
__pyx_L6_unpacking_failed:;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_6 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L7_unpacking_done:;
}
__pyx_v_ev = __pyx_t_4;
__pyx_t_4 = 0;
__pyx_v_EV = __pyx_t_3;
__pyx_t_3 = 0;
}
__pyx_L3:;
/* "evoMPS/matmul.py":405
* ev, EV = la.eigh(A)
*
* ev = 1. / ev # <<<<<<<<<<<<<<
*
* B = mmul_diag(ev, H(EV))
*/
__pyx_t_5 = PyFloat_FromDouble(1.); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_v_ev); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_v_ev);
__pyx_v_ev = __pyx_t_3;
__pyx_t_3 = 0;
/* "evoMPS/matmul.py":407
* ev = 1. / ev
*
* B = mmul_diag(ev, H(EV)) # <<<<<<<<<<<<<<
*
* if ret_evd:
*/
__pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__mmul_diag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__H); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_EV);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_EV);
__Pyx_GIVEREF(__pyx_v_EV);
__pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_ev);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_ev);
__Pyx_GIVEREF(__pyx_v_ev);
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7);
__Pyx_GIVEREF(__pyx_t_7);
__pyx_t_7 = 0;
__pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__pyx_v_B = __pyx_t_7;
__pyx_t_7 = 0;
/* "evoMPS/matmul.py":409
* B = mmul_diag(ev, H(EV))
*
* if ret_evd: # <<<<<<<<<<<<<<
* return mmul(EV, B), (ev, EV)
* else:
*/
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_ret_evd); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
/* "evoMPS/matmul.py":410
*
* if ret_evd:
* return mmul(EV, B), (ev, EV) # <<<<<<<<<<<<<<
* else:
* return mmul(EV, B)
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__mmul); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_EV);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_EV);
__Pyx_GIVEREF(__pyx_v_EV);
__Pyx_INCREF(__pyx_v_B);
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_B);
__Pyx_GIVEREF(__pyx_v_B);
__pyx_t_3 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_ev);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_ev);
__Pyx_GIVEREF(__pyx_v_ev);
__Pyx_INCREF(__pyx_v_EV);
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_EV);
__Pyx_GIVEREF(__pyx_v_EV);
__pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_t_4));
__Pyx_GIVEREF(((PyObject *)__pyx_t_4));
__pyx_t_3 = 0;
__pyx_t_4 = 0;
__pyx_r = ((PyObject *)__pyx_t_7);
__pyx_t_7 = 0;
goto __pyx_L0;
goto __pyx_L8;
}
/*else*/ {
/* "evoMPS/matmul.py":412
* return mmul(EV, B), (ev, EV)
* else:
* return mmul(EV, B) # <<<<<<<<<<<<<<
*
* def sqrtmpo(A, out=None):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__mmul); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_EV);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_EV);
__Pyx_GIVEREF(__pyx_v_EV);
__Pyx_INCREF(__pyx_v_B);
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_B);
__Pyx_GIVEREF(__pyx_v_B);
__pyx_t_3 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
}
__pyx_L8:;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("evoMPS.matmul.invmh", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_ev);
__Pyx_XDECREF(__pyx_v_EV);
__Pyx_XDECREF(__pyx_v_B);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_17sqrtmpo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6evoMPS_6matmul_16sqrtmpo[] = "Return the matrix square root of a hermitian or symmetric positive definite matrix\n\n Uses a Cholesky decomposition, followed by a QR decomposition, and then\n Nwewton iteration to obtain a polar form UH, with H Hermitian p.d. and\n the desired square root, as described in algorithm 6.21 in:\n \n Higham, N. J., \"Functions of Matrices, Theory and Computation\", SCIAM 2008\n \n NOT YET IMPLEMENTED!\n\n Parameters\n ----------\n A : ndarray\n A hermitian or symmetric two-dimensional square array (a matrix)\n\n Returns\n -------\n sqrt_A : ndarray\n An array of the same shape and type as A containing the matrix square root of A.\n\n ";
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_17sqrtmpo = {__Pyx_NAMESTR("sqrtmpo"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_17sqrtmpo, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6evoMPS_6matmul_16sqrtmpo)};
static PyObject *__pyx_pw_6evoMPS_6matmul_17sqrtmpo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_A = 0;
CYTHON_UNUSED PyObject *__pyx_v_out = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sqrtmpo (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__out,0};
PyObject* values[2] = {0,0};
/* "evoMPS/matmul.py":414
* return mmul(EV, B)
*
* def sqrtmpo(A, out=None): # <<<<<<<<<<<<<<
* """Return the matrix square root of a hermitian or symmetric positive definite matrix
*
*/
values[1] = ((PyObject *)((PyObject *)Py_None));
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sqrtmpo") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_A = values[0];
__pyx_v_out = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("sqrtmpo", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.sqrtmpo", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_16sqrtmpo(__pyx_self, __pyx_v_A, __pyx_v_out);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6evoMPS_6matmul_16sqrtmpo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, CYTHON_UNUSED PyObject *__pyx_v_out) {
PyObject *__pyx_v_R = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("sqrtmpo", 0);
/* "evoMPS/matmul.py":436
*
* """
* R = la.cholesky(A) # <<<<<<<<<<<<<<
* R = la.qr(R, overwrite_a=True, mode='r')
*
*/
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__la); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__cholesky); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_A);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_A);
__Pyx_GIVEREF(__pyx_v_A);
__pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_v_R = __pyx_t_3;
__pyx_t_3 = 0;
/* "evoMPS/matmul.py":437
* """
* R = la.cholesky(A)
* R = la.qr(R, overwrite_a=True, mode='r') # <<<<<<<<<<<<<<
*
* #FIXME: NOTFINISHED
*/
__pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__la); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__qr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_R);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_R);
__Pyx_GIVEREF(__pyx_v_R);
__pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__overwrite_a), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__mode), ((PyObject *)__pyx_n_s__r)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_v_R);
__pyx_v_R = __pyx_t_4;
__pyx_t_4 = 0;
/* "evoMPS/matmul.py":440
*
* #FIXME: NOTFINISHED
* assert False # <<<<<<<<<<<<<<
*
* return 0
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
if (unlikely(!0)) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
/* "evoMPS/matmul.py":442
* assert False
*
* return 0 # <<<<<<<<<<<<<<
*
* def invtr(A, overwrite=False, lower=False):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_int_0);
__pyx_r = __pyx_int_0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("evoMPS.matmul.sqrtmpo", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_R);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":444
* return 0
*
* def invtr(A, overwrite=False, lower=False): # <<<<<<<<<<<<<<
* """Compute the inverse of a triangular matrix
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_32__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__defaults__", 0);
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults5, __pyx_self)->__pyx_arg_overwrite);
PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults5, __pyx_self)->__pyx_arg_overwrite);
__Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults5, __pyx_self)->__pyx_arg_overwrite);
__Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults5, __pyx_self)->__pyx_arg_lower);
PyTuple_SET_ITEM(__pyx_t_1, 1, __Pyx_CyFunction_Defaults(__pyx_defaults5, __pyx_self)->__pyx_arg_lower);
__Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults5, __pyx_self)->__pyx_arg_lower);
__pyx_r = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("evoMPS.matmul.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_19invtr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6evoMPS_6matmul_18invtr[] = "Compute the inverse of a triangular matrix\n\n Uses the corresponding LAPACK routine.\n\n Parameters\n ----------\n A : ndarray\n An upper or lower triangular matrix.\n \n overwrite : bool\n Whether to overwrite the input array (may increase performance).\n \n lower : bool\n Whether the input array is lower-triangular, rather than upper-triangular.\n\n Returns\n -------\n inv_A : ndarray\n The inverse of A, which is also triangular. \n\n ";
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_19invtr = {__Pyx_NAMESTR("invtr"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_19invtr, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6evoMPS_6matmul_18invtr)};
static PyObject *__pyx_pw_6evoMPS_6matmul_19invtr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_A = 0;
PyObject *__pyx_v_overwrite = 0;
PyObject *__pyx_v_lower = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("invtr (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__overwrite,&__pyx_n_s__lower,0};
PyObject* values[3] = {0,0,0};
__pyx_defaults5 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults5, __pyx_self);
values[1] = __pyx_dynamic_args->__pyx_arg_overwrite;
values[2] = __pyx_dynamic_args->__pyx_arg_lower;
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__overwrite);
if (value) { values[1] = value; kw_args--; }
}
case 2:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lower);
if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "invtr") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_A = values[0];
__pyx_v_overwrite = values[1];
__pyx_v_lower = values[2];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("invtr", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.invtr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_18invtr(__pyx_self, __pyx_v_A, __pyx_v_overwrite, __pyx_v_lower);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6evoMPS_6matmul_18invtr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_overwrite, PyObject *__pyx_v_lower) {
PyObject *__pyx_v_trtri = NULL;
PyObject *__pyx_v_inv_A = NULL;
PyObject *__pyx_v_info = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *(*__pyx_t_4)(PyObject *);
PyObject *__pyx_t_5 = NULL;
int __pyx_t_6;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("invtr", 0);
/* "evoMPS/matmul.py":466
*
* """
* trtri, = la.lapack.get_lapack_funcs(('trtri',), (A,)) # <<<<<<<<<<<<<<
*
* inv_A, info = trtri(A, lower=lower, overwrite_c=overwrite)
*/
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__la); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__lapack); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__get_lapack_funcs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_A);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_A);
__Pyx_GIVEREF(__pyx_v_A);
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(((PyObject *)__pyx_k_tuple_2));
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_k_tuple_2));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_2));
__Pyx_GIVEREF(((PyObject *)__pyx_t_2));
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
PyObject* sequence = __pyx_t_2;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 1)) {
if (size > 1) __Pyx_RaiseTooManyValuesError(1);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
} else {
__pyx_t_3 = PyList_GET_ITEM(sequence, 0);
}
__Pyx_INCREF(__pyx_t_3);
#else
__pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
#endif
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
} else
{
Py_ssize_t index = -1;
__pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
index = 0; __pyx_t_3 = __pyx_t_4(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_1), 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = NULL;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L4_unpacking_done;
__pyx_L3_unpacking_failed:;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_4 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L4_unpacking_done:;
}
__pyx_v_trtri = __pyx_t_3;
__pyx_t_3 = 0;
/* "evoMPS/matmul.py":468
* trtri, = la.lapack.get_lapack_funcs(('trtri',), (A,))
*
* inv_A, info = trtri(A, lower=lower, overwrite_c=overwrite) # <<<<<<<<<<<<<<
*
* if info > 0:
*/
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_A);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_A);
__Pyx_GIVEREF(__pyx_v_A);
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__lower), __pyx_v_lower) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__overwrite_c), __pyx_v_overwrite) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_1 = PyObject_Call(__pyx_v_trtri, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
PyObject* sequence = __pyx_t_1;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_3 = PyList_GET_ITEM(sequence, 0);
__pyx_t_2 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_2);
#else
__pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
} else
{
Py_ssize_t index = -1;
__pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_4 = Py_TYPE(__pyx_t_5)->tp_iternext;
index = 0; __pyx_t_3 = __pyx_t_4(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = NULL;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
goto __pyx_L6_unpacking_done;
__pyx_L5_unpacking_failed:;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_4 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L6_unpacking_done:;
}
__pyx_v_inv_A = __pyx_t_3;
__pyx_t_3 = 0;
__pyx_v_info = __pyx_t_2;
__pyx_t_2 = 0;
/* "evoMPS/matmul.py":470
* inv_A, info = trtri(A, lower=lower, overwrite_c=overwrite)
*
* if info > 0: # <<<<<<<<<<<<<<
* raise sp.LinAlgError("%d-th diagonal element of the matrix is zero" % info)
* if info < 0:
*/
__pyx_t_1 = PyObject_RichCompare(__pyx_v_info, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_6) {
/* "evoMPS/matmul.py":471
*
* if info > 0:
* raise sp.LinAlgError("%d-th diagonal element of the matrix is zero" % info) # <<<<<<<<<<<<<<
* if info < 0:
* raise ValueError('illegal value in %d-th argument of internal potri'
*/
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__LinAlgError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), __pyx_v_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
/* "evoMPS/matmul.py":472
* if info > 0:
* raise sp.LinAlgError("%d-th diagonal element of the matrix is zero" % info)
* if info < 0: # <<<<<<<<<<<<<<
* raise ValueError('illegal value in %d-th argument of internal potri'
* % -info)
*/
__pyx_t_1 = PyObject_RichCompare(__pyx_v_info, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_6) {
/* "evoMPS/matmul.py":474
* if info < 0:
* raise ValueError('illegal value in %d-th argument of internal potri'
* % -info) # <<<<<<<<<<<<<<
*
* return inv_A
*/
__pyx_t_1 = PyNumber_Negative(__pyx_v_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3));
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
/* "evoMPS/matmul.py":476
* % -info)
*
* return inv_A # <<<<<<<<<<<<<<
*
* def invpo(A, out=None, lower=False):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_inv_A);
__pyx_r = __pyx_v_inv_A;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("evoMPS.matmul.invtr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_trtri);
__Pyx_XDECREF(__pyx_v_inv_A);
__Pyx_XDECREF(__pyx_v_info);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":478
* return inv_A
*
* def invpo(A, out=None, lower=False): # <<<<<<<<<<<<<<
* """Efficient inversion of positive definite matrices using Cholesky decomposition.
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_34__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__defaults__", 0);
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(((PyObject *)Py_None));
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_None));
__Pyx_GIVEREF(((PyObject *)Py_None));
__Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults6, __pyx_self)->__pyx_arg_lower);
PyTuple_SET_ITEM(__pyx_t_1, 1, __Pyx_CyFunction_Defaults(__pyx_defaults6, __pyx_self)->__pyx_arg_lower);
__Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults6, __pyx_self)->__pyx_arg_lower);
__pyx_r = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("evoMPS.matmul.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_21invpo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6evoMPS_6matmul_20invpo[] = "Efficient inversion of positive definite matrices using Cholesky decomposition.\n \n NOT YET WORKING\n ";
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_21invpo = {__Pyx_NAMESTR("invpo"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_21invpo, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6evoMPS_6matmul_20invpo)};
static PyObject *__pyx_pw_6evoMPS_6matmul_21invpo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_A = 0;
CYTHON_UNUSED PyObject *__pyx_v_out = 0;
PyObject *__pyx_v_lower = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("invpo (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__out,&__pyx_n_s__lower,0};
PyObject* values[3] = {0,0,0};
__pyx_defaults6 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults6, __pyx_self);
values[1] = ((PyObject *)((PyObject *)Py_None));
values[2] = __pyx_dynamic_args->__pyx_arg_lower;
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
if (value) { values[1] = value; kw_args--; }
}
case 2:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lower);
if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "invpo") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_A = values[0];
__pyx_v_out = values[1];
__pyx_v_lower = values[2];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("invpo", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.invpo", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_20invpo(__pyx_self, __pyx_v_A, __pyx_v_out, __pyx_v_lower);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6evoMPS_6matmul_20invpo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, CYTHON_UNUSED PyObject *__pyx_v_out, PyObject *__pyx_v_lower) {
PyObject *__pyx_v_t = NULL;
PyObject *__pyx_v_potri = NULL;
PyObject *__pyx_v_inv_A = NULL;
PyObject *__pyx_v_info = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *(*__pyx_t_6)(PyObject *);
int __pyx_t_7;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("invpo", 0);
/* "evoMPS/matmul.py":483
* NOT YET WORKING
* """
* t = la.cholesky(A, lower=lower) # <<<<<<<<<<<<<<
*
* print sp.allclose(sp.dot(H(t), t), A)
*/
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__la); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__cholesky); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_A);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_A);
__Pyx_GIVEREF(__pyx_v_A);
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__lower), __pyx_v_lower) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_v_t = __pyx_t_4;
__pyx_t_4 = 0;
/* "evoMPS/matmul.py":485
* t = la.cholesky(A, lower=lower)
*
* print sp.allclose(sp.dot(H(t), t), A) # <<<<<<<<<<<<<<
* #a, lower = la.cho_factor(A, lower=lower) #no.. we need a clean answer, it seems
*
*/
__pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__allclose); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__H); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_t);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_t);
__Pyx_GIVEREF(__pyx_v_t);
__pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__Pyx_INCREF(__pyx_v_t);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_t);
__Pyx_GIVEREF(__pyx_v_t);
__pyx_t_5 = 0;
__pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__Pyx_INCREF(__pyx_v_A);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_A);
__Pyx_GIVEREF(__pyx_v_A);
__pyx_t_5 = 0;
__pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
if (__Pyx_PrintOne(0, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "evoMPS/matmul.py":488
* #a, lower = la.cho_factor(A, lower=lower) #no.. we need a clean answer, it seems
*
* potri, = la.lapack.get_lapack_funcs(('potri',), (A,)) # <<<<<<<<<<<<<<
*
* inv_A, info = potri(t, lower=lower, overwrite_c=1, rowmajor=1) #rowmajor (C-order) is the default...
*/
__pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__la); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__lapack); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__get_lapack_funcs); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_A);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_A);
__Pyx_GIVEREF(__pyx_v_A);
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(((PyObject *)__pyx_k_tuple_5));
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_k_tuple_5));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_2));
__Pyx_GIVEREF(((PyObject *)__pyx_t_2));
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
PyObject* sequence = __pyx_t_2;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 1)) {
if (size > 1) __Pyx_RaiseTooManyValuesError(1);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
} else {
__pyx_t_3 = PyList_GET_ITEM(sequence, 0);
}
__Pyx_INCREF(__pyx_t_3);
#else
__pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
#endif
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
} else
{
Py_ssize_t index = -1;
__pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_6 = NULL;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
goto __pyx_L4_unpacking_done;
__pyx_L3_unpacking_failed:;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_6 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L4_unpacking_done:;
}
__pyx_v_potri = __pyx_t_3;
__pyx_t_3 = 0;
/* "evoMPS/matmul.py":490
* potri, = la.lapack.get_lapack_funcs(('potri',), (A,))
*
* inv_A, info = potri(t, lower=lower, overwrite_c=1, rowmajor=1) #rowmajor (C-order) is the default... # <<<<<<<<<<<<<<
*
* if info > 0:
*/
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_t);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_t);
__Pyx_GIVEREF(__pyx_v_t);
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__lower), __pyx_v_lower) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__overwrite_c), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__rowmajor), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_5 = PyObject_Call(__pyx_v_potri, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
PyObject* sequence = __pyx_t_5;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_3 = PyList_GET_ITEM(sequence, 0);
__pyx_t_2 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_2);
#else
__pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
#endif
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
} else
{
Py_ssize_t index = -1;
__pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
index = 1; __pyx_t_2 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_1), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_6 = NULL;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L6_unpacking_done;
__pyx_L5_unpacking_failed:;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_6 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L6_unpacking_done:;
}
__pyx_v_inv_A = __pyx_t_3;
__pyx_t_3 = 0;
__pyx_v_info = __pyx_t_2;
__pyx_t_2 = 0;
/* "evoMPS/matmul.py":492
* inv_A, info = potri(t, lower=lower, overwrite_c=1, rowmajor=1) #rowmajor (C-order) is the default...
*
* if info > 0: # <<<<<<<<<<<<<<
* raise sp.LinAlgError("%d-th diagonal element of the Cholesky factor is zero" % info)
* if info < 0:
*/
__pyx_t_5 = PyObject_RichCompare(__pyx_v_info, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
/* "evoMPS/matmul.py":493
*
* if info > 0:
* raise sp.LinAlgError("%d-th diagonal element of the Cholesky factor is zero" % info) # <<<<<<<<<<<<<<
* if info < 0:
* raise ValueError('illegal value in %d-th argument of internal potri'
*/
__pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__LinAlgError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), __pyx_v_info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5));
__Pyx_GIVEREF(((PyObject *)__pyx_t_5));
__pyx_t_5 = 0;
__pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_5, 0, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
/* "evoMPS/matmul.py":494
* if info > 0:
* raise sp.LinAlgError("%d-th diagonal element of the Cholesky factor is zero" % info)
* if info < 0: # <<<<<<<<<<<<<<
* raise ValueError('illegal value in %d-th argument of internal potri'
* % -info)
*/
__pyx_t_5 = PyObject_RichCompare(__pyx_v_info, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
/* "evoMPS/matmul.py":496
* if info < 0:
* raise ValueError('illegal value in %d-th argument of internal potri'
* % -info) # <<<<<<<<<<<<<<
* return inv_A
*
*/
__pyx_t_5 = PyNumber_Negative(__pyx_v_info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_3));
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
/* "evoMPS/matmul.py":497
* raise ValueError('illegal value in %d-th argument of internal potri'
* % -info)
* return inv_A # <<<<<<<<<<<<<<
*
* def bicgstab_iso(A, x, b, MVop, VVop, max_itr=500, atol=1E-14, rtol=1E-14):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_inv_A);
__pyx_r = __pyx_v_inv_A;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("evoMPS.matmul.invpo", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_t);
__Pyx_XDECREF(__pyx_v_potri);
__Pyx_XDECREF(__pyx_v_inv_A);
__Pyx_XDECREF(__pyx_v_info);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "evoMPS/matmul.py":499
* return inv_A
*
* def bicgstab_iso(A, x, b, MVop, VVop, max_itr=500, atol=1E-14, rtol=1E-14): # <<<<<<<<<<<<<<
* """Implements the Bi-CGSTAB method for isomorphic operations.
*
*/
static PyObject *__pyx_pf_6evoMPS_6matmul_36__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__defaults__", 0);
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(((PyObject *)__pyx_int_500));
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_int_500));
__Pyx_GIVEREF(((PyObject *)__pyx_int_500));
__Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults7, __pyx_self)->__pyx_arg_atol);
PyTuple_SET_ITEM(__pyx_t_1, 1, __Pyx_CyFunction_Defaults(__pyx_defaults7, __pyx_self)->__pyx_arg_atol);
__Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults7, __pyx_self)->__pyx_arg_atol);
__Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults7, __pyx_self)->__pyx_arg_rtol);
PyTuple_SET_ITEM(__pyx_t_1, 2, __Pyx_CyFunction_Defaults(__pyx_defaults7, __pyx_self)->__pyx_arg_rtol);
__Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults7, __pyx_self)->__pyx_arg_rtol);
__pyx_r = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("evoMPS.matmul.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6evoMPS_6matmul_23bicgstab_iso(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6evoMPS_6matmul_22bicgstab_iso[] = "Implements the Bi-CGSTAB method for isomorphic operations.\n \n The Bi-CGSTAB method is used to solve linear equations Ax = b.\n \n Should the vectors x, b be isomorphic to some other objects, say\n matrices x' and b', with corresponding opeator A'\n (for example, via the Choi-Jamiolkowski isomorphism), the method\n can similarly be carried out in the alternative form.\n \n With this function, the operations corresponding to matrix-vector\n and vector-vector multiplication are supplied by the caller to enable\n using the method in an isomorphic way.\n \n Parameters\n ----------\n A : ndarray\n The A matrix, or equivalent. \n x : ndarray\n An initial value for the unknown vector, or equivalent.\n b : ndarray\n The b vector, or equivalent.\n MVop : function(ndarray, ndarray)\n The matrix-vector multiplication operation.\n VVop : function(ndarray, ndarray)\n The vector-vector multiplication operation.\n max_itr : int\n Maximum number of iterations.\n atol : float\n Absolute tolerance for solution.\n rtol : float\n Relative tolerance for solution.\n\n Returns\n -------\n x : ndarray\n The final value for the unknown vector x.\n convg : bool\n Whether the algorithm converged within max_itr iterations.\n ";
static PyMethodDef __pyx_mdef_6evoMPS_6matmul_23bicgstab_iso = {__Pyx_NAMESTR("bicgstab_iso"), (PyCFunction)__pyx_pw_6evoMPS_6matmul_23bicgstab_iso, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6evoMPS_6matmul_22bicgstab_iso)};
static PyObject *__pyx_pw_6evoMPS_6matmul_23bicgstab_iso(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_A = 0;
PyObject *__pyx_v_x = 0;
PyObject *__pyx_v_b = 0;
PyObject *__pyx_v_MVop = 0;
PyObject *__pyx_v_VVop = 0;
PyObject *__pyx_v_max_itr = 0;
PyObject *__pyx_v_atol = 0;
PyObject *__pyx_v_rtol = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("bicgstab_iso (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__x,&__pyx_n_s__b,&__pyx_n_s__MVop,&__pyx_n_s__VVop,&__pyx_n_s__max_itr,&__pyx_n_s__atol,&__pyx_n_s__rtol,0};
PyObject* values[8] = {0,0,0,0,0,0,0,0};
__pyx_defaults7 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults7, __pyx_self);
values[5] = ((PyObject *)((PyObject *)__pyx_int_500));
values[6] = __pyx_dynamic_args->__pyx_arg_atol;
values[7] = __pyx_dynamic_args->__pyx_arg_rtol;
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("bicgstab_iso", 0, 5, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__b)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("bicgstab_iso", 0, 5, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__MVop)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("bicgstab_iso", 0, 5, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 4:
if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__VVop)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("bicgstab_iso", 0, 5, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 5:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_itr);
if (value) { values[5] = value; kw_args--; }
}
case 6:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__atol);
if (value) { values[6] = value; kw_args--; }
}
case 7:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rtol);
if (value) { values[7] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bicgstab_iso") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_A = values[0];
__pyx_v_x = values[1];
__pyx_v_b = values[2];
__pyx_v_MVop = values[3];
__pyx_v_VVop = values[4];
__pyx_v_max_itr = values[5];
__pyx_v_atol = values[6];
__pyx_v_rtol = values[7];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("bicgstab_iso", 0, 5, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("evoMPS.matmul.bicgstab_iso", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6evoMPS_6matmul_22bicgstab_iso(__pyx_self, __pyx_v_A, __pyx_v_x, __pyx_v_b, __pyx_v_MVop, __pyx_v_VVop, __pyx_v_max_itr, __pyx_v_atol, __pyx_v_rtol);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6evoMPS_6matmul_22bicgstab_iso(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_x, PyObject *__pyx_v_b, PyObject *__pyx_v_MVop, PyObject *__pyx_v_VVop, PyObject *__pyx_v_max_itr, PyObject *__pyx_v_atol, PyObject *__pyx_v_rtol) {
PyObject *__pyx_v_r_prv = NULL;
PyObject *__pyx_v_r0 = NULL;
PyObject *__pyx_v_rho_prv = NULL;
PyObject *__pyx_v_alpha = NULL;
PyObject *__pyx_v_omega_prv = NULL;
PyObject *__pyx_v_v_prv = NULL;
PyObject *__pyx_v_p_prv = NULL;
PyObject *__pyx_v_i = NULL;
PyObject *__pyx_v_rho = NULL;
PyObject *__pyx_v_beta = NULL;
PyObject *__pyx_v_p = NULL;
PyObject *__pyx_v_v = NULL;
PyObject *__pyx_v_s = NULL;
PyObject *__pyx_v_t = NULL;
PyObject *__pyx_v_omega = NULL;
PyObject *__pyx_v_convg = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
Py_ssize_t __pyx_t_4;
PyObject *(*__pyx_t_5)(PyObject *);
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
int __pyx_t_8;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("bicgstab_iso", 0);
__Pyx_INCREF(__pyx_v_x);
/* "evoMPS/matmul.py":539
* Whether the algorithm converged within max_itr iterations.
* """
* r_prv = b - MVop(A, x) # <<<<<<<<<<<<<<
*
* r0 = r_prv.copy()
*/
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_A);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_A);
__Pyx_GIVEREF(__pyx_v_A);
__Pyx_INCREF(__pyx_v_x);
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_x);
__Pyx_GIVEREF(__pyx_v_x);
__pyx_t_2 = PyObject_Call(__pyx_v_MVop, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_t_1 = PyNumber_Subtract(__pyx_v_b, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_r_prv = __pyx_t_1;
__pyx_t_1 = 0;
/* "evoMPS/matmul.py":541
* r_prv = b - MVop(A, x)
*
* r0 = r_prv.copy() # <<<<<<<<<<<<<<
*
* rho_prv = 1
*/
__pyx_t_1 = PyObject_GetAttr(__pyx_v_r_prv, __pyx_n_s__copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_r0 = __pyx_t_2;
__pyx_t_2 = 0;
/* "evoMPS/matmul.py":543
* r0 = r_prv.copy()
*
* rho_prv = 1 # <<<<<<<<<<<<<<
* alpha = 1
* omega_prv = 1
*/
__Pyx_INCREF(__pyx_int_1);
__pyx_v_rho_prv = __pyx_int_1;
/* "evoMPS/matmul.py":544
*
* rho_prv = 1
* alpha = 1 # <<<<<<<<<<<<<<
* omega_prv = 1
*
*/
__Pyx_INCREF(__pyx_int_1);
__pyx_v_alpha = __pyx_int_1;
/* "evoMPS/matmul.py":545
* rho_prv = 1
* alpha = 1
* omega_prv = 1 # <<<<<<<<<<<<<<
*
* v_prv = sp.zeros_like(x)
*/
__Pyx_INCREF(__pyx_int_1);
__pyx_v_omega_prv = __pyx_int_1;
/* "evoMPS/matmul.py":547
* omega_prv = 1
*
* v_prv = sp.zeros_like(x) # <<<<<<<<<<<<<<
* p_prv = sp.zeros_like(x)
*
*/
__pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_x);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x);
__Pyx_GIVEREF(__pyx_v_x);
__pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_v_v_prv = __pyx_t_3;
__pyx_t_3 = 0;
/* "evoMPS/matmul.py":548
*
* v_prv = sp.zeros_like(x)
* p_prv = sp.zeros_like(x) # <<<<<<<<<<<<<<
*
* for i in xrange(max_itr):
*/
__pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_x);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x);
__Pyx_GIVEREF(__pyx_v_x);
__pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_v_p_prv = __pyx_t_1;
__pyx_t_1 = 0;
/* "evoMPS/matmul.py":550
* p_prv = sp.zeros_like(x)
*
* for i in xrange(max_itr): # <<<<<<<<<<<<<<
* rho = sp.trace(sp.dot(r0, r_prv))
*
*/
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_max_itr);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_max_itr);
__Pyx_GIVEREF(__pyx_v_max_itr);
__pyx_t_3 = PyObject_Call(__pyx_builtin_xrange, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
__pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
__pyx_t_5 = NULL;
} else {
__pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
for (;;) {
if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
__pyx_t_3 = __pyx_t_5(__pyx_t_1);
if (unlikely(!__pyx_t_3)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_3);
}
__Pyx_XDECREF(__pyx_v_i);
__pyx_v_i = __pyx_t_3;
__pyx_t_3 = 0;
/* "evoMPS/matmul.py":551
*
* for i in xrange(max_itr):
* rho = sp.trace(sp.dot(r0, r_prv)) # <<<<<<<<<<<<<<
*
* beta = (rho / rho_prv) * (alpha / omega_prv)
*/
__pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__trace); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_r0);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_r0);
__Pyx_GIVEREF(__pyx_v_r0);
__Pyx_INCREF(__pyx_v_r_prv);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_r_prv);
__Pyx_GIVEREF(__pyx_v_r_prv);
__pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7);
__Pyx_GIVEREF(__pyx_t_7);
__pyx_t_7 = 0;
__pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_v_rho);
__pyx_v_rho = __pyx_t_7;
__pyx_t_7 = 0;
/* "evoMPS/matmul.py":553
* rho = sp.trace(sp.dot(r0, r_prv))
*
* beta = (rho / rho_prv) * (alpha / omega_prv) # <<<<<<<<<<<<<<
*
* p = r_prv + beta * (p_prv - omega_prv * v_prv)
*/
__pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_v_rho, __pyx_v_rho_prv); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_v_alpha, __pyx_v_omega_prv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = PyNumber_Multiply(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_v_beta);
__pyx_v_beta = __pyx_t_2;
__pyx_t_2 = 0;
/* "evoMPS/matmul.py":555
* beta = (rho / rho_prv) * (alpha / omega_prv)
*
* p = r_prv + beta * (p_prv - omega_prv * v_prv) # <<<<<<<<<<<<<<
*
* v = MVop(A, p)
*/
__pyx_t_2 = PyNumber_Multiply(__pyx_v_omega_prv, __pyx_v_v_prv); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyNumber_Subtract(__pyx_v_p_prv, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyNumber_Multiply(__pyx_v_beta, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyNumber_Add(__pyx_v_r_prv, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_v_p);
__pyx_v_p = __pyx_t_3;
__pyx_t_3 = 0;
/* "evoMPS/matmul.py":557
* p = r_prv + beta * (p_prv - omega_prv * v_prv)
*
* v = MVop(A, p) # <<<<<<<<<<<<<<
*
* alpha = rho / VVop(r0, v)
*/
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_A);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_A);
__Pyx_GIVEREF(__pyx_v_A);
__Pyx_INCREF(__pyx_v_p);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_p);
__Pyx_GIVEREF(__pyx_v_p);
__pyx_t_2 = PyObject_Call(__pyx_v_MVop, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_v_v);
__pyx_v_v = __pyx_t_2;
__pyx_t_2 = 0;
/* "evoMPS/matmul.py":559
* v = MVop(A, p)
*
* alpha = rho / VVop(r0, v) # <<<<<<<<<<<<<<
*
* s = r_prv - alpha * v
*/
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_r0);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_r0);
__Pyx_GIVEREF(__pyx_v_r0);
__Pyx_INCREF(__pyx_v_v);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_v);
__Pyx_GIVEREF(__pyx_v_v);
__pyx_t_3 = PyObject_Call(__pyx_v_VVop, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_rho, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_v_alpha);
__pyx_v_alpha = __pyx_t_2;
__pyx_t_2 = 0;
/* "evoMPS/matmul.py":561
* alpha = rho / VVop(r0, v)
*
* s = r_prv - alpha * v # <<<<<<<<<<<<<<
*
* t = MVop(A, s)
*/
__pyx_t_2 = PyNumber_Multiply(__pyx_v_alpha, __pyx_v_v); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyNumber_Subtract(__pyx_v_r_prv, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_v_s);
__pyx_v_s = __pyx_t_3;
__pyx_t_3 = 0;
/* "evoMPS/matmul.py":563
* s = r_prv - alpha * v
*
* t = MVop(A, s) # <<<<<<<<<<<<<<
*
* omega = VVop(t, s) / VVop(t, t)
*/
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_A);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_A);
__Pyx_GIVEREF(__pyx_v_A);
__Pyx_INCREF(__pyx_v_s);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_s);
__Pyx_GIVEREF(__pyx_v_s);
__pyx_t_2 = PyObject_Call(__pyx_v_MVop, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_v_t);
__pyx_v_t = __pyx_t_2;
__pyx_t_2 = 0;
/* "evoMPS/matmul.py":565
* t = MVop(A, s)
*
* omega = VVop(t, s) / VVop(t, t) # <<<<<<<<<<<<<<
*
* x += alpha * p + omega * s
*/
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_t);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_t);
__Pyx_GIVEREF(__pyx_v_t);
__Pyx_INCREF(__pyx_v_s);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_s);
__Pyx_GIVEREF(__pyx_v_s);
__pyx_t_3 = PyObject_Call(__pyx_v_VVop, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_t);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_t);
__Pyx_GIVEREF(__pyx_v_t);
__Pyx_INCREF(__pyx_v_t);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_t);
__Pyx_GIVEREF(__pyx_v_t);
__pyx_t_7 = PyObject_Call(__pyx_v_VVop, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_XDECREF(__pyx_v_omega);
__pyx_v_omega = __pyx_t_2;
__pyx_t_2 = 0;
/* "evoMPS/matmul.py":567
* omega = VVop(t, s) / VVop(t, t)
*
* x += alpha * p + omega * s # <<<<<<<<<<<<<<
*
* #Test x
*/
__pyx_t_2 = PyNumber_Multiply(__pyx_v_alpha, __pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_7 = PyNumber_Multiply(__pyx_v_omega, __pyx_v_s); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_x, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_v_x);
__pyx_v_x = __pyx_t_7;
__pyx_t_7 = 0;
/* "evoMPS/matmul.py":570
*
* #Test x
* if sp.allclose(MVop(A, x), b, atol=atol, rtol=rtol): # <<<<<<<<<<<<<<
* break
*
*/
__pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__allclose); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_INCREF(__pyx_v_A);
PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_A);
__Pyx_GIVEREF(__pyx_v_A);
__Pyx_INCREF(__pyx_v_x);
PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_x);
__Pyx_GIVEREF(__pyx_v_x);
__pyx_t_2 = PyObject_Call(__pyx_v_MVop, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
__pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_b);
__Pyx_GIVEREF(__pyx_v_b);
__pyx_t_2 = 0;
__pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__atol), __pyx_v_atol) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__rtol), __pyx_v_rtol) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (__pyx_t_8) {
/* "evoMPS/matmul.py":571
* #Test x
* if sp.allclose(MVop(A, x), b, atol=atol, rtol=rtol):
* break # <<<<<<<<<<<<<<
*
* r_prv = s - omega * t
*/
goto __pyx_L4_break;
goto __pyx_L5;
}
__pyx_L5:;
/* "evoMPS/matmul.py":573
* break
*
* r_prv = s - omega * t # <<<<<<<<<<<<<<
*
* rho_prv = rho
*/
__pyx_t_6 = PyNumber_Multiply(__pyx_v_omega, __pyx_v_t); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_2 = PyNumber_Subtract(__pyx_v_s, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_v_r_prv);
__pyx_v_r_prv = __pyx_t_2;
__pyx_t_2 = 0;
/* "evoMPS/matmul.py":575
* r_prv = s - omega * t
*
* rho_prv = rho # <<<<<<<<<<<<<<
* omega_prv = omega
*
*/
__Pyx_INCREF(__pyx_v_rho);
__Pyx_DECREF(__pyx_v_rho_prv);
__pyx_v_rho_prv = __pyx_v_rho;
/* "evoMPS/matmul.py":576
*
* rho_prv = rho
* omega_prv = omega # <<<<<<<<<<<<<<
*
* v_prv[:] = v
*/
__Pyx_INCREF(__pyx_v_omega);
__Pyx_DECREF(__pyx_v_omega_prv);
__pyx_v_omega_prv = __pyx_v_omega;
/* "evoMPS/matmul.py":578
* omega_prv = omega
*
* v_prv[:] = v # <<<<<<<<<<<<<<
* p_prv[:] = p
*
*/
if (__Pyx_PySequence_SetSlice(__pyx_v_v_prv, 0, PY_SSIZE_T_MAX, __pyx_v_v) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":579
*
* v_prv[:] = v
* p_prv[:] = p # <<<<<<<<<<<<<<
*
* convg = i < max_itr - 1
*/
if (__Pyx_PySequence_SetSlice(__pyx_v_p_prv, 0, PY_SSIZE_T_MAX, __pyx_v_p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L4_break:;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":581
* p_prv[:] = p
*
* convg = i < max_itr - 1 # <<<<<<<<<<<<<<
*
* return x, convg
*/
if (unlikely(!__pyx_v_i)) { __Pyx_RaiseUnboundLocalError("i"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
__pyx_t_1 = PyNumber_Subtract(__pyx_v_max_itr, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_RichCompare(__pyx_v_i, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_convg = __pyx_t_2;
__pyx_t_2 = 0;
/* "evoMPS/matmul.py":583
* convg = i < max_itr - 1
*
* return x, convg # <<<<<<<<<<<<<<
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_x);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x);
__Pyx_GIVEREF(__pyx_v_x);
__Pyx_INCREF(__pyx_v_convg);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_convg);
__Pyx_GIVEREF(__pyx_v_convg);
__pyx_r = ((PyObject *)__pyx_t_2);
__pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("evoMPS.matmul.bicgstab_iso", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_r_prv);
__Pyx_XDECREF(__pyx_v_r0);
__Pyx_XDECREF(__pyx_v_rho_prv);
__Pyx_XDECREF(__pyx_v_alpha);
__Pyx_XDECREF(__pyx_v_omega_prv);
__Pyx_XDECREF(__pyx_v_v_prv);
__Pyx_XDECREF(__pyx_v_p_prv);
__Pyx_XDECREF(__pyx_v_i);
__Pyx_XDECREF(__pyx_v_rho);
__Pyx_XDECREF(__pyx_v_beta);
__Pyx_XDECREF(__pyx_v_p);
__Pyx_XDECREF(__pyx_v_v);
__Pyx_XDECREF(__pyx_v_s);
__Pyx_XDECREF(__pyx_v_t);
__Pyx_XDECREF(__pyx_v_omega);
__Pyx_XDECREF(__pyx_v_convg);
__Pyx_XDECREF(__pyx_v_x);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "numpy.pxd":194
* # experimental exception made for __getbuffer__ and __releasebuffer__
* # -- the details of this may change.
* def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
* # This implementation of getbuffer is geared towards Cython
* # requirements, and does not yet fullfill the PEP.
*/
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
int __pyx_v_copy_shape;
int __pyx_v_i;
int __pyx_v_ndim;
int __pyx_v_endian_detector;
int __pyx_v_little_endian;
int __pyx_v_t;
char *__pyx_v_f;
PyArray_Descr *__pyx_v_descr = 0;
int __pyx_v_offset;
int __pyx_v_hasfields;
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
int __pyx_t_5;
int __pyx_t_6;
int __pyx_t_7;
PyObject *__pyx_t_8 = NULL;
char *__pyx_t_9;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getbuffer__", 0);
if (__pyx_v_info != NULL) {
__pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
__Pyx_GIVEREF(__pyx_v_info->obj);
}
/* "numpy.pxd":200
* # of flags
*
* if info == NULL: return # <<<<<<<<<<<<<<
*
* cdef int copy_shape, i, ndim
*/
__pyx_t_1 = (__pyx_v_info == NULL);
if (__pyx_t_1) {
__pyx_r = 0;
goto __pyx_L0;
goto __pyx_L3;
}
__pyx_L3:;
/* "numpy.pxd":203
*
* cdef int copy_shape, i, ndim
* cdef int endian_detector = 1 # <<<<<<<<<<<<<<
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
*
*/
__pyx_v_endian_detector = 1;
/* "numpy.pxd":204
* cdef int copy_shape, i, ndim
* cdef int endian_detector = 1
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
*
* ndim = PyArray_NDIM(self)
*/
__pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
/* "numpy.pxd":206
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
*
* ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<<
*
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
*/
__pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
/* "numpy.pxd":208
* ndim = PyArray_NDIM(self)
*
* if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
* copy_shape = 1
* else:
*/
__pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
if (__pyx_t_1) {
/* "numpy.pxd":209
*
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
* copy_shape = 1 # <<<<<<<<<<<<<<
* else:
* copy_shape = 0
*/
__pyx_v_copy_shape = 1;
goto __pyx_L4;
}
/*else*/ {
/* "numpy.pxd":211
* copy_shape = 1
* else:
* copy_shape = 0 # <<<<<<<<<<<<<<
*
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
*/
__pyx_v_copy_shape = 0;
}
__pyx_L4:;
/* "numpy.pxd":213
* copy_shape = 0
*
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
* and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
* raise ValueError(u"ndarray is not C contiguous")
*/
__pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
if (__pyx_t_1) {
/* "numpy.pxd":214
*
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
* and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<<
* raise ValueError(u"ndarray is not C contiguous")
*
*/
__pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS));
__pyx_t_3 = __pyx_t_2;
} else {
__pyx_t_3 = __pyx_t_1;
}
if (__pyx_t_3) {
/* "numpy.pxd":215
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
* and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
* raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
*
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
*/
__pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L5;
}
__pyx_L5:;
/* "numpy.pxd":217
* raise ValueError(u"ndarray is not C contiguous")
*
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
* and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
* raise ValueError(u"ndarray is not Fortran contiguous")
*/
__pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
if (__pyx_t_3) {
/* "numpy.pxd":218
*
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
* and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<<
* raise ValueError(u"ndarray is not Fortran contiguous")
*
*/
__pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS));
__pyx_t_2 = __pyx_t_1;
} else {
__pyx_t_2 = __pyx_t_3;
}
if (__pyx_t_2) {
/* "numpy.pxd":219
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
* and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
* raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
*
* info.buf = PyArray_DATA(self)
*/
__pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
__pyx_L6:;
/* "numpy.pxd":221
* raise ValueError(u"ndarray is not Fortran contiguous")
*
* info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<<
* info.ndim = ndim
* if copy_shape:
*/
__pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
/* "numpy.pxd":222
*
* info.buf = PyArray_DATA(self)
* info.ndim = ndim # <<<<<<<<<<<<<<
* if copy_shape:
* # Allocate new buffer for strides and shape info.
*/
__pyx_v_info->ndim = __pyx_v_ndim;
/* "numpy.pxd":223
* info.buf = PyArray_DATA(self)
* info.ndim = ndim
* if copy_shape: # <<<<<<<<<<<<<<
* # Allocate new buffer for strides and shape info.
* # This is allocated as one block, strides first.
*/
if (__pyx_v_copy_shape) {
/* "numpy.pxd":226
* # Allocate new buffer for strides and shape info.
* # This is allocated as one block, strides first.
* info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2) # <<<<<<<<<<<<<<
* info.shape = info.strides + ndim
* for i in range(ndim):
*/
__pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2)));
/* "numpy.pxd":227
* # This is allocated as one block, strides first.
* info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
* info.shape = info.strides + ndim # <<<<<<<<<<<<<<
* for i in range(ndim):
* info.strides[i] = PyArray_STRIDES(self)[i]
*/
__pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
/* "numpy.pxd":228
* info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
* info.shape = info.strides + ndim
* for i in range(ndim): # <<<<<<<<<<<<<<
* info.strides[i] = PyArray_STRIDES(self)[i]
* info.shape[i] = PyArray_DIMS(self)[i]
*/
__pyx_t_5 = __pyx_v_ndim;
for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
__pyx_v_i = __pyx_t_6;
/* "numpy.pxd":229
* info.shape = info.strides + ndim
* for i in range(ndim):
* info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<<
* info.shape[i] = PyArray_DIMS(self)[i]
* else:
*/
(__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
/* "numpy.pxd":230
* for i in range(ndim):
* info.strides[i] = PyArray_STRIDES(self)[i]
* info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<<
* else:
* info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
*/
(__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
}
goto __pyx_L7;
}
/*else*/ {
/* "numpy.pxd":232
* info.shape[i] = PyArray_DIMS(self)[i]
* else:
* info.strides = <Py_ssize_t*>PyArray_STRIDES(self) # <<<<<<<<<<<<<<
* info.shape = <Py_ssize_t*>PyArray_DIMS(self)
* info.suboffsets = NULL
*/
__pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
/* "numpy.pxd":233
* else:
* info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
* info.shape = <Py_ssize_t*>PyArray_DIMS(self) # <<<<<<<<<<<<<<
* info.suboffsets = NULL
* info.itemsize = PyArray_ITEMSIZE(self)
*/
__pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
}
__pyx_L7:;
/* "numpy.pxd":234
* info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
* info.shape = <Py_ssize_t*>PyArray_DIMS(self)
* info.suboffsets = NULL # <<<<<<<<<<<<<<
* info.itemsize = PyArray_ITEMSIZE(self)
* info.readonly = not PyArray_ISWRITEABLE(self)
*/
__pyx_v_info->suboffsets = NULL;
/* "numpy.pxd":235
* info.shape = <Py_ssize_t*>PyArray_DIMS(self)
* info.suboffsets = NULL
* info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<<
* info.readonly = not PyArray_ISWRITEABLE(self)
*
*/
__pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
/* "numpy.pxd":236
* info.suboffsets = NULL
* info.itemsize = PyArray_ITEMSIZE(self)
* info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<<
*
* cdef int t
*/
__pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self));
/* "numpy.pxd":239
*
* cdef int t
* cdef char* f = NULL # <<<<<<<<<<<<<<
* cdef dtype descr = self.descr
* cdef list stack
*/
__pyx_v_f = NULL;
/* "numpy.pxd":240
* cdef int t
* cdef char* f = NULL
* cdef dtype descr = self.descr # <<<<<<<<<<<<<<
* cdef list stack
* cdef int offset
*/
__Pyx_INCREF(((PyObject *)__pyx_v_self->descr));
__pyx_v_descr = __pyx_v_self->descr;
/* "numpy.pxd":244
* cdef int offset
*
* cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<<
*
* if not hasfields and not copy_shape:
*/
__pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);
/* "numpy.pxd":246
* cdef bint hasfields = PyDataType_HASFIELDS(descr)
*
* if not hasfields and not copy_shape: # <<<<<<<<<<<<<<
* # do not call releasebuffer
* info.obj = None
*/
__pyx_t_2 = (!__pyx_v_hasfields);
if (__pyx_t_2) {
__pyx_t_3 = (!__pyx_v_copy_shape);
__pyx_t_1 = __pyx_t_3;
} else {
__pyx_t_1 = __pyx_t_2;
}
if (__pyx_t_1) {
/* "numpy.pxd":248
* if not hasfields and not copy_shape:
* # do not call releasebuffer
* info.obj = None # <<<<<<<<<<<<<<
* else:
* # need to call releasebuffer
*/
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_GOTREF(__pyx_v_info->obj);
__Pyx_DECREF(__pyx_v_info->obj);
__pyx_v_info->obj = Py_None;
goto __pyx_L10;
}
/*else*/ {
/* "numpy.pxd":251
* else:
* # need to call releasebuffer
* info.obj = self # <<<<<<<<<<<<<<
*
* if not hasfields:
*/
__Pyx_INCREF(((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
__Pyx_GOTREF(__pyx_v_info->obj);
__Pyx_DECREF(__pyx_v_info->obj);
__pyx_v_info->obj = ((PyObject *)__pyx_v_self);
}
__pyx_L10:;
/* "numpy.pxd":253
* info.obj = self
*
* if not hasfields: # <<<<<<<<<<<<<<
* t = descr.type_num
* if ((descr.byteorder == c'>' and little_endian) or
*/
__pyx_t_1 = (!__pyx_v_hasfields);
if (__pyx_t_1) {
/* "numpy.pxd":254
*
* if not hasfields:
* t = descr.type_num # <<<<<<<<<<<<<<
* if ((descr.byteorder == c'>' and little_endian) or
* (descr.byteorder == c'<' and not little_endian)):
*/
__pyx_v_t = __pyx_v_descr->type_num;
/* "numpy.pxd":255
* if not hasfields:
* t = descr.type_num
* if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
* (descr.byteorder == c'<' and not little_endian)):
* raise ValueError(u"Non-native byte order not supported")
*/
__pyx_t_1 = (__pyx_v_descr->byteorder == '>');
if (__pyx_t_1) {
__pyx_t_2 = __pyx_v_little_endian;
} else {
__pyx_t_2 = __pyx_t_1;
}
if (!__pyx_t_2) {
/* "numpy.pxd":256
* t = descr.type_num
* if ((descr.byteorder == c'>' and little_endian) or
* (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
* raise ValueError(u"Non-native byte order not supported")
* if t == NPY_BYTE: f = "b"
*/
__pyx_t_1 = (__pyx_v_descr->byteorder == '<');
if (__pyx_t_1) {
__pyx_t_3 = (!__pyx_v_little_endian);
__pyx_t_7 = __pyx_t_3;
} else {
__pyx_t_7 = __pyx_t_1;
}
__pyx_t_1 = __pyx_t_7;
} else {
__pyx_t_1 = __pyx_t_2;
}
if (__pyx_t_1) {
/* "numpy.pxd":257
* if ((descr.byteorder == c'>' and little_endian) or
* (descr.byteorder == c'<' and not little_endian)):
* raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
* if t == NPY_BYTE: f = "b"
* elif t == NPY_UBYTE: f = "B"
*/
__pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L12;
}
__pyx_L12:;
/* "numpy.pxd":258
* (descr.byteorder == c'<' and not little_endian)):
* raise ValueError(u"Non-native byte order not supported")
* if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<<
* elif t == NPY_UBYTE: f = "B"
* elif t == NPY_SHORT: f = "h"
*/
__pyx_t_1 = (__pyx_v_t == NPY_BYTE);
if (__pyx_t_1) {
__pyx_v_f = __pyx_k__b;
goto __pyx_L13;
}
/* "numpy.pxd":259
* raise ValueError(u"Non-native byte order not supported")
* if t == NPY_BYTE: f = "b"
* elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<<
* elif t == NPY_SHORT: f = "h"
* elif t == NPY_USHORT: f = "H"
*/
__pyx_t_1 = (__pyx_v_t == NPY_UBYTE);
if (__pyx_t_1) {
__pyx_v_f = __pyx_k__B;
goto __pyx_L13;
}
/* "numpy.pxd":260
* if t == NPY_BYTE: f = "b"
* elif t == NPY_UBYTE: f = "B"
* elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<<
* elif t == NPY_USHORT: f = "H"
* elif t == NPY_INT: f = "i"
*/
__pyx_t_1 = (__pyx_v_t == NPY_SHORT);
if (__pyx_t_1) {
__pyx_v_f = __pyx_k__h;
goto __pyx_L13;
}
/* "numpy.pxd":261
* elif t == NPY_UBYTE: f = "B"
* elif t == NPY_SHORT: f = "h"
* elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<<
* elif t == NPY_INT: f = "i"
* elif t == NPY_UINT: f = "I"
*/
__pyx_t_1 = (__pyx_v_t == NPY_USHORT);
if (__pyx_t_1) {
__pyx_v_f = __pyx_k__H;
goto __pyx_L13;
}
/* "numpy.pxd":262
* elif t == NPY_SHORT: f = "h"
* elif t == NPY_USHORT: f = "H"
* elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<<
* elif t == NPY_UINT: f = "I"
* elif t == NPY_LONG: f = "l"
*/
__pyx_t_1 = (__pyx_v_t == NPY_INT);
if (__pyx_t_1) {
__pyx_v_f = __pyx_k__i;
goto __pyx_L13;
}
/* "numpy.pxd":263
* elif t == NPY_USHORT: f = "H"
* elif t == NPY_INT: f = "i"
* elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<<
* elif t == NPY_LONG: f = "l"
* elif t == NPY_ULONG: f = "L"
*/
__pyx_t_1 = (__pyx_v_t == NPY_UINT);
if (__pyx_t_1) {
__pyx_v_f = __pyx_k__I;
goto __pyx_L13;
}
/* "numpy.pxd":264
* elif t == NPY_INT: f = "i"
* elif t == NPY_UINT: f = "I"
* elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<<
* elif t == NPY_ULONG: f = "L"
* elif t == NPY_LONGLONG: f = "q"
*/
__pyx_t_1 = (__pyx_v_t == NPY_LONG);
if (__pyx_t_1) {
__pyx_v_f = __pyx_k__l;
goto __pyx_L13;
}
/* "numpy.pxd":265
* elif t == NPY_UINT: f = "I"
* elif t == NPY_LONG: f = "l"
* elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<<
* elif t == NPY_LONGLONG: f = "q"
* elif t == NPY_ULONGLONG: f = "Q"
*/
__pyx_t_1 = (__pyx_v_t == NPY_ULONG);
if (__pyx_t_1) {
__pyx_v_f = __pyx_k__L;
goto __pyx_L13;
}
/* "numpy.pxd":266
* elif t == NPY_LONG: f = "l"
* elif t == NPY_ULONG: f = "L"
* elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<<
* elif t == NPY_ULONGLONG: f = "Q"
* elif t == NPY_FLOAT: f = "f"
*/
__pyx_t_1 = (__pyx_v_t == NPY_LONGLONG);
if (__pyx_t_1) {
__pyx_v_f = __pyx_k__q;
goto __pyx_L13;
}
/* "numpy.pxd":267
* elif t == NPY_ULONG: f = "L"
* elif t == NPY_LONGLONG: f = "q"
* elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<<
* elif t == NPY_FLOAT: f = "f"
* elif t == NPY_DOUBLE: f = "d"
*/
__pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG);
if (__pyx_t_1) {
__pyx_v_f = __pyx_k__Q;
goto __pyx_L13;
}
/* "numpy.pxd":268
* elif t == NPY_LONGLONG: f = "q"
* elif t == NPY_ULONGLONG: f = "Q"
* elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<<
* elif t == NPY_DOUBLE: f = "d"
* elif t == NPY_LONGDOUBLE: f = "g"
*/
__pyx_t_1 = (__pyx_v_t == NPY_FLOAT);
if (__pyx_t_1) {
__pyx_v_f = __pyx_k__f;
goto __pyx_L13;
}
/* "numpy.pxd":269
* elif t == NPY_ULONGLONG: f = "Q"
* elif t == NPY_FLOAT: f = "f"
* elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<<
* elif t == NPY_LONGDOUBLE: f = "g"
* elif t == NPY_CFLOAT: f = "Zf"
*/
__pyx_t_1 = (__pyx_v_t == NPY_DOUBLE);
if (__pyx_t_1) {
__pyx_v_f = __pyx_k__d;
goto __pyx_L13;
}
/* "numpy.pxd":270
* elif t == NPY_FLOAT: f = "f"
* elif t == NPY_DOUBLE: f = "d"
* elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<<
* elif t == NPY_CFLOAT: f = "Zf"
* elif t == NPY_CDOUBLE: f = "Zd"
*/
__pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE);
if (__pyx_t_1) {
__pyx_v_f = __pyx_k__g;
goto __pyx_L13;
}
/* "numpy.pxd":271
* elif t == NPY_DOUBLE: f = "d"
* elif t == NPY_LONGDOUBLE: f = "g"
* elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<<
* elif t == NPY_CDOUBLE: f = "Zd"
* elif t == NPY_CLONGDOUBLE: f = "Zg"
*/
__pyx_t_1 = (__pyx_v_t == NPY_CFLOAT);
if (__pyx_t_1) {
__pyx_v_f = __pyx_k__Zf;
goto __pyx_L13;
}
/* "numpy.pxd":272
* elif t == NPY_LONGDOUBLE: f = "g"
* elif t == NPY_CFLOAT: f = "Zf"
* elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<<
* elif t == NPY_CLONGDOUBLE: f = "Zg"
* elif t == NPY_OBJECT: f = "O"
*/
__pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE);
if (__pyx_t_1) {
__pyx_v_f = __pyx_k__Zd;
goto __pyx_L13;
}
/* "numpy.pxd":273
* elif t == NPY_CFLOAT: f = "Zf"
* elif t == NPY_CDOUBLE: f = "Zd"
* elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<<
* elif t == NPY_OBJECT: f = "O"
* else:
*/
__pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE);
if (__pyx_t_1) {
__pyx_v_f = __pyx_k__Zg;
goto __pyx_L13;
}
/* "numpy.pxd":274
* elif t == NPY_CDOUBLE: f = "Zd"
* elif t == NPY_CLONGDOUBLE: f = "Zg"
* elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<<
* else:
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
*/
__pyx_t_1 = (__pyx_v_t == NPY_OBJECT);
if (__pyx_t_1) {
__pyx_v_f = __pyx_k__O;
goto __pyx_L13;
}
/*else*/ {
/* "numpy.pxd":276
* elif t == NPY_OBJECT: f = "O"
* else:
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
* info.format = f
* return
*/
__pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_13), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_8));
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8));
__Pyx_GIVEREF(((PyObject *)__pyx_t_8));
__pyx_t_8 = 0;
__pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__Pyx_Raise(__pyx_t_8, 0, 0, 0);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L13:;
/* "numpy.pxd":277
* else:
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
* info.format = f # <<<<<<<<<<<<<<
* return
* else:
*/
__pyx_v_info->format = __pyx_v_f;
/* "numpy.pxd":278
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
* info.format = f
* return # <<<<<<<<<<<<<<
* else:
* info.format = <char*>stdlib.malloc(_buffer_format_string_len)
*/
__pyx_r = 0;
goto __pyx_L0;
goto __pyx_L11;
}
/*else*/ {
/* "numpy.pxd":280
* return
* else:
* info.format = <char*>stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<<
* info.format[0] = c'^' # Native data types, manual alignment
* offset = 0
*/
__pyx_v_info->format = ((char *)malloc(255));
/* "numpy.pxd":281
* else:
* info.format = <char*>stdlib.malloc(_buffer_format_string_len)
* info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<<
* offset = 0
* f = _util_dtypestring(descr, info.format + 1,
*/
(__pyx_v_info->format[0]) = '^';
/* "numpy.pxd":282
* info.format = <char*>stdlib.malloc(_buffer_format_string_len)
* info.format[0] = c'^' # Native data types, manual alignment
* offset = 0 # <<<<<<<<<<<<<<
* f = _util_dtypestring(descr, info.format + 1,
* info.format + _buffer_format_string_len,
*/
__pyx_v_offset = 0;
/* "numpy.pxd":285
* f = _util_dtypestring(descr, info.format + 1,
* info.format + _buffer_format_string_len,
* &offset) # <<<<<<<<<<<<<<
* f[0] = c'\0' # Terminate format string
*
*/
__pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_f = __pyx_t_9;
/* "numpy.pxd":286
* info.format + _buffer_format_string_len,
* &offset)
* f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<<
*
* def __releasebuffer__(ndarray self, Py_buffer* info):
*/
(__pyx_v_f[0]) = '\x00';
}
__pyx_L11:;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
__Pyx_GOTREF(__pyx_v_info->obj);
__Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
}
goto __pyx_L2;
__pyx_L0:;
if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
__Pyx_GOTREF(Py_None);
__Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
}
__pyx_L2:;
__Pyx_XDECREF((PyObject *)__pyx_v_descr);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "numpy.pxd":288
* f[0] = c'\0' # Terminate format string
*
* def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
* if PyArray_HASFIELDS(self):
* stdlib.free(info.format)
*/
static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("__releasebuffer__", 0);
/* "numpy.pxd":289
*
* def __releasebuffer__(ndarray self, Py_buffer* info):
* if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
* stdlib.free(info.format)
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
*/
__pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self);
if (__pyx_t_1) {
/* "numpy.pxd":290
* def __releasebuffer__(ndarray self, Py_buffer* info):
* if PyArray_HASFIELDS(self):
* stdlib.free(info.format) # <<<<<<<<<<<<<<
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
* stdlib.free(info.strides)
*/
free(__pyx_v_info->format);
goto __pyx_L3;
}
__pyx_L3:;
/* "numpy.pxd":291
* if PyArray_HASFIELDS(self):
* stdlib.free(info.format)
* if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
* stdlib.free(info.strides)
* # info.shape was stored after info.strides in the same block
*/
__pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
if (__pyx_t_1) {
/* "numpy.pxd":292
* stdlib.free(info.format)
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
* stdlib.free(info.strides) # <<<<<<<<<<<<<<
* # info.shape was stored after info.strides in the same block
*
*/
free(__pyx_v_info->strides);
goto __pyx_L4;
}
__pyx_L4:;
__Pyx_RefNannyFinishContext();
}
/* "numpy.pxd":768
* ctypedef npy_cdouble complex_t
*
* cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
* return PyArray_MultiIterNew(1, <void*>a)
*
*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
/* "numpy.pxd":769
*
* cdef inline object PyArray_MultiIterNew1(a):
* return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
*
* cdef inline object PyArray_MultiIterNew2(a, b):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "numpy.pxd":771
* return PyArray_MultiIterNew(1, <void*>a)
*
* cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
* return PyArray_MultiIterNew(2, <void*>a, <void*>b)
*
*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
/* "numpy.pxd":772
*
* cdef inline object PyArray_MultiIterNew2(a, b):
* return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
*
* cdef inline object PyArray_MultiIterNew3(a, b, c):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "numpy.pxd":774
* return PyArray_MultiIterNew(2, <void*>a, <void*>b)
*
* cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
* return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
*
*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
/* "numpy.pxd":775
*
* cdef inline object PyArray_MultiIterNew3(a, b, c):
* return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
*
* cdef inline object PyArray_MultiIterNew4(a, b, c, d):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "numpy.pxd":777
* return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
*
* cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
* return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
*
*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
/* "numpy.pxd":778
*
* cdef inline object PyArray_MultiIterNew4(a, b, c, d):
* return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
*
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "numpy.pxd":780
* return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
*
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
* return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
*
*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
/* "numpy.pxd":781
*
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
* return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
*
* cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "numpy.pxd":783
* return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
*
* cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
* # Recursive utility function used in __getbuffer__ to get format
* # string. The new location in the format string is returned.
*/
static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
PyArray_Descr *__pyx_v_child = 0;
int __pyx_v_endian_detector;
int __pyx_v_little_endian;
PyObject *__pyx_v_fields = 0;
PyObject *__pyx_v_childname = NULL;
PyObject *__pyx_v_new_offset = NULL;
PyObject *__pyx_v_t = NULL;
char *__pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
Py_ssize_t __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *(*__pyx_t_6)(PyObject *);
int __pyx_t_7;
int __pyx_t_8;
int __pyx_t_9;
int __pyx_t_10;
long __pyx_t_11;
char *__pyx_t_12;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_util_dtypestring", 0);
/* "numpy.pxd":790
* cdef int delta_offset
* cdef tuple i
* cdef int endian_detector = 1 # <<<<<<<<<<<<<<
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
* cdef tuple fields
*/
__pyx_v_endian_detector = 1;
/* "numpy.pxd":791
* cdef tuple i
* cdef int endian_detector = 1
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
* cdef tuple fields
*
*/
__pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
/* "numpy.pxd":794
* cdef tuple fields
*
* for childname in descr.names: # <<<<<<<<<<<<<<
* fields = descr.fields[childname]
* child, new_offset = fields
*/
if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
for (;;) {
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
__Pyx_XDECREF(__pyx_v_childname);
__pyx_v_childname = __pyx_t_3;
__pyx_t_3 = 0;
/* "numpy.pxd":795
*
* for childname in descr.names:
* fields = descr.fields[childname] # <<<<<<<<<<<<<<
* child, new_offset = fields
*
*/
__pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_XDECREF(((PyObject *)__pyx_v_fields));
__pyx_v_fields = ((PyObject*)__pyx_t_3);
__pyx_t_3 = 0;
/* "numpy.pxd":796
* for childname in descr.names:
* fields = descr.fields[childname]
* child, new_offset = fields # <<<<<<<<<<<<<<
*
* if (end - f) - (new_offset - offset[0]) < 15:
*/
if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) {
PyObject* sequence = ((PyObject *)__pyx_v_fields);
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
#else
__pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
#endif
} else if (1) {
__Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
} else
{
Py_ssize_t index = -1;
__pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
__Pyx_GOTREF(__pyx_t_4);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_6 = NULL;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
goto __pyx_L6_unpacking_done;
__pyx_L5_unpacking_failed:;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_6 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L6_unpacking_done:;
}
if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_XDECREF(((PyObject *)__pyx_v_child));
__pyx_v_child = ((PyArray_Descr *)__pyx_t_3);
__pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_v_new_offset);
__pyx_v_new_offset = __pyx_t_4;
__pyx_t_4 = 0;
/* "numpy.pxd":798
* child, new_offset = fields
*
* if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
*
*/
__pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
/* "numpy.pxd":799
*
* if (end - f) - (new_offset - offset[0]) < 15:
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
*
* if ((child.byteorder == c'>' and little_endian) or
*/
__pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_Raise(__pyx_t_5, 0, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
/* "numpy.pxd":801
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
*
* if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
* (child.byteorder == c'<' and not little_endian)):
* raise ValueError(u"Non-native byte order not supported")
*/
__pyx_t_7 = (__pyx_v_child->byteorder == '>');
if (__pyx_t_7) {
__pyx_t_8 = __pyx_v_little_endian;
} else {
__pyx_t_8 = __pyx_t_7;
}
if (!__pyx_t_8) {
/* "numpy.pxd":802
*
* if ((child.byteorder == c'>' and little_endian) or
* (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
* raise ValueError(u"Non-native byte order not supported")
* # One could encode it in the format string and have Cython
*/
__pyx_t_7 = (__pyx_v_child->byteorder == '<');
if (__pyx_t_7) {
__pyx_t_9 = (!__pyx_v_little_endian);
__pyx_t_10 = __pyx_t_9;
} else {
__pyx_t_10 = __pyx_t_7;
}
__pyx_t_7 = __pyx_t_10;
} else {
__pyx_t_7 = __pyx_t_8;
}
if (__pyx_t_7) {
/* "numpy.pxd":803
* if ((child.byteorder == c'>' and little_endian) or
* (child.byteorder == c'<' and not little_endian)):
* raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
* # One could encode it in the format string and have Cython
* # complain instead, BUT: < and > in format strings also imply
*/
__pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_Raise(__pyx_t_5, 0, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
/* "numpy.pxd":813
*
* # Output padding bytes
* while offset[0] < new_offset: # <<<<<<<<<<<<<<
* f[0] = 120 # "x"; pad byte
* f += 1
*/
while (1) {
__pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (!__pyx_t_7) break;
/* "numpy.pxd":814
* # Output padding bytes
* while offset[0] < new_offset:
* f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<<
* f += 1
* offset[0] += 1
*/
(__pyx_v_f[0]) = 120;
/* "numpy.pxd":815
* while offset[0] < new_offset:
* f[0] = 120 # "x"; pad byte
* f += 1 # <<<<<<<<<<<<<<
* offset[0] += 1
*
*/
__pyx_v_f = (__pyx_v_f + 1);
/* "numpy.pxd":816
* f[0] = 120 # "x"; pad byte
* f += 1
* offset[0] += 1 # <<<<<<<<<<<<<<
*
* offset[0] += child.itemsize
*/
__pyx_t_11 = 0;
(__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1);
}
/* "numpy.pxd":818
* offset[0] += 1
*
* offset[0] += child.itemsize # <<<<<<<<<<<<<<
*
* if not PyDataType_HASFIELDS(child):
*/
__pyx_t_11 = 0;
(__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize);
/* "numpy.pxd":820
* offset[0] += child.itemsize
*
* if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
* t = child.type_num
* if end - f < 5:
*/
__pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child));
if (__pyx_t_7) {
/* "numpy.pxd":821
*
* if not PyDataType_HASFIELDS(child):
* t = child.type_num # <<<<<<<<<<<<<<
* if end - f < 5:
* raise RuntimeError(u"Format string allocated too short.")
*/
__pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_v_t);
__pyx_v_t = __pyx_t_3;
__pyx_t_3 = 0;
/* "numpy.pxd":822
* if not PyDataType_HASFIELDS(child):
* t = child.type_num
* if end - f < 5: # <<<<<<<<<<<<<<
* raise RuntimeError(u"Format string allocated too short.")
*
*/
__pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5);
if (__pyx_t_7) {
/* "numpy.pxd":823
* t = child.type_num
* if end - f < 5:
* raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
*
* # Until ticket #99 is fixed, use integers to avoid warnings
*/
__pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L12;
}
__pyx_L12:;
/* "numpy.pxd":826
*
* # Until ticket #99 is fixed, use integers to avoid warnings
* if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<<
* elif t == NPY_UBYTE: f[0] = 66 #"B"
* elif t == NPY_SHORT: f[0] = 104 #"h"
*/
__pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
(__pyx_v_f[0]) = 98;
goto __pyx_L13;
}
/* "numpy.pxd":827
* # Until ticket #99 is fixed, use integers to avoid warnings
* if t == NPY_BYTE: f[0] = 98 #"b"
* elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<<
* elif t == NPY_SHORT: f[0] = 104 #"h"
* elif t == NPY_USHORT: f[0] = 72 #"H"
*/
__pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_7) {
(__pyx_v_f[0]) = 66;
goto __pyx_L13;
}
/* "numpy.pxd":828
* if t == NPY_BYTE: f[0] = 98 #"b"
* elif t == NPY_UBYTE: f[0] = 66 #"B"
* elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<<
* elif t == NPY_USHORT: f[0] = 72 #"H"
* elif t == NPY_INT: f[0] = 105 #"i"
*/
__pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
(__pyx_v_f[0]) = 104;
goto __pyx_L13;
}
/* "numpy.pxd":829
* elif t == NPY_UBYTE: f[0] = 66 #"B"
* elif t == NPY_SHORT: f[0] = 104 #"h"
* elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<<
* elif t == NPY_INT: f[0] = 105 #"i"
* elif t == NPY_UINT: f[0] = 73 #"I"
*/
__pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_7) {
(__pyx_v_f[0]) = 72;
goto __pyx_L13;
}
/* "numpy.pxd":830
* elif t == NPY_SHORT: f[0] = 104 #"h"
* elif t == NPY_USHORT: f[0] = 72 #"H"
* elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<<
* elif t == NPY_UINT: f[0] = 73 #"I"
* elif t == NPY_LONG: f[0] = 108 #"l"
*/
__pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
(__pyx_v_f[0]) = 105;
goto __pyx_L13;
}
/* "numpy.pxd":831
* elif t == NPY_USHORT: f[0] = 72 #"H"
* elif t == NPY_INT: f[0] = 105 #"i"
* elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<<
* elif t == NPY_LONG: f[0] = 108 #"l"
* elif t == NPY_ULONG: f[0] = 76 #"L"
*/
__pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_7) {
(__pyx_v_f[0]) = 73;
goto __pyx_L13;
}
/* "numpy.pxd":832
* elif t == NPY_INT: f[0] = 105 #"i"
* elif t == NPY_UINT: f[0] = 73 #"I"
* elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<<
* elif t == NPY_ULONG: f[0] = 76 #"L"
* elif t == NPY_LONGLONG: f[0] = 113 #"q"
*/
__pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
(__pyx_v_f[0]) = 108;
goto __pyx_L13;
}
/* "numpy.pxd":833
* elif t == NPY_UINT: f[0] = 73 #"I"
* elif t == NPY_LONG: f[0] = 108 #"l"
* elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<<
* elif t == NPY_LONGLONG: f[0] = 113 #"q"
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
*/
__pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_7) {
(__pyx_v_f[0]) = 76;
goto __pyx_L13;
}
/* "numpy.pxd":834
* elif t == NPY_LONG: f[0] = 108 #"l"
* elif t == NPY_ULONG: f[0] = 76 #"L"
* elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<<
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
* elif t == NPY_FLOAT: f[0] = 102 #"f"
*/
__pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
(__pyx_v_f[0]) = 113;
goto __pyx_L13;
}
/* "numpy.pxd":835
* elif t == NPY_ULONG: f[0] = 76 #"L"
* elif t == NPY_LONGLONG: f[0] = 113 #"q"
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<<
* elif t == NPY_FLOAT: f[0] = 102 #"f"
* elif t == NPY_DOUBLE: f[0] = 100 #"d"
*/
__pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_7) {
(__pyx_v_f[0]) = 81;
goto __pyx_L13;
}
/* "numpy.pxd":836
* elif t == NPY_LONGLONG: f[0] = 113 #"q"
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
* elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<<
* elif t == NPY_DOUBLE: f[0] = 100 #"d"
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
*/
__pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
(__pyx_v_f[0]) = 102;
goto __pyx_L13;
}
/* "numpy.pxd":837
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
* elif t == NPY_FLOAT: f[0] = 102 #"f"
* elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<<
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
*/
__pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_7) {
(__pyx_v_f[0]) = 100;
goto __pyx_L13;
}
/* "numpy.pxd":838
* elif t == NPY_FLOAT: f[0] = 102 #"f"
* elif t == NPY_DOUBLE: f[0] = 100 #"d"
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<<
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
*/
__pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
(__pyx_v_f[0]) = 103;
goto __pyx_L13;
}
/* "numpy.pxd":839
* elif t == NPY_DOUBLE: f[0] = 100 #"d"
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<<
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
* elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
*/
__pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_7) {
(__pyx_v_f[0]) = 90;
(__pyx_v_f[1]) = 102;
__pyx_v_f = (__pyx_v_f + 1);
goto __pyx_L13;
}
/* "numpy.pxd":840
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<<
* elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
* elif t == NPY_OBJECT: f[0] = 79 #"O"
*/
__pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
(__pyx_v_f[0]) = 90;
(__pyx_v_f[1]) = 100;
__pyx_v_f = (__pyx_v_f + 1);
goto __pyx_L13;
}
/* "numpy.pxd":841
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
* elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<<
* elif t == NPY_OBJECT: f[0] = 79 #"O"
* else:
*/
__pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_7) {
(__pyx_v_f[0]) = 90;
(__pyx_v_f[1]) = 103;
__pyx_v_f = (__pyx_v_f + 1);
goto __pyx_L13;
}
/* "numpy.pxd":842
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
* elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
* elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<<
* else:
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
*/
__pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
(__pyx_v_f[0]) = 79;
goto __pyx_L13;
}
/*else*/ {
/* "numpy.pxd":844
* elif t == NPY_OBJECT: f[0] = 79 #"O"
* else:
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
* f += 1
* else:
*/
__pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_13), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5));
__Pyx_GIVEREF(((PyObject *)__pyx_t_5));
__pyx_t_5 = 0;
__pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_5, 0, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L13:;
/* "numpy.pxd":845
* else:
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
* f += 1 # <<<<<<<<<<<<<<
* else:
* # Cython ignores struct boundary information ("T{...}"),
*/
__pyx_v_f = (__pyx_v_f + 1);
goto __pyx_L11;
}
/*else*/ {
/* "numpy.pxd":849
* # Cython ignores struct boundary information ("T{...}"),
* # so don't output it
* f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<<
* return f
*
*/
__pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_f = __pyx_t_12;
}
__pyx_L11:;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "numpy.pxd":850
* # so don't output it
* f = _util_dtypestring(child, f, end, offset)
* return f # <<<<<<<<<<<<<<
*
*
*/
__pyx_r = __pyx_v_f;
goto __pyx_L0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_child);
__Pyx_XDECREF(__pyx_v_fields);
__Pyx_XDECREF(__pyx_v_childname);
__Pyx_XDECREF(__pyx_v_new_offset);
__Pyx_XDECREF(__pyx_v_t);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "numpy.pxd":965
*
*
* cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
* cdef PyObject* baseptr
* if base is None:
*/
static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
PyObject *__pyx_v_baseptr;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("set_array_base", 0);
/* "numpy.pxd":967
* cdef inline void set_array_base(ndarray arr, object base):
* cdef PyObject* baseptr
* if base is None: # <<<<<<<<<<<<<<
* baseptr = NULL
* else:
*/
__pyx_t_1 = (__pyx_v_base == Py_None);
if (__pyx_t_1) {
/* "numpy.pxd":968
* cdef PyObject* baseptr
* if base is None:
* baseptr = NULL # <<<<<<<<<<<<<<
* else:
* Py_INCREF(base) # important to do this before decref below!
*/
__pyx_v_baseptr = NULL;
goto __pyx_L3;
}
/*else*/ {
/* "numpy.pxd":970
* baseptr = NULL
* else:
* Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<<
* baseptr = <PyObject*>base
* Py_XDECREF(arr.base)
*/
Py_INCREF(__pyx_v_base);
/* "numpy.pxd":971
* else:
* Py_INCREF(base) # important to do this before decref below!
* baseptr = <PyObject*>base # <<<<<<<<<<<<<<
* Py_XDECREF(arr.base)
* arr.base = baseptr
*/
__pyx_v_baseptr = ((PyObject *)__pyx_v_base);
}
__pyx_L3:;
/* "numpy.pxd":972
* Py_INCREF(base) # important to do this before decref below!
* baseptr = <PyObject*>base
* Py_XDECREF(arr.base) # <<<<<<<<<<<<<<
* arr.base = baseptr
*
*/
Py_XDECREF(__pyx_v_arr->base);
/* "numpy.pxd":973
* baseptr = <PyObject*>base
* Py_XDECREF(arr.base)
* arr.base = baseptr # <<<<<<<<<<<<<<
*
* cdef inline object get_array_base(ndarray arr):
*/
__pyx_v_arr->base = __pyx_v_baseptr;
__Pyx_RefNannyFinishContext();
}
/* "numpy.pxd":975
* arr.base = baseptr
*
* cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
* if arr.base is NULL:
* return None
*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("get_array_base", 0);
/* "numpy.pxd":976
*
* cdef inline object get_array_base(ndarray arr):
* if arr.base is NULL: # <<<<<<<<<<<<<<
* return None
* else:
*/
__pyx_t_1 = (__pyx_v_arr->base == NULL);
if (__pyx_t_1) {
/* "numpy.pxd":977
* cdef inline object get_array_base(ndarray arr):
* if arr.base is NULL:
* return None # <<<<<<<<<<<<<<
* else:
* return <object>arr.base
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(Py_None);
__pyx_r = Py_None;
goto __pyx_L0;
goto __pyx_L3;
}
/*else*/ {
/* "numpy.pxd":979
* return None
* else:
* return <object>arr.base # <<<<<<<<<<<<<<
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
__pyx_r = ((PyObject *)__pyx_v_arr->base);
goto __pyx_L0;
}
__pyx_L3:;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyMethodDef __pyx_methods[] = {
{0, 0, 0, 0}
};
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
PyModuleDef_HEAD_INIT,
__Pyx_NAMESTR("matmul"),
__Pyx_DOCSTR(__pyx_k_19), /* m_doc */
-1, /* m_size */
__pyx_methods /* m_methods */,
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL /* m_free */
};
#endif
static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
{&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0},
{&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0},
{&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0},
{&__pyx_kp_u_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 1, 0, 0},
{&__pyx_n_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 1},
{&__pyx_n_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 1},
{&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
{&__pyx_n_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 1},
{&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
{&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
{&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
{&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0},
{&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0},
{&__pyx_n_s__A, __pyx_k__A, sizeof(__pyx_k__A), 0, 0, 1, 1},
{&__pyx_n_s__Adiag, __pyx_k__Adiag, sizeof(__pyx_k__Adiag), 0, 0, 1, 1},
{&__pyx_n_s__AttributeError, __pyx_k__AttributeError, sizeof(__pyx_k__AttributeError), 0, 0, 1, 1},
{&__pyx_n_s__B, __pyx_k__B, sizeof(__pyx_k__B), 0, 0, 1, 1},
{&__pyx_n_s__BaseException, __pyx_k__BaseException, sizeof(__pyx_k__BaseException), 0, 0, 1, 1},
{&__pyx_n_s__C, __pyx_k__C, sizeof(__pyx_k__C), 0, 0, 1, 1},
{&__pyx_n_s__D, __pyx_k__D, sizeof(__pyx_k__D), 0, 0, 1, 1},
{&__pyx_n_s__EV, __pyx_k__EV, sizeof(__pyx_k__EV), 0, 0, 1, 1},
{&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
{&__pyx_n_s__H, __pyx_k__H, sizeof(__pyx_k__H), 0, 0, 1, 1},
{&__pyx_n_s__LinAlgError, __pyx_k__LinAlgError, sizeof(__pyx_k__LinAlgError), 0, 0, 1, 1},
{&__pyx_n_s__MVop, __pyx_k__MVop, sizeof(__pyx_k__MVop), 0, 0, 1, 1},
{&__pyx_n_s__NotImplemented, __pyx_k__NotImplemented, sizeof(__pyx_k__NotImplemented), 0, 0, 1, 1},
{&__pyx_n_s__R, __pyx_k__R, sizeof(__pyx_k__R), 0, 0, 1, 1},
{&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
{&__pyx_n_s__T, __pyx_k__T, sizeof(__pyx_k__T), 0, 0, 1, 1},
{&__pyx_n_s__VVop, __pyx_k__VVop, sizeof(__pyx_k__VVop), 0, 0, 1, 1},
{&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
{&__pyx_n_s____add__, __pyx_k____add__, sizeof(__pyx_k____add__), 0, 0, 1, 1},
{&__pyx_n_s____array__, __pyx_k____array__, sizeof(__pyx_k____array__), 0, 0, 1, 1},
{&__pyx_n_s____array_priority__, __pyx_k____array_priority__, sizeof(__pyx_k____array_priority__), 0, 0, 1, 1},
{&__pyx_n_s____coerce__, __pyx_k____coerce__, sizeof(__pyx_k____coerce__), 0, 0, 1, 1},
{&__pyx_n_s____getattr__, __pyx_k____getattr__, sizeof(__pyx_k____getattr__), 0, 0, 1, 1},
{&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
{&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
{&__pyx_n_s____mul__, __pyx_k____mul__, sizeof(__pyx_k____mul__), 0, 0, 1, 1},
{&__pyx_n_s____radd__, __pyx_k____radd__, sizeof(__pyx_k____radd__), 0, 0, 1, 1},
{&__pyx_n_s____rmul__, __pyx_k____rmul__, sizeof(__pyx_k____rmul__), 0, 0, 1, 1},
{&__pyx_n_s____rsub__, __pyx_k____rsub__, sizeof(__pyx_k____rsub__), 0, 0, 1, 1},
{&__pyx_n_s____sub__, __pyx_k____sub__, sizeof(__pyx_k____sub__), 0, 0, 1, 1},
{&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
{&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1},
{&__pyx_n_s__act_right, __pyx_k__act_right, sizeof(__pyx_k__act_right), 0, 0, 1, 1},
{&__pyx_n_s__adot, __pyx_k__adot, sizeof(__pyx_k__adot), 0, 0, 1, 1},
{&__pyx_n_s__adot_noconj, __pyx_k__adot_noconj, sizeof(__pyx_k__adot_noconj), 0, 0, 1, 1},
{&__pyx_n_s__aj, __pyx_k__aj, sizeof(__pyx_k__aj), 0, 0, 1, 1},
{&__pyx_n_s__allclose, __pyx_k__allclose, sizeof(__pyx_k__allclose), 0, 0, 1, 1},
{&__pyx_n_s__alpha, __pyx_k__alpha, sizeof(__pyx_k__alpha), 0, 0, 1, 1},
{&__pyx_n_s__args, __pyx_k__args, sizeof(__pyx_k__args), 0, 0, 1, 1},
{&__pyx_n_s__asanyarray, __pyx_k__asanyarray, sizeof(__pyx_k__asanyarray), 0, 0, 1, 1},
{&__pyx_n_s__atol, __pyx_k__atol, sizeof(__pyx_k__atol), 0, 0, 1, 1},
{&__pyx_n_s__attr, __pyx_k__attr, sizeof(__pyx_k__attr), 0, 0, 1, 1},
{&__pyx_n_s__b, __pyx_k__b, sizeof(__pyx_k__b), 0, 0, 1, 1},
{&__pyx_n_s__beta, __pyx_k__beta, sizeof(__pyx_k__beta), 0, 0, 1, 1},
{&__pyx_n_s__bicgstab_iso, __pyx_k__bicgstab_iso, sizeof(__pyx_k__bicgstab_iso), 0, 0, 1, 1},
{&__pyx_n_s__bj, __pyx_k__bj, sizeof(__pyx_k__bj), 0, 0, 1, 1},
{&__pyx_n_s__cholesky, __pyx_k__cholesky, sizeof(__pyx_k__cholesky), 0, 0, 1, 1},
{&__pyx_n_s__conj, __pyx_k__conj, sizeof(__pyx_k__conj), 0, 0, 1, 1},
{&__pyx_n_s__conjugate, __pyx_k__conjugate, sizeof(__pyx_k__conjugate), 0, 0, 1, 1},
{&__pyx_n_s__convg, __pyx_k__convg, sizeof(__pyx_k__convg), 0, 0, 1, 1},
{&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1},
{&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1},
{&__pyx_n_s__diag, __pyx_k__diag, sizeof(__pyx_k__diag), 0, 0, 1, 1},
{&__pyx_n_s__diagonal, __pyx_k__diagonal, sizeof(__pyx_k__diagonal), 0, 0, 1, 1},
{&__pyx_n_s__dot, __pyx_k__dot, sizeof(__pyx_k__dot), 0, 0, 1, 1},
{&__pyx_n_s__dot_left, __pyx_k__dot_left, sizeof(__pyx_k__dot_left), 0, 0, 1, 1},
{&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1},
{&__pyx_n_s__eigh, __pyx_k__eigh, sizeof(__pyx_k__eigh), 0, 0, 1, 1},
{&__pyx_n_s__ev, __pyx_k__ev, sizeof(__pyx_k__ev), 0, 0, 1, 1},
{&__pyx_n_s__evd, __pyx_k__evd, sizeof(__pyx_k__evd), 0, 0, 1, 1},
{&__pyx_n_s__eye, __pyx_k__eye, sizeof(__pyx_k__eye), 0, 0, 1, 1},
{&__pyx_n_s__eyemat, __pyx_k__eyemat, sizeof(__pyx_k__eyemat), 0, 0, 1, 1},
{&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1},
{&__pyx_n_s__get_lapack_funcs, __pyx_k__get_lapack_funcs, sizeof(__pyx_k__get_lapack_funcs), 0, 0, 1, 1},
{&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
{&__pyx_n_s__info, __pyx_k__info, sizeof(__pyx_k__info), 0, 0, 1, 1},
{&__pyx_n_s__inner, __pyx_k__inner, sizeof(__pyx_k__inner), 0, 0, 1, 1},
{&__pyx_n_s__inv, __pyx_k__inv, sizeof(__pyx_k__inv), 0, 0, 1, 1},
{&__pyx_n_s__inv_A, __pyx_k__inv_A, sizeof(__pyx_k__inv_A), 0, 0, 1, 1},
{&__pyx_n_s__invmh, __pyx_k__invmh, sizeof(__pyx_k__invmh), 0, 0, 1, 1},
{&__pyx_n_s__invpo, __pyx_k__invpo, sizeof(__pyx_k__invpo), 0, 0, 1, 1},
{&__pyx_n_s__invtr, __pyx_k__invtr, sizeof(__pyx_k__invtr), 0, 0, 1, 1},
{&__pyx_n_s__isscalar, __pyx_k__isscalar, sizeof(__pyx_k__isscalar), 0, 0, 1, 1},
{&__pyx_n_s__la, __pyx_k__la, sizeof(__pyx_k__la), 0, 0, 1, 1},
{&__pyx_n_s__lapack, __pyx_k__lapack, sizeof(__pyx_k__lapack), 0, 0, 1, 1},
{&__pyx_n_s__lower, __pyx_k__lower, sizeof(__pyx_k__lower), 0, 0, 1, 1},
{&__pyx_n_s__m, __pyx_k__m, sizeof(__pyx_k__m), 0, 0, 1, 1},
{&__pyx_n_s__max_itr, __pyx_k__max_itr, sizeof(__pyx_k__max_itr), 0, 0, 1, 1},
{&__pyx_n_s__mmul, __pyx_k__mmul, sizeof(__pyx_k__mmul), 0, 0, 1, 1},
{&__pyx_n_s__mmul_diag, __pyx_k__mmul_diag, sizeof(__pyx_k__mmul_diag), 0, 0, 1, 1},
{&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1},
{&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1},
{&__pyx_n_s__object, __pyx_k__object, sizeof(__pyx_k__object), 0, 0, 1, 1},
{&__pyx_n_s__offset, __pyx_k__offset, sizeof(__pyx_k__offset), 0, 0, 1, 1},
{&__pyx_n_s__omega, __pyx_k__omega, sizeof(__pyx_k__omega), 0, 0, 1, 1},
{&__pyx_n_s__omega_prv, __pyx_k__omega_prv, sizeof(__pyx_k__omega_prv), 0, 0, 1, 1},
{&__pyx_n_s__ones, __pyx_k__ones, sizeof(__pyx_k__ones), 0, 0, 1, 1},
{&__pyx_n_s__order, __pyx_k__order, sizeof(__pyx_k__order), 0, 0, 1, 1},
{&__pyx_n_s__other, __pyx_k__other, sizeof(__pyx_k__other), 0, 0, 1, 1},
{&__pyx_n_s__out, __pyx_k__out, sizeof(__pyx_k__out), 0, 0, 1, 1},
{&__pyx_n_s__overwrite, __pyx_k__overwrite, sizeof(__pyx_k__overwrite), 0, 0, 1, 1},
{&__pyx_n_s__overwrite_a, __pyx_k__overwrite_a, sizeof(__pyx_k__overwrite_a), 0, 0, 1, 1},
{&__pyx_n_s__overwrite_c, __pyx_k__overwrite_c, sizeof(__pyx_k__overwrite_c), 0, 0, 1, 1},
{&__pyx_n_s__p, __pyx_k__p, sizeof(__pyx_k__p), 0, 0, 1, 1},
{&__pyx_n_s__p_prv, __pyx_k__p_prv, sizeof(__pyx_k__p_prv), 0, 0, 1, 1},
{&__pyx_n_s__potri, __pyx_k__potri, sizeof(__pyx_k__potri), 0, 0, 1, 1},
{&__pyx_n_s__qr, __pyx_k__qr, sizeof(__pyx_k__qr), 0, 0, 1, 1},
{&__pyx_n_s__r, __pyx_k__r, sizeof(__pyx_k__r), 0, 0, 1, 1},
{&__pyx_n_s__r0, __pyx_k__r0, sizeof(__pyx_k__r0), 0, 0, 1, 1},
{&__pyx_n_s__r_prv, __pyx_k__r_prv, sizeof(__pyx_k__r_prv), 0, 0, 1, 1},
{&__pyx_n_s__random, __pyx_k__random, sizeof(__pyx_k__random), 0, 0, 1, 1},
{&__pyx_n_s__randomize_cmplx, __pyx_k__randomize_cmplx, sizeof(__pyx_k__randomize_cmplx), 0, 0, 1, 1},
{&__pyx_n_s__ranf, __pyx_k__ranf, sizeof(__pyx_k__ranf), 0, 0, 1, 1},
{&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
{&__pyx_n_s__ravel, __pyx_k__ravel, sizeof(__pyx_k__ravel), 0, 0, 1, 1},
{&__pyx_n_s__res, __pyx_k__res, sizeof(__pyx_k__res), 0, 0, 1, 1},
{&__pyx_n_s__ret_evd, __pyx_k__ret_evd, sizeof(__pyx_k__ret_evd), 0, 0, 1, 1},
{&__pyx_n_s__rho, __pyx_k__rho, sizeof(__pyx_k__rho), 0, 0, 1, 1},
{&__pyx_n_s__rho_prv, __pyx_k__rho_prv, sizeof(__pyx_k__rho_prv), 0, 0, 1, 1},
{&__pyx_n_s__rowmajor, __pyx_k__rowmajor, sizeof(__pyx_k__rowmajor), 0, 0, 1, 1},
{&__pyx_n_s__rtol, __pyx_k__rtol, sizeof(__pyx_k__rtol), 0, 0, 1, 1},
{&__pyx_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 0, 0, 1, 1},
{&__pyx_n_s__scipy, __pyx_k__scipy, sizeof(__pyx_k__scipy), 0, 0, 1, 1},
{&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1},
{&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1},
{&__pyx_n_s__simple_diag_matrix, __pyx_k__simple_diag_matrix, sizeof(__pyx_k__simple_diag_matrix), 0, 0, 1, 1},
{&__pyx_n_s__sp, __pyx_k__sp, sizeof(__pyx_k__sp), 0, 0, 1, 1},
{&__pyx_n_s__sqrt, __pyx_k__sqrt, sizeof(__pyx_k__sqrt), 0, 0, 1, 1},
{&__pyx_n_s__sqrtmh, __pyx_k__sqrtmh, sizeof(__pyx_k__sqrtmh), 0, 0, 1, 1},
{&__pyx_n_s__sqrtmpo, __pyx_k__sqrtmpo, sizeof(__pyx_k__sqrtmpo), 0, 0, 1, 1},
{&__pyx_n_s__sum, __pyx_k__sum, sizeof(__pyx_k__sum), 0, 0, 1, 1},
{&__pyx_n_s__t, __pyx_k__t, sizeof(__pyx_k__t), 0, 0, 1, 1},
{&__pyx_n_s__tmp, __pyx_k__tmp, sizeof(__pyx_k__tmp), 0, 0, 1, 1},
{&__pyx_n_s__toarray, __pyx_k__toarray, sizeof(__pyx_k__toarray), 0, 0, 1, 1},
{&__pyx_n_s__trace, __pyx_k__trace, sizeof(__pyx_k__trace), 0, 0, 1, 1},
{&__pyx_n_s__transpose, __pyx_k__transpose, sizeof(__pyx_k__transpose), 0, 0, 1, 1},
{&__pyx_n_s__trtri, __pyx_k__trtri, sizeof(__pyx_k__trtri), 0, 0, 1, 1},
{&__pyx_n_s__v, __pyx_k__v, sizeof(__pyx_k__v), 0, 0, 1, 1},
{&__pyx_n_s__v_prv, __pyx_k__v_prv, sizeof(__pyx_k__v_prv), 0, 0, 1, 1},
{&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1},
{&__pyx_n_s__xrange, __pyx_k__xrange, sizeof(__pyx_k__xrange), 0, 0, 1, 1},
{&__pyx_n_s__zeros_like, __pyx_k__zeros_like, sizeof(__pyx_k__zeros_like), 0, 0, 1, 1},
{0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
__pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_NotImplemented = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplemented); if (!__pyx_builtin_NotImplemented) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if PY_VERSION_HEX < 0x02050000
__pyx_builtin_BaseException = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_BaseException) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_builtin_BaseException = __Pyx_GetName(__pyx_b, __pyx_n_s__BaseException); if (!__pyx_builtin_BaseException) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
__pyx_builtin_AttributeError = __Pyx_GetName(__pyx_b, __pyx_n_s__AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if PY_MAJOR_VERSION >= 3
__pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
__pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
return 0;
__pyx_L1_error:;
return -1;
}
static int __Pyx_InitCachedConstants(void) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
/* "evoMPS/matmul.py":466
*
* """
* trtri, = la.lapack.get_lapack_funcs(('trtri',), (A,)) # <<<<<<<<<<<<<<
*
* inv_A, info = trtri(A, lower=lower, overwrite_c=overwrite)
*/
__pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__trtri)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_2);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
/* "evoMPS/matmul.py":488
* #a, lower = la.cho_factor(A, lower=lower) #no.. we need a clean answer, it seems
*
* potri, = la.lapack.get_lapack_funcs(('potri',), (A,)) # <<<<<<<<<<<<<<
*
* inv_A, info = potri(t, lower=lower, overwrite_c=1, rowmajor=1) #rowmajor (C-order) is the default...
*/
__pyx_k_tuple_5 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__potri)); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_5);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
/* "numpy.pxd":215
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
* and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
* raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
*
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
*/
__pyx_k_tuple_8 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_7)); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_8);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));
/* "numpy.pxd":219
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
* and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
* raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
*
* info.buf = PyArray_DATA(self)
*/
__pyx_k_tuple_10 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_9)); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_10);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
/* "numpy.pxd":257
* if ((descr.byteorder == c'>' and little_endian) or
* (descr.byteorder == c'<' and not little_endian)):
* raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
* if t == NPY_BYTE: f = "b"
* elif t == NPY_UBYTE: f = "B"
*/
__pyx_k_tuple_12 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_11)); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_12);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
/* "numpy.pxd":799
*
* if (end - f) - (new_offset - offset[0]) < 15:
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
*
* if ((child.byteorder == c'>' and little_endian) or
*/
__pyx_k_tuple_15 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_14)); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_15);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15));
/* "numpy.pxd":803
* if ((child.byteorder == c'>' and little_endian) or
* (child.byteorder == c'<' and not little_endian)):
* raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
* # One could encode it in the format string and have Cython
* # complain instead, BUT: < and > in format strings also imply
*/
__pyx_k_tuple_16 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_11)); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_16);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));
/* "numpy.pxd":823
* t = child.type_num
* if end - f < 5:
* raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
*
* # Until ticket #99 is fixed, use integers to avoid warnings
*/
__pyx_k_tuple_18 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_17)); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_18);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));
/* "evoMPS/matmul.py":20
* __array_priority__ = 10.1 #makes right-ops work, ala sparse
*
* def __init__(self, D, dtype=sp.float64): # <<<<<<<<<<<<<<
* self.shape = (D, D)
* self.dtype = dtype
*/
__pyx_k_tuple_22 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__D), ((PyObject *)__pyx_n_s__dtype)); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_22);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));
__pyx_k_codeobj_23 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s____init__, 20, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":25
* self.data = None
*
* def __array__(self): # <<<<<<<<<<<<<<
* return self.toarray()
*
*/
__pyx_k_tuple_26 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_26);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
__pyx_k_codeobj_27 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s____array__, 25, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":28
* return self.toarray()
*
* def toarray(self): # <<<<<<<<<<<<<<
* return sp.eye(self.shape[0], dtype=self.dtype)
*
*/
__pyx_k_tuple_28 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_28);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28));
__pyx_k_codeobj_29 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__toarray, 28, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":31
* return sp.eye(self.shape[0], dtype=self.dtype)
*
* def __mul__(self, other): # <<<<<<<<<<<<<<
* if sp.isscalar(other):
* return simple_diag_matrix(sp.ones(self.shape[0], self.dtype) * other)
*/
__pyx_k_tuple_30 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__other)); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_30);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30));
__pyx_k_codeobj_31 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s____mul__, 31, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":43
* return self.toarray() * other
*
* def __rmul__(self, other): # <<<<<<<<<<<<<<
* return self.__mul__(self, other)
*
*/
__pyx_k_tuple_32 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__other)); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_32);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
__pyx_k_codeobj_33 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s____rmul__, 43, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":46
* return self.__mul__(self, other)
*
* def __add__(self, other): # <<<<<<<<<<<<<<
* try:
* return self.toarray() + other
*/
__pyx_k_tuple_34 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__other)); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_34);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34));
__pyx_k_codeobj_35 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s____add__, 46, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":52
* return NotImplemented
*
* def __radd__(self, other): # <<<<<<<<<<<<<<
* try:
* return other + self.toarray()
*/
__pyx_k_tuple_36 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__other)); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_36);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));
__pyx_k_codeobj_37 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s____radd__, 52, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":58
* return NotImplemented
*
* def __sub__(self, other): # <<<<<<<<<<<<<<
* try:
* return self.toarray() - other
*/
__pyx_k_tuple_38 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__other)); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_38);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));
__pyx_k_codeobj_39 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s____sub__, 58, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":64
* return NotImplemented
*
* def __rsub__(self, other): # <<<<<<<<<<<<<<
* try:
* return other - self.toarray()
*/
__pyx_k_tuple_40 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__other)); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_40);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40));
__pyx_k_codeobj_41 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s____rsub__, 64, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":70
* return NotImplemented
*
* def __coerce__(self, other): # <<<<<<<<<<<<<<
* try:
* other = sp.asanyarray(other)
*/
__pyx_k_tuple_42 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__other)); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_42);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42));
__pyx_k_codeobj_43 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s____coerce__, 70, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":80
* return NotImplemented
*
* def dot(self, other): # <<<<<<<<<<<<<<
* if self.shape[1] == other.shape[0]:
* return other
*/
__pyx_k_tuple_44 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__other)); if (unlikely(!__pyx_k_tuple_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_44);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44));
__pyx_k_codeobj_45 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__dot, 80, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":86
* raise BaseException
*
* def dot_left(self, other): # <<<<<<<<<<<<<<
* if self.shape[0] == other.shape[1]:
* return other
*/
__pyx_k_tuple_46 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__other)); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_46);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46));
__pyx_k_codeobj_47 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__dot_left, 86, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":92
* raise BaseException
*
* def conj(self): # <<<<<<<<<<<<<<
* return self
*
*/
__pyx_k_tuple_48 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_48);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_48));
__pyx_k_codeobj_49 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__conj, 92, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":95
* return self
*
* def transpose(self): # <<<<<<<<<<<<<<
* return self
*
*/
__pyx_k_tuple_50 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_50);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50));
__pyx_k_codeobj_51 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__transpose, 95, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":98
* return self
*
* def trace(self, offset=0): # <<<<<<<<<<<<<<
* if offset == 0:
* return self.shape[0]
*/
__pyx_k_tuple_52 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__offset)); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_52);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));
__pyx_k_codeobj_53 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__trace, 98, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_k_tuple_54 = PyTuple_Pack(1, ((PyObject *)__pyx_int_0)); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_54);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54));
/* "evoMPS/matmul.py":104
* return 0
*
* def diagonal(self): # <<<<<<<<<<<<<<
* return sp.ones((self.shape[0]), dtype=self.dtype)
*
*/
__pyx_k_tuple_55 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_55);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));
__pyx_k_codeobj_56 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__diagonal, 104, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":107
* return sp.ones((self.shape[0]), dtype=self.dtype)
*
* def sqrt(self): # <<<<<<<<<<<<<<
* return self
*
*/
__pyx_k_tuple_57 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_57);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57));
__pyx_k_codeobj_58 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__sqrt, 107, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":110
* return self
*
* def inv(self): # <<<<<<<<<<<<<<
* return self
*
*/
__pyx_k_tuple_59 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_59);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59));
__pyx_k_codeobj_60 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__inv, 110, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":113
* return self
*
* def ravel(self): # <<<<<<<<<<<<<<
* return self.toarray().ravel()
*
*/
__pyx_k_tuple_61 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_61);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61));
__pyx_k_codeobj_62 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__ravel, 113, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":116
* return self.toarray().ravel()
*
* def copy(self, order='C'): # <<<<<<<<<<<<<<
* return eyemat(self.shape[0], dtype=self.dtype)
*
*/
__pyx_k_tuple_63 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__order)); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_63);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63));
__pyx_k_codeobj_64 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__copy, 116, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_k_tuple_65 = PyTuple_Pack(1, ((PyObject *)((PyObject*)__pyx_n_s__C))); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_65);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_65));
/* "evoMPS/matmul.py":119
* return eyemat(self.shape[0], dtype=self.dtype)
*
* def __getattr__(self, attr): # <<<<<<<<<<<<<<
* if attr == 'A':
* return self.toarray()
*/
__pyx_k_tuple_66 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__attr)); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_66);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_66));
__pyx_k_codeobj_67 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s____getattr__, 119, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":135
* dtype = None
*
* def __init__(self, diag, dtype=None): # <<<<<<<<<<<<<<
* self.dtype = dtype
* diag = sp.asanyarray(diag, dtype=dtype)
*/
__pyx_k_tuple_68 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__diag), ((PyObject *)__pyx_n_s__dtype)); if (unlikely(!__pyx_k_tuple_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_68);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_68));
__pyx_k_codeobj_69 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s____init__, 135, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_k_tuple_70 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_k_tuple_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_70);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_70));
/* "evoMPS/matmul.py":142
* self.shape = (diag.shape[0], diag.shape[0])
*
* def __array__(self): # <<<<<<<<<<<<<<
* return self.toarray()
*
*/
__pyx_k_tuple_71 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_71);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_71));
__pyx_k_codeobj_72 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s____array__, 142, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":145
* return self.toarray()
*
* def dot(self, b): # <<<<<<<<<<<<<<
* if isinstance(b, simple_diag_matrix):
* return simple_diag_matrix(self.diag * b.diag)
*/
__pyx_k_tuple_73 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__b)); if (unlikely(!__pyx_k_tuple_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_73);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_73));
__pyx_k_codeobj_74 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__dot, 145, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":151
* return mmul_diag(self.diag, b)
*
* def dot_left(self, a): # <<<<<<<<<<<<<<
* if isinstance(a, simple_diag_matrix):
* return simple_diag_matrix(self.diag * a.diag)
*/
__pyx_k_tuple_75 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__a)); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_75);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75));
__pyx_k_codeobj_76 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__dot_left, 151, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":157
* return mmul_diag(self.diag, a, act_right=False)
*
* def conj(self): # <<<<<<<<<<<<<<
* return simple_diag_matrix(self.diag.conj())
*
*/
__pyx_k_tuple_77 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_77);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_77));
__pyx_k_codeobj_78 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__conj, 157, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":160
* return simple_diag_matrix(self.diag.conj())
*
* def transpose(self): # <<<<<<<<<<<<<<
* return self
*
*/
__pyx_k_tuple_79 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_79);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_79));
__pyx_k_codeobj_80 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_79, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__transpose, 160, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_80)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":163
* return self
*
* def inv(self): # <<<<<<<<<<<<<<
* return simple_diag_matrix(1. / self.diag)
*
*/
__pyx_k_tuple_81 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_81)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_81);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_81));
__pyx_k_codeobj_82 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_81, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__inv, 163, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_82)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":166
* return simple_diag_matrix(1. / self.diag)
*
* def sqrt(self): # <<<<<<<<<<<<<<
* return simple_diag_matrix(sp.sqrt(self.diag))
*
*/
__pyx_k_tuple_83 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_83)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_83);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_83));
__pyx_k_codeobj_84 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_83, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__sqrt, 166, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_84)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":169
* return simple_diag_matrix(sp.sqrt(self.diag))
*
* def ravel(self): # <<<<<<<<<<<<<<
* return sp.diag(self.diag).ravel()
*
*/
__pyx_k_tuple_85 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_85)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_85);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_85));
__pyx_k_codeobj_86 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_85, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__ravel, 169, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_86)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":172
* return sp.diag(self.diag).ravel()
*
* def diagonal(self): # <<<<<<<<<<<<<<
* return self.diag
*
*/
__pyx_k_tuple_87 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_87)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_87);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_87));
__pyx_k_codeobj_88 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_87, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__diagonal, 172, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_88)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":175
* return self.diag
*
* def trace(self, offset=0): # <<<<<<<<<<<<<<
* if offset == 0:
* return self.diag.sum()
*/
__pyx_k_tuple_89 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__offset)); if (unlikely(!__pyx_k_tuple_89)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_89);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_89));
__pyx_k_codeobj_90 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_89, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__trace, 175, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_k_tuple_91 = PyTuple_Pack(1, ((PyObject *)__pyx_int_0)); if (unlikely(!__pyx_k_tuple_91)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_91);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_91));
/* "evoMPS/matmul.py":181
* return 0
*
* def toarray(self): # <<<<<<<<<<<<<<
* return sp.diag(self.diag)
*
*/
__pyx_k_tuple_92 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_92)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_92);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_92));
__pyx_k_codeobj_93 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_92, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__toarray, 181, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_93)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":184
* return sp.diag(self.diag)
*
* def copy(self, order='C'): # <<<<<<<<<<<<<<
* return simple_diag_matrix(self.diag.copy())
*
*/
__pyx_k_tuple_94 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__order)); if (unlikely(!__pyx_k_tuple_94)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_94);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_94));
__pyx_k_codeobj_95 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_94, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__copy, 184, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_95)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_k_tuple_96 = PyTuple_Pack(1, ((PyObject *)((PyObject*)__pyx_n_s__C))); if (unlikely(!__pyx_k_tuple_96)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_96);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_96));
/* "evoMPS/matmul.py":187
* return simple_diag_matrix(self.diag.copy())
*
* def __mul__(self, other): # <<<<<<<<<<<<<<
* if sp.isscalar(other):
* return simple_diag_matrix(self.diag * other)
*/
__pyx_k_tuple_97 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__other)); if (unlikely(!__pyx_k_tuple_97)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_97);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_97));
__pyx_k_codeobj_98 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_97, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s____mul__, 187, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_98)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":201
* return NotImplemented
*
* def __rmul__(self, other): # <<<<<<<<<<<<<<
* return self.__mul__(self, other)
*
*/
__pyx_k_tuple_99 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__other)); if (unlikely(!__pyx_k_tuple_99)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_99);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_99));
__pyx_k_codeobj_100 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_99, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s____rmul__, 201, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":204
* return self.__mul__(self, other)
*
* def __add__(self, other): # <<<<<<<<<<<<<<
* try:
* return self.toarray() + other
*/
__pyx_k_tuple_101 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__other)); if (unlikely(!__pyx_k_tuple_101)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_101);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_101));
__pyx_k_codeobj_102 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_101, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s____add__, 204, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_102)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":210
* return NotImplemented
*
* def __radd__(self, other): # <<<<<<<<<<<<<<
* try:
* return other + self.toarray()
*/
__pyx_k_tuple_103 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__other)); if (unlikely(!__pyx_k_tuple_103)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_103);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_103));
__pyx_k_codeobj_104 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_103, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s____radd__, 210, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_104)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":216
* return NotImplemented
*
* def __sub__(self, other): # <<<<<<<<<<<<<<
* try:
* return self.toarray() - other
*/
__pyx_k_tuple_105 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__other)); if (unlikely(!__pyx_k_tuple_105)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_105);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_105));
__pyx_k_codeobj_106 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_105, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s____sub__, 216, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_106)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":222
* return NotImplemented
*
* def __rsub__(self, other): # <<<<<<<<<<<<<<
* try:
* return other - self.toarray()
*/
__pyx_k_tuple_107 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__other)); if (unlikely(!__pyx_k_tuple_107)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_107);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_107));
__pyx_k_codeobj_108 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_107, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s____rsub__, 222, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_108)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":228
* return NotImplemented
*
* def __coerce__(self, other): # <<<<<<<<<<<<<<
* try:
* other = sp.asanyarray(other)
*/
__pyx_k_tuple_109 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__other)); if (unlikely(!__pyx_k_tuple_109)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_109);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_109));
__pyx_k_codeobj_110 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_109, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s____coerce__, 228, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_110)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":238
* return None
*
* def __getattr__(self, attr): # <<<<<<<<<<<<<<
* if attr == 'A':
* return self.toarray()
*/
__pyx_k_tuple_111 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__attr)); if (unlikely(!__pyx_k_tuple_111)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_111);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_111));
__pyx_k_codeobj_112 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_111, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s____getattr__, 238, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_112)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":246
* raise AttributeError(attr + " not found")
*
* def mmul(*args): # <<<<<<<<<<<<<<
* """Multiplies a chain of matrices (2-d ndarrays)
*
*/
__pyx_k_tuple_113 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__args), ((PyObject *)__pyx_n_s__args), ((PyObject *)__pyx_n_s__res), ((PyObject *)__pyx_n_s__x)); if (unlikely(!__pyx_k_tuple_113)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_113);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_113));
__pyx_k_codeobj_114 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__mmul, 246, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_114)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":293
* # return sp.dot(res, args[-1], out=out)
*
* def adot(a, b): # <<<<<<<<<<<<<<
* """
* Calculates the scalar product for the ancilla, expecting
*/
__pyx_k_tuple_115 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__a), ((PyObject *)__pyx_n_s__b)); if (unlikely(!__pyx_k_tuple_115)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_115);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_115));
__pyx_k_codeobj_116 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_115, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__adot, 293, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_116)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":301
* return sp.inner(a.ravel().conj(), b.ravel())
*
* def adot_noconj(a, b): # <<<<<<<<<<<<<<
* """
* Calculates the scalar product for the ancilla, expecting
*/
__pyx_k_tuple_117 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__a), ((PyObject *)__pyx_n_s__b)); if (unlikely(!__pyx_k_tuple_117)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_117);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_117));
__pyx_k_codeobj_118 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_117, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__adot_noconj, 301, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_118)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":309
* return sp.inner(a.T.ravel(), b.ravel())
*
* def H(m, out=None): # <<<<<<<<<<<<<<
* """Matrix conjugate transpose (adjoint).
*
*/
__pyx_k_tuple_119 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__m), ((PyObject *)__pyx_n_s__out)); if (unlikely(!__pyx_k_tuple_119)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_119);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_119));
__pyx_k_codeobj_120 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_119, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__H, 309, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_120)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_k_tuple_121 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_k_tuple_121)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_121);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_121));
/* "evoMPS/matmul.py":333
* return out
*
* def randomize_cmplx(x, a=-0.5, b=0.5, aj=-0.5, bj=0.5): # <<<<<<<<<<<<<<
* """Randomizes a complex matrix in place.
* """
*/
__pyx_k_tuple_122 = PyTuple_Pack(5, ((PyObject *)__pyx_n_s__x), ((PyObject *)__pyx_n_s__a), ((PyObject *)__pyx_n_s__b), ((PyObject *)__pyx_n_s__aj), ((PyObject *)__pyx_n_s__bj)); if (unlikely(!__pyx_k_tuple_122)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_122);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_122));
__pyx_k_codeobj_123 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_122, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__randomize_cmplx, 333, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_123)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":340
* return x
*
* def sqrtmh(A, ret_evd=False, evd=None): # <<<<<<<<<<<<<<
* """Return the matrix square root of a hermitian or symmetric matrix
*
*/
__pyx_k_tuple_124 = PyTuple_Pack(6, ((PyObject *)__pyx_n_s__A), ((PyObject *)__pyx_n_s__ret_evd), ((PyObject *)__pyx_n_s__evd), ((PyObject *)__pyx_n_s__ev), ((PyObject *)__pyx_n_s__EV), ((PyObject *)__pyx_n_s__B)); if (unlikely(!__pyx_k_tuple_124)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_124);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_124));
__pyx_k_codeobj_125 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_124, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__sqrtmh, 340, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_125)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":381
* return mmul(EV, B)
*
* def mmul_diag(Adiag, B, act_right=True): # <<<<<<<<<<<<<<
* if act_right:
* assert B.shape[0] == Adiag.shape[0]
*/
__pyx_k_tuple_126 = PyTuple_Pack(5, ((PyObject *)__pyx_n_s__Adiag), ((PyObject *)__pyx_n_s__B), ((PyObject *)__pyx_n_s__act_right), ((PyObject *)__pyx_n_s__tmp), ((PyObject *)__pyx_n_s__out)); if (unlikely(!__pyx_k_tuple_126)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_126);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_126));
__pyx_k_codeobj_127 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_126, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__mmul_diag, 381, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_127)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":399
* return out
*
* def invmh(A, ret_evd=False, evd=None): # <<<<<<<<<<<<<<
* if not evd is None:
* (ev, EV) = evd
*/
__pyx_k_tuple_128 = PyTuple_Pack(6, ((PyObject *)__pyx_n_s__A), ((PyObject *)__pyx_n_s__ret_evd), ((PyObject *)__pyx_n_s__evd), ((PyObject *)__pyx_n_s__ev), ((PyObject *)__pyx_n_s__EV), ((PyObject *)__pyx_n_s__B)); if (unlikely(!__pyx_k_tuple_128)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_128);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_128));
__pyx_k_codeobj_129 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_128, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__invmh, 399, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_129)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":414
* return mmul(EV, B)
*
* def sqrtmpo(A, out=None): # <<<<<<<<<<<<<<
* """Return the matrix square root of a hermitian or symmetric positive definite matrix
*
*/
__pyx_k_tuple_130 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__A), ((PyObject *)__pyx_n_s__out), ((PyObject *)__pyx_n_s__R)); if (unlikely(!__pyx_k_tuple_130)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_130);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_130));
__pyx_k_codeobj_131 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_130, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__sqrtmpo, 414, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_131)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_k_tuple_132 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_k_tuple_132)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_132);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_132));
/* "evoMPS/matmul.py":444
* return 0
*
* def invtr(A, overwrite=False, lower=False): # <<<<<<<<<<<<<<
* """Compute the inverse of a triangular matrix
*
*/
__pyx_k_tuple_133 = PyTuple_Pack(6, ((PyObject *)__pyx_n_s__A), ((PyObject *)__pyx_n_s__overwrite), ((PyObject *)__pyx_n_s__lower), ((PyObject *)__pyx_n_s__trtri), ((PyObject *)__pyx_n_s__inv_A), ((PyObject *)__pyx_n_s__info)); if (unlikely(!__pyx_k_tuple_133)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_133);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_133));
__pyx_k_codeobj_134 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_133, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__invtr, 444, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_134)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":478
* return inv_A
*
* def invpo(A, out=None, lower=False): # <<<<<<<<<<<<<<
* """Efficient inversion of positive definite matrices using Cholesky decomposition.
*
*/
__pyx_k_tuple_135 = PyTuple_Pack(7, ((PyObject *)__pyx_n_s__A), ((PyObject *)__pyx_n_s__out), ((PyObject *)__pyx_n_s__lower), ((PyObject *)__pyx_n_s__t), ((PyObject *)__pyx_n_s__potri), ((PyObject *)__pyx_n_s__inv_A), ((PyObject *)__pyx_n_s__info)); if (unlikely(!__pyx_k_tuple_135)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_135);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_135));
__pyx_k_codeobj_136 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_135, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__invpo, 478, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_136)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":499
* return inv_A
*
* def bicgstab_iso(A, x, b, MVop, VVop, max_itr=500, atol=1E-14, rtol=1E-14): # <<<<<<<<<<<<<<
* """Implements the Bi-CGSTAB method for isomorphic operations.
*
*/
__pyx_k_tuple_137 = PyTuple_Pack(24, ((PyObject *)__pyx_n_s__A), ((PyObject *)__pyx_n_s__x), ((PyObject *)__pyx_n_s__b), ((PyObject *)__pyx_n_s__MVop), ((PyObject *)__pyx_n_s__VVop), ((PyObject *)__pyx_n_s__max_itr), ((PyObject *)__pyx_n_s__atol), ((PyObject *)__pyx_n_s__rtol), ((PyObject *)__pyx_n_s__r_prv), ((PyObject *)__pyx_n_s__r0), ((PyObject *)__pyx_n_s__rho_prv), ((PyObject *)__pyx_n_s__alpha), ((PyObject *)__pyx_n_s__omega_prv), ((PyObject *)__pyx_n_s__v_prv), ((PyObject *)__pyx_n_s__p_prv), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__rho), ((PyObject *)__pyx_n_s__beta), ((PyObject *)__pyx_n_s__p), ((PyObject *)__pyx_n_s__v), ((PyObject *)__pyx_n_s__s), ((PyObject *)__pyx_n_s__t), ((PyObject *)__pyx_n_s__omega), ((PyObject *)__pyx_n_s__convg)); if (unlikely(!__pyx_k_tuple_137)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_137);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_137));
__pyx_k_codeobj_138 = (PyObject*)__Pyx_PyCode_New(8, 0, 24, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_137, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__bicgstab_iso, 499, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_138)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
__Pyx_RefNannyFinishContext();
return -1;
}
static int __Pyx_InitGlobals(void) {
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_500 = PyInt_FromLong(500); if (unlikely(!__pyx_int_500)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
return 0;
__pyx_L1_error:;
return -1;
}
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initmatmul(void); /*proto*/
PyMODINIT_FUNC initmatmul(void)
#else
PyMODINIT_FUNC PyInit_matmul(void); /*proto*/
PyMODINIT_FUNC PyInit_matmul(void)
#endif
{
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
__Pyx_RefNannyDeclarations
#if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
PyErr_Clear();
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
if (!__Pyx_RefNanny)
Py_FatalError("failed to import 'refnanny' module");
}
#endif
__Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_matmul(void)", 0);
if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#ifdef __Pyx_CyFunction_USED
if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
#ifdef __Pyx_FusedFunction_USED
if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
#ifdef __Pyx_Generator_USED
if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
/*--- Library function declarations ---*/
/*--- Threads initialization code ---*/
#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
#ifdef WITH_THREAD /* Python build with threading support? */
PyEval_InitThreads();
#endif
#endif
/*--- Module creation code ---*/
#if PY_MAJOR_VERSION < 3
__pyx_m = Py_InitModule4(__Pyx_NAMESTR("matmul"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_19), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
#else
__pyx_m = PyModule_Create(&__pyx_moduledef);
#endif
if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if PY_MAJOR_VERSION >= 3
{
PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (!PyDict_GetItemString(modules, "evoMPS.matmul")) {
if (unlikely(PyDict_SetItemString(modules, "evoMPS.matmul", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
}
#endif
__pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if CYTHON_COMPILING_IN_PYPY
Py_INCREF(__pyx_b);
#endif
if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
/*--- Initialize various global constants etc. ---*/
if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_module_is_main_evoMPS__matmul) {
if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
/*--- Builtin init code ---*/
if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Constants init code ---*/
if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Global init code ---*/
/*--- Variable export code ---*/
/*--- Function export code ---*/
/*--- Type init code ---*/
/*--- Type import code ---*/
__pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
#if CYTHON_COMPILING_IN_PYPY
sizeof(PyTypeObject),
#else
sizeof(PyHeapTypeObject),
#endif
0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Variable import code ---*/
/*--- Function import code ---*/
/*--- Execution code ---*/
/* "evoMPS/matmul.py":13
* """
*
* import scipy as sp # <<<<<<<<<<<<<<
* import scipy.linalg as la
* #import scipy.sparse as spa
*/
__pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__scipy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sp, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":14
*
* import scipy as sp
* import scipy.linalg as la # <<<<<<<<<<<<<<
* #import scipy.sparse as spa
*
*/
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(((PyObject *)__pyx_n_s_21));
PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s_21));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s_21));
__pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_20), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__la, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "evoMPS/matmul.py":17
* #import scipy.sparse as spa
*
* class eyemat(object): # <<<<<<<<<<<<<<
* __array_priority__ = 10.1 #makes right-ops work, ala sparse
*
*/
__pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
/* "evoMPS/matmul.py":18
*
* class eyemat(object):
* __array_priority__ = 10.1 #makes right-ops work, ala sparse # <<<<<<<<<<<<<<
*
* def __init__(self, D, dtype=sp.float64):
*/
__pyx_t_1 = PyFloat_FromDouble(10.1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____array_priority__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":20
* __array_priority__ = 10.1 #makes right-ops work, ala sparse
*
* def __init__(self, D, dtype=sp.float64): # <<<<<<<<<<<<<<
* self.shape = (D, D)
* self.dtype = dtype
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_6eyemat_1__init__, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_23)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_CyFunction_InitDefaults(__pyx_t_1, sizeof(__pyx_defaults), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_1)->__pyx_arg_dtype = __pyx_t_4;
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
__Pyx_CyFunction_SetDefaultsGetter(__pyx_t_1, __pyx_pf_6evoMPS_6matmul_6eyemat_42__defaults__);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____init__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":25
* self.data = None
*
* def __array__(self): # <<<<<<<<<<<<<<
* return self.toarray()
*
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_6eyemat_3__array__, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_27)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____array__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":28
* return self.toarray()
*
* def toarray(self): # <<<<<<<<<<<<<<
* return sp.eye(self.shape[0], dtype=self.dtype)
*
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_6eyemat_5toarray, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_29)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__toarray, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":31
* return sp.eye(self.shape[0], dtype=self.dtype)
*
* def __mul__(self, other): # <<<<<<<<<<<<<<
* if sp.isscalar(other):
* return simple_diag_matrix(sp.ones(self.shape[0], self.dtype) * other)
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_6eyemat_7__mul__, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_31)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____mul__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":43
* return self.toarray() * other
*
* def __rmul__(self, other): # <<<<<<<<<<<<<<
* return self.__mul__(self, other)
*
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_6eyemat_9__rmul__, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_33)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____rmul__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":46
* return self.__mul__(self, other)
*
* def __add__(self, other): # <<<<<<<<<<<<<<
* try:
* return self.toarray() + other
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_6eyemat_11__add__, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_35)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____add__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":52
* return NotImplemented
*
* def __radd__(self, other): # <<<<<<<<<<<<<<
* try:
* return other + self.toarray()
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_6eyemat_13__radd__, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_37)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____radd__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":58
* return NotImplemented
*
* def __sub__(self, other): # <<<<<<<<<<<<<<
* try:
* return self.toarray() - other
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_6eyemat_15__sub__, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_39)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____sub__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":64
* return NotImplemented
*
* def __rsub__(self, other): # <<<<<<<<<<<<<<
* try:
* return other - self.toarray()
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_6eyemat_17__rsub__, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_41)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____rsub__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":70
* return NotImplemented
*
* def __coerce__(self, other): # <<<<<<<<<<<<<<
* try:
* other = sp.asanyarray(other)
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_6eyemat_19__coerce__, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_43)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____coerce__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":80
* return NotImplemented
*
* def dot(self, other): # <<<<<<<<<<<<<<
* if self.shape[1] == other.shape[0]:
* return other
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_6eyemat_21dot, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_45)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__dot, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":86
* raise BaseException
*
* def dot_left(self, other): # <<<<<<<<<<<<<<
* if self.shape[0] == other.shape[1]:
* return other
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_6eyemat_23dot_left, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_47)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__dot_left, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":92
* raise BaseException
*
* def conj(self): # <<<<<<<<<<<<<<
* return self
*
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_6eyemat_25conj, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_49)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__conj, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":95
* return self
*
* def transpose(self): # <<<<<<<<<<<<<<
* return self
*
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_6eyemat_27transpose, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_51)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__transpose, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":98
* return self
*
* def trace(self, offset=0): # <<<<<<<<<<<<<<
* if offset == 0:
* return self.shape[0]
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_6eyemat_29trace, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_53)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, ((PyObject *)__pyx_k_tuple_54));
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__trace, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":104
* return 0
*
* def diagonal(self): # <<<<<<<<<<<<<<
* return sp.ones((self.shape[0]), dtype=self.dtype)
*
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_6eyemat_31diagonal, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_56)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__diagonal, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":107
* return sp.ones((self.shape[0]), dtype=self.dtype)
*
* def sqrt(self): # <<<<<<<<<<<<<<
* return self
*
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_6eyemat_33sqrt, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_58)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__sqrt, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":110
* return self
*
* def inv(self): # <<<<<<<<<<<<<<
* return self
*
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_6eyemat_35inv, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_60)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__inv, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":113
* return self
*
* def ravel(self): # <<<<<<<<<<<<<<
* return self.toarray().ravel()
*
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_6eyemat_37ravel, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_62)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__ravel, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":116
* return self.toarray().ravel()
*
* def copy(self, order='C'): # <<<<<<<<<<<<<<
* return eyemat(self.shape[0], dtype=self.dtype)
*
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_6eyemat_39copy, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_64)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, ((PyObject *)__pyx_k_tuple_65));
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__copy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":119
* return eyemat(self.shape[0], dtype=self.dtype)
*
* def __getattr__(self, attr): # <<<<<<<<<<<<<<
* if attr == 'A':
* return self.toarray()
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_6eyemat_41__getattr__, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_67)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____getattr__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "evoMPS/matmul.py":17
* #import scipy.sparse as spa
*
* class eyemat(object): # <<<<<<<<<<<<<<
* __array_priority__ = 10.1 #makes right-ops work, ala sparse
*
*/
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_builtin_object);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object);
__Pyx_GIVEREF(__pyx_builtin_object);
__pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2), __pyx_n_s__eyemat, __pyx_n_s_25); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__eyemat, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
/* "evoMPS/matmul.py":128
*
*
* class simple_diag_matrix: # <<<<<<<<<<<<<<
* __array_priority__ = 10.1 #makes right-ops work, ala sparse
*
*/
__pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
/* "evoMPS/matmul.py":129
*
* class simple_diag_matrix:
* __array_priority__ = 10.1 #makes right-ops work, ala sparse # <<<<<<<<<<<<<<
*
* diag = None
*/
__pyx_t_4 = PyFloat_FromDouble(10.1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____array_priority__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":131
* __array_priority__ = 10.1 #makes right-ops work, ala sparse
*
* diag = None # <<<<<<<<<<<<<<
* shape = None
* dtype = None
*/
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__diag, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":132
*
* diag = None
* shape = None # <<<<<<<<<<<<<<
* dtype = None
*
*/
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__shape, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":133
* diag = None
* shape = None
* dtype = None # <<<<<<<<<<<<<<
*
* def __init__(self, diag, dtype=None):
*/
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__dtype, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "evoMPS/matmul.py":135
* dtype = None
*
* def __init__(self, diag, dtype=None): # <<<<<<<<<<<<<<
* self.dtype = dtype
* diag = sp.asanyarray(diag, dtype=dtype)
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_1__init__, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_69)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, ((PyObject *)__pyx_k_tuple_70));
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____init__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":142
* self.shape = (diag.shape[0], diag.shape[0])
*
* def __array__(self): # <<<<<<<<<<<<<<
* return self.toarray()
*
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_3__array__, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_72)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____array__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":145
* return self.toarray()
*
* def dot(self, b): # <<<<<<<<<<<<<<
* if isinstance(b, simple_diag_matrix):
* return simple_diag_matrix(self.diag * b.diag)
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_5dot, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_74)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__dot, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":151
* return mmul_diag(self.diag, b)
*
* def dot_left(self, a): # <<<<<<<<<<<<<<
* if isinstance(a, simple_diag_matrix):
* return simple_diag_matrix(self.diag * a.diag)
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_7dot_left, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_76)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__dot_left, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":157
* return mmul_diag(self.diag, a, act_right=False)
*
* def conj(self): # <<<<<<<<<<<<<<
* return simple_diag_matrix(self.diag.conj())
*
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_9conj, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_78)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__conj, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":160
* return simple_diag_matrix(self.diag.conj())
*
* def transpose(self): # <<<<<<<<<<<<<<
* return self
*
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_11transpose, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_80)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__transpose, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":163
* return self
*
* def inv(self): # <<<<<<<<<<<<<<
* return simple_diag_matrix(1. / self.diag)
*
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_13inv, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_82)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__inv, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":166
* return simple_diag_matrix(1. / self.diag)
*
* def sqrt(self): # <<<<<<<<<<<<<<
* return simple_diag_matrix(sp.sqrt(self.diag))
*
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_15sqrt, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_84)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__sqrt, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":169
* return simple_diag_matrix(sp.sqrt(self.diag))
*
* def ravel(self): # <<<<<<<<<<<<<<
* return sp.diag(self.diag).ravel()
*
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_17ravel, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_86)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__ravel, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":172
* return sp.diag(self.diag).ravel()
*
* def diagonal(self): # <<<<<<<<<<<<<<
* return self.diag
*
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_19diagonal, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_88)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__diagonal, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":175
* return self.diag
*
* def trace(self, offset=0): # <<<<<<<<<<<<<<
* if offset == 0:
* return self.diag.sum()
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_21trace, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_90)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, ((PyObject *)__pyx_k_tuple_91));
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__trace, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":181
* return 0
*
* def toarray(self): # <<<<<<<<<<<<<<
* return sp.diag(self.diag)
*
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_23toarray, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_93)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__toarray, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":184
* return sp.diag(self.diag)
*
* def copy(self, order='C'): # <<<<<<<<<<<<<<
* return simple_diag_matrix(self.diag.copy())
*
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_25copy, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_95)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, ((PyObject *)__pyx_k_tuple_96));
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__copy, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":187
* return simple_diag_matrix(self.diag.copy())
*
* def __mul__(self, other): # <<<<<<<<<<<<<<
* if sp.isscalar(other):
* return simple_diag_matrix(self.diag * other)
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_27__mul__, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_98)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____mul__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":201
* return NotImplemented
*
* def __rmul__(self, other): # <<<<<<<<<<<<<<
* return self.__mul__(self, other)
*
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_29__rmul__, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_100)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____rmul__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":204
* return self.__mul__(self, other)
*
* def __add__(self, other): # <<<<<<<<<<<<<<
* try:
* return self.toarray() + other
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_31__add__, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_102)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____add__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":210
* return NotImplemented
*
* def __radd__(self, other): # <<<<<<<<<<<<<<
* try:
* return other + self.toarray()
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_33__radd__, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_104)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____radd__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":216
* return NotImplemented
*
* def __sub__(self, other): # <<<<<<<<<<<<<<
* try:
* return self.toarray() - other
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_35__sub__, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_106)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____sub__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":222
* return NotImplemented
*
* def __rsub__(self, other): # <<<<<<<<<<<<<<
* try:
* return other - self.toarray()
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_37__rsub__, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_108)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____rsub__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":228
* return NotImplemented
*
* def __coerce__(self, other): # <<<<<<<<<<<<<<
* try:
* other = sp.asanyarray(other)
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_39__coerce__, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_110)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____coerce__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":238
* return None
*
* def __getattr__(self, attr): # <<<<<<<<<<<<<<
* if attr == 'A':
* return self.toarray()
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_18simple_diag_matrix_41__getattr__, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_112)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____getattr__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "evoMPS/matmul.py":128
*
*
* class simple_diag_matrix: # <<<<<<<<<<<<<<
* __array_priority__ = 10.1 #makes right-ops work, ala sparse
*
*/
__pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2), __pyx_n_s__simple_diag_matrix, __pyx_n_s_25); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__simple_diag_matrix, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
/* "evoMPS/matmul.py":246
* raise AttributeError(attr + " not found")
*
* def mmul(*args): # <<<<<<<<<<<<<<
* """Multiplies a chain of matrices (2-d ndarrays)
*
*/
__pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_1mmul, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_114)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__mmul, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "evoMPS/matmul.py":293
* # return sp.dot(res, args[-1], out=out)
*
* def adot(a, b): # <<<<<<<<<<<<<<
* """
* Calculates the scalar product for the ancilla, expecting
*/
__pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_3adot, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_116)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__adot, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "evoMPS/matmul.py":301
* return sp.inner(a.ravel().conj(), b.ravel())
*
* def adot_noconj(a, b): # <<<<<<<<<<<<<<
* """
* Calculates the scalar product for the ancilla, expecting
*/
__pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_5adot_noconj, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_118)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__adot_noconj, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "evoMPS/matmul.py":309
* return sp.inner(a.T.ravel(), b.ravel())
*
* def H(m, out=None): # <<<<<<<<<<<<<<
* """Matrix conjugate transpose (adjoint).
*
*/
__pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_7H, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_120)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, ((PyObject *)__pyx_k_tuple_121));
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__H, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "evoMPS/matmul.py":333
* return out
*
* def randomize_cmplx(x, a=-0.5, b=0.5, aj=-0.5, bj=0.5): # <<<<<<<<<<<<<<
* """Randomizes a complex matrix in place.
* """
*/
__pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_9randomize_cmplx, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_123)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
if (!__Pyx_CyFunction_InitDefaults(__pyx_t_2, sizeof(__pyx_defaults1), 4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = PyFloat_FromDouble(-0.5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_t_2)->__pyx_arg_a = __pyx_t_4;
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
__pyx_t_4 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_t_2)->__pyx_arg_b = __pyx_t_4;
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
__pyx_t_4 = PyFloat_FromDouble(-0.5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_t_2)->__pyx_arg_aj = __pyx_t_4;
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
__pyx_t_4 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_t_2)->__pyx_arg_bj = __pyx_t_4;
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
__Pyx_CyFunction_SetDefaultsGetter(__pyx_t_2, __pyx_pf_6evoMPS_6matmul_24__defaults__);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__randomize_cmplx, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "evoMPS/matmul.py":340
* return x
*
* def sqrtmh(A, ret_evd=False, evd=None): # <<<<<<<<<<<<<<
* """Return the matrix square root of a hermitian or symmetric matrix
*
*/
__pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_11sqrtmh, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_125)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
if (!__Pyx_CyFunction_InitDefaults(__pyx_t_2, sizeof(__pyx_defaults2), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_t_2)->__pyx_arg_ret_evd = __pyx_t_4;
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
__Pyx_CyFunction_SetDefaultsGetter(__pyx_t_2, __pyx_pf_6evoMPS_6matmul_26__defaults__);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sqrtmh, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "evoMPS/matmul.py":381
* return mmul(EV, B)
*
* def mmul_diag(Adiag, B, act_right=True): # <<<<<<<<<<<<<<
* if act_right:
* assert B.shape[0] == Adiag.shape[0]
*/
__pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_13mmul_diag, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_127)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
if (!__Pyx_CyFunction_InitDefaults(__pyx_t_2, sizeof(__pyx_defaults3), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_t_2)->__pyx_arg_act_right = __pyx_t_4;
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
__Pyx_CyFunction_SetDefaultsGetter(__pyx_t_2, __pyx_pf_6evoMPS_6matmul_28__defaults__);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__mmul_diag, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "evoMPS/matmul.py":399
* return out
*
* def invmh(A, ret_evd=False, evd=None): # <<<<<<<<<<<<<<
* if not evd is None:
* (ev, EV) = evd
*/
__pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_15invmh, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_129)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
if (!__Pyx_CyFunction_InitDefaults(__pyx_t_2, sizeof(__pyx_defaults4), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_CyFunction_Defaults(__pyx_defaults4, __pyx_t_2)->__pyx_arg_ret_evd = __pyx_t_4;
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
__Pyx_CyFunction_SetDefaultsGetter(__pyx_t_2, __pyx_pf_6evoMPS_6matmul_30__defaults__);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__invmh, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "evoMPS/matmul.py":414
* return mmul(EV, B)
*
* def sqrtmpo(A, out=None): # <<<<<<<<<<<<<<
* """Return the matrix square root of a hermitian or symmetric positive definite matrix
*
*/
__pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_17sqrtmpo, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_131)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, ((PyObject *)__pyx_k_tuple_132));
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sqrtmpo, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "evoMPS/matmul.py":444
* return 0
*
* def invtr(A, overwrite=False, lower=False): # <<<<<<<<<<<<<<
* """Compute the inverse of a triangular matrix
*
*/
__pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_19invtr, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_134)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
if (!__Pyx_CyFunction_InitDefaults(__pyx_t_2, sizeof(__pyx_defaults5), 2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_CyFunction_Defaults(__pyx_defaults5, __pyx_t_2)->__pyx_arg_overwrite = __pyx_t_4;
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
__pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_CyFunction_Defaults(__pyx_defaults5, __pyx_t_2)->__pyx_arg_lower = __pyx_t_4;
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
__Pyx_CyFunction_SetDefaultsGetter(__pyx_t_2, __pyx_pf_6evoMPS_6matmul_32__defaults__);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__invtr, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "evoMPS/matmul.py":478
* return inv_A
*
* def invpo(A, out=None, lower=False): # <<<<<<<<<<<<<<
* """Efficient inversion of positive definite matrices using Cholesky decomposition.
*
*/
__pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_21invpo, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_136)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
if (!__Pyx_CyFunction_InitDefaults(__pyx_t_2, sizeof(__pyx_defaults6), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_CyFunction_Defaults(__pyx_defaults6, __pyx_t_2)->__pyx_arg_lower = __pyx_t_4;
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
__Pyx_CyFunction_SetDefaultsGetter(__pyx_t_2, __pyx_pf_6evoMPS_6matmul_34__defaults__);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__invpo, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "evoMPS/matmul.py":499
* return inv_A
*
* def bicgstab_iso(A, x, b, MVop, VVop, max_itr=500, atol=1E-14, rtol=1E-14): # <<<<<<<<<<<<<<
* """Implements the Bi-CGSTAB method for isomorphic operations.
*
*/
__pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6evoMPS_6matmul_23bicgstab_iso, 0, NULL, __pyx_n_s_25, ((PyObject *)__pyx_k_codeobj_138)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
if (!__Pyx_CyFunction_InitDefaults(__pyx_t_2, sizeof(__pyx_defaults7), 2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = PyFloat_FromDouble(1E-14); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_CyFunction_Defaults(__pyx_defaults7, __pyx_t_2)->__pyx_arg_atol = __pyx_t_4;
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
__pyx_t_4 = PyFloat_FromDouble(1E-14); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_CyFunction_Defaults(__pyx_defaults7, __pyx_t_2)->__pyx_arg_rtol = __pyx_t_4;
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
__Pyx_CyFunction_SetDefaultsGetter(__pyx_t_2, __pyx_pf_6evoMPS_6matmul_36__defaults__);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__bicgstab_iso, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "evoMPS/matmul.py":1
* # -*- coding: utf-8 -*- # <<<<<<<<<<<<<<
* # cython: profile=False
* """
*/
__pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
/* "numpy.pxd":975
* arr.base = baseptr
*
* cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
* if arr.base is NULL:
* return None
*/
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
if (__pyx_m) {
__Pyx_AddTraceback("init evoMPS.matmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
Py_DECREF(__pyx_m); __pyx_m = 0;
} else if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_ImportError, "init evoMPS.matmul");
}
__pyx_L0:;
__Pyx_RefNannyFinishContext();
#if PY_MAJOR_VERSION < 3
return;
#else
return __pyx_m;
#endif
}
/* Runtime support code */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
PyObject *m = NULL, *p = NULL;
void *r = NULL;
m = PyImport_ImportModule((char *)modname);
if (!m) goto end;
p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
if (!p) goto end;
r = PyLong_AsVoidPtr(p);
end:
Py_XDECREF(p);
Py_XDECREF(m);
return (__Pyx_RefNannyAPIStruct *)r;
}
#endif /* CYTHON_REFNANNY */
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
PyObject *result;
result = PyObject_GetAttr(dict, name);
if (!result) {
if (dict != __pyx_b) {
PyErr_Clear();
result = PyObject_GetAttr(__pyx_b, name);
}
if (!result) {
PyErr_SetObject(PyExc_NameError, name);
}
}
return result;
}
static void __Pyx_RaiseArgtupleInvalid(
const char* func_name,
int exact,
Py_ssize_t num_min,
Py_ssize_t num_max,
Py_ssize_t num_found)
{
Py_ssize_t num_expected;
const char *more_or_less;
if (num_found < num_min) {
num_expected = num_min;
more_or_less = "at least";
} else {
num_expected = num_max;
more_or_less = "at most";
}
if (exact) {
more_or_less = "exactly";
}
PyErr_Format(PyExc_TypeError,
"%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
func_name, more_or_less, num_expected,
(num_expected == 1) ? "" : "s", num_found);
}
static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name,
PyObject* kw_name)
{
PyErr_Format(PyExc_TypeError,
#if PY_MAJOR_VERSION >= 3
"%s() got multiple values for keyword argument '%U'", func_name, kw_name);
#else
"%s() got multiple values for keyword argument '%s'", func_name,
PyString_AsString(kw_name));
#endif
}
static int __Pyx_ParseOptionalKeywords(
PyObject *kwds,
PyObject **argnames[],
PyObject *kwds2,
PyObject *values[],
Py_ssize_t num_pos_args,
const char* function_name)
{
PyObject *key = 0, *value = 0;
Py_ssize_t pos = 0;
PyObject*** name;
PyObject*** first_kw_arg = argnames + num_pos_args;
while (PyDict_Next(kwds, &pos, &key, &value)) {
name = first_kw_arg;
while (*name && (**name != key)) name++;
if (*name) {
values[name-argnames] = value;
continue;
}
name = first_kw_arg;
#if PY_MAJOR_VERSION < 3
if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
while (*name) {
if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
&& _PyString_Eq(**name, key)) {
values[name-argnames] = value;
break;
}
name++;
}
if (*name) continue;
else {
PyObject*** argname = argnames;
while (argname != first_kw_arg) {
if ((**argname == key) || (
(CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
&& _PyString_Eq(**argname, key))) {
goto arg_passed_twice;
}
argname++;
}
}
} else
#endif
if (likely(PyUnicode_Check(key))) {
while (*name) {
int cmp = (**name == key) ? 0 :
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
(PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
#endif
PyUnicode_Compare(**name, key);
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
if (cmp == 0) {
values[name-argnames] = value;
break;
}
name++;
}
if (*name) continue;
else {
PyObject*** argname = argnames;
while (argname != first_kw_arg) {
int cmp = (**argname == key) ? 0 :
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
(PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
#endif
PyUnicode_Compare(**argname, key);
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
if (cmp == 0) goto arg_passed_twice;
argname++;
}
}
} else
goto invalid_keyword_type;
if (kwds2) {
if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
} else {
goto invalid_keyword;
}
}
return 0;
arg_passed_twice:
__Pyx_RaiseDoubleKeywordsError(function_name, key);
goto bad;
invalid_keyword_type:
PyErr_Format(PyExc_TypeError,
"%s() keywords must be strings", function_name);
goto bad;
invalid_keyword:
PyErr_Format(PyExc_TypeError,
#if PY_MAJOR_VERSION < 3
"%s() got an unexpected keyword argument '%s'",
function_name, PyString_AsString(key));
#else
"%s() got an unexpected keyword argument '%U'",
function_name, key);
#endif
bad:
return -1;
}
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
PyObject *local_type, *local_value, *local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
PyObject *tmp_type, *tmp_value, *tmp_tb;
PyThreadState *tstate = PyThreadState_GET();
local_type = tstate->curexc_type;
local_value = tstate->curexc_value;
local_tb = tstate->curexc_traceback;
tstate->curexc_type = 0;
tstate->curexc_value = 0;
tstate->curexc_traceback = 0;
#else
PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_COMPILING_IN_CPYTHON
if (unlikely(tstate->curexc_type))
#else
if (unlikely(PyErr_Occurred()))
#endif
goto bad;
#if PY_MAJOR_VERSION >= 3
if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
goto bad;
#endif
Py_INCREF(local_type);
Py_INCREF(local_value);
Py_INCREF(local_tb);
*type = local_type;
*value = local_value;
*tb = local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
tmp_type = tstate->exc_type;
tmp_value = tstate->exc_value;
tmp_tb = tstate->exc_traceback;
tstate->exc_type = local_type;
tstate->exc_value = local_value;
tstate->exc_traceback = local_tb;
/* Make sure tstate is in a consistent state when we XDECREF
these objects (DECREF may run arbitrary code). */
Py_XDECREF(tmp_type);
Py_XDECREF(tmp_value);
Py_XDECREF(tmp_tb);
#else
PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
return 0;
bad:
*type = 0;
*value = 0;
*tb = 0;
Py_XDECREF(local_type);
Py_XDECREF(local_value);
Py_XDECREF(local_tb);
return -1;
}
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
PyObject *tmp_type, *tmp_value, *tmp_tb;
PyThreadState *tstate = PyThreadState_GET();
tmp_type = tstate->curexc_type;
tmp_value = tstate->curexc_value;
tmp_tb = tstate->curexc_traceback;
tstate->curexc_type = type;
tstate->curexc_value = value;
tstate->curexc_traceback = tb;
Py_XDECREF(tmp_type);
Py_XDECREF(tmp_value);
Py_XDECREF(tmp_tb);
#else
PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
PyThreadState *tstate = PyThreadState_GET();
*type = tstate->curexc_type;
*value = tstate->curexc_value;
*tb = tstate->curexc_traceback;
tstate->curexc_type = 0;
tstate->curexc_value = 0;
tstate->curexc_traceback = 0;
#else
PyErr_Fetch(type, value, tb);
#endif
}
#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
CYTHON_UNUSED PyObject *cause) {
Py_XINCREF(type);
if (!value || value == Py_None)
value = NULL;
else
Py_INCREF(value);
if (!tb || tb == Py_None)
tb = NULL;
else {
Py_INCREF(tb);
if (!PyTraceBack_Check(tb)) {
PyErr_SetString(PyExc_TypeError,
"raise: arg 3 must be a traceback or None");
goto raise_error;
}
}
#if PY_VERSION_HEX < 0x02050000
if (PyClass_Check(type)) {
#else
if (PyType_Check(type)) {
#endif
#if CYTHON_COMPILING_IN_PYPY
if (!value) {
Py_INCREF(Py_None);
value = Py_None;
}
#endif
PyErr_NormalizeException(&type, &value, &tb);
} else {
if (value) {
PyErr_SetString(PyExc_TypeError,
"instance exception may not have a separate value");
goto raise_error;
}
value = type;
#if PY_VERSION_HEX < 0x02050000
if (PyInstance_Check(type)) {
type = (PyObject*) ((PyInstanceObject*)type)->in_class;
Py_INCREF(type);
}
else {
type = 0;
PyErr_SetString(PyExc_TypeError,
"raise: exception must be an old-style class or instance");
goto raise_error;
}
#else
type = (PyObject*) Py_TYPE(type);
Py_INCREF(type);
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
PyErr_SetString(PyExc_TypeError,
"raise: exception class must be a subclass of BaseException");
goto raise_error;
}
#endif
}
__Pyx_ErrRestore(type, value, tb);
return;
raise_error:
Py_XDECREF(value);
Py_XDECREF(type);
Py_XDECREF(tb);
return;
}
#else /* Python 3+ */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
PyObject* owned_instance = NULL;
if (tb == Py_None) {
tb = 0;
} else if (tb && !PyTraceBack_Check(tb)) {
PyErr_SetString(PyExc_TypeError,
"raise: arg 3 must be a traceback or None");
goto bad;
}
if (value == Py_None)
value = 0;
if (PyExceptionInstance_Check(type)) {
if (value) {
PyErr_SetString(PyExc_TypeError,
"instance exception may not have a separate value");
goto bad;
}
value = type;
type = (PyObject*) Py_TYPE(value);
} else if (PyExceptionClass_Check(type)) {
PyObject *args;
if (!value)
args = PyTuple_New(0);
else if (PyTuple_Check(value)) {
Py_INCREF(value);
args = value;
}
else
args = PyTuple_Pack(1, value);
if (!args)
goto bad;
owned_instance = PyEval_CallObject(type, args);
Py_DECREF(args);
if (!owned_instance)
goto bad;
value = owned_instance;
if (!PyExceptionInstance_Check(value)) {
PyErr_Format(PyExc_TypeError,
"calling %R should have returned an instance of "
"BaseException, not %R",
type, Py_TYPE(value));
goto bad;
}
} else {
PyErr_SetString(PyExc_TypeError,
"raise: exception class must be a subclass of BaseException");
goto bad;
}
if (cause && cause != Py_None) {
PyObject *fixed_cause;
if (PyExceptionClass_Check(cause)) {
fixed_cause = PyObject_CallObject(cause, NULL);
if (fixed_cause == NULL)
goto bad;
}
else if (PyExceptionInstance_Check(cause)) {
fixed_cause = cause;
Py_INCREF(fixed_cause);
}
else {
PyErr_SetString(PyExc_TypeError,
"exception causes must derive from "
"BaseException");
goto bad;
}
PyException_SetCause(value, fixed_cause);
}
PyErr_SetObject(type, value);
if (tb) {
PyThreadState *tstate = PyThreadState_GET();
PyObject* tmp_tb = tstate->curexc_traceback;
if (tb != tmp_tb) {
Py_INCREF(tb);
tstate->curexc_traceback = tb;
Py_XDECREF(tmp_tb);
}
}
bad:
Py_XDECREF(owned_instance);
return;
}
#endif
static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
PyObject *kwdict,
const char* function_name,
int kw_allowed)
{
PyObject* key = 0;
Py_ssize_t pos = 0;
#if CPYTHON_COMPILING_IN_PYPY
if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
goto invalid_keyword;
return 1;
#else
while (PyDict_Next(kwdict, &pos, &key, 0)) {
#if PY_MAJOR_VERSION < 3
if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
#endif
if (unlikely(!PyUnicode_Check(key)))
goto invalid_keyword_type;
}
if ((!kw_allowed) && unlikely(key))
goto invalid_keyword;
return 1;
invalid_keyword_type:
PyErr_Format(PyExc_TypeError,
"%s() keywords must be strings", function_name);
return 0;
#endif
invalid_keyword:
PyErr_Format(PyExc_TypeError,
#if PY_MAJOR_VERSION < 3
"%s() got an unexpected keyword argument '%s'",
function_name, PyString_AsString(key));
#else
"%s() got an unexpected keyword argument '%U'",
function_name, key);
#endif
return 0;
}
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
PyErr_Format(PyExc_ValueError,
"too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
PyErr_Format(PyExc_ValueError,
"need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
index, (index == 1) ? "" : "s");
}
static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_COMPILING_IN_CPYTHON
PyThreadState *tstate = PyThreadState_GET();
PyObject* exc_type = tstate->curexc_type;
if (unlikely(exc_type)) {
if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
PyObject *exc_value, *exc_tb;
exc_value = tstate->curexc_value;
exc_tb = tstate->curexc_traceback;
tstate->curexc_type = 0;
tstate->curexc_value = 0;
tstate->curexc_traceback = 0;
Py_DECREF(exc_type);
Py_XDECREF(exc_value);
Py_XDECREF(exc_tb);
return 0;
} else {
return -1;
}
}
return 0;
#else
if (unlikely(PyErr_Occurred())) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
PyErr_Clear();
return 0;
} else {
return -1;
}
}
return 0;
#endif
}
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
if (unlikely(retval)) {
Py_DECREF(retval);
__Pyx_RaiseTooManyValuesError(expected);
return -1;
} else {
return __Pyx_IterFinish();
}
return 0;
}
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
if (unlikely(!type)) {
PyErr_Format(PyExc_SystemError, "Missing type object");
return 0;
}
if (likely(PyObject_TypeCheck(obj, type)))
return 1;
PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
Py_TYPE(obj)->tp_name, type->tp_name);
return 0;
}
static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
PyThreadState *tstate = PyThreadState_GET();
*type = tstate->exc_type;
*value = tstate->exc_value;
*tb = tstate->exc_traceback;
Py_XINCREF(*type);
Py_XINCREF(*value);
Py_XINCREF(*tb);
#else
PyErr_GetExcInfo(type, value, tb);
#endif
}
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
PyObject *tmp_type, *tmp_value, *tmp_tb;
PyThreadState *tstate = PyThreadState_GET();
tmp_type = tstate->exc_type;
tmp_value = tstate->exc_value;
tmp_tb = tstate->exc_traceback;
tstate->exc_type = type;
tstate->exc_value = value;
tstate->exc_traceback = tb;
Py_XDECREF(tmp_type);
Py_XDECREF(tmp_value);
Py_XDECREF(tmp_tb);
#else
PyErr_SetExcInfo(type, value, tb);
#endif
}
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
PyObject *empty_list = 0;
PyObject *module = 0;
PyObject *global_dict = 0;
PyObject *empty_dict = 0;
PyObject *list;
#if PY_VERSION_HEX < 0x03030000
PyObject *py_import = 0;
py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
if (!py_import)
goto bad;
#endif
if (from_list)
list = from_list;
else {
empty_list = PyList_New(0);
if (!empty_list)
goto bad;
list = empty_list;
}
global_dict = PyModule_GetDict(__pyx_m);
if (!global_dict)
goto bad;
empty_dict = PyDict_New();
if (!empty_dict)
goto bad;
#if PY_VERSION_HEX >= 0x02050000
{
#if PY_MAJOR_VERSION >= 3
if (level == -1) {
if (strchr(__Pyx_MODULE_NAME, '.')) {
#if PY_VERSION_HEX < 0x03030000
PyObject *py_level = PyInt_FromLong(1);
if (!py_level)
goto bad;
module = PyObject_CallFunctionObjArgs(py_import,
name, global_dict, empty_dict, list, py_level, NULL);
Py_DECREF(py_level);
#else
module = PyImport_ImportModuleLevelObject(
name, global_dict, empty_dict, list, 1);
#endif
if (!module) {
if (!PyErr_ExceptionMatches(PyExc_ImportError))
goto bad;
PyErr_Clear();
}
}
level = 0; /* try absolute import on failure */
}
#endif
if (!module) {
#if PY_VERSION_HEX < 0x03030000
PyObject *py_level = PyInt_FromLong(level);
if (!py_level)
goto bad;
module = PyObject_CallFunctionObjArgs(py_import,
name, global_dict, empty_dict, list, py_level, NULL);
Py_DECREF(py_level);
#else
module = PyImport_ImportModuleLevelObject(
name, global_dict, empty_dict, list, level);
#endif
}
}
#else
if (level>0) {
PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
goto bad;
}
module = PyObject_CallFunctionObjArgs(py_import,
name, global_dict, empty_dict, list, NULL);
#endif
bad:
#if PY_VERSION_HEX < 0x03030000
Py_XDECREF(py_import);
#endif
Py_XDECREF(empty_list);
Py_XDECREF(empty_dict);
return module;
}
static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
PyObject *metaclass;
#if PY_MAJOR_VERSION < 3
if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
PyObject *base = PyTuple_GET_ITEM(bases, 0);
metaclass = PyObject_GetAttrString(base, (char *)"__class__");
if (!metaclass) {
PyErr_Clear();
metaclass = (PyObject*) Py_TYPE(base);
}
} else {
metaclass = (PyObject *) &PyClass_Type;
}
#else
if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
PyObject *base = PyTuple_GET_ITEM(bases, 0);
metaclass = (PyObject*) Py_TYPE(base);
} else {
metaclass = (PyObject *) &PyType_Type;
}
#endif
Py_INCREF(metaclass);
return metaclass;
}
static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
PyObject *modname) {
PyObject *result;
PyObject *metaclass;
if (PyDict_SetItemString(dict, "__module__", modname) < 0)
return NULL;
metaclass = PyDict_GetItemString(dict, "__metaclass__");
if (metaclass) {
Py_INCREF(metaclass);
} else {
metaclass = __Pyx_FindPy2Metaclass(bases);
}
result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
Py_DECREF(metaclass);
return result;
}
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
if (op->func_doc == NULL && op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
}
if (op->func_doc == 0) {
Py_INCREF(Py_None);
return Py_None;
}
Py_INCREF(op->func_doc);
return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
PyObject *tmp = op->func_doc;
if (value == NULL)
op->func_doc = Py_None; /* Mark as deleted */
else
op->func_doc = value;
Py_INCREF(op->func_doc);
Py_XDECREF(tmp);
return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
{
if (op->func_name == NULL) {
#if PY_MAJOR_VERSION >= 3
op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
}
Py_INCREF(op->func_name);
return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
{
PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
if (value == NULL || !PyUnicode_Check(value)) {
#else
if (value == NULL || !PyString_Check(value)) {
#endif
PyErr_SetString(PyExc_TypeError,
"__name__ must be set to a string object");
return -1;
}
tmp = op->func_name;
Py_INCREF(value);
op->func_name = value;
Py_XDECREF(tmp);
return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
PyObject *self;
self = m->func_closure;
if (self == NULL)
self = Py_None;
Py_INCREF(self);
return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
{
if (op->func_dict == NULL) {
op->func_dict = PyDict_New();
if (op->func_dict == NULL)
return NULL;
}
Py_INCREF(op->func_dict);
return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
{
PyObject *tmp;
if (value == NULL) {
PyErr_SetString(PyExc_TypeError,
"function's dictionary may not be deleted");
return -1;
}
if (!PyDict_Check(value)) {
PyErr_SetString(PyExc_TypeError,
"setting function's dictionary to a non-dict");
return -1;
}
tmp = op->func_dict;
Py_INCREF(value);
op->func_dict = value;
Py_XDECREF(tmp);
return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
PyObject* dict = PyModule_GetDict(__pyx_m);
Py_XINCREF(dict);
return dict;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
{
PyObject* result = (op->func_code) ? op->func_code : Py_None;
Py_INCREF(result);
return result;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op)
{
if (op->defaults_tuple) {
Py_INCREF(op->defaults_tuple);
return op->defaults_tuple;
}
if (op->defaults_getter) {
PyObject *res = op->defaults_getter((PyObject *) op);
if (res) {
Py_INCREF(res);
op->defaults_tuple = res;
}
return res;
}
Py_INCREF(Py_None);
return Py_None;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
{(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
{(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
{(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
{(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
{(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
{(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
{(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
{(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
{(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
{(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
{(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
{(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
{(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
{(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, 0, 0, 0},
{(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, 0, 0, 0},
{0, 0, 0, 0, 0}
};
#ifndef PY_WRITE_RESTRICTED /* < Py2.5 */
#define PY_WRITE_RESTRICTED WRITE_RESTRICTED
#endif
static PyMemberDef __pyx_CyFunction_members[] = {
{(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
{0, 0, 0, 0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
{__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
{0, 0, 0, 0}
};
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags,
PyObject *closure, PyObject *module, PyObject* code) {
__pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
if (op == NULL)
return NULL;
op->flags = flags;
op->func_weakreflist = NULL;
op->func.m_ml = ml;
op->func.m_self = (PyObject *) op;
Py_XINCREF(closure);
op->func_closure = closure;
Py_XINCREF(module);
op->func.m_module = module;
op->func_dict = NULL;
op->func_name = NULL;
op->func_doc = NULL;
op->func_classobj = NULL;
Py_XINCREF(code);
op->func_code = code;
op->defaults_pyobjects = 0;
op->defaults = NULL;
op->defaults_tuple = NULL;
op->defaults_getter = NULL;
PyObject_GC_Track(op);
return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
Py_CLEAR(m->func_closure);
Py_CLEAR(m->func.m_module);
Py_CLEAR(m->func_dict);
Py_CLEAR(m->func_name);
Py_CLEAR(m->func_doc);
Py_CLEAR(m->func_code);
Py_CLEAR(m->func_classobj);
Py_CLEAR(m->defaults_tuple);
if (m->defaults) {
PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
int i;
for (i = 0; i < m->defaults_pyobjects; i++)
Py_XDECREF(pydefaults[i]);
PyMem_Free(m->defaults);
m->defaults = NULL;
}
return 0;
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
PyObject_GC_UnTrack(m);
if (m->func_weakreflist != NULL)
PyObject_ClearWeakRefs((PyObject *) m);
__Pyx_CyFunction_clear(m);
PyObject_GC_Del(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
Py_VISIT(m->func_closure);
Py_VISIT(m->func.m_module);
Py_VISIT(m->func_dict);
Py_VISIT(m->func_name);
Py_VISIT(m->func_doc);
Py_VISIT(m->func_code);
Py_VISIT(m->func_classobj);
Py_VISIT(m->defaults_tuple);
if (m->defaults) {
PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
int i;
for (i = 0; i < m->defaults_pyobjects; i++)
Py_VISIT(pydefaults[i]);
}
return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
Py_INCREF(func);
return func;
}
if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
if (type == NULL)
type = (PyObject *)(Py_TYPE(obj));
return PyMethod_New(func,
type, (PyObject *)(Py_TYPE(type)));
}
if (obj == Py_None)
obj = NULL;
return PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
PyObject *func_name = __Pyx_CyFunction_get_name(op);
#if PY_MAJOR_VERSION >= 3
return PyUnicode_FromFormat("<cyfunction %U at %p>",
func_name, (void *)op);
#else
return PyString_FromFormat("<cyfunction %s at %p>",
PyString_AsString(func_name), (void *)op);
#endif
}
#if CYTHON_COMPILING_IN_PYPY
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
PyCFunctionObject* f = (PyCFunctionObject*)func;
PyCFunction meth = PyCFunction_GET_FUNCTION(func);
PyObject *self = PyCFunction_GET_SELF(func);
Py_ssize_t size;
switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) {
case METH_VARARGS:
if (likely(kw == NULL) || PyDict_Size(kw) == 0)
return (*meth)(self, arg);
break;
case METH_VARARGS | METH_KEYWORDS:
return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
case METH_NOARGS:
if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
size = PyTuple_GET_SIZE(arg);
if (size == 0)
return (*meth)(self, NULL);
PyErr_Format(PyExc_TypeError,
"%.200s() takes no arguments (%zd given)",
f->m_ml->ml_name, size);
return NULL;
}
break;
case METH_O:
if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
size = PyTuple_GET_SIZE(arg);
if (size == 1)
return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
PyErr_Format(PyExc_TypeError,
"%.200s() takes exactly one argument (%zd given)",
f->m_ml->ml_name, size);
return NULL;
}
break;
default:
PyErr_SetString(PyExc_SystemError, "Bad call flags in "
"__Pyx_CyFunction_Call. METH_OLDARGS is no "
"longer supported!");
return NULL;
}
PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
f->m_ml->ml_name);
return NULL;
}
#else
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
return PyCFunction_Call(func, arg, kw);
}
#endif
static PyTypeObject __pyx_CyFunctionType_type = {
PyVarObject_HEAD_INIT(0, 0)
__Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
sizeof(__pyx_CyFunctionObject), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
0, /*tp_compare*/
#else
0, /*reserved*/
#endif
(reprfunc) __Pyx_CyFunction_repr, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
__Pyx_CyFunction_Call, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
0, /*tp_doc*/
(traverseproc) __Pyx_CyFunction_traverse, /*tp_traverse*/
(inquiry) __Pyx_CyFunction_clear, /*tp_clear*/
0, /*tp_richcompare*/
offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_CyFunction_methods, /*tp_methods*/
__pyx_CyFunction_members, /*tp_members*/
__pyx_CyFunction_getsets, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
__Pyx_CyFunction_descr_get, /*tp_descr_get*/
0, /*tp_descr_set*/
offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
0, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
0, /*tp_mro*/
0, /*tp_cache*/
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
#if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
#endif
};
static int __Pyx_CyFunction_init(void) {
#if !CYTHON_COMPILING_IN_PYPY
__pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
#endif
if (PyType_Ready(&__pyx_CyFunctionType_type) < 0)
return -1;
__pyx_CyFunctionType = &__pyx_CyFunctionType_type;
return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
m->defaults = PyMem_Malloc(size);
if (!m->defaults)
return PyErr_NoMemory();
memset(m->defaults, 0, sizeof(size));
m->defaults_pyobjects = pyobjects;
return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
m->defaults_tuple = tuple;
Py_INCREF(tuple);
}
#if CYTHON_CCOMPLEX
#ifdef __cplusplus
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
return ::std::complex< double >(x, y);
}
#else
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
return x + y*(__pyx_t_double_complex)_Complex_I;
}
#endif
#else
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
__pyx_t_double_complex z;
z.real = x;
z.imag = y;
return z;
}
#endif
#if CYTHON_CCOMPLEX
#else
static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) {
return (a.real == b.real) && (a.imag == b.imag);
}
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) {
__pyx_t_double_complex z;
z.real = a.real + b.real;
z.imag = a.imag + b.imag;
return z;
}
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) {
__pyx_t_double_complex z;
z.real = a.real - b.real;
z.imag = a.imag - b.imag;
return z;
}
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) {
__pyx_t_double_complex z;
z.real = a.real * b.real - a.imag * b.imag;
z.imag = a.real * b.imag + a.imag * b.real;
return z;
}
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) {
__pyx_t_double_complex z;
double denom = b.real * b.real + b.imag * b.imag;
z.real = (a.real * b.real + a.imag * b.imag) / denom;
z.imag = (a.imag * b.real - a.real * b.imag) / denom;
return z;
}
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) {
__pyx_t_double_complex z;
z.real = -a.real;
z.imag = -a.imag;
return z;
}
static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) {
return (a.real == 0) && (a.imag == 0);
}
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) {
__pyx_t_double_complex z;
z.real = a.real;
z.imag = -a.imag;
return z;
}
#if 1
static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) {
#if !defined(HAVE_HYPOT) || defined(_MSC_VER)
return sqrt(z.real*z.real + z.imag*z.imag);
#else
return hypot(z.real, z.imag);
#endif
}
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) {
__pyx_t_double_complex z;
double r, lnr, theta, z_r, z_theta;
if (b.imag == 0 && b.real == (int)b.real) {
if (b.real < 0) {
double denom = a.real * a.real + a.imag * a.imag;
a.real = a.real / denom;
a.imag = -a.imag / denom;
b.real = -b.real;
}
switch ((int)b.real) {
case 0:
z.real = 1;
z.imag = 0;
return z;
case 1:
return a;
case 2:
z = __Pyx_c_prod(a, a);
return __Pyx_c_prod(a, a);
case 3:
z = __Pyx_c_prod(a, a);
return __Pyx_c_prod(z, a);
case 4:
z = __Pyx_c_prod(a, a);
return __Pyx_c_prod(z, z);
}
}
if (a.imag == 0) {
if (a.real == 0) {
return a;
}
r = a.real;
theta = 0;
} else {
r = __Pyx_c_abs(a);
theta = atan2(a.imag, a.real);
}
lnr = log(r);
z_r = exp(lnr * b.real - theta * b.imag);
z_theta = theta * b.real + lnr * b.imag;
z.real = z_r * cos(z_theta);
z.imag = z_r * sin(z_theta);
return z;
}
#endif
#endif
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
static PyObject *__Pyx_GetStdout(void) {
PyObject *f = PySys_GetObject((char *)"stdout");
if (!f) {
PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
}
return f;
}
static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
int i;
if (!f) {
if (!(f = __Pyx_GetStdout()))
return -1;
}
Py_INCREF(f);
for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
PyObject* v;
if (PyFile_SoftSpace(f, 1)) {
if (PyFile_WriteString(" ", f) < 0)
goto error;
}
v = PyTuple_GET_ITEM(arg_tuple, i);
if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
goto error;
if (PyString_Check(v)) {
char *s = PyString_AsString(v);
Py_ssize_t len = PyString_Size(v);
if (len > 0 &&
isspace(Py_CHARMASK(s[len-1])) &&
s[len-1] != ' ')
PyFile_SoftSpace(f, 0);
}
}
if (newline) {
if (PyFile_WriteString("\n", f) < 0)
goto error;
PyFile_SoftSpace(f, 0);
}
Py_DECREF(f);
return 0;
error:
Py_DECREF(f);
return -1;
}
#else /* Python 3 has a print function */
static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
PyObject* kwargs = 0;
PyObject* result = 0;
PyObject* end_string;
if (unlikely(!__pyx_print)) {
__pyx_print = __Pyx_GetAttrString(__pyx_b, "print");
if (!__pyx_print)
return -1;
}
if (stream) {
kwargs = PyDict_New();
if (unlikely(!kwargs))
return -1;
if (unlikely(PyDict_SetItemString(kwargs, "file", stream) < 0))
goto bad;
if (!newline) {
end_string = PyUnicode_FromStringAndSize(" ", 1);
if (unlikely(!end_string))
goto bad;
if (PyDict_SetItemString(kwargs, "end", end_string) < 0) {
Py_DECREF(end_string);
goto bad;
}
Py_DECREF(end_string);
}
} else if (!newline) {
if (unlikely(!__pyx_print_kwargs)) {
__pyx_print_kwargs = PyDict_New();
if (unlikely(!__pyx_print_kwargs))
return -1;
end_string = PyUnicode_FromStringAndSize(" ", 1);
if (unlikely(!end_string))
return -1;
if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) {
Py_DECREF(end_string);
return -1;
}
Py_DECREF(end_string);
}
kwargs = __pyx_print_kwargs;
}
result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
Py_DECREF(kwargs);
if (!result)
return -1;
Py_DECREF(result);
return 0;
bad:
if (kwargs != __pyx_print_kwargs)
Py_XDECREF(kwargs);
return -1;
}
#endif
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
if (!f) {
if (!(f = __Pyx_GetStdout()))
return -1;
}
Py_INCREF(f);
if (PyFile_SoftSpace(f, 0)) {
if (PyFile_WriteString(" ", f) < 0)
goto error;
}
if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
goto error;
if (PyFile_WriteString("\n", f) < 0)
goto error;
Py_DECREF(f);
return 0;
error:
Py_DECREF(f);
return -1;
/* the line below is just to avoid C compiler
* warnings about unused functions */
return __Pyx_Print(f, NULL, 0);
}
#else /* Python 3 has a print function */
static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
int res;
PyObject* arg_tuple = PyTuple_Pack(1, o);
if (unlikely(!arg_tuple))
return -1;
res = __Pyx_Print(stream, arg_tuple, 1);
Py_DECREF(arg_tuple);
return res;
}
#endif
#if CYTHON_CCOMPLEX
#ifdef __cplusplus
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
return ::std::complex< float >(x, y);
}
#else
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
return x + y*(__pyx_t_float_complex)_Complex_I;
}
#endif
#else
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
__pyx_t_float_complex z;
z.real = x;
z.imag = y;
return z;
}
#endif
#if CYTHON_CCOMPLEX
#else
static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
return (a.real == b.real) && (a.imag == b.imag);
}
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
__pyx_t_float_complex z;
z.real = a.real + b.real;
z.imag = a.imag + b.imag;
return z;
}
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) {
__pyx_t_float_complex z;
z.real = a.real - b.real;
z.imag = a.imag - b.imag;
return z;
}
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
__pyx_t_float_complex z;
z.real = a.real * b.real - a.imag * b.imag;
z.imag = a.real * b.imag + a.imag * b.real;
return z;
}
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
__pyx_t_float_complex z;
float denom = b.real * b.real + b.imag * b.imag;
z.real = (a.real * b.real + a.imag * b.imag) / denom;
z.imag = (a.imag * b.real - a.real * b.imag) / denom;
return z;
}
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) {
__pyx_t_float_complex z;
z.real = -a.real;
z.imag = -a.imag;
return z;
}
static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) {
return (a.real == 0) && (a.imag == 0);
}
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) {
__pyx_t_float_complex z;
z.real = a.real;
z.imag = -a.imag;
return z;
}
#if 1
static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) {
#if !defined(HAVE_HYPOT) || defined(_MSC_VER)
return sqrtf(z.real*z.real + z.imag*z.imag);
#else
return hypotf(z.real, z.imag);
#endif
}
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
__pyx_t_float_complex z;
float r, lnr, theta, z_r, z_theta;
if (b.imag == 0 && b.real == (int)b.real) {
if (b.real < 0) {
float denom = a.real * a.real + a.imag * a.imag;
a.real = a.real / denom;
a.imag = -a.imag / denom;
b.real = -b.real;
}
switch ((int)b.real) {
case 0:
z.real = 1;
z.imag = 0;
return z;
case 1:
return a;
case 2:
z = __Pyx_c_prodf(a, a);
return __Pyx_c_prodf(a, a);
case 3:
z = __Pyx_c_prodf(a, a);
return __Pyx_c_prodf(z, a);
case 4:
z = __Pyx_c_prodf(a, a);
return __Pyx_c_prodf(z, z);
}
}
if (a.imag == 0) {
if (a.real == 0) {
return a;
}
r = a.real;
theta = 0;
} else {
r = __Pyx_c_absf(a);
theta = atan2f(a.imag, a.real);
}
lnr = logf(r);
z_r = expf(lnr * b.real - theta * b.imag);
z_theta = theta * b.real + lnr * b.imag;
z.real = z_r * cosf(z_theta);
z.imag = z_r * sinf(z_theta);
return z;
}
#endif
#endif
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(unsigned char) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(unsigned char)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to unsigned char" :
"value too large to convert to unsigned char");
}
return (unsigned char)-1;
}
return (unsigned char)val;
}
return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(unsigned short) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(unsigned short)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to unsigned short" :
"value too large to convert to unsigned short");
}
return (unsigned short)-1;
}
return (unsigned short)val;
}
return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}
static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(unsigned int) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(unsigned int)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to unsigned int" :
"value too large to convert to unsigned int");
}
return (unsigned int)-1;
}
return (unsigned int)val;
}
return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}
static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
const char neg_one = (char)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(char) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(char)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to char" :
"value too large to convert to char");
}
return (char)-1;
}
return (char)val;
}
return (char)__Pyx_PyInt_AsLong(x);
}
static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
const short neg_one = (short)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(short) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(short)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to short" :
"value too large to convert to short");
}
return (short)-1;
}
return (short)val;
}
return (short)__Pyx_PyInt_AsLong(x);
}
static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
const int neg_one = (int)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(int) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(int)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to int" :
"value too large to convert to int");
}
return (int)-1;
}
return (int)val;
}
return (int)__Pyx_PyInt_AsLong(x);
}
static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
const signed char neg_one = (signed char)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(signed char) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(signed char)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to signed char" :
"value too large to convert to signed char");
}
return (signed char)-1;
}
return (signed char)val;
}
return (signed char)__Pyx_PyInt_AsSignedLong(x);
}
static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
const signed short neg_one = (signed short)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(signed short) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(signed short)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to signed short" :
"value too large to convert to signed short");
}
return (signed short)-1;
}
return (signed short)val;
}
return (signed short)__Pyx_PyInt_AsSignedLong(x);
}
static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
const signed int neg_one = (signed int)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(signed int) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(signed int)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to signed int" :
"value too large to convert to signed int");
}
return (signed int)-1;
}
return (signed int)val;
}
return (signed int)__Pyx_PyInt_AsSignedLong(x);
}
static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
const int neg_one = (int)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(int) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(int)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to int" :
"value too large to convert to int");
}
return (int)-1;
}
return (int)val;
}
return (int)__Pyx_PyInt_AsLong(x);
}
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned long");
return (unsigned long)-1;
}
return (unsigned long)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned long");
return (unsigned long)-1;
}
return (unsigned long)PyLong_AsUnsignedLong(x);
} else {
return (unsigned long)PyLong_AsLong(x);
}
} else {
unsigned long val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (unsigned long)-1;
val = __Pyx_PyInt_AsUnsignedLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned PY_LONG_LONG");
return (unsigned PY_LONG_LONG)-1;
}
return (unsigned PY_LONG_LONG)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned PY_LONG_LONG");
return (unsigned PY_LONG_LONG)-1;
}
return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
} else {
return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
}
} else {
unsigned PY_LONG_LONG val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (unsigned PY_LONG_LONG)-1;
val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
const long neg_one = (long)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to long");
return (long)-1;
}
return (long)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to long");
return (long)-1;
}
return (long)PyLong_AsUnsignedLong(x);
} else {
return (long)PyLong_AsLong(x);
}
} else {
long val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (long)-1;
val = __Pyx_PyInt_AsLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to PY_LONG_LONG");
return (PY_LONG_LONG)-1;
}
return (PY_LONG_LONG)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to PY_LONG_LONG");
return (PY_LONG_LONG)-1;
}
return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
} else {
return (PY_LONG_LONG)PyLong_AsLongLong(x);
}
} else {
PY_LONG_LONG val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (PY_LONG_LONG)-1;
val = __Pyx_PyInt_AsLongLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
const signed long neg_one = (signed long)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed long");
return (signed long)-1;
}
return (signed long)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed long");
return (signed long)-1;
}
return (signed long)PyLong_AsUnsignedLong(x);
} else {
return (signed long)PyLong_AsLong(x);
}
} else {
signed long val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (signed long)-1;
val = __Pyx_PyInt_AsSignedLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed PY_LONG_LONG");
return (signed PY_LONG_LONG)-1;
}
return (signed PY_LONG_LONG)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed PY_LONG_LONG");
return (signed PY_LONG_LONG)-1;
}
return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
} else {
return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
}
} else {
signed PY_LONG_LONG val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (signed PY_LONG_LONG)-1;
val = __Pyx_PyInt_AsSignedLongLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static int __Pyx_check_binary_version(void) {
char ctversion[4], rtversion[4];
PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
char message[200];
PyOS_snprintf(message, sizeof(message),
"compiletime version %s of module '%.100s' "
"does not match runtime version %s",
ctversion, __Pyx_MODULE_NAME, rtversion);
#if PY_VERSION_HEX < 0x02050000
return PyErr_Warn(NULL, message);
#else
return PyErr_WarnEx(NULL, message, 1);
#endif
}
return 0;
}
#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
PyObject *py_name = 0;
PyObject *py_module = 0;
py_name = __Pyx_PyIdentifier_FromString(name);
if (!py_name)
goto bad;
py_module = PyImport_Import(py_name);
Py_DECREF(py_name);
return py_module;
bad:
Py_XDECREF(py_name);
return 0;
}
#endif
#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
size_t size, int strict)
{
PyObject *py_module = 0;
PyObject *result = 0;
PyObject *py_name = 0;
char warning[200];
py_module = __Pyx_ImportModule(module_name);
if (!py_module)
goto bad;
py_name = __Pyx_PyIdentifier_FromString(class_name);
if (!py_name)
goto bad;
result = PyObject_GetAttr(py_module, py_name);
Py_DECREF(py_name);
py_name = 0;
Py_DECREF(py_module);
py_module = 0;
if (!result)
goto bad;
if (!PyType_Check(result)) {
PyErr_Format(PyExc_TypeError,
"%s.%s is not a type object",
module_name, class_name);
goto bad;
}
if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) {
PyOS_snprintf(warning, sizeof(warning),
"%s.%s size changed, may indicate binary incompatibility",
module_name, class_name);
#if PY_VERSION_HEX < 0x02050000
if (PyErr_Warn(NULL, warning) < 0) goto bad;
#else
if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
#endif
}
else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) {
PyErr_Format(PyExc_ValueError,
"%s.%s has the wrong size, try recompiling",
module_name, class_name);
goto bad;
}
return (PyTypeObject *)result;
bad:
Py_XDECREF(py_module);
Py_XDECREF(result);
return NULL;
}
#endif
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
int start = 0, mid = 0, end = count - 1;
if (end >= 0 && code_line > entries[end].code_line) {
return count;
}
while (start < end) {
mid = (start + end) / 2;
if (code_line < entries[mid].code_line) {
end = mid;
} else if (code_line > entries[mid].code_line) {
start = mid + 1;
} else {
return mid;
}
}
if (code_line <= entries[mid].code_line) {
return mid;
} else {
return mid + 1;
}
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
PyCodeObject* code_object;
int pos;
if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
return NULL;
}
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
return NULL;
}
code_object = __pyx_code_cache.entries[pos].code_object;
Py_INCREF(code_object);
return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
int pos, i;
__Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
if (unlikely(!code_line)) {
return;
}
if (unlikely(!entries)) {
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
if (likely(entries)) {
__pyx_code_cache.entries = entries;
__pyx_code_cache.max_count = 64;
__pyx_code_cache.count = 1;
entries[0].code_line = code_line;
entries[0].code_object = code_object;
Py_INCREF(code_object);
}
return;
}
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
PyCodeObject* tmp = entries[pos].code_object;
entries[pos].code_object = code_object;
Py_DECREF(tmp);
return;
}
if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
int new_max = __pyx_code_cache.max_count + 64;
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
__pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
if (unlikely(!entries)) {
return;
}
__pyx_code_cache.entries = entries;
__pyx_code_cache.max_count = new_max;
}
for (i=__pyx_code_cache.count; i>pos; i--) {
entries[i] = entries[i-1];
}
entries[pos].code_line = code_line;
entries[pos].code_object = code_object;
__pyx_code_cache.count++;
Py_INCREF(code_object);
}
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
const char *funcname, int c_line,
int py_line, const char *filename) {
PyCodeObject *py_code = 0;
PyObject *py_srcfile = 0;
PyObject *py_funcname = 0;
#if PY_MAJOR_VERSION < 3
py_srcfile = PyString_FromString(filename);
#else
py_srcfile = PyUnicode_FromString(filename);
#endif
if (!py_srcfile) goto bad;
if (c_line) {
#if PY_MAJOR_VERSION < 3
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
#else
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
#endif
}
else {
#if PY_MAJOR_VERSION < 3
py_funcname = PyString_FromString(funcname);
#else
py_funcname = PyUnicode_FromString(funcname);
#endif
}
if (!py_funcname) goto bad;
py_code = __Pyx_PyCode_New(
0, /*int argcount,*/
0, /*int kwonlyargcount,*/
0, /*int nlocals,*/
0, /*int stacksize,*/
0, /*int flags,*/
__pyx_empty_bytes, /*PyObject *code,*/
__pyx_empty_tuple, /*PyObject *consts,*/
__pyx_empty_tuple, /*PyObject *names,*/
__pyx_empty_tuple, /*PyObject *varnames,*/
__pyx_empty_tuple, /*PyObject *freevars,*/
__pyx_empty_tuple, /*PyObject *cellvars,*/
py_srcfile, /*PyObject *filename,*/
py_funcname, /*PyObject *name,*/
py_line, /*int firstlineno,*/
__pyx_empty_bytes /*PyObject *lnotab*/
);
Py_DECREF(py_srcfile);
Py_DECREF(py_funcname);
return py_code;
bad:
Py_XDECREF(py_srcfile);
Py_XDECREF(py_funcname);
return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
int py_line, const char *filename) {
PyCodeObject *py_code = 0;
PyObject *py_globals = 0;
PyFrameObject *py_frame = 0;
py_code = __pyx_find_code_object(c_line ? c_line : py_line);
if (!py_code) {
py_code = __Pyx_CreateCodeObjectForTraceback(
funcname, c_line, py_line, filename);
if (!py_code) goto bad;
__pyx_insert_code_object(c_line ? c_line : py_line, py_code);
}
py_globals = PyModule_GetDict(__pyx_m);
if (!py_globals) goto bad;
py_frame = PyFrame_New(
PyThreadState_GET(), /*PyThreadState *tstate,*/
py_code, /*PyCodeObject *code,*/
py_globals, /*PyObject *globals,*/
0 /*PyObject *locals*/
);
if (!py_frame) goto bad;
py_frame->f_lineno = py_line;
PyTraceBack_Here(py_frame);
bad:
Py_XDECREF(py_code);
Py_XDECREF(py_frame);
}
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
while (t->p) {
#if PY_MAJOR_VERSION < 3
if (t->is_unicode) {
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
} else if (t->intern) {
*t->p = PyString_InternFromString(t->s);
} else {
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
}
#else /* Python 3+ has unicode identifiers */
if (t->is_unicode | t->is_str) {
if (t->intern) {
*t->p = PyUnicode_InternFromString(t->s);
} else if (t->encoding) {
*t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
} else {
*t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
}
} else {
*t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
}
#endif
if (!*t->p)
return -1;
++t;
}
return 0;
}
/* Type Conversion Functions */
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
int is_true = x == Py_True;
if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
else return PyObject_IsTrue(x);
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
PyNumberMethods *m;
const char *name = NULL;
PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
if (PyInt_Check(x) || PyLong_Check(x))
#else
if (PyLong_Check(x))
#endif
return Py_INCREF(x), x;
m = Py_TYPE(x)->tp_as_number;
#if PY_VERSION_HEX < 0x03000000
if (m && m->nb_int) {
name = "int";
res = PyNumber_Int(x);
}
else if (m && m->nb_long) {
name = "long";
res = PyNumber_Long(x);
}
#else
if (m && m->nb_int) {
name = "int";
res = PyNumber_Long(x);
}
#endif
if (res) {
#if PY_VERSION_HEX < 0x03000000
if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
if (!PyLong_Check(res)) {
#endif
PyErr_Format(PyExc_TypeError,
"__%s__ returned non-%s (type %.200s)",
name, name, Py_TYPE(res)->tp_name);
Py_DECREF(res);
return NULL;
}
}
else if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError,
"an integer is required");
}
return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
Py_ssize_t ival;
PyObject* x = PyNumber_Index(b);
if (!x) return -1;
ival = PyInt_AsSsize_t(x);
Py_DECREF(x);
return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
if (ival <= LONG_MAX)
return PyInt_FromLong((long)ival);
else {
unsigned char *bytes = (unsigned char *) &ival;
int one = 1; int little = (int)*(unsigned char*)&one;
return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
}
#else
return PyInt_FromSize_t(ival);
#endif
}
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
return (size_t)-1;
} else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to size_t");
return (size_t)-1;
}
return (size_t)val;
}
#endif /* Py_PYTHON_H */
| 45.360624 | 1,436 | 0.681152 |
81487c80ce53a33cd98de9c2104e083455a7c465 | 1,290 | h | C | PrivateFrameworks/ActionKit/WFDiskCache.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 17 | 2018-11-13T04:02:58.000Z | 2022-01-20T09:27:13.000Z | PrivateFrameworks/ActionKit/WFDiskCache.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 3 | 2018-04-06T02:02:27.000Z | 2018-10-02T01:12:10.000Z | PrivateFrameworks/ActionKit/WFDiskCache.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 1 | 2018-09-28T13:54:23.000Z | 2018-09-28T13:54:23.000Z | //
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "NSObject.h"
@class NSObject<OS_dispatch_queue>, NSURL;
@interface WFDiskCache : NSObject
{
NSObject<OS_dispatch_queue> *_queue;
NSURL *_cacheURL;
}
+ (id)workflowCache;
@property(readonly, copy, nonatomic) NSURL *cacheURL; // @synthesize cacheURL=_cacheURL;
- (void).cxx_destruct;
- (id)actuallyGetObjectForKey:(id)arg1;
- (void)actuallyRemoveObjectForKey:(id)arg1;
- (void)actuallySetObject:(id)arg1 forKey:(id)arg2;
- (id)fileURLForKey:(id)arg1;
- (id)objectForKeyComponents:(id)arg1;
- (void)removeObjectForKeyComponents:(id)arg1;
- (void)setObject:(id)arg1 forKeyComponents:(id)arg2;
- (void)objectForKey:(id)arg1 completion:(CDUnknownBlockType)arg2;
- (void)removeObjectForKey:(id)arg1 completion:(CDUnknownBlockType)arg2;
- (void)setObject:(id)arg1 forKey:(id)arg2 completion:(CDUnknownBlockType)arg3;
- (id)objectForKey:(id)arg1;
- (void)removeObjectForKey:(id)arg1;
- (void)setObject:(id)arg1 forKey:(id)arg2;
- (id)initWithCacheURL:(id)arg1 name:(id)arg2;
- (id)initWithCacheDirectory:(id)arg1 name:(id)arg2;
- (id)initWithApplicationGroupIdentifier:(id)arg1 name:(id)arg2;
- (id)initWithName:(id)arg1;
- (id)init;
@end
| 31.463415 | 88 | 0.74031 |
9005f24bde3216a2ea1cb5084756eecd5dba9d77 | 4,309 | h | C | SourceCode/Common/ngiFileUtilities.h | neurogadgets/Syntheta | dedae834916a63095d0c97231731b601df875743 | [
"BSD-3-Clause"
] | 2 | 2021-12-30T15:33:58.000Z | 2021-12-30T22:24:31.000Z | SourceCode/Common/ngiFileUtilities.h | neurogadgets/Syntheta | dedae834916a63095d0c97231731b601df875743 | [
"BSD-3-Clause"
] | null | null | null | SourceCode/Common/ngiFileUtilities.h | neurogadgets/Syntheta | dedae834916a63095d0c97231731b601df875743 | [
"BSD-3-Clause"
] | null | null | null | // ngiFileUtilities.h
// Version 2019.01.30
/*
Copyright (c) 2013-2019, NeuroGadgets Inc.
Author: Robert L. Charlebois
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 NeuroGadgets Inc. 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 HOLDERS 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.
*/
#ifndef NGI_FILE_UTILITIES
#define NGI_FILE_UTILITIES
#include <ctime>
#include <iosfwd>
#include <regex>
#include <string>
#include <vector>
#if __cplusplus >= 201703L
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
#endif
#include <sys/stat.h>
#include <sys/types.h>
class Lockfile { // An RAII file locker based on flock()
private:
std::string myLockfileName_;
int myLockfileDescriptor_;
public:
explicit Lockfile(const std::string& lockfileName, bool wait = true);
~Lockfile();
bool hasLock() const { return myLockfileDescriptor_ >= 0; } // only useful if wait was false
};
namespace ngi {
// For setting permissions of newly created files:
const mode_t rw = (S_IRUSR | S_IWUSR);
const mode_t rwr = (S_IRUSR | S_IWUSR | S_IRGRP);
// For setting permissions of newly created folders:
const mode_t rwxrx = (S_IRWXU | S_IRGRP | S_IXGRP);
std::time_t fileModificationTime(const std::string& filename);
inline bool localFileMissingOrEmpty(const std::string& filename) {
return (!fs::exists(filename) || fs::is_empty(filename));
}
inline bool fileIsNewerThanTime(const std::string& filename, const std::time_t theTime) {
return (fileModificationTime(filename) > theTime);
}
void filedelete(const std::string& filename);
void filemove(const std::string& from, std::string to);
void filecopy(const std::string& theOriginal, const std::string& theCopy);
bool filecopy_or_create(const std::string& theOriginal, const std::string& theCopy);
// returns true if copied, false if created (empty)
void filecat(const std::vector<std::string>& source, const std::string& sink);
} // namespace ngi
std::string extractFileNameFromPath(const std::string& path);
std::string readFileIntoString(const std::string& filename);
void convertToUnixLineEndings(const std::string& filename);
std::string deduceApplicationDirectory(const std::string& app);
std::string currentWorkingDirectory();
void checkForValidPath(const fs::path& fileName);
std::uint64_t countLinesInFile(const std::string& filename);
std::ifstream openFileAndTest(const std::string& name);
// Call as, e.g.: std::ifstream infile(openFileAndTest(infilename));
// uses ifstream's move constructor, throws if the file is not open
std::string checksum(const std::string& filename);
std::vector<fs::path> listFilesInDirectory(const fs::path& directory, bool recursive = false, const std::regex& pattern = std::regex(""));
std::vector<fs::path> listDirectoriesInDirectory(const fs::path& directory, const std::regex& pattern = std::regex(""));
std::vector<fs::path> autocompleteFilesystemName(const std::string& filenamePrefix);
#endif
| 41.432692 | 138 | 0.765607 |
b0b276589879e439dd067938975f2b611006e37a | 3,934 | h | C | Framework2/sfkTransportTimeUtils.h | Schrankee/Cakewalk-Control-Surface-SDK | 7db5014645567142fc0c47c4f7cd47a4eb7315b3 | [
"MIT"
] | 36 | 2015-03-29T09:49:55.000Z | 2021-11-05T05:35:29.000Z | Framework2/sfkTransportTimeUtils.h | Schrankee/Cakewalk-Control-Surface-SDK | 7db5014645567142fc0c47c4f7cd47a4eb7315b3 | [
"MIT"
] | 2 | 2020-06-04T14:07:30.000Z | 2020-09-15T06:39:10.000Z | Framework2/sfkTransportTimeUtils.h | Schrankee/Cakewalk-Control-Surface-SDK | 7db5014645567142fc0c47c4f7cd47a4eb7315b3 | [
"MIT"
] | 17 | 2015-03-29T09:42:46.000Z | 2021-09-24T14:41:35.000Z | //----------------------------------------------------------
// Surface Transport Time Helpers
#pragma once
#include <math.h>
namespace SurfaceTransportTimeUtils
{
enum JogResolution
{
JOG_TICKS,
JOG_BEATS,
JOG_MEASURES,
JOG_HOURS,
JOG_MINUTES,
JOG_SECONDS,
JOG_FRAMES
};
////////////////////////////////////////////////////////////////////////////
static void ZeroTime( MFX_TIME& mfxTime )
{
switch( mfxTime.timeFormat )
{
case TF_MBT:
mfxTime.mbt.nMeas = mfxTime.mbt.nBeat = 1;
mfxTime.mbt.nTick = 0;
break;
case TF_SECONDS:
mfxTime.dSeconds = 0;
break;
case TF_SAMPLES:
mfxTime.llSamples = 0;
break;
case TF_TICKS:
mfxTime.lTicks = 0;
break;
case TF_UTICKS:
mfxTime.llUTicks = 0;
break;
case TF_FRAMES:
case TF_FRAMES_REL:
mfxTime.frames.lFrame = 0;
break;
case TF_SMPTE:
case TF_SMPTE_REL:
mfxTime.smpte.nFrame = mfxTime.smpte.nHour = mfxTime.smpte.nMin = mfxTime.smpte.nSec = 0;
mfxTime.smpte.nSub400 = 0;
break;
}
}
//---------------------------------------------------------------------
// Given a time, a res, and an amount, Alter the time
static void NudgeTimeCursor( MFX_TIME& mfxTime, // [in][out] Current Time in, Modified time out
JogResolution eJogResolution, // Time Res
int iDir ) // Motion increment
{
if ( iDir == 0 ) // no change?
return;
// Fixup for when the displayed time is (incorrectly?) rounded up
switch (eJogResolution)
{
case JOG_HOURS:
case JOG_MINUTES:
case JOG_SECONDS:
if (iDir > 0)
{
double c = ceil(mfxTime.dSeconds);
double d = c - mfxTime.dSeconds;
if (d > 0.0 && d < 1e-8)
{
mfxTime.dSeconds = c;
}
}
else
{
double f = floor(mfxTime.dSeconds);
double d = mfxTime.dSeconds - f;
if (d > 0.0 && d < 1e-8)
{
mfxTime.dSeconds = f;
}
}
break;
}
switch (eJogResolution)
{
case JOG_MEASURES:
mfxTime.mbt.nMeas += iDir;
mfxTime.mbt.nBeat = 1;
mfxTime.mbt.nTick = 0;
break;
case JOG_BEATS:
mfxTime.mbt.nBeat += short(iDir); // oy I don;'t think the host handles rolling over the measure for us!
mfxTime.mbt.nTick = 0;
break;
case JOG_TICKS:
mfxTime.mbt.nTick += short(iDir);
break;
case JOG_HOURS:
if (iDir > 0)
mfxTime.dSeconds = 3600 * (floor(mfxTime.dSeconds / 3600) + iDir);
else
mfxTime.dSeconds = 3600 * (ceil(mfxTime.dSeconds / 3600) + iDir);
mfxTime.dSeconds = max(0, mfxTime.dSeconds);
break;
case JOG_MINUTES:
if (iDir > 0)
mfxTime.dSeconds = 60 * (floor(mfxTime.dSeconds / 60) + iDir);
else
mfxTime.dSeconds = 60 * (ceil(mfxTime.dSeconds / 60) + iDir);
mfxTime.dSeconds = max(0, mfxTime.dSeconds);
break;
case JOG_SECONDS:
if (iDir > 0)
mfxTime.dSeconds = floor(mfxTime.dSeconds) + iDir;
else
mfxTime.dSeconds = ceil(mfxTime.dSeconds) + iDir;
mfxTime.dSeconds = max(0, mfxTime.dSeconds);
break;
case JOG_FRAMES:
{
// argh this is a bug. we're modifying the dSeconds field which
// means we can't possibly be using the .smpte.fps field since they
// are unionized together. What we need to do is accept a separate arg
// for FPS.
double dFramePeriod = dFramePeriod = 1.0 / 30.0;
switch (mfxTime.smpte.fps)
{
case FPS_24: dFramePeriod = 1.0 / 24.0; break;
case FPS_25: dFramePeriod = 1.0 / 25.0; break;
case FPS_2997: dFramePeriod = 1.0 / 29.97; break;
case FPS_2997_DROP: dFramePeriod = 1.0 / 29.97; break;
case FPS_30: dFramePeriod = 1.0 / 30.0; break;
case FPS_30_DROP: dFramePeriod = 1.0 / 30.0; break;
}
mfxTime.dSeconds += (double)iDir * dFramePeriod;
mfxTime.dSeconds = max(0, mfxTime.dSeconds);
}
break;
default:
return;
}
}
}; | 23.278107 | 108 | 0.58058 |
507aed1bc23902dbff0066c386fafae3fa334b77 | 40,512 | c | C | extensions/ffi/t-routine.c | BlackATTR/ren-c | 533a998a30e6a74a528718df58d5ece997a43138 | [
"Apache-2.0"
] | null | null | null | extensions/ffi/t-routine.c | BlackATTR/ren-c | 533a998a30e6a74a528718df58d5ece997a43138 | [
"Apache-2.0"
] | 1 | 2015-12-15T15:07:45.000Z | 2015-12-15T15:07:45.000Z | extensions/ffi/t-routine.c | giuliolunati/ren-c | 631d93a3406ef2e17f221164b3dee3e1385880fc | [
"Apache-2.0"
] | null | null | null | //
// File: %t-routine.c
// Summary: "Support for calling non-Rebol C functions in DLLs w/Rebol args)"
// Section: datatypes
// Project: "Rebol 3 Interpreter and Run-time (Ren-C branch)"
// Homepage: https://github.com/metaeducation/ren-c/
//
//=////////////////////////////////////////////////////////////////////////=//
//
// Copyright 2014 Atronix Engineering, Inc.
// Copyright 2014-2017 Rebol Open Source Contributors
// REBOL is a trademark of REBOL Technologies
//
// See README.md and CREDITS.md for more information.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//=////////////////////////////////////////////////////////////////////////=//
//
#include "sys-core.h"
#include "reb-struct.h"
// Currently there is a static linkage dependency on the implementation
// details of VECTOR!. Trust the build system got the include directory in.
//
#include "sys-vector.h"
static struct {
REBSYM sym;
uintptr_t bits;
} syms_to_typesets[] = {
{SYM_VOID, FLAGIT_KIND(REB_VOID)},
{SYM_UINT8, FLAGIT_KIND(REB_INTEGER)},
{SYM_INT8, FLAGIT_KIND(REB_INTEGER)},
{SYM_UINT16, FLAGIT_KIND(REB_INTEGER)},
{SYM_INT16, FLAGIT_KIND(REB_INTEGER)},
{SYM_UINT32, FLAGIT_KIND(REB_INTEGER)},
{SYM_INT32, FLAGIT_KIND(REB_INTEGER)},
{SYM_UINT64, FLAGIT_KIND(REB_INTEGER)},
{SYM_INT64, FLAGIT_KIND(REB_INTEGER)},
{SYM_FLOAT, FLAGIT_KIND(REB_DECIMAL)},
{SYM_DOUBLE, FLAGIT_KIND(REB_DECIMAL)},
{
SYM_POINTER,
FLAGIT_KIND(REB_INTEGER)
| FLAGIT_KIND(REB_NULLED) // Rebol's null as 0 seems sensible
| FLAGIT_KIND(REB_TEXT)
| FLAGIT_KIND(REB_BINARY)
| FLAGIT_KIND(REB_CUSTOM) // !!! Was REB_VECTOR, must narrow (!)
| FLAGIT_KIND(REB_ACTION) // legal if routine or callback
},
{SYM_REBVAL, TS_VALUE},
{SYM_0, 0}
};
//
// Writes into `schema_out` a Rebol value which describes either a basic FFI
// type or the layout of a STRUCT! (not including data).
//
static void Schema_From_Block_May_Fail(
RELVAL *schema_out, // => INTEGER! or HANDLE! for struct
RELVAL *opt_param_out, // => parameter for use in ACTION!s
const REBVAL *blk,
REBSTR *opt_spelling
){
TRASH_CELL_IF_DEBUG(schema_out);
if (not opt_spelling)
assert(not opt_param_out);
else {
assert(opt_param_out);
TRASH_CELL_IF_DEBUG(opt_param_out);
}
assert(IS_BLOCK(blk));
if (VAL_LEN_AT(blk) == 0)
fail (blk);
RELVAL *item = VAL_ARRAY_AT(blk);
DECLARE_LOCAL (def);
DECLARE_LOCAL (temp);
if (IS_WORD(item) and VAL_WORD_SYM(item) == SYM_STRUCT_X) {
//
// [struct! [...struct definition...]]
++item;
if (IS_END(item) or not IS_BLOCK(item))
fail (blk);
// Use the block spec to build a temporary structure through the same
// machinery that implements `make struct! [...]`
Derelativize(def, item, VAL_SPECIFIER(blk));
MAKE_Struct(temp, REB_CUSTOM, nullptr, def); // may fail()
assert(IS_STRUCT(temp));
// !!! It should be made possible to create a schema without going
// through a struct creation. There are "raw" structs with no memory,
// which would avoid the data series (not the REBSTU array, though)
//
Init_Block(schema_out, VAL_STRUCT_SCHEMA(temp));
// !!! Saying any STRUCT! is legal here in the typeset suggests any
// structure is legal to pass into a routine. Yet structs in C
// have different sizes (and static type checking so you can't pass
// one structure in the place of another. Actual struct compatibility
// is not checked until runtime, when the call happens.
//
if (opt_spelling)
Init_Param(
opt_param_out,
REB_P_NORMAL,
opt_spelling,
FLAGIT_KIND(REB_CUSTOM) // !!! Was REB_STRUCT, must narrow!
);
return;
}
if (IS_STRUCT(item)) {
Init_Block(schema_out, VAL_STRUCT_SCHEMA(item));
if (opt_spelling)
Init_Param(
opt_param_out,
REB_P_NORMAL,
opt_spelling,
FLAGIT_KIND(REB_CUSTOM) // !!! Was REB_STRUCT, must narrow!
);
return;
}
if (VAL_LEN_AT(blk) != 1)
fail (blk);
// !!! It was presumed the only parameter convention that made sense was
// a normal args, but quoted ones could work too. In particular, anything
// passed to the C as a REBVAL*. Not a huge priority.
//
if (not IS_WORD(item))
fail (blk);
Init_Word(schema_out, VAL_WORD_SPELLING(item));
REBSYM sym = VAL_WORD_SYM(item);
if (sym == SYM_VOID) {
assert(
not opt_param_out
or VAL_PARAM_SYM(opt_param_out) == SYM_RETURN
); // can only do void for return types
Init_Blank(schema_out);
}
if (opt_spelling) {
int index = 0;
for (; ; ++index) {
if (syms_to_typesets[index].sym == REB_0)
fail ("Invalid FFI type indicator");
if (SAME_SYM_NONZERO(syms_to_typesets[index].sym, sym)) {
Init_Param(
opt_param_out,
REB_P_NORMAL,
opt_spelling,
syms_to_typesets[index].bits
);
break;
}
}
}
}
//
// According to the libffi documentation, the arguments "must be suitably
// aligned; it is the caller's responsibility to ensure this".
//
// We assume the store's data pointer will have suitable alignment for any
// type (currently Make_Series() is expected to match malloc() in this way).
// This will round the offset positions to an alignment appropriate for the
// type size given.
//
// This means sequential arguments in the store may have padding between them.
//
inline static void *Expand_And_Align_Core(
uintptr_t *offset_out,
REBLEN align,
REBSER *store,
REBLEN size
){
REBLEN padding = SER_LEN(store) % align;
if (padding != 0)
padding = align - padding;
*offset_out = SER_LEN(store) + padding;
EXPAND_SERIES_TAIL(store, padding + size);
return SER_DATA_RAW(store) + *offset_out;
}
inline static void *Expand_And_Align(
uintptr_t *offset_out,
REBSER *store,
REBLEN size // assumes align == size
){
return Expand_And_Align_Core(offset_out, size, store, size);
}
//
// Convert a Rebol value into a bit pattern suitable for the expectations of
// the FFI for how a C argument would be represented. (e.g. turn an
// INTEGER! into the appropriate representation of an `int` in memory.)
//
static uintptr_t arg_to_ffi(
REBSER *store,
void *dest,
const REBVAL *arg,
const REBVAL *schema,
const REBVAL *param
){
// Only one of dest or store should be non-nullptr. This allows to write
// either to a known pointer of sufficient size (dest) or to a series
// that will expand enough to accommodate the data (store).
//
assert(store == nullptr ? dest != nullptr : dest == nullptr);
#if !defined(NDEBUG)
//
// If the value being converted has a "name"--e.g. the FFI Routine
// interface named it in the spec--then `param` contains that name, for
// reporting any errors in the conversion.
//
// !!! Shouldn't the argument have already had its type checked by the
// calling process?
//
if (param)
assert(arg != nullptr and IS_PARAM(param));
else
assert(arg == nullptr); // return value, just make space (no arg)
#endif
REBFRM *frame_ = FS_TOP; // So you can use the D_xxx macros
uintptr_t offset;
if (dest == nullptr)
offset = 0;
else
offset = 10200304; // shouldn't be used, but avoid warning
if (IS_BLOCK(schema)) {
REBFLD *top = VAL_ARRAY(schema);
assert(FLD_IS_STRUCT(top));
assert(not FLD_IS_ARRAY(top)); // !!! wasn't supported--should be?
// !!! In theory a struct has to be aligned to its maximal alignment
// needed by a fundamental member. We'll assume that the largest
// is sizeof(void*) here...this may waste some space in the padding
// between arguments, but that shouldn't have any semantic effect.
//
if (dest == nullptr)
dest = Expand_And_Align_Core(
&offset,
sizeof(void*),
store,
FLD_WIDE(top) // !!! What about FLD_LEN_BYTES_TOTAL ?
);
if (arg == nullptr) {
//
// Return values don't have an incoming argument to fill into the
// calling frame.
//
return offset;
}
// !!! There wasn't any compatibility checking here before (not even
// that the arg was a struct. :-/ It used a stored STRUCT! from
// when the routine was specified to know what the size should be,
// and didn't pay attention to the size of the passed-in struct.
//
// (One reason it didn't use the size of the passed-struct is
// because it couldn't do so in the return case where arg was null)
if (not IS_STRUCT(arg))
fail (Error_Arg_Type(D_FRAME, param, VAL_TYPE(arg)));
if (STU_SIZE(VAL_STRUCT(arg)) != FLD_WIDE(top))
fail (Error_Arg_Type(D_FRAME, param, VAL_TYPE(arg)));
memcpy(dest, VAL_STRUCT_DATA_AT(arg), STU_SIZE(VAL_STRUCT(arg)));
TERM_BIN_LEN(store, offset + STU_SIZE(VAL_STRUCT(arg)));
return offset;
}
assert(IS_WORD(schema));
union {
uint8_t u8;
int8_t i8;
uint16_t u16;
int16_t i16;
uint32_t u32;
int32_t i32;
int64_t i64;
float f;
double d;
intptr_t ipt;
} buffer;
char *data;
REBSIZ size;
switch (VAL_WORD_SYM(schema)) {
case SYM_UINT8: {
if (not arg)
buffer.u8 = 0; // return value, make space (but initialize)
else if (IS_INTEGER(arg))
buffer.u8 = cast(uint8_t, VAL_INT64(arg));
else
fail (Error_Arg_Type(D_FRAME, param, VAL_TYPE(arg)));
data = cast(char*, &buffer.u8);
size = sizeof(buffer.u8);
break; }
case SYM_INT8: {
if (not arg)
buffer.i8 = 0; // return value, make space (but initialize)
else if (IS_INTEGER(arg))
buffer.i8 = cast(int8_t, VAL_INT64(arg));
else
fail (Error_Arg_Type(D_FRAME, param, VAL_TYPE(arg)));
data = cast(char*, &buffer.i8);
size = sizeof(buffer.i8);
break; }
case SYM_UINT16: {
if (not arg)
buffer.u16 = 0; // return value, make space (but initialize)
else if (IS_INTEGER(arg))
buffer.u16 = cast(uint16_t, VAL_INT64(arg));
else
fail (Error_Arg_Type(D_FRAME, param, VAL_TYPE(arg)));
data = cast(char*, &buffer.u16);
size = sizeof(buffer.u16);
break; }
case SYM_INT16: {
if (not arg)
buffer.i16 = 0; // return value, make space (but initialize)
else if (IS_INTEGER(arg))
buffer.i16 = cast(int16_t, VAL_INT64(arg));
else
fail (Error_Arg_Type(D_FRAME, param, VAL_TYPE(arg)));
data = cast(char*, &buffer.i16);
size = sizeof(buffer.i16);
break; }
case SYM_UINT32: {
if (not arg)
buffer.u32 = 0; // return value, make space (but initialize)
else if (IS_INTEGER(arg))
buffer.u32 = cast(int32_t, VAL_INT64(arg));
else
fail (Error_Arg_Type(D_FRAME, param, VAL_TYPE(arg)));
data = cast(char*, &buffer.u32);
size = sizeof(buffer.u32);
break; }
case SYM_INT32: {
if (not arg)
buffer.i32 = 0; // return value, make space (but initialize)
else if (IS_INTEGER(arg))
buffer.i32 = cast(int32_t, VAL_INT64(arg));
else
fail (Error_Arg_Type(D_FRAME, param, VAL_TYPE(arg)));
data = cast(char*, &buffer.i32);
size = sizeof(buffer.i32);
break; }
case SYM_UINT64:
case SYM_INT64: {
if (not arg)
buffer.i64 = 0; // return value, make space (but initialize)
else if (IS_INTEGER(arg))
buffer.i64 = VAL_INT64(arg);
else
fail (Error_Arg_Type(D_FRAME, param, VAL_TYPE(arg)));
data = cast(char*, &buffer.i64);
size = sizeof(buffer.i64);
break; }
case SYM_POINTER: {
//
// Note: Function pointers and data pointers may not be same size.
//
if (not arg) {
buffer.ipt = 0xDECAFBAD; // return value, make space (but init)
}
else switch (VAL_TYPE(arg)) {
case REB_NULLED:
buffer.ipt = 0;
break;
case REB_INTEGER:
buffer.ipt = VAL_INT64(arg);
break;
// !!! This is a questionable idea, giving out pointers directly into
// Rebol series data. The data may be relocated in memory if any
// modifications happen during a callback (or in the future, just for
// GC compaction even if not changed)...so the memory is not "stable".
//
case REB_TEXT: // !!! copies a *pointer*!
buffer.ipt = cast(intptr_t, VAL_UTF8_AT(nullptr, arg));
break;
case REB_BINARY: // !!! copies a *pointer*!
buffer.ipt = cast(intptr_t, VAL_BYTES_AT(nullptr, arg));
break;
case REB_CUSTOM: // !!! copies a *pointer* (and assumes vector!)
buffer.ipt = cast(intptr_t, VAL_VECTOR_HEAD(arg));
break;
case REB_ACTION: {
if (not IS_ACTION_RIN(arg))
fail (Error_Only_Callback_Ptr_Raw()); // but routines, too
REBRIN *rin = VAL_ACT_DETAILS(arg);
CFUNC* cfunc = RIN_CFUNC(rin);
size_t sizeof_cfunc = sizeof(cfunc); // avoid conditional const
if (sizeof_cfunc != sizeof(intptr_t)) // not necessarily true
fail ("intptr_t size not equal to function pointer size");
memcpy(&buffer.ipt, &cfunc, sizeof(intptr_t));
break; }
default:
fail (Error_Arg_Type(D_FRAME, param, VAL_TYPE(arg)));
}
data = cast(char*, &buffer.ipt);
size = sizeof(buffer.ipt);
break; } // end case FFI_TYPE_POINTER
case SYM_REBVAL: {
if (not arg)
buffer.ipt = 0xDECAFBAD; // return value, make space (but init)
else
buffer.ipt = cast(intptr_t, arg);
data = cast(char*, &buffer.ipt);
size = sizeof(buffer.ipt);
break; }
case SYM_FLOAT: {
if (not arg)
buffer.f = 0; // return value, make space (but initialize)
else if (IS_DECIMAL(arg))
buffer.f = cast(float, VAL_DECIMAL(arg));
else
fail (Error_Arg_Type(D_FRAME, param, VAL_TYPE(arg)));
data = cast(char*, &buffer.f);
size = sizeof(buffer.f);
break; }
case SYM_DOUBLE: {
if (not arg)
buffer.d = 0;
else if (IS_DECIMAL(arg))
buffer.d = VAL_DECIMAL(arg);
else
fail (Error_Arg_Type(D_FRAME, param, VAL_TYPE(arg)));
data = cast(char*, &buffer.d);
size = sizeof(buffer.d);
break;}
case SYM_STRUCT_X:
//
// structs should be processed above by the HANDLE! case, not WORD!
//
assert(false);
case SYM_VOID:
//
// can't return a meaningful offset for "void"--it's only valid for
// return types, so caller should check and not try to pass it in.
//
assert(false);
default:
fail (arg);
}
if (store) {
assert(dest == nullptr);
dest = Expand_And_Align(&offset, store, size);
}
memcpy(dest, data, size);
if (store)
TERM_BIN_LEN(store, offset + size);
return offset;
}
/* convert the return value to rebol
*/
static void ffi_to_rebol(
RELVAL *out,
const REBVAL *schema,
void *ffi_rvalue
){
if (IS_BLOCK(schema)) {
REBFLD *top = VAL_ARRAY(schema);
assert(FLD_IS_STRUCT(top));
assert(not FLD_IS_ARRAY(top)); // !!! wasn't supported, should be?
REBSTU *stu = Alloc_Singular(
NODE_FLAG_MANAGED | SERIES_FLAG_LINK_NODE_NEEDS_MARK
);
LINK_SCHEMA_NODE(stu) = NOD(top);
REBSER *data = Make_Series_Core(
FLD_WIDE(top), // !!! what about FLD_LEN_BYTES_TOTAL ?
sizeof(REBYTE),
NODE_FLAG_MANAGED
);
memcpy(SER_HEAD(REBYTE, data), ffi_rvalue, FLD_WIDE(top));
RESET_CUSTOM_CELL(out, EG_Struct_Type, CELL_FLAG_FIRST_IS_NODE);
INIT_VAL_NODE(out, stu);
VAL_STRUCT_OFFSET(out) = 0;
Init_Binary(ARR_SINGLE(stu), data);
assert(STU_DATA_HEAD(stu) == BIN_HEAD(data));
return;
}
assert(IS_WORD(schema));
switch (VAL_WORD_SYM(schema)) {
case SYM_UINT8:
Init_Integer(out, *cast(uint8_t*, ffi_rvalue));
break;
case SYM_INT8:
Init_Integer(out, *cast(int8_t*, ffi_rvalue));
break;
case SYM_UINT16:
Init_Integer(out, *cast(uint16_t*, ffi_rvalue));
break;
case SYM_INT16:
Init_Integer(out, *cast(int16_t*, ffi_rvalue));
break;
case SYM_UINT32:
Init_Integer(out, *cast(uint32_t*, ffi_rvalue));
break;
case SYM_INT32:
Init_Integer(out, *cast(int32_t*, ffi_rvalue));
break;
case SYM_UINT64:
Init_Integer(out, *cast(uint64_t*, ffi_rvalue));
break;
case SYM_INT64:
Init_Integer(out, *cast(int64_t*, ffi_rvalue));
break;
case SYM_POINTER: // !!! Should 0 come back as a NULL to Rebol?
Init_Integer(out, cast(uintptr_t, *cast(void**, ffi_rvalue)));
break;
case SYM_FLOAT:
Init_Decimal(out, *cast(float*, ffi_rvalue));
break;
case SYM_DOUBLE:
Init_Decimal(out, *cast(double*, ffi_rvalue));
break;
case SYM_REBVAL:
Move_Value(out, *cast(const REBVAL**, ffi_rvalue));
break;
case SYM_VOID:
assert(false); // not covered by generic routine.
default:
assert(false);
//
// !!! Was reporting Error_Invalid_Arg on uninitialized `out`
//
fail ("Unknown FFI type indicator");
}
}
//
// Routine_Dispatcher: C
//
REB_R Routine_Dispatcher(REBFRM *f)
{
REBRIN *rin = ACT_DETAILS(FRM_PHASE(f));
if (RIN_IS_CALLBACK(rin) or RIN_LIB(rin) == nullptr) {
//
// lib is nullptr when routine is constructed from address directly,
// so there's nothing to track whether that gets loaded or unloaded
}
else {
if (IS_LIB_CLOSED(RIN_LIB(rin)))
fail (Error_Bad_Library_Raw());
}
REBLEN num_fixed = RIN_NUM_FIXED_ARGS(rin);
REBLEN num_variable;
REBDSP dsp_orig = DSP; // variadic args pushed to stack, so save base ptr
if (not RIN_IS_VARIADIC(rin))
num_variable = 0;
else {
// The function specification should have one extra parameter for
// the variadic source ("...")
//
assert(ACT_NUM_PARAMS(FRM_PHASE(f)) == num_fixed + 1);
REBVAL *vararg = FRM_ARG(f, num_fixed + 1); // 1-based
assert(IS_VARARGS(vararg) and FRM_BINDING(f) == UNBOUND);
// Evaluate the VARARGS! feed of values to the data stack. This way
// they will be available to be counted, to know how big to make the
// FFI argument series.
//
do {
if (Do_Vararg_Op_Maybe_End_Throws(
f->out,
VARARG_OP_TAKE,
vararg
)){
return R_THROWN;
}
if (IS_END(f->out))
break;
Move_Value(DS_PUSH(), f->out);
SET_END(f->out); // expected by Do_Vararg_Op
} while (true);
// !!! The Atronix va_list interface required a type to be specified
// for each argument--achieving what you would get if you used a
// C cast on each variadic argument. Such as:
//
// printf reduce ["%d, %f" 10 + 20 [int32] 12.34 [float]]
//
// While this provides generality, it may be useful to use defaulting
// like C's where integer types default to `int` and floating point
// types default to `double`. In the VARARGS!-based syntax it could
// offer several possibilities:
//
// (printf "%d, %f" (10 + 20) 12.34)
// (printf "%d, %f" [int32 10 + 20] 12.34)
// (printf "%d, %f" [int32] 10 + 20 [float] 12.34)
//
// For the moment, this is following the idea that there must be
// pairings of values and then blocks (though the values are evaluated
// expressions).
//
if ((DSP - dsp_orig) % 2 != 0)
fail ("Variadic FFI functions must alternate blocks and values");
num_variable = (DSP - dsp_orig) / 2;
}
REBLEN num_args = num_fixed + num_variable;
// The FFI arguments are passed by void*. Those void pointers point to
// transformations of the Rebol arguments into ranges of memory of
// various sizes. This is the backing store for those arguments, which
// is appended to for each one. The memory is freed after the call.
//
// The offsets array has one element for each argument. These point at
// indexes of where each FFI variable resides. Offsets are used instead
// of pointers in case the store has to be resized, which may move the
// base of the series. Hence the offsets must be mutated into pointers
// at the last minute before the FFI call.
//
REBSER *store = Make_Series(1, sizeof(REBYTE));
void *ret_offset;
if (not IS_BLANK(RIN_RET_SCHEMA(rin))) {
ret_offset = cast(void*, arg_to_ffi(
store, // ffi-converted arg appended here
nullptr, // dest pointer must be nullptr if store is non-nullptr
nullptr, // arg: none (we're only making space--leave uninitialized)
RIN_RET_SCHEMA(rin),
nullptr // param: none (it's a return value/output)
));
}
else {
// Shouldn't be used (assigned to nullptr later) but avoid maybe
// uninitialized warning.
//
ret_offset = cast(void*, cast(uintptr_t, 0xDECAFBAD));
}
REBSER *arg_offsets;
if (num_args == 0)
arg_offsets = nullptr; // don't waste time with the alloc + free
else
arg_offsets = Make_Series(num_args, sizeof(void*));
// First gather the fixed parameters from the frame. They are known to
// be of correct general types (they were checked by Eval_Core for the call)
// but a STRUCT! might not be compatible with the type of STRUCT! in
// the parameter specification. They might also be out of range, e.g.
// a too-large or negative INTEGER! passed to a uint8. Could fail() here.
//
blockscope {
REBLEN i = 0;
for (; i < num_fixed; ++i) {
uintptr_t offset = arg_to_ffi(
store, // ffi-converted arg appended here
nullptr, // dest pointer must be nullptr if store is non-null
FRM_ARG(f, i + 1), // 1-based
RIN_ARG_SCHEMA(rin, i), // 0-based
ACT_PARAM(FRM_PHASE(f), i + 1) // 1-based
);
// We will convert the offset to a pointer later
//
*SER_AT(void*, arg_offsets, i) = cast(void*, offset);
}
}
// If an FFI routine takes a fixed number of arguments, then its Call
// InterFace (CIF) can be created just once. This will be in the RIN_CIF.
// However a variadic routine requires a CIF that matches the number
// and types of arguments for that specific call.
//
// These pointers need to be freed by HANDLE! cleanup.
//
ffi_cif *cif; // pre-made if not variadic, built for this call otherwise
ffi_type **args_fftypes = nullptr; // ffi_type*[] if num_variable > 0
if (not RIN_IS_VARIADIC(rin)) {
cif = RIN_CIF(rin);
}
else {
assert(IS_BLANK(RIN_AT(rin, IDX_ROUTINE_CIF)));
// CIF creation requires a C array of argument descriptions that is
// contiguous across both the fixed and variadic parts. Start by
// filling in the ffi_type*s for all the fixed args.
//
args_fftypes = rebAllocN(ffi_type*, num_fixed + num_variable);
REBLEN i;
for (i = 0; i < num_fixed; ++i)
args_fftypes[i] = SCHEMA_FFTYPE(RIN_ARG_SCHEMA(rin, i));
DECLARE_LOCAL (schema);
DECLARE_LOCAL (param);
REBDSP dsp;
for (dsp = dsp_orig + 1; i < num_args; dsp += 2, ++i) {
//
// This param is used with the variadic type spec, and is
// initialized as it would be for an ordinary FFI argument. This
// means its allowed type flags are set, which is not really
// necessary. Whatever symbol name is used here will be seen
// in error reports.
//
Schema_From_Block_May_Fail(
schema,
param, // sets type bits in param
DS_AT(dsp + 1), // will error if this is not a block
Canon(SYM_ELLIPSIS)
);
args_fftypes[i] = SCHEMA_FFTYPE(schema);
*SER_AT(void*, arg_offsets, i) = cast(void*, arg_to_ffi(
store, // data appended to store
nullptr, // dest pointer must be null if store is non-null
DS_AT(dsp), // arg
schema,
param // used for typecheck, VAL_TYPESET_SYM for error msgs
));
}
DS_DROP_TO(dsp_orig); // done w/args (converted to bytes in `store`)
cif = rebAlloc(ffi_cif);
ffi_status status = ffi_prep_cif_var( // _var-iadic prep_cif version
cif,
RIN_ABI(rin),
num_fixed, // just fixed
num_args, // fixed plus variable
IS_BLANK(RIN_RET_SCHEMA(rin))
? &ffi_type_void
: SCHEMA_FFTYPE(RIN_RET_SCHEMA(rin)), // return FFI type
args_fftypes // arguments FFI types
);
if (status != FFI_OK) {
rebFree(cif); // would free automatically on fail
rebFree(args_fftypes); // would free automatically on fail
fail ("FFI: Couldn't prep CIF_VAR");
}
}
// Now that all the additions to store have been made, we want to change
// the offsets of each FFI argument into actual pointers (since the
// data won't be relocated)
//
blockscope {
if (IS_BLANK(RIN_RET_SCHEMA(rin)))
ret_offset = nullptr;
else
ret_offset = SER_DATA_RAW(store) + cast(uintptr_t, ret_offset);
REBLEN i;
for (i = 0; i < num_args; ++i) {
uintptr_t off = cast(uintptr_t, *SER_AT(void*, arg_offsets, i));
assert(off == 0 or off < SER_LEN(store));
*SER_AT(void*, arg_offsets, i) = SER_DATA_RAW(store) + off;
}
}
// THE ACTUAL FFI CALL
//
// Note that the "offsets" are now direct pointers. Also note that
// any callbacks which run Rebol code during the course of calling this
// arbitrary C code are not allowed to propagate failures out of the
// callback--they'll panic and crash the interpreter, since they don't
// know what to do otherwise. See MAKE-CALLBACK/FALLBACK for some
// mitigation of this problem.
//
ffi_call(
cif,
RIN_CFUNC(rin),
ret_offset, // actually a real pointer now (no longer an offset)
(num_args == 0)
? nullptr
: SER_HEAD(void*, arg_offsets) // also real pointers now
);
if (IS_BLANK(RIN_RET_SCHEMA(rin)))
Init_Nulled(f->out);
else
ffi_to_rebol(f->out, RIN_RET_SCHEMA(rin), ret_offset);
if (num_args != 0)
Free_Unmanaged_Series(arg_offsets);
Free_Unmanaged_Series(store);
if (RIN_IS_VARIADIC(rin)) {
rebFree(cif);
rebFree(args_fftypes);
}
// Note: cannot "throw" a Rebol value across an FFI boundary.
return f->out;
}
//
// cleanup_ffi_closure: C
//
// The GC-able HANDLE! used by callbacks contains a ffi_closure pointer that
// needs to be freed when the handle references go away (really only one
// reference is likely--in the ACT_BODY of the callback, but still this is
// how the GC gets hooked in Ren-C)
//
void cleanup_ffi_closure(const REBVAL *v) {
ffi_closure_free(VAL_HANDLE_POINTER(ffi_closure, v));
}
static void cleanup_cif(const REBVAL *v) {
FREE(ffi_cif, VAL_HANDLE_POINTER(ffi_cif, v));
}
static void cleanup_args_fftypes(const REBVAL *v) {
FREE_N(ffi_type*, VAL_HANDLE_LEN(v), VAL_HANDLE_POINTER(ffi_type*, v));
}
struct Reb_Callback_Invocation {
ffi_cif *cif;
void *ret;
void **args;
REBRIN *rin;
};
static REBVAL *callback_dispatcher_core(struct Reb_Callback_Invocation *inv)
{
// Build an array of code to run which represents the call. The first
// item in that array will be the callback function value, and then
// the arguments will be the remaining values.
//
REBARR *code = Make_Array(1 + inv->cif->nargs);
RELVAL *elem = ARR_HEAD(code);
Init_Action_Unbound(elem, RIN_CALLBACK_ACTION(inv->rin));
++elem;
REBLEN i;
for (i = 0; i != inv->cif->nargs; ++i, ++elem)
ffi_to_rebol(elem, RIN_ARG_SCHEMA(inv->rin, i), inv->args[i]);
TERM_ARRAY_LEN(code, 1 + inv->cif->nargs);
Manage_Array(code); // DO requires managed arrays (guarded while running)
DECLARE_LOCAL (result);
if (Do_At_Mutable_Throws(result, code, 0, SPECIFIED))
fail (Error_No_Catch_For_Throw(result)); // caller will panic()
if (inv->cif->rtype->type == FFI_TYPE_VOID)
assert(IS_BLANK(RIN_RET_SCHEMA(inv->rin)));
else {
DECLARE_LOCAL (param);
Init_Param(param, REB_P_NORMAL, Canon(SYM_RETURN), 0);
arg_to_ffi(
nullptr, // store must be null if dest is non-null,
inv->ret, // destination pointer
result,
RIN_RET_SCHEMA(inv->rin),
param // parameter used for symbol in error only
);
}
return nullptr; // return result not used
}
//
// callback_dispatcher: C
//
// Callbacks allow C code to call Rebol functions. It does so by creating a
// stub function pointer that can be passed in slots where C code expected
// a C function pointer. When such stubs are triggered, the FFI will call
// this dispatcher--which was registered using ffi_prep_closure_loc().
//
// An example usage of this feature is in %qsort.r, where the C library
// function qsort() is made to use a custom comparison function that is
// actually written in Rebol.
//
void callback_dispatcher(
ffi_cif *cif,
void *ret,
void **args,
void *user_data
){
struct Reb_Callback_Invocation inv;
inv.cif = cif;
inv.ret = ret;
inv.args = args;
inv.rin = cast(REBRIN*, user_data);
assert(not RIN_IS_VARIADIC(inv.rin));
assert(cif->nargs == RIN_NUM_FIXED_ARGS(inv.rin));
REBVAL *error = rebRescue(cast(REBDNG*, callback_dispatcher_core), &inv);
if (error != nullptr) {
//
// If a callback encounters an un-trapped error in mid-run, there's
// nothing we can do here to "guess" what its C contract return
// value should be. And we can't just jump up to the next trap point,
// because that would cross unknown FFI code (if it were C++, the
// destructors might not run, etc.)
//
// See MAKE-CALLBACK/FALLBACK for the usermode workaround.
//
panic (error);
}
}
//
// Alloc_Ffi_Action_For_Spec: C
//
// This allocates a REBACT designed for using with the FFI--though it does
// not fill in the actual code to run. That is done by the caller, which
// needs to be done differently if it runs a C function (routine) or if it
// makes Rebol code callable as if it were a C function (callback).
//
// It has a HANDLE! holding a Routine INfo structure (RIN) which describes
// the FFI argument types. For callbacks, this cannot be automatically
// deduced from the parameters of the Rebol function it wraps--because there
// are multiple possible mappings (e.g. differently sized C types all of
// which are passed in from Rebol's INTEGER!)
//
// The spec format is a block which is similar to the spec for functions:
//
// [
// "document"
// arg1 [type1 type2] "note"
// arg2 [type3] "note"
// ...
// argn [typen] "note"
// return: [type] "note"
// ]
//
REBACT *Alloc_Ffi_Action_For_Spec(REBVAL *ffi_spec, ffi_abi abi) {
assert(IS_BLOCK(ffi_spec));
// Build the paramlist on the data stack. First slot is reserved for the
// ACT_ARCHETYPE (see comments on `struct Reb_Action`)
//
REBDSP dsp_orig = DSP;
Init_Unreadable_Blank(DS_PUSH()); // GC-safe form of "trash"
// arguments can be complex, defined as structures. A "schema" is a
// REBVAL that holds either an INTEGER! for simple types, or a HANDLE!
// for compound ones.
//
// Note that in order to avoid deep walking the schemas after construction
// to convert them from unmanaged to managed, they are managed at the
// time of creation. This means that the array of them has to be
// guarded across any evaluations, since the routine being built is not
// ready for GC visibility.
//
// !!! Should the spec analysis be allowed to do evaluation? (it does)
//
const REBLEN capacity_guess = 8; // !!! Magic number...why 8? (can grow)
REBARR *args_schemas = Make_Array(capacity_guess);
Manage_Array(args_schemas);
PUSH_GC_GUARD(args_schemas);
DECLARE_LOCAL (ret_schema);
Init_Blank(ret_schema); // ret_schema defaults blank (e.g. void C func)
PUSH_GC_GUARD(ret_schema);
REBLEN num_fixed = 0; // number of fixed (non-variadic) arguments
bool is_variadic = false; // default to not being variadic
RELVAL *item = VAL_ARRAY_AT(ffi_spec);
for (; NOT_END(item); ++item) {
if (IS_TEXT(item))
continue; // !!! TBD: extract ACT_META info from spec notes
switch (VAL_TYPE(item)) {
case REB_WORD: {
REBSTR *name = VAL_WORD_SPELLING(item);
if (SAME_STR(name, Canon(SYM_ELLIPSIS))) { // variadic
if (is_variadic)
fail ("FFI: Duplicate ... indicating variadic");
is_variadic = true;
// !!! Originally, a feature in VARARGS! was that they would
// "chain" by default, if VARARGS! was not explicitly added.
// This feature was removed, but may be re-added:
//
// https://github.com/metaeducation/ren-c/issues/801
//
// For that reason, varargs was not in the list by default.
//
Init_Param(
DS_PUSH(),
REB_P_NORMAL,
Canon(SYM_VARARGS),
TS_VALUE & ~FLAGIT_KIND(REB_VARARGS)
);
TYPE_SET(DS_TOP, REB_TS_VARIADIC);
}
else { // ordinary argument
if (is_variadic)
fail ("FFI: Variadic must be final parameter");
++item;
DECLARE_LOCAL (block);
Derelativize(block, item, VAL_SPECIFIER(ffi_spec));
Schema_From_Block_May_Fail(
Alloc_Tail_Array(args_schemas), // schema (out)
DS_PUSH(), // param (out)
block, // block (in)
name
);
++num_fixed;
}
break; }
case REB_SET_WORD:
switch (VAL_WORD_SYM(item)) {
case SYM_RETURN:{
if (not IS_BLANK(ret_schema))
fail ("FFI: Return already specified");
++item;
DECLARE_LOCAL (block);
Derelativize(block, item, VAL_SPECIFIER(ffi_spec));
DECLARE_LOCAL (param);
Schema_From_Block_May_Fail(
ret_schema,
nullptr, // dummy (return/output has no arg to typecheck)
block,
nullptr // no symbol name
);
break; }
default:
fail (KNOWN(item));
}
break;
default:
fail (KNOWN(item));
}
}
REBARR *paramlist = Pop_Stack_Values_Core(
dsp_orig,
SERIES_MASK_PARAMLIST | NODE_FLAG_MANAGED
);
// Now fill in the canon value of the paramlist so it is an actual REBACT
//
REBVAL *rootparam = RESET_CELL(
ARR_HEAD(paramlist),
REB_ACTION,
CELL_MASK_ACTION
);
Sync_Paramlist_Archetype(paramlist);
INIT_BINDING(rootparam, UNBOUND);
MISC_META_NODE(paramlist) = nullptr;
REBACT *action = Make_Action(
paramlist,
&Routine_Dispatcher,
nullptr, // no underlying action (use paramlist)
nullptr, // no specialization exemplar (or inherited exemplar)
IDX_ROUTINE_MAX // details array len
);
REBRIN *r = ACT_DETAILS(action);
Init_Integer(RIN_AT(r, IDX_ROUTINE_ABI), abi);
// Caller must update these in the returned function.
//
TRASH_CELL_IF_DEBUG(RIN_AT(r, IDX_ROUTINE_CFUNC));
TRASH_CELL_IF_DEBUG(RIN_AT(r, IDX_ROUTINE_CLOSURE));
TRASH_CELL_IF_DEBUG(RIN_AT(r, IDX_ROUTINE_ORIGIN)); // LIBRARY!/ACTION!
Move_Value(RIN_AT(r, IDX_ROUTINE_RET_SCHEMA), ret_schema);
DROP_GC_GUARD(ret_schema);
Init_Logic(RIN_AT(r, IDX_ROUTINE_IS_VARIADIC), is_variadic);
ASSERT_ARRAY(args_schemas);
Init_Block(RIN_AT(r, IDX_ROUTINE_ARG_SCHEMAS), args_schemas);
DROP_GC_GUARD(args_schemas);
if (RIN_IS_VARIADIC(r)) {
//
// Each individual call needs to use `ffi_prep_cif_var` to make the
// proper variadic CIF for that call.
//
Init_Blank(RIN_AT(r, IDX_ROUTINE_CIF));
Init_Blank(RIN_AT(r, IDX_ROUTINE_ARG_FFTYPES));
}
else {
// The same CIF can be used for every call of the routine if it is
// not variadic. The CIF must stay alive for the entire the lifetime
// of the args_fftypes, apparently.
//
ffi_cif *cif = ALLOC(ffi_cif);
ffi_type **args_fftypes;
if (num_fixed == 0)
args_fftypes = nullptr;
else
args_fftypes = ALLOC_N(ffi_type*, num_fixed);
REBLEN i;
for (i = 0; i < num_fixed; ++i)
args_fftypes[i] = SCHEMA_FFTYPE(RIN_ARG_SCHEMA(r, i));
if (
FFI_OK != ffi_prep_cif(
cif,
abi,
num_fixed,
IS_BLANK(RIN_RET_SCHEMA(r))
? &ffi_type_void
: SCHEMA_FFTYPE(RIN_RET_SCHEMA(r)),
args_fftypes // nullptr if 0 fixed args
)
){
fail ("FFI: Couldn't prep CIF");
}
Init_Handle_Cdata_Managed(
RIN_AT(r, IDX_ROUTINE_CIF),
cif,
sizeof(&cif),
&cleanup_cif
);
if (args_fftypes == nullptr)
Init_Blank(RIN_AT(r, IDX_ROUTINE_ARG_FFTYPES));
else
Init_Handle_Cdata_Managed(
RIN_AT(r, IDX_ROUTINE_ARG_FFTYPES),
args_fftypes,
num_fixed,
&cleanup_args_fftypes
); // lifetime must match cif lifetime
}
TERM_ARRAY_LEN(r, IDX_ROUTINE_MAX);
return action;
}
| 32.30622 | 80 | 0.587233 |
f72d2f11696b4bbb84057dfbbd8eb3af0f666aa4 | 1,831 | h | C | include/editor/iplugin.h | GarethNelson/ares | fb2b2d25f000a3e0aa974ff08a3f0ec8fc89845e | [
"MIT"
] | null | null | null | include/editor/iplugin.h | GarethNelson/ares | fb2b2d25f000a3e0aa974ff08a3f0ec8fc89845e | [
"MIT"
] | null | null | null | include/editor/iplugin.h | GarethNelson/ares | fb2b2d25f000a3e0aa974ff08a3f0ec8fc89845e | [
"MIT"
] | null | null | null | /*
The MIT License
Copyright (c) 2012 by Jorrit Tyberghein
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef __iplugin_h__
#define __iplugin_h__
#include "csutil/scf.h"
#include <wx/wx.h>
#include "editor/icommand.h"
struct iDynamicObject;
struct i3DView;
struct iAresEditor;
/**
* A plugin for the editor.
*/
struct iEditorPlugin : public virtual iBase
{
SCF_INTERFACE(iEditorPlugin,0,0,1);
/**
* Set the application.
*/
virtual void SetApplication (iAresEditor* app) = 0;
/**
* Set the wxWindow parent toplevel window.
*/
virtual void SetTopLevelParent (wxWindow* parent) = 0;
/**
* The name of this plugin.
*/
virtual const char* GetPluginName () const = 0;
/// After changing config settings, let the plugin read the config again.
virtual void ReadConfig () = 0;
};
#endif // __iplugin_h__
| 27.742424 | 77 | 0.753687 |
dda87bb87750c8646d38c6cb17ddaf3dea675cb9 | 1,552 | h | C | tree.h | bl0ckeduser/easyderivsteps | 7c19e9f03c3f980bfa04abd3d8bb0173736befb1 | [
"MIT"
] | 22 | 2016-09-24T21:58:14.000Z | 2021-03-31T16:35:10.000Z | tree.h | bl0ckeduser/easyderivsteps | 7c19e9f03c3f980bfa04abd3d8bb0173736befb1 | [
"MIT"
] | null | null | null | tree.h | bl0ckeduser/easyderivsteps | 7c19e9f03c3f980bfa04abd3d8bb0173736befb1 | [
"MIT"
] | null | null | null | #ifndef TREE_H
#define TREE_H
#include <stdlib.h>
#include "tokenizer.h"
enum { /* head_type */
BLOCK = 0,
ADD,
SUB,
MULT,
DIV,
ASGN,
IF,
WHILE,
NUMBER,
VARIABLE,
GT,
LT,
GTE,
LTE,
EQL,
NEQL,
INT_DECL,
BPF_INSTR,
NEGATIVE,
INC,
DEC,
POST_INC,
POST_DEC,
LABEL,
GOTO,
ARRAY,
ARRAY_DECL,
ARG_LIST,
PROC,
RET,
FUNC,
SYMBOL,
MATCH_NUM,
MATCH_VAR,
MATCH_IND,
MATCH_CONT,
MATCH_FUNC,
MATCH_CONTX,
MATCH_NAN,
MATCH_IND_SYM,
EXP,
/* special */
NULL_TREE
};
static char* tree_nam[] = {
"BLOCK",
"ADD",
"SUB",
"MULT",
"DIV",
"ASGN",
"IF",
"WHILE",
"NUMBER",
"VARIABLE",
"GT",
"LT",
"GTE",
"LTE",
"EQL",
"NEQL",
"INT_DECL",
"BPF_INSTR",
"NEGATIVE",
"INC",
"DEC",
"POST_INC",
"POST_DEC",
"LABEL",
"GOTO",
"ARRAY",
"ARRAY_DECL",
"ARG_LIST",
"PROC",
"RET",
"FUNC",
"SYMBOL",
"MATCH_NUM",
"MATCH_VAR",
"MATCH_IND",
"MATCH_CONT",
"MATCH_FUNC",
"MATCH_CONTX",
"MATCH_NAN",
"MATCH_IND_SYM",
"EXP",
"NULL_TREE"
};
typedef struct exp_tree {
char head_type;
token_t* tok;
unsigned int child_count;
unsigned int child_alloc;
struct exp_tree **child;
int age;
} exp_tree_t;
static exp_tree_t null_tree = { NULL_TREE, NULL, 0, 0, NULL };
extern void add_child(exp_tree_t *dest, exp_tree_t* src);
extern exp_tree_t new_exp_tree(unsigned int type, token_t* tok);
extern int valid_tree(exp_tree_t et);
extern exp_tree_t *alloc_exptree(exp_tree_t et);
extern void printout_tree(exp_tree_t et);
extern exp_tree_t* copy_tree(exp_tree_t *);
extern int is_special_tree(int ht);
#endif
| 13.042017 | 64 | 0.664948 |
f582483ce704076cda960d80ca029114c99ce199 | 656 | c | C | vm/os-genunix.c | mecon/factor | 28a1573d8e2f67a47a2bc4358c00a2766d3e33d2 | [
"BSD-2-Clause"
] | 5 | 2015-03-10T12:59:52.000Z | 2019-05-10T03:22:36.000Z | vm/os-genunix.c | glguy/factor | 8ace93a75f9c62cc78b9569a6656724333589944 | [
"BSD-2-Clause"
] | null | null | null | vm/os-genunix.c | glguy/factor | 8ace93a75f9c62cc78b9569a6656724333589944 | [
"BSD-2-Clause"
] | 1 | 2022-02-14T09:44:23.000Z | 2022-02-14T09:44:23.000Z | #include "master.h"
void c_to_factor_toplevel(CELL quot)
{
c_to_factor(quot);
}
void init_signals(void)
{
unix_init_signals();
}
void early_init(void) { }
#define SUFFIX ".image"
#define SUFFIX_LEN 6
const char *default_image_path(void)
{
const char *path = vm_executable_path();
if(!path)
return "factor.image";
/* We can't call strlen() here because with gcc 4.1.2 this
causes an internal compiler error. */
int len = 0;
const char *iter = path;
while(*iter) { len++; iter++; }
char *new_path = safe_malloc(PATH_MAX + SUFFIX_LEN + 1);
memcpy(new_path,path,len + 1);
memcpy(new_path + len,SUFFIX,SUFFIX_LEN + 1);
return new_path;
}
| 18.222222 | 59 | 0.696646 |
91df523a6df0d676836229fff93c4b82137e83f8 | 56 | h | C | Configuration_adv.h | jefbed/marlin_tiny_configuration | 5810051ed2fffebf7ebe05222adfaaf6a7abbd31 | [
"MIT"
] | 1 | 2020-03-05T04:07:53.000Z | 2020-03-05T04:07:53.000Z | Configuration_adv.h | jefbed/marlin_tiny_configuration | 5810051ed2fffebf7ebe05222adfaaf6a7abbd31 | [
"MIT"
] | null | null | null | Configuration_adv.h | jefbed/marlin_tiny_configuration | 5810051ed2fffebf7ebe05222adfaaf6a7abbd31 | [
"MIT"
] | null | null | null | #pragma once
#define CONFIGURATION_ADV_H_VERSION 010109
| 18.666667 | 42 | 0.875 |
8789139715e120294cb831ff034e338bec448391 | 2,250 | h | C | ios/Atom/FLWebViewProvider.h | kumarparth380/react-native-atom-payment | 9bbb44488825d741db81c7aef6d71e0b72a917ad | [
"MIT"
] | null | null | null | ios/Atom/FLWebViewProvider.h | kumarparth380/react-native-atom-payment | 9bbb44488825d741db81c7aef6d71e0b72a917ad | [
"MIT"
] | null | null | null | ios/Atom/FLWebViewProvider.h | kumarparth380/react-native-atom-payment | 9bbb44488825d741db81c7aef6d71e0b72a917ad | [
"MIT"
] | null | null | null | //
// FLWebViewProvider.h
// FLWebView
//
// Created by Steve Richey on 11/21/14.
// Copyright (c) 2014 Float Mobile Learning. Shared under an MIT license. See license.md for details.
//
#import <Foundation/Foundation.h>
/*
* This class defines methods that FLUIWebView and FLWKWebView should implement in
* order to work within our ViewController.
*/
@protocol FLWebViewProvider <NSObject>
/*
* Return the active NSURLRequest of this webview.
* The methodology is a bit different between UIWebView and WKWebView.
* Defining it here one way helps to ensure we'll implement it in the same way in our categories.
*/
@property (nonatomic, strong) NSURLRequest *request;
/*
* Returns the active NSURL. Again, this is a bit different between the two web views.
*/
@property (nonatomic, strong) NSURL *URL;
/*
* Assign a delegate view for this webview.
*/
- (void) setDelegateViews: (id) delegateView;
/*
* Load an NSURLRequest in the active webview.
*/
- (void) loadRequest: (NSURLRequest *) request;
/*
* Convenience method to load a request from a string.
*/
- (void) loadRequestFromString: (NSString *) urlNameAsString;
/*
* Returns true if it is possible to go back, false otherwise.
*/
- (BOOL) canGoBack;
/*
* UIWebView has stringByEvaluatingJavaScriptFromString, which is synchronous.
* WKWebView has evaluateJavaScript, which is asynchronous.
* Since it's far easier to implement the latter in UIWebView, we define it here and do that.
*/
- (NSString *) evaluateJavaScript: (NSString *) javaScriptString completionHandler: (void (^)(NSString *, NSError *)) completionHandler;
- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler;
- (void)webView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL result))completionHandler ;
- (void)webView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(nullable NSString *)defaultText initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSString * __nullable result))completionHandler ;
@end
| 33.58209 | 254 | 0.758222 |
0ce735df937bcd9916fbf30cfc436f9524d6e24c | 1,472 | c | C | dspkit/src/backend/btn_debounce/btn_debounce.c | mrztti/asp1 | 53edce29bf1d5a9f1b825376541048bbd4300829 | [
"MIT"
] | null | null | null | dspkit/src/backend/btn_debounce/btn_debounce.c | mrztti/asp1 | 53edce29bf1d5a9f1b825376541048bbd4300829 | [
"MIT"
] | null | null | null | dspkit/src/backend/btn_debounce/btn_debounce.c | mrztti/asp1 | 53edce29bf1d5a9f1b825376541048bbd4300829 | [
"MIT"
] | null | null | null | #include "btn_debounce.h"
#include <stddef.h>
void btn_debounce_init(struct btn_debounce_s * const btn){
BTN_DEBOUNCE_ATOMIC( \
btn->btn_state = btn_debounce_state_undefined; \
btn->integrator = btn->int_top; \
);
}
void btn_debounce_idle(struct btn_debounce_s * const btn, const bool rawstate){
bool newstate = false;
bool newstate_val;
BTN_DEBOUNCE_ATOMIC( \
if(rawstate){ \
if(btn->integrator < btn->int_top){ \
btn->integrator++; \
if(btn->integrator == btn->int_top){ \
if(btn->btn_state == btn_debounce_state_false){ \
newstate = true; \
newstate_val = true; \
} \
btn->btn_state = btn_debounce_state_true; \
} \
} \
}else{ \
if(btn->integrator){ \
btn->integrator--; \
if(btn->integrator == 0){ \
if(btn->btn_state == btn_debounce_state_true){ \
newstate = true; \
newstate_val = false; \
} \
btn->btn_state = btn_debounce_state_false; \
} \
} \
} \
);
if(btn->new_state_fun != NULL && newstate){
btn->new_state_fun(newstate_val, btn);
}
}
enum btn_debounce_state_e btn_debounce_get_state(struct btn_debounce_s * const btn){
enum btn_debounce_state_e retval;
BTN_DEBOUNCE_ATOMIC(retval = btn->btn_state);
return retval;
}
| 28.862745 | 84 | 0.557745 |
f0c631dd5c5369d4baa0e00eec244acb5b6d2374 | 4,890 | h | C | third_party/blink/renderer/core/paint/link_highlight_impl.h | zipated/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 2,151 | 2020-04-18T07:31:17.000Z | 2022-03-31T08:39:18.000Z | third_party/blink/renderer/core/paint/link_highlight_impl.h | cangulcan/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 395 | 2020-04-18T08:22:18.000Z | 2021-12-08T13:04:49.000Z | third_party/blink/renderer/core/paint/link_highlight_impl.h | cangulcan/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 338 | 2020-04-18T08:03:10.000Z | 2022-03-29T12:33:22.000Z | /*
* Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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.
*/
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_LINK_HIGHLIGHT_IMPL_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_LINK_HIGHLIGHT_IMPL_H_
#include <memory>
#include "cc/layers/content_layer_client.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/platform/animation/compositor_animation.h"
#include "third_party/blink/renderer/platform/animation/compositor_animation_client.h"
#include "third_party/blink/renderer/platform/animation/compositor_animation_delegate.h"
#include "third_party/blink/renderer/platform/graphics/compositor_element_id.h"
#include "third_party/blink/renderer/platform/graphics/link_highlight.h"
#include "third_party/blink/renderer/platform/graphics/path.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/wtf/forward.h"
namespace cc {
class Layer;
class PictureLayer;
}
namespace blink {
class GraphicsLayer;
class LayoutBoxModelObject;
class Node;
class WebViewImpl;
class CORE_EXPORT LinkHighlightImpl final : public LinkHighlight,
public cc::ContentLayerClient,
public CompositorAnimationDelegate,
public CompositorAnimationClient {
public:
static std::unique_ptr<LinkHighlightImpl> Create(Node*, WebViewImpl*);
~LinkHighlightImpl() override;
cc::PictureLayer* ContentLayer();
cc::Layer* ClipLayer();
void StartHighlightAnimationIfNeeded();
void UpdateGeometry();
// cc::ContentLayerClient implementation.
gfx::Rect PaintableRegion() override;
scoped_refptr<cc::DisplayItemList> PaintContentsToDisplayList(
PaintingControlSetting painting_control) override;
bool FillsBoundsCompletely() const override { return false; }
size_t GetApproximateUnsharedMemoryUsage() const override { return 0; }
// CompositorAnimationDelegate implementation.
void NotifyAnimationStarted(double monotonic_time, int group) override;
void NotifyAnimationFinished(double monotonic_time, int group) override;
void NotifyAnimationAborted(double monotonic_time, int group) override {}
// LinkHighlight implementation.
void Invalidate() override;
cc::Layer* Layer() override;
void ClearCurrentGraphicsLayer() override;
// CompositorAnimationClient implementation.
CompositorAnimation* GetCompositorAnimation() const override;
GraphicsLayer* CurrentGraphicsLayerForTesting() const {
return current_graphics_layer_;
}
private:
LinkHighlightImpl(Node*, WebViewImpl*);
void ReleaseResources();
void ComputeQuads(const Node&, Vector<FloatQuad>&) const;
void AttachLinkHighlightToCompositingLayer(
const LayoutBoxModelObject& paint_invalidation_container);
void ClearGraphicsLayerLinkHighlightPointer();
// This function computes the highlight path, and returns true if it has
// changed size since the last call to this function.
bool ComputeHighlightLayerPathAndPosition(const LayoutBoxModelObject&);
scoped_refptr<cc::PictureLayer> content_layer_;
scoped_refptr<cc::Layer> clip_layer_;
Path path_;
Persistent<Node> node_;
WebViewImpl* owning_web_view_;
GraphicsLayer* current_graphics_layer_;
bool is_scrolling_graphics_layer_;
std::unique_ptr<CompositorAnimation> compositor_animation_;
bool geometry_needs_update_;
bool is_animating_;
double start_time_;
UniqueObjectId unique_id_;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_LINK_HIGHLIGHT_IMPL_H_
| 39.756098 | 88 | 0.778528 |
093fe140b0aab4dbc7847841fce71ec5af95f200 | 3,320 | c | C | layouts/community/ortho_4x12/guidoism/keymap.c | crisalm29/niu-mini-layout | d71b92928c643aeb6efcf88fe37dac7fbd44ed68 | [
"MIT"
] | 2 | 2019-05-13T05:19:02.000Z | 2021-11-29T09:07:43.000Z | layouts/community/ortho_4x12/guidoism/keymap.c | crisalm29/niu-mini-layout | d71b92928c643aeb6efcf88fe37dac7fbd44ed68 | [
"MIT"
] | null | null | null | layouts/community/ortho_4x12/guidoism/keymap.c | crisalm29/niu-mini-layout | d71b92928c643aeb6efcf88fe37dac7fbd44ed68 | [
"MIT"
] | null | null | null | #include QMK_KEYBOARD_H
#include "action_layer.h"
#include "eeconfig.h"
extern keymap_config_t keymap_config;
enum planck_layers {
_QWERTY,
_LOWER,
_RAISE,
_MOVEMENT,
_NUMPAD,
};
enum planck_keycodes {
QWERTY = SAFE_RANGE,
LOWER,
RAISE,
MOVEMENT,
NUMPAD,
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT_planck_mit(
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
LCTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_COLN, KC_ENT,
LSFT_T(KC_CAPS), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_NO,
MOVEMENT, KC_NO, KC_LALT, KC_LGUI, LOWER, LSFT_T(KC_SPC), RAISE, KC_RGUI, KC_RALT, KC_SCLN, KC_NO),
[_LOWER] = LAYOUT_planck_mit(
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_NO, KC_NO, KC_UNDO,
KC_TRNS, KC_NO, KC_CUT, KC_COPY, KC_PSTE, KC_NO, KC_NO, KC_UNDS, KC_PLUS, KC_DQUO, KC_QUOT, KC_PIPE,
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY),
[_RAISE] = LAYOUT_planck_mit(
KC_GRV, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, KC_P0, KC_TRNS,
KC_TRNS, KC_LBRC, KC_RBRC, KC_LPRN, KC_RPRN, KC_NO, KC_NO, KC_PMNS, KC_PEQL, KC_NO, KC_NO, KC_BSLS,
KC_TRNS, KC_LT, KC_GT, KC_LCBR, KC_RCBR, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
[_MOVEMENT] = LAYOUT_planck_mit(
RESET, DEBUG, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_PGUP, KC_UP, KC_PGDN, KC_NO, KC_TRNS,
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_LEFT, KC_DOWN, KC_RGHT, KC_NO, KC_TRNS,
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_HOME, KC_NO, KC_END, KC_NO, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
[_NUMPAD] = LAYOUT_planck_mit(
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_P7, KC_P8, KC_P9, KC_PSLS, KC_TRNS,
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_P4, KC_P5, KC_P6, KC_PAST, KC_TRNS,
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_P1, KC_P2, KC_P3, KC_PMNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PCMM, KC_P0, KC_PDOT, KC_PPLS, KC_TRNS)
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
set_single_persistent_default_layer(_QWERTY);
}
return false;
break;
case LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
update_tri_layer(_LOWER, _MOVEMENT, _NUMPAD);
} else {
layer_off(_LOWER);
update_tri_layer(_LOWER, _MOVEMENT, _NUMPAD);
}
return false;
break;
case RAISE:
if (record->event.pressed) {
layer_on(_RAISE);
} else {
layer_off(_RAISE);
}
return false;
break;
case MOVEMENT:
if (record->event.pressed) {
layer_on(_MOVEMENT);
update_tri_layer(_LOWER, _MOVEMENT, _NUMPAD);
} else {
layer_off(_MOVEMENT);
update_tri_layer(_LOWER, _MOVEMENT, _NUMPAD);
}
return false;
break;
}
return true;
}
| 34.226804 | 100 | 0.698494 |
51d0aee01e27be7af0c1f17da38fa56efcd29ada | 17,256 | c | C | private/net/sockets/winsock2/wsp/ws2map/startup.c | King0987654/windows2000 | 01f9c2e62c4289194e33244aade34b7d19e7c9b8 | [
"MIT"
] | 11 | 2017-09-02T11:27:08.000Z | 2022-01-02T15:25:24.000Z | private/net/sockets/winsock2/wsp/ws2map/startup.c | King0987654/windows2000 | 01f9c2e62c4289194e33244aade34b7d19e7c9b8 | [
"MIT"
] | null | null | null | private/net/sockets/winsock2/wsp/ws2map/startup.c | King0987654/windows2000 | 01f9c2e62c4289194e33244aade34b7d19e7c9b8 | [
"MIT"
] | 14 | 2019-01-16T01:01:23.000Z | 2022-02-20T15:54:27.000Z | /*++
Copyright (c) 1996 Microsoft Corporation
Module Name:
startup.c
Abstract:
This module contains the startup code for the Winsock 2 to
Winsock 1.1 Mapper Service Provider.
The following routines are exported by this module:
WSPStartup()
WSPCleanup()
Author:
Keith Moore (keithmo) 29-May-1996
Revision History:
--*/
#include "precomp.h"
#pragma hdrstop
//
// Our version number.
//
#define SPI_VERSION MAKEWORD( 2, 2 )
//
// Public functions.
//
INT
WSPAPI
WSPStartup(
IN WORD wVersionRequested,
OUT LPWSPDATA lpWSPData,
IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
IN WSPUPCALLTABLE UpcallTable,
OUT LPWSPPROC_TABLE lpProcTable
)
/*++
Routine Description:
This routine MUST be the first WinSock SPI function called by a WinSock
SPI client on a per-process basis. It allows the client to specify the
version of WinSock SPI required and to provide its upcall dispatch table.
All upcalls, i.e., functions prefixed with WPU, made by the WinSock
service provider are invoked via the client's upcall dispatch table.
This routine also allows the client to retrieve details of the specific
WinSock service provider implementation. The WinSock SPI client may only
issue further WinSock SPI functions after a successful WSPStartup()
invocation. A table of pointers to the rest of the SPI functions is
retrieved via the lpProcTable parameter.
In order to support future versions of the WinSock SPI and the WinSock 2
DLL which may have functionality differences from the current WinSock SPI,
a negotiation takes place in WSPStartup(). The caller of WSPStartup()
(either the WinSock 2 DLL or a layered protocol) and the WinSock service
provider indicate to each other the highest version that they can support,
and each confirms that the other's highest version is acceptable. Upon
entry to WSPStartup(), the WinSock service provider examines the version
requested by the client. If this version is equal to or higher than the
lowest version supported by the service provider, the call succeeds and
the service provider returns in wHighVersion the highest version it
supports and in wVersion the minimum of its high version and
wVersionRequested. The WinSock service provider then assumes that the
WinSock SPI client will use wVersion. If the wVersion field of the WSPDATA
structure is unacceptable to the caller, it should call WSPCleanup() and
either search for another WinSock service provider or fail to initialize.
This negotiation allows both a WinSock service provider and a WinSock SPI
client to support a range of WinSock versions. A client can successfully
utilize a WinSock service provider if there is any overlap in the version
ranges. The following chart gives examples of how WSPStartup() works in
conjunction with different WinSock DLL and WinSock service provider (SP)
versions:
DLL SP wVersion- wVersion wHigh- End
Version Version Requested Version Result
~~~~~~~ ~~~~~~~ ~~~~~~~~~ ~~~~~~~~ ~~~~~~~ ~~~~~~
1.1 1.1 1.1 1.1 1.1 use 1.1
1.0 1.1 1.0 1.1 1.0 1.0 use 1.0
1.0 1.0 1.1 1.0 1.0 1.1 use 1.0
1.1 1.0 1.1 1.1 1.1 1.1 use 1.1
1.1 1.0 1.1 1.0 1.0 DLL fails
1.0 1.1 1.0 --- --- WSAVERNOTSUPPORTED
1.0 1.1 1.0 1.1 1.1 1.1 1.1 use 1.1
1.1 2.0 1.1 2.0 1.1 1.1 use 1.1
2.0 2.0 2.0 2.0 2.0 use 2.0
The following code fragment demonstrates how a WinSock SPI client which
supports only version 2.0 of WinSock SPI makes a WSPStartup() call:
WORD wVersionRequested;
WSPDATA WSPData;
int err;
WSPUPCALLTABLE upcallTable =
{
// initialize upcallTable with function pointers
};
LPWSPPROC_TABLE lpProcTable =
{
// allocate memory for the ProcTable
};
wVersionRequested = MAKEWORD( 2, 0 );
err = WSPStartup( wVersionRequested, &WSPData,
lpProtocolBuffer, upcallTable, lpProcTable );
if ( err != 0 ) {
// Tell the user that we couldn't find a useable
// WinSock service provider.
return;
}
// Confirm that the WinSock service provider supports 2.0.
// Note that if the service provider supports versions
// greater than 2.0 in addition to 2.0, it will still
// return 2.0 in wVersion since that is the version we
// requested.
if ( LOBYTE( WSPData.wVersion ) != 2 ||
HIBYTE( WSPData.wVersion ) != 0 ) {
// Tell the user that we couldn't find a useable
// WinSock service provider.
WSPCleanup( );
return;
}
// The WinSock service provider is acceptable. Proceed.
And this code fragment demonstrates how a WinSock service provider which
supports only version 2.0 performs the WSPStartup() negotiation:
// Make sure that the version requested is >= 2.0.
// The low byte is the major version and the high
// byte is the minor version.
if ( LOBYTE( wVersionRequested ) < 2) {
return WSAVERNOTSUPPORTED;
}
// Since we only support 2.0, set both wVersion and
// wHighVersion to 2.0.
lpWSPData->wVersion = MAKEWORD( 2, 0 );
lpWSPData->wHighVersion = MAKEWORD( 2, 0 );
Once the WinSock SPI client has made a successful WSPStartup() call, it
may proceed to make other WinSock SPI calls as needed. When it has
finished using the services of the WinSock service provider, the client
must call WSPCleanup() in order to allow the WinSock service provider to
free any resources allocated for the client.
Details of how WinSock service provider information is encoded in the
WSPData structure is as follows:
typedef struct WSPData {
WORD wVersion;
WORD wHighVersion;
char szDescription[WSPDESCRIPTION_LEN+1];
} WSPDATA, FAR * LPWSPDATA;
The members of this structure are:
wVersion- The version of the WinSock SPI specification that the
WinSock service provider expects the caller to use.
wHighVersion - The highest version of the WinSock SPI specification
that this service provider can support (also encoded as above).
Normally this will be the same as wVersion.
szDescription - A null-terminated ASCII string into which the
WinSock provider copies a description of itself. The text
(up to 256 characters in length) may contain any characters
except control and formatting characters: the most likely use
that a SPI client will put this to is to display it (possibly
truncated) in a status message.
A WinSock SPI client may call WSPStartup() more than once if it needs to
obtain the WSPData structure information more than once. On each such
call the client may specify any version number supported by the provider.
There must be one WSPCleanup() call corresponding to every successful
WSPStartup() call to allow third-party DLLs to make use of a WinSock
provider. This means, for example, that if WSPStartup() is called three
times, the corresponding call to WSPCleanup() must occur three times.
The first two calls to WSPCleanup() do nothing except decrement an
internal counter; the final WSPCleanup() call does all necessary resource
deallocation.
Arguments:
wVersionRequested - The highest version of WinSock SPI support that the
caller can use. The high order byte specifies the minor version
(revision) number; the low-order byte specifies the major version
number.
lpWSPData - A pointer to the WSPDATA data structure that is to receive
details of the WinSock service provider.
lpProtocolInfo - A pointer to a WSAPROTOCOL_INFOW struct that defines the
characteristics of the desired protocol. This is especially useful
when a single provider DLL is capable of instantiating multiple
different service providers..
UpcallTable - The WinSock 2 DLL's upcall dispatch table.
lpProcTable - A pointer to the table of SPI function pointers.
Return Value:
WSPStartup() returns zero if successful. Otherwise it returns an error
code.
--*/
{
int err;
SOCK_ENTER( "WSPStartup", (PVOID)wVersionRequested, lpWSPData, (PVOID)&UpcallTable, NULL );
SOCK_ASSERT( lpWSPData != NULL );
err = SockEnterApi( FALSE, TRUE );
if( err != NO_ERROR ) {
SOCK_EXIT( "WSPStartup", err, &err );
return err;
}
//
// Check the version number.
//
if ( SockWspStartupCount == 0 &&
wVersionRequested != SPI_VERSION ) {
err = WSAVERNOTSUPPORTED;
SOCK_EXIT( "WSPStartup", WSAVERNOTSUPPORTED, &err );
return err;
}
//
// Remember that the app has called WSPStartup.
//
InterlockedIncrement( &SockWspStartupCount );
//
// Fill in the WSPData structure.
//
lpWSPData->wVersion = SPI_VERSION;
lpWSPData->wHighVersion = SPI_VERSION;
wcscpy(
lpWSPData->szDescription,
L"Microsoft Windows Sockets 2 to 1.1 Mapper."
);
//
// Save the upcall table.
//
SockUpcallTable = UpcallTable;
//
// Return our proc table to the DLL.
//
*lpProcTable = SockProcTable;
//
// Cleanup & exit.
//
SockTerminating = FALSE;
SOCK_EXIT( "WSPStartup", NO_ERROR, NULL );
return NO_ERROR;
} // WSPStartup
INT
WSPAPI
WSPCleanup(
OUT LPINT lpErrno
)
/*++
Routine Description:
The WinSock 2 SPI client is required to perform a successful WSPStartup()
call before it can use WinSock service providers. When it has completed
the use of WinSock service providers, the SPI client will call
WSPCleanup() to deregister itself from a WinSock service provider and
allow the service provider to free any resources allocated on behalf of
the WinSock 2 client. It is permissible for SPI clients to make more than
one WSPStartup() call. For each WSPStartup() call a corresponding
WSPCleanup() call will also be issued. Only the final WSPCleanup() for
the service provider does the actual cleanup; the preceding calls simply
decrement an internal reference count in the WinSock service provider.
When the internal reference count reaches zero and actual cleanup
operations commence, any pending blocking or asynchronous calls issued by
any thread in this process are canceled without posting any notification
messages or signaling any event objects. Any pending overlapped send and
receive operations (WSPSend()/WSPSendTo()/WSPRecv()/WSPRecvFrom() with an
overlapped socket) issued by any thread in this process are also canceled
without setting the event object or invoking the completion routine, if
specified. In this case, the pending overlapped operations fail with the
error status WSA_OPERATION_ABORTED. Any sockets open when WSPCleanup() is
called are reset and automatically deallocated as if WSPClosesocket() was
called; sockets which have been closed with WSPCloseSocket() but which
still have pending data to be sent are not affected--the pending data is
still sent.
This routine should not return until the service provider DLL is
prepared to be unloaded from memory. In particular, any data remaining
to be transmitted must either already have been sent or be queued for
transmission by portions of the transport stack that will not be unloaded
from memory along with the service provider's DLL.
A WinSock service provider must be prepared to deal with a process which
terminates without invoking WSPCleanup() - for example, as a result of an
error. A WinSock service provider must ensure that WSPCleanup() leaves
things in a state in which the WinSock 2 DLL can immediately invoke
WSPStartup() to re-establish WinSock usage.
Arguments:
lpErrno - A pointer to the error code.
Return Value:
The return value is 0 if the operation has been successfully initiated.
Otherwise the value SOCKET_ERROR is returned, and a specific error
number is available in lpErrno.
--*/
{
PSOCKET_INFORMATION socketInfo;
LINGER lingerInfo;
PLIST_ENTRY listEntry;
LONG startupCount;
INT err;
BOOL globalLockHeld;
SOCK_ENTER( "WSPCleanup", NULL, NULL, NULL, NULL );
SOCK_ASSERT( lpErrno != NULL );
err = SockEnterApi( TRUE, FALSE );
if( err != NO_ERROR ) {
*lpErrno = err;
SOCK_EXIT( "WSPCleanup", SOCKET_ERROR, lpErrno );
return SOCKET_ERROR;
}
//
// Decrement the reference count.
//
startupCount = InterlockedDecrement( &SockWspStartupCount );
//
// If the count of calls to WSPStartup() is not 0, we shouldn't do
// cleanup yet. Just return.
//
if( startupCount != 0 ) {
IF_DEBUG(MISC) {
SOCK_PRINT(( "Leaving WSPCleanup().\n" ));
}
SOCK_EXIT( "WSPCleanup", NO_ERROR, NULL );
return NO_ERROR;
}
//
// Indicate that the DLL is no longer initialized. This will
// result in all open sockets being abortively disconnected.
//
SockTerminating = TRUE;;
//
// Close each open socket. We loop looking for open sockets until
// all sockets are either off the list of in the closing state.
//
SockAcquireGlobalLock();
globalLockHeld = TRUE;
try {
for( listEntry = SockGlobalSocketListHead.Flink ;
listEntry != &SockGlobalSocketListHead ; ) {
SOCKET socketHandle;
int errTmp;
socketInfo = CONTAINING_RECORD(
listEntry,
SOCKET_INFORMATION,
SocketListEntry
);
//
// If this socket is about to close, go on to the next socket.
//
if( socketInfo->State == SocketStateClosing ) {
listEntry = listEntry->Flink;
continue;
}
//
// Pull the handle into a local in case another thread closes
// this socket just as we are trying to close it.
//
socketHandle = socketInfo->WS2Handle;
//
// Release the global lock so that we don't cause a deadlock
// from out-of-order lock acquisitions.
//
SockReleaseGlobalLock();
globalLockHeld = FALSE;
//
// Set each socket to linger for 0 seconds. This will cause
// the connection to reset, if appropriate, when we close the
// socket. If the setsockopt() fails, press on regardless.
//
lingerInfo.l_onoff = 1;
lingerInfo.l_linger = 0;
WSPSetSockOpt(
socketHandle,
SOL_SOCKET,
SO_LINGER,
(char *)&lingerInfo,
sizeof(lingerInfo),
&errTmp
);
//
// Perform the actual close of the socket.
//
WSPCloseSocket( socketHandle, &errTmp );
SockAcquireGlobalLock();
globalLockHeld = TRUE;
//
// Restart the search from the beginning of the list. We cannot
// use listEntry->Flink because the socket that is pointed to by
// listEntry may have been freed.
//
listEntry = SockGlobalSocketListHead.Flink;
}
} except( SOCK_EXCEPTION_FILTER() ) {
NOTHING;
}
if( globalLockHeld ) {
SockReleaseGlobalLock();
}
//
// Free hooker info structures.
//
SockFreeAllHookers();
IF_DEBUG(MISC) {
SOCK_PRINT(( "Leaving WSPCleanup().\n" ));
}
SOCK_EXIT( "WSPCleanup", NO_ERROR, NULL );
return NO_ERROR;
} // WSPCleanup
| 32.254206 | 96 | 0.614105 |
4edcae646b3dbe247e09bf099422d79da62df705 | 1,421 | h | C | XenoEngine/Code/Core/Assert.h | benjaminmao123/XenoEngine | e20f1cbab3dc199732fba468d26b1357e2741e2a | [
"MIT"
] | 1 | 2021-04-11T10:58:26.000Z | 2021-04-11T10:58:26.000Z | XenoEngine/Code/Core/Assert.h | benjaminmao123/XenoEngine | e20f1cbab3dc199732fba468d26b1357e2741e2a | [
"MIT"
] | null | null | null | XenoEngine/Code/Core/Assert.h | benjaminmao123/XenoEngine | e20f1cbab3dc199732fba468d26b1357e2741e2a | [
"MIT"
] | null | null | null | #pragma once
#include "Core/Core.h"
#include "Core/Logger.h"
#include <filesystem>
#ifdef XN_ENABLE_ASSERTS
// Alteratively we could use the same "default" message for both "WITH_MSG" and "NO_MSG" and
// provide support for custom formatting by concatenating the formatting string instead of having the format inside the default message
#define XN_INTERNAL_ASSERT_IMPL(type, check, msg, ...) { if(!(check)) { XN##type##ERROR(msg, __VA_ARGS__); XN_DEBUGBREAK(); } }
#define XN_INTERNAL_ASSERT_WITH_MSG(type, check, ...) XN_INTERNAL_ASSERT_IMPL(type, check, "Assertion failed: {0}", __VA_ARGS__)
#define XN_INTERNAL_ASSERT_NO_MSG(type, check) XN_INTERNAL_ASSERT_IMPL(type, check, "Assertion '{0}' failed at {1}:{2}", XN_STRINGIFY_MACRO(check), std::filesystem::path(__FILE__).filename().string(), __LINE__)
#define XN_INTERNAL_ASSERT_GET_MACRO_NAME(arg1, arg2, macro, ...) macro
#define XN_INTERNAL_ASSERT_GET_MACRO(...) XN_EXPAND_MACRO( XN_INTERNAL_ASSERT_GET_MACRO_NAME(__VA_ARGS__, XN_INTERNAL_ASSERT_WITH_MSG, XN_INTERNAL_ASSERT_NO_MSG) )
// Currently accepts at least the condition and one additional parameter (the message) being optional
#define XN_ASSERT(...) XN_EXPAND_MACRO( XN_INTERNAL_ASSERT_GET_MACRO(__VA_ARGS__)(_, __VA_ARGS__) )
#define XN_CORE_ASSERT(...) XN_EXPAND_MACRO( XN_INTERNAL_ASSERT_GET_MACRO(__VA_ARGS__)(_CORE_, __VA_ARGS__) )
#else
#define XN_ASSERT(...)
#define XN_CORE_ASSERT(...)
#endif | 59.208333 | 210 | 0.786066 |
9f613516256d15e12af8bf0ea63113562e811e82 | 870 | c | C | CoreText/stubs.c | mrolappe/darling-cocotron | d7cc4e3ff153f8986b911fbb0a7f7b9d6d74022c | [
"MIT"
] | 32 | 2018-01-17T16:25:13.000Z | 2021-12-04T20:28:31.000Z | CoreText/stubs.c | mrolappe/darling-cocotron | d7cc4e3ff153f8986b911fbb0a7f7b9d6d74022c | [
"MIT"
] | 11 | 2019-06-11T03:31:30.000Z | 2021-06-29T03:08:59.000Z | CoreText/stubs.c | mrolappe/darling-cocotron | d7cc4e3ff153f8986b911fbb0a7f7b9d6d74022c | [
"MIT"
] | 16 | 2019-06-11T01:49:14.000Z | 2021-06-29T03:10:59.000Z | #include <stdio.h>
void *CTFontCreateWithFontDescriptor(void) {
printf("STUB %s\n", __PRETTY_FUNCTION__);
return NULL;
}
void *CTFontDescriptorCreateWithAttributes(void) {
printf("STUB %s\n", __PRETTY_FUNCTION__);
return NULL;
}
void *CTFrameDraw(void) {
printf("STUB %s\n", __PRETTY_FUNCTION__);
return NULL;
}
void *CTFrameGetLines(void) {
printf("STUB %s\n", __PRETTY_FUNCTION__);
return NULL;
}
void *CTFramesetterCreateFrame(void) {
printf("STUB %s\n", __PRETTY_FUNCTION__);
return NULL;
}
void *CTFramesetterCreateWithAttributedString(void) {
printf("STUB %s\n", __PRETTY_FUNCTION__);
return NULL;
}
void *CTLineGetTypographicBounds(void) {
printf("STUB %s\n", __PRETTY_FUNCTION__);
return NULL;
}
void *CTParagraphStyleCreate(void) {
printf("STUB %s\n", __PRETTY_FUNCTION__);
return NULL;
}
| 20.714286 | 53 | 0.698851 |
7f077b70e978f38c1262020ac2122b8fe39d2e23 | 864 | h | C | 45/qb/hd/switch.h | minblock/msdos | 479ffd237d9bb7cc83cb06361db2c4ef42dfbac0 | [
"Apache-2.0"
] | null | null | null | 45/qb/hd/switch.h | minblock/msdos | 479ffd237d9bb7cc83cb06361db2c4ef42dfbac0 | [
"Apache-2.0"
] | null | null | null | 45/qb/hd/switch.h | minblock/msdos | 479ffd237d9bb7cc83cb06361db2c4ef42dfbac0 | [
"Apache-2.0"
] | null | null | null | /***
* switch.h
*
* Copyright <C> 1985, 1986, 1987 Microsoft Corporation
*
*******************************************************************************/
/*===========================================================================*/
/* This file is the first thing included by version.h. */
/*===========================================================================*/
#define ON (-1)
#define OFF 0
/*=============================================================*/
/* Switches specific to c source */
/* These switches are not in switch.inc */
/*=============================================================*/
#ifndef DEFINE_VARIABLES /* Allow to be defined previous to VERSION.H */
#define DEFINE_VARIABLES OFF /* ON - allocate global variables.*/
#endif
#define LINT_ARGS OFF /* ON - runtime lib arg types to be checked */
| 34.56 | 80 | 0.375 |
c33ef72d009955aa37696c042e7227c68493e9a5 | 80 | h | C | Kernel/include/idtLoader.h | shipupi/SO-TP2 | cbf02c621ca5b3e3a78a470efe5532e107b2b4cb | [
"BSD-3-Clause"
] | null | null | null | Kernel/include/idtLoader.h | shipupi/SO-TP2 | cbf02c621ca5b3e3a78a470efe5532e107b2b4cb | [
"BSD-3-Clause"
] | null | null | null | Kernel/include/idtLoader.h | shipupi/SO-TP2 | cbf02c621ca5b3e3a78a470efe5532e107b2b4cb | [
"BSD-3-Clause"
] | null | null | null | #ifndef IDTLOADER_H
#define IDTLOADER_H
void load_idt();
void reboot();
#endif | 11.428571 | 19 | 0.7625 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.