KlarnaHybridSDKEventListener
@objc
public protocol KlarnaHybridSDKEventListener : AnyObject
The merchant’s app can listen to Hybrid SDK events in the Hybrid SDK by implementing this protocol.
-
Event to notify the merchant app that the following web view will present content that should be displayed in a full-screen format.
Declaration
Swift
func klarnaHybridSDKWillShowFullscreen(inWebView webView: KlarnaWebView, completion: () -> Void)
Parameters
webView
Web view to be presented in fullscreen.
completion
A callback the merchant should use to let the Hybrid SDK know when any actions addressing this event are complete.
-
Event to notify the merchant app merchant that content that should be presented in full-screen has been displayed.
Declaration
Swift
func klarnaHybridSDKDidShowFullscreen(inWebView webView: KlarnaWebView, completion: () -> Void)
Parameters
webView
Web view that has presented full-screen content.
completion
A callback the merchant should use to let the Hybrid SDK know when any actions addressing this event are complete.
-
Event to notify the merchant’s app that the full-screen content in the following web view will be removed, and the
original
contents will be displayed.Declaration
Swift
func klarnaHybridSDKWillHideFullscreen(inWebView webView: KlarnaWebView, completion: () -> Void)
Parameters
webView
Web view to be restored to original presentation.
completion
A callback the merchant should use to let the Hybrid SDK know when any actions addressing this event are complete
-
Event to notify merchant that the full-screen content in the web view has been removed and it is now displaying
regular
content.Declaration
Swift
func klarnaHybridSDKDidHideFullscreen(inWebView webView: KlarnaWebView, completion: () -> Void)
Parameters
webView
Web View presenting original content.
completion
A callback the merchant should use to let the Hybrid SDK know when any actions addressing this event are complete
-
Event to notify merchant that an error occured during Hybrid SDK usage.
Declaration
Swift
func klarnaHybridSDKFailed(inWebView webView: KlarnaWebView, withError error: KlarnaMobileSDKError)
Parameters
webView
on which webview the failure happened.
error
detail error.


Dart is a general-purpose programming language originally developed by Google and later approved as a standard by Ecma (ECMA-408). It is used to build web, server, and mobile applications. Dart is an object-oriented, class defined, garbage-collected language using a C-style syntax. It supports interfaces, mixins, abstract classes, reified generics, static typing, and a sound type system. Developers at Google and elsewhere use Dart to create high-quality, mission-critical apps for iOS, Android, and the web. With features aimed at client-side development, Dart is a great fit for both mobile and web apps. Dart is free and open source, developed on GitHub.


Welcom to SBC channel..
SBC is shamikh Broadcasting channel, a publicly funded national broadcaster of the the Caribbean islands. SBC is an independent news organisation funded in part by the Caribbean government , the network challenged established narratives and gave a global audience an alternative voice, one that put the people back at the centre of the news agenda, and quickly made it one of the world’s most influential news networks.


Weather App
--
Temp: --
Wind: --
Humidity: --
UV Index:
--
5-Day Forecast
DATE
Temp:
Wind:
Humidity:
DATE
Temp:
Wind:
Humidity:
DATE
Temp:
Wind:
Humidity:
DATE
Temp:
Wind:
Humidity:
DATE
Temp:
Wind:
Humidity:


Adam Litke -<EMAIL_ADDRESS>Senior Software Engineer - Red Hat
August Penguin - 7.9.2017
My create volume
target: my-ceph-storage
operation: create_volume
params:
id: 80a690f4-9fb7-4615-bc83-709cfabb42a4
size: 1
Your create volume
target: your-netapp-storage
operation: create_volume
params:
id: 80a690f4-9fb7-4615-bc83-709cfabb42a4
size: 1
| cinder | |
| - | deployment complexity |
| - | vertical integration |
| + | active community |
| = | profit! |
ansible-galaxy install aglitke.quarry
A common API to perform a storage task
Storage type with a unique way of performing operations
A backend instance defined by configuration parameters
---
target_host: localhost
target_user:
backend: ceph
backend_config:
osd: <IP_ADDRESS>
id: admin
key: AQDfdKxYTCs0LSBAt08Qk23Z+ecgAAb2Je2YuA==
pool: volumes
---
- hosts: localhost
roles:
- aglitke.quarry
vars:
generate_only: false
generated_playbook: "/tmp/playbook.yml"
target: myceph
operation: create_volume
params:
id: 80a690f4-9fb7-4615-bc83-709cfabb42a4
size: 1
---
- include: check_vars.yml
- include: make_playbook.yml
when: generated_playbook is defined
- name: Run playbook
shell: ansible-playbook {{ generated_playbook }}
when:
- generated_playbook is defined
- not generate_only
- name: Checking that required playbook variables are set
fail: msg="Variable {{ item }} is not defined in the playbook"
with_items:
- target
- operation
- params
when: vars[item] is undefined
- name: Load target definition
include_vars:
file: "{{ target_definitions_dir }}/{{ target }}.yml"
- name: Checking that required target variables are set
fail: msg="Variable {{ item }} missing from the target definition {{ target }}"
with_items:
- target_host
- target_user
- backend
- backend_config
when: vars[item] is undefined
---
- name: Generate playbook
template:
src: "{{ playbook_templates_dir }}/\
{{ backend }}/{{ operation }}.yml.j2"
dest: "{{ generated_playbook }}"
- hosts: {{ target_host }}
remote_user: {{ target_user }}
tasks:
- name: Setup auth
copy:
content: "{{ backend_config.key }}"
dest: /tmp/quarry_ceph_key
- name: Create a volume
shell: >
rbd -m {{ backend_config.osd }}
--id {{ backend_config.id }}
--keyfile /tmp/quarry_ceph_key
-p {{ backend_config.pool }}
create {{ params.id }} --size {{ params.size }}
Just a playbook!
---
- hosts: localhost
roles:
- aglitke.quarry
vars:
generate_only: false
generated_playbook: "/tmp/playbook.yml"
target: myxtremio <== (change me) ==<
operation: create_volume
params:
id: 80a690f4-9fb7-4615-bc83-709cfabb42a4
size: 1
Title - August Penguin Date


One man dead and three seriously hurt in east London stabbing
by PA MediaPolice appeal for witnesses as two people arrested after incident in Whitechapel
A man has died and three have been injured after a stabbing in east London.
A man in his 20s died at the scene on Buckle Street, Whitechapel, the Metropolitan police said.
Three men with stab injuries were treated at the scene and taken to hospital.
Two people have been arrested on suspicion of grievous bodily harm and officers remain at the scene, having been called just before 9am on Saturday.
Police have asked anybody with any information, including pictures or video of the incident, to come forward.


Survey Form
Let us know how to improve FreeCodeCamp
*Name:
*Email:
*Age:
Which option best describes your current role?
Student
Full time job
Full time learner
Prefer not to say
Other
How likely is that you would recommend freeCodeCamp to a friend?
Definitely
Maybe
Not sure
What do you like most in FCC:
Select an Opinion
Challenges
Projects
Community
Open Source
Things that should be improved in the future (Check all that apply):
Front-end Projects
Back-end Projects
Data Visualization
Challenges
Open Source
Gitter help rooms
Videos
City Meetups
Wiki
Forum
Additional Courses
Any Comments or Suggestions?


Project Title
Website Sitemap — v1
Home
About
Careers
Giving
2013
2014
2015
Our Team
Peter Baumgartner
Yann Malet
Martin Mahner
Joni Trythall
Portfolio
Bank Project
Startup Project
Community Project
Services
Blog
Newsletter
Privacy
Terms & Conditions


Coding Quiz Challenge
Try to answer the following code-related questions within the time limit.
Keep in mind that incorrect answers will penalize your score/time by 10 seconds.
Try to answer the following code-related questions within the time limit.
Keep in mind that incorrect answers will penalize your score/time by 10 seconds.


|
Bug-reproducer Assistant Python kernel
1.0
Código Python de kernel del Bug-reproducer Assistant
|
Public Member Functions | |
| def | __init__ |
| def | enterBugReproducerAssistant_ |
| def | exitClass_ |
| def | exitFunction_ |
| def | getClasses |
| def | getFunctions |
Public Attributes | |
| classes_ | |
| functions_ | |
| functionAnnotationState_ | |
| classAnnotationState_ | |
| className_ |
"Line Processor" class that gets all the functions and classes for a file, and calculates their annotation state.
| def bug_reproducer_assistant::source_code_parser::GetClassesAndFunctionsLineProcessor::__init__ | ( | self, | |
| language | |||
| ) |
| self | The GetClassesAndFunctionsLineProcessor instance to construct. |
| language | The program's programming language. Constructor. |
Reimplemented from bug_reproducer_assistant::source_code_parser::LineProcessor.
| def bug_reproducer_assistant::source_code_parser::GetClassesAndFunctionsLineProcessor::enterBugReproducerAssistant_ | ( | self | ) |
| self | The GetClassesAndFunctionsLineProcessor instance. Enter a "Bug-reproducer Assistant" region. The current class or function is hence annotated -> upgrade its status. |
Reimplemented from bug_reproducer_assistant::source_code_parser::LineProcessor.
| def bug_reproducer_assistant::source_code_parser::GetClassesAndFunctionsLineProcessor::exitClass_ | ( | self | ) |
| self | The GetClassesAndFunctionsLineProcessor instance. Leave a class, and consolidate its annotation state. |
Reimplemented from bug_reproducer_assistant::source_code_parser::LineProcessor.
| def bug_reproducer_assistant::source_code_parser::GetClassesAndFunctionsLineProcessor::exitFunction_ | ( | self | ) |
| self | The GetClassesAndFunctionsLineProcessor instance. Leave a function, and consolidate its annotation state. |
Reimplemented from bug_reproducer_assistant::source_code_parser::LineProcessor.
| def bug_reproducer_assistant::source_code_parser::GetClassesAndFunctionsLineProcessor::getClasses | ( | self | ) |
| self | The GetClassesAndFunctionsLineProcessor instance. |
Return a list of tuples (class name, annotation state) for all classes in the file.
| def bug_reproducer_assistant::source_code_parser::GetClassesAndFunctionsLineProcessor::getFunctions | ( | self | ) |
| self | The GetClassesAndFunctionsLineProcessor instance. |
Return a list of tuples (function name, annotation state) for all global function in the file.


elm-sortable-table Examples
This directory contains the compiled examples from
billstclair/elm-sortable-table
.
U.S. Presidents by Birth Place
Travel Planner for the Mission District in San Francisco


{% include 'pinboard/includes/annual_bookmark_counts.html' with account=account only %}
{% include 'pinboard/includes/nav_tabs.html' with account=account active='toread' only %}
{% include 'pinboard/includes/bookmark_list.html' with bookmark_list=bookmark_list page_obj=page_obj perms=perms only %}


Statistics
Hey, {{ current_user.firstname }}!
Live Stats
{% for field in live_stats %}
{{field}}
{% endfor %}
Application Stats
{% for field in application_stats %}
{{field}}
{% endfor %}
Applicant Stats (Submitted Applications)
{% for field in applicant_stats %}
{{field}}
{% endfor %}
Application Review Stats (Hackers only)
{% for field in review_stats %}
{{field}}
{% endfor %}
Attending Stats
{% for type_account in rsvp_stats %}
{% endfor %}
{% for type_account in rsvp_stats %}
{% for field in rsvp_stats[type_account] %}
{{field}}
{% endfor %}
{% endfor %}


Home |
Resources |
About Us |
Get Your Score
KidsMath
The FUN Way to Learn Math!
Would you like a copy of your scores?


Objective C: Posting Foundation Objects with AFNetworking
The scenario was this. I had Objective C objects which I needed to parse as JSON, and send a POST request to a web server. At first, I used RestKit because that’s the framework that’s being used in the project, but that was giving issues, so I decided to strip it down a level, and use AFNetworking.  Here’s how I did it to anyone who may be in this position in future:
First of all, the here’s a simplified version of the piece of code that does the work. I’ll talk through it step by step:
NSMutableURLRequest *request = [self postRequestWithObject:objectToParse andPath:@"path/to/endpoint"];
AFHTTPRequestOperation *requestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
// What happens when it goes right }
failure:^(AFHTTPRequestOperation *operation, NSError *error) {
// What happens when it goes wrong
}];
[requestOperation start];
The first line calls a method which creates the request object based on the path to the endpoint. This method is as follows:
- (NSMutableURLRequest *)postRequestWithObject:(NSObject *)object andPath:(NSString *)path
{
NSString *baseUrl = @"www.codingafro.co/";
NSString *fullUrlString = [NSString stringWithFormat:@"%@%@", baseUrl, path];
NSURL *requestURL = [NSURL URLWithString:fullUrlString];
NSMutableURLRequest *request = [[NSURLRequest requestWithURL:requestURL] mutableCopy];
request.HTTPMethod = @"POST";
[request addValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request addValue:@"application/json" forHTTPHeaderField:@"Accept"];
NSError *error = nil;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:[object dictionaryOfProperties] options:NSJSONWritingPrettyPrinted error:&error];
NSMutableData *bodyData = [NSMutableData data];
[bodyData appendData:jsonData];
request.HTTPBody = bodyData;
return request;
}
The complete URL is first built up based on the base url, as well as the path to the endpoint. After this a request object is created based on the URL to the endpoint. A dictionary of property names and values of the object is then created, and this is serialised into JSON. This JSON is added to the body of the request.
To create a dictionary of property names and values, I created a category of NSObject so that it can be used by other objects at other times. This may not be the best approach, and I’m open to correction:
#import <objc/runtime.h>
@implementation NSObject (Utility)
- (NSDictionary *)dictionaryOfProperties
{
NSMutableDictionary *objectPropertyValueDictionary = [[NSMutableDictionary alloc] init];
unsigned int numberOfProperties = 0;
objc_property_t *propertyArray = class_copyPropertyList([self class], &numberOfProperties);
for (NSUInteger i = 0; i < numberOfProperties; i++)
{
objc_property_t property = propertyArray[i];
NSString *name = [[NSString alloc] initWithUTF8String:property_getName(property)];
NSString *value = [self valueForKey:name];
[objectPropertyValueDictionary addEntriesFromDictionary:@{ name : value }];
}
return objectPropertyValueDictionary;
}
@end
Back to the original code excerpt, now that we have the request, we just create a request operation (AFHTTPRequestOperation), and set the completion and failure blocks. Then start the operation. And done.
Any way that this can be improved?


WIDGET 11: Keyboard/mouse/drag events must have roles
onMouseMove
onMouseMove pass
onMouseMove fail
onMouseMove hidden
onMouseUp
onMouseUp pass
onMouseUp fail
onMouseUp hidden
onMouseDown
onMouseDown pass
onMouseDown fail
onMouseDown hidden
Events on Parent Links
Menu Item 1
Menu Item 2
Menu Item 3
Menu Item 1
Menu Item 2
Menu Item 3


Finde Event
Vol
Switch to Organiser
Home
Find Event
My Event
Time Table
Find by location
Search
Find by theme
Politics
Economic
Environment
Cultural
Technology


Elder Spiron:
Go see
Trader Shari of the weapons shop
, collect his guild dues and bring them to me.


Home-The Miraculous Kitchen
Piano of Death is a text-based game that will be created in Twine. Nothing will be told about this game. To view the repository, visit this page--->https://github.com/IbidunO/Piano-of-Death
Host a blog on IbidunO.wordpress.com?


Use Med Magnet to track your drugs, and research their known side-effects. Likewise, use the symptom diary to compare those drug side-effects against your own personal symptom history.


Field Set
Overview
Dark Theme
Light Theme
Simple Field Set
Full Name
Kevin Carter
Position
Shipping Manager
Field Set with DevExtreme Widgets
Address
City
Field Set with Custom Value Width
Notes


Sign up to see more Information about word.
By signing up, you agree to our Terms , Data Policy and Cookies Policy
have an account? Login
Get the app.
Don't have an account? sign up


* maximum of 5 comma separated keywords are accepted.
* optional fields
* For composite values you may enter values separated by commas


Steve Jobs
The man who started apple
Here's a timeline on Steve Job's life:
1955 -Jobs was born on February 24, 1955, in San Francisco, California.
1974 - Jobs took a position as a video game designer with Atari.
1976 - When Jobs was just 21, he and Wozniak started Apple Computer in the Jobs’ family garage.
1980 - Apple Computer became a publicly-traded company, with a market value of $1.2 billion by the end of its very first day of trading.
1984 - Apple released the Macintosh, marketing the computer as a piece of a counterculture lifestyle: romantic, youthful, creative.
1985 - After leaving Apple, Jobs began a new hardware and software enterprise called NeXT, Inc.
1996 - Apple bought the company Next, inc. for $429 million.
1997 - Jobs returned to his post as Apple's CEO
October 5, 2011 - Jobs died in Palo Alto, after battling pancreatic cancer for nearly a decade. He was 56 years old.
"Innovation distinguishes between a leader and a follower."
-Steve JobsFind out more about Steve Job's incredible life on his wiki page


Unity asset to aid vr developers in creating games and experiences. Complete with 14 animations and a flexible animation script to choose which animations are needed.
To be announced - follow the blog to find out more and catch some sneak peeks
I'll post game updates and upcoming products on the blog so make sure you follow the blog to be the first to know!


This page contains webassembly and javascript content, please enable javascript in your browser.
0
Next
Next 10
Next 100
▶


Contact Us!
+27 76 051 7773
<EMAIL_ADDRESS>Somerset West,
Cape Town,
South Africa
Name is required and needs to be at least 3 characters long.
Needs to be a valid email.
Cell is required and needs to be valid.
Company is required.
Your message is required!
Submit
Contact Us!
+27 76 051 7773
<EMAIL_ADDRESS>Somerset West,
Cape Town,
South Africa


Uses a 2x2 matrix thats determinate is relatively prime to 26. Then goes 2 letters at a time to encrypt.
If the message has an odd number of characters it will add a "Z" to the end. a = 1
Encrypt = [Matrix * [1st character, 2nd character]] mod
26
Decrypt = [Inverse of Matrix * [1st character, 2nd character]]
mod 26


Is FSSAI registration mandatory for all the products. How I can do this?
-No, FSSAI is not mandatory registration for all products but it is mandatory only for items in Food and related category.
Is GST registration mandatory?
-HomeBiz365 is just a platform made available to facilitate the trade for home based vendors. GST and related compliance is individual vendor's responsibility inline with government regulations.
It is not mandatory though preferable to have GST registration for vendors on HomeBiz365 platform.
How can I start selling my products on HomeBiz365?
-to Start Selling on HomeBiz365.
Is delivery option available?
-Delivery is the biggest problem for home based businesses to cross the limits of service.
HomeBiz365 has solved this problem by making delivery option available as marginally extra cost through our delivery partner.
As of now delivery is available within Pune and Pimpri-chinchwad area only.
What are the delivery charges?
-Delivery charge varies with each Seller.
Sellers incur relatively higher shipping costs on low value items.
In such cases, charging delivery charge helps them offset logistics costs.
Please check your order summary to understand the delivery charges for individual products.
What is the estimated delivery time?
-Sellers generally prepare/procure and ship the items within the time specified on the product page.
Business days exclude public holidays and Sundays.
Estimated delivery time depends on the following factors:
The Seller offering the product
Product's availability with the Seller
The destination to which you want the order shipped to and location of the Seller.
Are there any hidden costs (sales tax, octroi etc) on items sold by Sellers on Homebiz365?
-There are NO hidden charges when you make a purchase on homebiz365.
List prices you see on the products page are all-inclusive of all the taxes.
The price you see on the product page is exactly what you would pay.
Delivery charges are not hidden charges and are charged (if at all) extra depending on the Seller's shipping policy.
These charges will be displayed before proceeding for payment.
If I request for a replacement, when will I get it?
-Visit My Orders to check the status of your replacement.
In most locations, the replacement item is delivered to you at the time of pick-up.
In all other areas, the replacement is initiated after the originally delivered item is picked up.
Please check the SMS & email we send you for your replacement request for more details.
Can items be returned after the time period mentioned in the seller's Returns Policy?
-No, sellers will not be able to accept products after the time period mentioned in the seller's Returns Policy.
How do returns work?
-You can raise a request to return your items with these simple steps:
Log into your homebiz365 account
Go to My Orders
Click on 'Return' against the item you wish to return or exchange
Fill in the details and raise a return request
Once you raise a request, you'll get an email and SMS confirming that your request is being processed.
Based on the item, your request may be automatically approved or you may be contacted for more details.
If the request is approved, the item will be picked up after which you will get a replacement or refund.
You can also track the status of your return request instantly from the 'My Orders' section.


| Path: | README |
| Last Update: | Mon Aug 18 22:35:53 +0200 2008 |
merb-core is a new branch of Merb (also referred to as merb-next or the 0.9 series) which aims to provide a stable, stripped down API for a future Merb 1.0 release.
This branch is based off the 0.5 release series but with significant rewrites.
Goals of this release:
* Stabilize the @public interface methods to provide for a more consistent application development experience. * Remove features until nothing except a central application API is left * Improve comments on methods using a standard documentation methodology as described in DOCUMENTATION_STANDARDS * Separate the tests into two sections... "private" and "public" * Public methods are methods tagged with @public that will be part of the standard, stable Merb API * Private methods are implementation methods that might * Implement a new render API * Build more extensions to regain selected features when needed
To familiarize yourself with how a merb-core application might look, use merb-gen (from merb-more) to generate a few apps: $ merb-gen app myapp # a "normal" merb app $ merb-gen app myapp —flat # a flattened app $ merb-gen app myapp —very-flat # a single-file app


public final class Lookup
extends java.lang.Object
Cache
,
Resolver
,
ResolverConfig
| Modifier and Type | Field and Description |
|---|---|
static int |
HOST_NOT_FOUND
The host does not exist.
|
static int |
SUCCESSFUL
The lookup was successful.
|
static int |
TRY_AGAIN
The lookup failed due to a network error.
|
static int |
TYPE_NOT_FOUND
The host exists, but has no records associated with the queried type.
|
static int |
UNRECOVERABLE
The lookup failed due to a data or server error.
|
| Constructor and Description |
|---|
Lookup(Name name)
Create a Lookup object that will find records of type A at the given name
in the IN class.
|
Lookup(Name name,
int type)
Create a Lookup object that will find records of the given name and type
in the IN class.
|
Lookup(Name name,
int type,
int dclass)
Create a Lookup object that will find records of the given name, type,
and class.
|
Lookup(java.lang.String name)
Create a Lookup object that will find records of type A at the given name
in the IN class.
|
Lookup(java.lang.String name,
int type)
Create a Lookup object that will find records of the given name and type
in the IN class.
|
Lookup(java.lang.String name,
int type,
int dclass)
Create a Lookup object that will find records of the given name, type,
and class.
|
| Modifier and Type | Method and Description |
|---|---|
Name[] |
getAliases()
Returns all known aliases for this name.
|
Record[] |
getAnswers()
Returns the answers from the lookup.
|
static Cache |
getDefaultCache(int dclass)
Gets the Cache that will be used as the default for the specified
class by future Lookups.
|
static Resolver |
getDefaultResolver()
Gets the Resolver that will be used as the default by future Lookups.
|
static Name[] |
getDefaultSearchPath()
Gets the search path that will be used as the default by future Lookups.
|
java.lang.String |
getErrorString()
Returns an error string describing the result code of this lookup.
|
int |
getResult()
Returns the result code of the lookup.
|
static void |
refreshDefault() |
Record[] |
run()
Performs the lookup, using the specified Cache, Resolver, and search path.
|
void |
setCache(Cache cache)
Sets the cache to use when performing this lookup.
|
void |
setCredibility(int credibility)
Sets the minimum credibility level that will be accepted when performing
the lookup.
|
static void |
setDefaultCache(Cache cache,
int dclass)
Sets the Cache to be used as the default for the specified class by future
Lookups.
|
static void |
setDefaultResolver(Resolver resolver)
Sets the default Resolver to be used as the default by future Lookups.
|
static void |
setDefaultSearchPath(Name[] domains)
Sets the search path to be used as the default by future Lookups.
|
static void |
setDefaultSearchPath(java.lang.String[] domains)
Sets the search path that will be used as the default by future Lookups.
|
void |
setNdots(int ndots)
Sets ndots to use when performing this lookup, overriding the default value.
|
static void |
setPacketLogger(PacketLogger logger)
Sets a custom logger that will be used to log the send and received packets.
|
void |
setResolver(Resolver resolver)
Sets the resolver to use when performing this lookup.
|
void |
setSearchPath(Name[] domains)
Sets the search path to use when performing this lookup.
|
void |
setSearchPath(java.lang.String[] domains)
Sets the search path to use when performing this lookup.
|
public static final int SUCCESSFUL
public static final int UNRECOVERABLE
public static final int TRY_AGAIN
public static final int HOST_NOT_FOUND
public static final int TYPE_NOT_FOUND
public Lookup(Name name, int type, int dclass)
public Lookup(Name name, int type)
name
- The name of the desired recordstype
- The type of the desired recordsjava.lang.IllegalArgumentException
- The type is a meta type other than ANY.Lookup(Name,int,int)
public Lookup(Name name)
name
- The name of the desired recordsLookup(Name,int,int)
public Lookup(java.lang.String name, int type, int dclass) throws TextParseException
name
- The name of the desired recordstype
- The type of the desired recordsdclass
- The class of the desired recordsTextParseException
- The name is not a valid DNS namejava.lang.IllegalArgumentException
- The type is a meta type other than ANY.Lookup(Name,int,int)
public Lookup(java.lang.String name, int type) throws TextParseException
name
- The name of the desired recordstype
- The type of the desired recordsTextParseException
- The name is not a valid DNS namejava.lang.IllegalArgumentException
- The type is a meta type other than ANY.Lookup(Name,int,int)
public Lookup(java.lang.String name) throws TextParseException
name
- The name of the desired recordsTextParseException
- The name is not a valid DNS nameLookup(Name,int,int)
public static void refreshDefault()
public static Resolver getDefaultResolver()
public static void setDefaultResolver(Resolver resolver)
resolver
- The default resolver.public static Cache getDefaultCache(int dclass)
dclass
- The class whose cache is being retrieved.public static void setDefaultCache(Cache cache, int dclass)
cache
- The default cache for the specified class.dclass
- The class whose cache is being set.public static Name[] getDefaultSearchPath()
public static void setDefaultSearchPath(Name[] domains)
domains
- The default search path.public static void setDefaultSearchPath(java.lang.String[] domains) throws TextParseException
domains
- The default search path.TextParseException
- A name in the array is not a valid DNS name.public static void setPacketLogger(PacketLogger logger)
logger
- public void setResolver(Resolver resolver)
resolver
- The resolver to use.public void setSearchPath(Name[] domains)
domains
- An array of names containing the search path.public void setSearchPath(java.lang.String[] domains) throws TextParseException
domains
- An array of names containing the search path.TextParseException
- A name in the array is not a valid DNS name.public void setCache(Cache cache)
cache
- The cache to use.public void setNdots(int ndots)
ndots
- The ndots value to use, which must be greater than or equal to
0.public void setCredibility(int credibility)
credibility
- The minimum credibility level.public Record[] run()
public Record[] getAnswers()
java.lang.IllegalStateException
- The lookup has not completed.public Name[] getAliases()
java.lang.IllegalStateException
- The lookup has not completed.public int getResult()
java.lang.IllegalStateException
- The lookup has not completed.public java.lang.String getErrorString()
java.lang.IllegalStateException
- The lookup has not completed.


| 6:00am | 7:00am | 8:00am | 9:00am | 10:00am | 11:00am | 12:00pm | 1:00pm | 2:00pm | 3:00pm | 4:00pm | 5:00pm | 6:00pm | 7:00pm | 8:00pm | Daily Location Total |
| 6:00am | 7:00am | 8:00am | 9:00am | 10:00am | 11:00am | 12:00pm | 1:00pm | 2:00pm | 3:00pm | 4:00pm | 5:00pm | 6:00pm | 7:00pm | 8:00pm | Daily Location Total |


Class JournaledGrain<TGrainState, TEventBase>
A base class for log-consistent grains using standard event-sourcing terminology.
All operations are reentrancy-safe.
Implements
Namespace: Orleans.EventSourcing
Assembly: Orleans.EventSourcing.dll
Syntax
public abstract class JournaledGrain<TGrainState, TEventBase> : LogConsistentGrain<TGrainState>, ILogConsistencyProtocolParticipant, ILogViewAdaptorHost<TGrainState, TEventBase> where TGrainState : class, new ()where TEventBase : class
Type Parameters
| Name | Description |
|---|---|
| TGrainState | |
| TEventBase |
Constructors
| Improve this Doc View SourceJournaledGrain()
Declaration
protected JournaledGrain()
JournaledGrain(IGrainIdentity, IGrainRuntime)
This constructor is particularly useful for unit testing where test code can create a Grain and replace the IGrainIdentity, IGrainRuntime and State with test doubles (mocks/stubs).
Declaration
protected JournaledGrain(IGrainIdentity identity, IGrainRuntime runtime)
Parameters
| Type | Name | Description |
|---|---|---|
| IGrainIdentity | identity | |
| IGrainRuntime | runtime |
Properties
| Improve this Doc View SourceDefaultAdaptorFactory
If there is no log-consistency provider specified, store versioned state using default storage provider
Declaration
protected override ILogViewAdaptorFactory DefaultAdaptorFactory { get; }
Property Value
| Type | Description |
|---|---|
| ILogViewAdaptorFactory |
State
The current confirmed state. Includes only confirmed events.
Declaration
protected TGrainState State { get; }
Property Value
| Type | Description |
|---|---|
| TGrainState |
TentativeState
The current tentative state. Includes both confirmed and unconfirmed events.
Declaration
protected TGrainState TentativeState { get; }
Property Value
| Type | Description |
|---|---|
| TGrainState |
UnconfirmedEvents
Returns the current queue of unconfirmed events.
Declaration
public IEnumerable<TEventBase> UnconfirmedEvents { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<TEventBase> |
UnresolvedConnectionIssues
Declaration
protected IEnumerable<ConnectionIssue> UnresolvedConnectionIssues { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<ConnectionIssue> |
Version
The version of the current confirmed state. Equals the total number of confirmed events.
Declaration
protected int Version { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Methods
| Improve this Doc View SourceConfirmEvents()
Waits until all previously raised events have been confirmed.
await this after raising one or more events, to ensure events are persisted before proceeding, or to guarantee strong consistency (linearizability) even if there are multiple instances of this grain
Declaration
protected Task ConfirmEvents()
Returns
| Type | Description |
|---|---|
| Task | a task that completes once the events have been confirmed. |
DisableStatsCollection()
Declaration
protected void DisableStatsCollection()
EnableStatsCollection()
Declaration
protected void EnableStatsCollection()
GetStats()
Declaration
protected LogConsistencyStatistics GetStats()
Returns
| Type | Description |
|---|---|
| LogConsistencyStatistics |
InstallAdaptor(ILogViewAdaptorFactory, Object, String, IGrainStorage, ILogConsistencyProtocolServices)
Called right after grain is constructed, to install the adaptor. The log-consistency provider contains a factory method that constructs the adaptor with chosen types for this grain
Declaration
protected override void InstallAdaptor(ILogViewAdaptorFactory factory, object initialState, string graintypename, IGrainStorage grainStorage, ILogConsistencyProtocolServices services)
Parameters
| Type | Name | Description |
|---|---|---|
| ILogViewAdaptorFactory | factory | |
| System.Object | initialState | |
| System.String | graintypename | |
| IGrainStorage | grainStorage | |
| ILogConsistencyProtocolServices | services |
OnActivateAsync()
By default, upon activation, the journaled grain waits until it has loaded the latest view from storage. Subclasses can override this behavior, and skip the wait if desired.
Declaration
public override Task OnActivateAsync()
Returns
| Type | Description |
|---|---|
| Task |
OnConnectionIssue(ConnectionIssue)
Called when the underlying persistence or replication protocol is running into some sort of connection trouble.
Override this to monitor the health of the log-consistency protocol and/or
to customize retry delays.
Any exceptions thrown are caught and logged by the
Declaration
protected virtual void OnConnectionIssue(ConnectionIssue issue)
Parameters
| Type | Name | Description |
|---|---|---|
| ConnectionIssue | issue |
OnConnectionIssueResolved(ConnectionIssue)
Called when a previously reported connection issue has been resolved.
Override this to monitor the health of the log-consistency protocol.
Any exceptions thrown are caught and logged by the
Declaration
protected virtual void OnConnectionIssueResolved(ConnectionIssue issue)
Parameters
| Type | Name | Description |
|---|---|---|
| ConnectionIssue | issue |
OnStateChanged()
Called after the confirmed state may have changed (i.e. the confirmed version number is larger).
Override this to react to changes of the confirmed state.
Declaration
protected virtual void OnStateChanged()
OnTentativeStateChanged()
Called whenever the tentative state may have changed due to local or remote events.
Override this to react to changes of the state.
Declaration
protected virtual void OnTentativeStateChanged()
RaiseConditionalEvent<TEvent>(TEvent)
Raise an event conditionally. Succeeds only if there are no conflicts, that is, no other events were raised in the meantime.
Declaration
protected virtual Task<bool> RaiseConditionalEvent<TEvent>(TEvent event)where TEvent : TEventBase
Parameters
| Type | Name | Description |
|---|---|---|
| TEvent | event | Event to raise |
Returns
| Type | Description |
|---|---|
| Task<System.Boolean> | true if successful, false if there was a conflict. |
Type Parameters
| Name | Description |
|---|---|
| TEvent |
RaiseConditionalEvents<TEvent>(IEnumerable<TEvent>)
Raise multiple events, as an atomic sequence, conditionally. Succeeds only if there are no conflicts, that is, no other events were raised in the meantime.
Declaration
protected virtual Task<bool> RaiseConditionalEvents<TEvent>(IEnumerable<TEvent> events)where TEvent : TEventBase
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<TEvent> | events | Events to raise |
Returns
| Type | Description |
|---|---|
| Task<System.Boolean> | true if successful, false if there was a conflict. |
Type Parameters
| Name | Description |
|---|---|
| TEvent |
RaiseEvent<TEvent>(TEvent)
Raise an event.
Declaration
protected virtual void RaiseEvent<TEvent>(TEvent event)where TEvent : TEventBase
Parameters
| Type | Name | Description |
|---|---|---|
| TEvent | event | Event to raise |
Type Parameters
| Name | Description |
|---|---|
| TEvent |
RaiseEvents<TEvent>(IEnumerable<TEvent>)
Raise multiple events, as an atomic sequence.
Declaration
protected virtual void RaiseEvents<TEvent>(IEnumerable<TEvent> events)where TEvent : TEventBase
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<TEvent> | events | Events to raise |
Type Parameters
| Name | Description |
|---|---|
| TEvent |
RefreshNow()
Retrieves the latest state now, and confirms all previously raised events. Effectively, this enforces synchronization with the global state.
Await this before reading the state to ensure strong consistency (linearizability) even if there are multiple instances of this grain
Declaration
protected Task RefreshNow()
Returns
| Type | Description |
|---|---|
| Task | a task that completes once the log has been refreshed and the events have been confirmed. |
RetrieveConfirmedEvents(Int32, Int32)
Retrieves a segment of the confirmed event sequence, possibly from storage.
Throws
Declaration
protected Task<IReadOnlyList<TEventBase>> RetrieveConfirmedEvents(int fromVersion, int toVersion)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | fromVersion | the position of the event sequence from which to start |
| System.Int32 | toVersion | the position of the event sequence on which to end |
Returns
| Type | Description |
|---|---|
| Task<IReadOnlyList<TEventBase>> | a task which returns the sequence of events between the two versions |
TransitionState(TGrainState, TEventBase)
Defines how to apply events to the state. Unless it is overridden in the subclass, it calls a dynamic "Apply" function on the state, with the event as a parameter. All exceptions thrown by this method are caught and logged by the log view provider.
Override this to customize how to transition the state for a given event.
Declaration
protected virtual void TransitionState(TGrainState state, TEventBase event)
Parameters
| Type | Name | Description |
|---|---|---|
| TGrainState | state | |
| TEventBase | event |


Contact Us
Click for the Quote of the Day!
Thank you for your interest in Give Kids The World Village. If your question isn’t among one of the frequently asked questions we receive, please call us at<PHONE_NUMBER> or submit the form below.
Click for the Quote of the Day!
Thank you for your interest in Give Kids The World Village. If your question isn’t among one of the frequently asked questions we receive, please call us at<PHONE_NUMBER> or submit the form below.


Vertical (basic) form
Disaster Type
Type Of Disaster
Earthquake
Fire
Floods
Cyclone
Hurricane
Contact Person
Location
Latitude
Longitude
Disaster Date and Time:
Remember me
Submit


Improve this Doc
The DateTime component is used to present an interface which makes it easy for users to select dates and times. The DateTime component is similar to the native `` element, however, Ionic's DateTime component makes it easy to display the date and time in a preferred format, and manage the datetime values.
_For more information, Check out the [API docs](../api/components/datetime/DateTime)._


# brace-expansion
[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), as known from sh/bash, in JavaScript.
[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion)
[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion)
## Example
```js var expand = require(‘brace-expansion’);
expand(‘file-{a,b,c}.jpg’) // => [‘file-a.jpg’, ‘file-b.jpg’, ‘file-c.jpg’]
expand(‘-v{,,}’) // => [‘-v’, ‘-v’, ‘-v’]
expand(‘file{0..2}.jpg’) // => [‘file0.jpg’, ‘file1.jpg’, ‘file2.jpg’]
expand(‘file-{a..c}.jpg’) // => [‘file-a.jpg’, ‘file-b.jpg’, ‘file-c.jpg’]
expand(‘file{2..0}.jpg’) // => [‘file2.jpg’, ‘file1.jpg’, ‘file0.jpg’]
expand(‘file{0..4..2}.jpg’) // => [‘file0.jpg’, ‘file2.jpg’, ‘file4.jpg’]
expand(‘file-{a..e..2}.jpg’) // => [‘file-a.jpg’, ‘file-c.jpg’, ‘file-e.jpg’]
expand(‘file{00..10..5}.jpg’) // => [‘file00.jpg’, ‘file05.jpg’, ‘file10.jpg’]
expand(‘{{A..C},{a..c}}’) // => [‘A’, ‘B’, ‘C’, ‘a’, ‘b’, ‘c’]
expand(‘ppp{,config,oe{,conf}}’) // => [‘ppp’, ‘pppconfig’, ‘pppoe’, ‘pppoeconf’] ```
## API
`js
var expand = require('brace-expansion');
`
### var expanded = expand(str)
Return an array of all possible and valid expansions of str. If none are found, [str] is returned.
Valid expansions are:
`js
/^(.*,)+(.+)?$/
// {a,b,...}
`
A comma seperated list of options, like {a,b} or {a,{b,c}} or {,a,}.
`js
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
// {x..y[..incr]}
`
A numeric sequence from x to y inclusive, with optional increment. If x or y start with a leading 0, all the numbers will be padded to have equal length. Negative numbers and backwards iteration work too.
`js
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
// {x..y[..incr]}
`
An alphabetic sequence from x to y inclusive, with optional increment. x and y must be exactly one character, and if given, incr must be a number.
For compatibility reasons, the string ${ is not eligible for brace expansion.
## Installation
With [npm](https://npmjs.org) do:
`bash
npm install brace-expansion
`
## Contributors
- [Julian Gruber](https://github.com/juliangruber)
- [Isaac Z. Schlueter](https://github.com/isaacs)
## License
(MIT)
Copyright (c) 2013 Julian Gruber<EMAIL_ADDRESS>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.
 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.


public interface Configurable<C extends Configurable>
Configurable
context are reflected in the associated
Configuration
state which is exposed via getConfiguration()
method.
A configurable context can be either indirectly associated with a particular component
(such as application or resource method configurable context passed to a Feature
or DynamicFeature
meta-providers) or can be directly represented
by a concrete component implementing the Configurable
interface
(such as Client
or WebTarget
).
As such, the exact scope of a configuration context is typically determined by a use case
scenario in which the context is accessed.
New properties can be set using the property(java.lang.String, java.lang.Object)
method. Similarly, updating a value of
an existing property can be achieved using the same method. Information about the configured set of
properties is available via the underlying Configuration
object. An existing property
can be removed by assigning a null
value to the property.
Registered custom component classes and instances are important part of the contextual configuration information as these are the main factors that determine the capabilities of a configured runtime. Implementations SHOULD warn about and ignore registrations that do not conform to the requirements of supported components in a given configurable context.
In most cases, when registering a component, the simplest form of methods
(register(Class)
or register(Object)
) of the available registration API
is sufficient.
For example:
config.register(HtmlDocumentReader.class); config.register(new HtmlDocumentWriter(writerConfig));
In some situations a component class or instance may implement multiple provider contracts recognized by an implementation (e.g. filter, interceptor or entity provider). By default, the implementation MUST register the new component class or instance as a provider for all the recognized provider contracts implemented by the component class.
For example:
@Priority(ENTITY_CODER) public class GzipInterceptor implements ReaderInterceptor, WriterInterceptor { ... } ... // register GzipInterceptor as a ReaderInterceptor // as well as a WriterInterceptor config.register(GzipInterceptor.class);
There are however situations when the default registration of a component to all the
recognized provider contracts is not desirable. In such cases users may use other versions of the
register(...)
method to explicitly specify the collection of the provider contracts
for which the component should be registered and/or the priority of each registered
provider contract.
For example:
@Priority(USER) public class ClientLoggingFilter implements ClientRequestFilter, ClientResponseFilter { ... } @Priority(ENTITY_CODER) public class GzipInterceptor implements ReaderInterceptor, WriterInterceptor { ... } ... // register ClientLoggingFilter as a ClientResponseFilter only config.register(ClientLoggingFilter.class, ClientResponseFilter.class); // override the priority of registered GzipInterceptor // and both of it's provider contracts config.register(GzipInterceptor.class, 6500);
As a general rule, for each component class there can be at most one registration — class-based or instance-based — configured at any given moment. Implementations MUST reject any attempts to configure a new registration for a provider class that has been already registered in the given configurable context earlier. Implementations SHOULD also raise a warning to inform the user about the rejected component registration.
For example:
config.register(GzipInterceptor.class, WriterInterceptor.class); config.register(GzipInterceptor.class); // Rejected by runtime. config.register(new GzipInterceptor()); // Rejected by runtime. config.register(GzipInterceptor.class, 6500); // Rejected by runtime. config.register(new ClientLoggingFilter()); config.register(ClientLoggingFilter.class); // rejected by runtime. config.register(ClientLoggingFilter.class, ClientResponseFilter.class); // Rejected by runtime.
| Modifier and Type | Method and Description |
|---|---|
Configuration |
getConfiguration()
Get a live view of an internal configuration state of this configurable instance.
|
C |
property(java.lang.String name,
java.lang.Object value)
Set the new configuration property, if already set, the existing value of
the property will be updated.
|
C |
register(java.lang.Class<?> componentClass)
Register a class of a custom component (such as an extension provider or
a
feature meta-provider) to be instantiated
and used in the scope of this configurable context. |
C |
register(java.lang.Class<?> componentClass,
java.lang.Class<?>... contracts)
Register a class of a custom component (such as an extension provider or
a
feature meta-provider) to be instantiated
and used in the scope of this configurable context. |
C |
register(java.lang.Class<?> componentClass,
int priority)
Register a class of a custom component (such as an extension provider or
a
feature meta-provider) to be instantiated
and used in the scope of this configurable context. |
C |
register(java.lang.Class<?> componentClass,
java.util.Map<java.lang.Class<?>,java.lang.Integer> contracts)
Register a class of a custom component (such as an extension provider or
a
feature meta-provider) to be instantiated
and used in the scope of this configurable context. |
C |
register(java.lang.Object component)
Register an instance of a custom component (such as an extension provider or
a
feature meta-provider) to be instantiated
and used in the scope of this configurable context. |
C |
register(java.lang.Object component,
java.lang.Class<?>... contracts)
Register an instance of a custom component (such as an extension provider or
a
feature meta-provider) to be instantiated
and used in the scope of this configurable context. |
C |
register(java.lang.Object component,
int priority)
Register an instance of a custom component (such as an extension provider or
a
feature meta-provider) to be instantiated
and used in the scope of this configurable context. |
C |
register(java.lang.Object component,
java.util.Map<java.lang.Class<?>,java.lang.Integer> contracts)
Register an instance of a custom component (such as an extension provider or
a
feature meta-provider) to be instantiated
and used in the scope of this configurable context. |
Configuration getConfiguration()
Configurable
instance will be reflected
in the returned Configuration
instance.
The returned Configuration
instance and the collection data it provides are not
thread-safe wrt. modification made using methods on the parent configurable object.
C property(java.lang.String name, java.lang.Object value)
null
value into a property
effectively removes the property from the property bag.name
- property name.value
- (new) property value. null
value removes the property
with the given name.C register(java.lang.Class<?> componentClass)
feature
meta-provider) to be instantiated
and used in the scope of this configurable context.
Implementations SHOULD warn about and ignore registrations that do not
conform to the requirements of supported component types in the
given configurable context. Any subsequent registration attempts for a component
type, for which a class or instance-based registration already exists in the system
MUST be rejected by the API implementation and a warning SHOULD be raised to
inform the user about the rejected registration.
The registered component class is registered as a contract provider of
all the recognized API or implementation-specific extension contracts including
meta-provider contracts, such as Feature
or DynamicFeature
.
As opposed to component instances registered via register(Object)
method,
the lifecycle of components registered using this class-based register(...)
method is fully managed by the implementation or any underlying IoC
container supported by the implementation.
componentClass
- component class to be configured in the scope of this
configurable context.C register(java.lang.Class<?> componentClass, int priority)
feature
meta-provider) to be instantiated
and used in the scope of this configurable context.
This registration method provides the same functionality as register(Class)
except that any priority specified on the registered component class via
javax.annotation.Priority
annotation is overridden with the supplied
priority
value.
Note that in case the priority is not applicable to a particular
provider contract implemented by the class of the registered component, the supplied
priority
value will be ignored for that contract.
componentClass
- component class to be configured in the scope of this
configurable context.priority
- the overriding priority for the registered component
and all the provider contracts the component implements.C register(java.lang.Class<?> componentClass, java.lang.Class<?>... contracts)
feature
meta-provider) to be instantiated
and used in the scope of this configurable context.
This registration method provides the same functionality as register(Class)
except the component class is only registered as a provider of the listed
extension provider or meta-provider contracts
.
All explicitly enumerated contract types must represent a class or an interface
implemented or extended by the registered component. Contracts that are not
assignable from
the registered component class
MUST be ignored and implementations SHOULD raise a warning to inform users about the
ignored contract(s).
componentClass
- component class to be configured in the scope of this
configurable context.contracts
- the specific extension provider or meta-provider contracts
implemented by the component for which the component should
be registered.
Implementations MUST ignore attempts to register a component
class for an empty or null
collection of contracts via
this method and SHOULD raise a warning about such event.C register(java.lang.Class<?> componentClass, java.util.Map<java.lang.Class<?>,java.lang.Integer> contracts)
feature
meta-provider) to be instantiated
and used in the scope of this configurable context.
This registration method provides same functionality as register(Class, Class[])
except that any priority specified on the registered component class via
javax.annotation.Priority
annotation is overridden
for each extension provider contract type separately with an integer priority value
specified as a value in the supplied map of [contract type, priority] pairs.
Note that in case a priority is not applicable to a provider contract registered for the component, the supplied priority value is ignored for such contract.
componentClass
- component class to be configured in the scope of this
configurable context.contracts
- map of the specific extension provider and meta-provider contracts
and their associated priorities for which the component
is registered.
All contracts in the map must represent a class or an interface
implemented or extended by the component. Contracts that are
not assignable from
the registered
component class MUST be ignored and implementations SHOULD raise a warning
to inform users about the ignored contract(s).C register(java.lang.Object component)
feature
meta-provider) to be instantiated
and used in the scope of this configurable context.
Implementations SHOULD warn about and ignore registrations that do not
conform to the requirements of supported component types in the
given configurable context. Any subsequent registration attempts for a component
type, for which a class or instance-based registration already exists in the system
MUST be rejected by the API implementation and a warning SHOULD be raised to
inform the user about the rejected registration.
The registered component is registered as a contract provider of
all the recognized API or implementation-specific extension contracts including
meta-provider contracts, such as Feature
or DynamicFeature
.
As opposed to components registered via register(Class)
method,
the lifecycle of providers registered using this instance-based register(...)
is not managed by the runtime. The same registered component instance is used during
the whole lifespan of the configurable context.
Fields and properties of all registered component instances are injected with their
declared dependencies (see Context
) by the runtime prior to use.
component
- component instance to be configured in the scope of this
configurable context.C register(java.lang.Object component, int priority)
feature
meta-provider) to be instantiated
and used in the scope of this configurable context.
This registration method provides the same functionality as register(Object)
except that any priority specified on the registered component class via
javax.annotation.Priority
annotation is overridden with the supplied
priority
value.
Note that in case the priority is not applicable to a particular
provider contract implemented by the class of the registered component, the supplied
priority
value will be ignored for that contract.
component
- component instance to be configured in the scope of this
configurable context.priority
- the overriding priority for the registered component
and all the provider contracts the component implements.C register(java.lang.Object component, java.lang.Class<?>... contracts)
feature
meta-provider) to be instantiated
and used in the scope of this configurable context.
This registration method provides the same functionality as register(Object)
except the component class is only registered as a provider of the listed
extension provider or meta-provider contracts
.
All explicitly enumerated contract types must represent a class or an interface
implemented or extended by the registered component. Contracts that are not
assignable from
the registered component class
MUST be ignored and implementations SHOULD raise a warning to inform users about the
ignored contract(s).
component
- component instance to be configured in the scope of this
configurable context.contracts
- the specific extension provider or meta-provider contracts
implemented by the component for which the component should
be registered.
Implementations MUST ignore attempts to register a component
class for an empty or null
collection of contracts via
this method and SHOULD raise a warning about such event.C register(java.lang.Object component, java.util.Map<java.lang.Class<?>,java.lang.Integer> contracts)
feature
meta-provider) to be instantiated
and used in the scope of this configurable context.
This registration method provides same functionality as register(Object, Class[])
except that any priority specified on the registered component class via
javax.annotation.Priority
annotation is overridden
for each extension provider contract type separately with an integer priority value
specified as a value in the supplied map of [contract type, priority] pairs.
Note that in case a priority is not applicable to a provider contract registered for the component, the supplied priority value is ignored for such contract.
component
- component instance to be configured in the scope of this
configurable context.contracts
- map of the specific extension provider and meta-provider contracts
and their associated priorities for which the component
is registered.
All contracts in the map must represent a class or an interface
implemented or extended by the component. Contracts that are
not assignable from
the registered
component class MUST be ignored and implementations SHOULD raise a warning
to inform users about the ignored contract(s).


quspin.operators.quantum_operator¶
-
class
quspin.operators.
quantum_operator
(input_dict, N=None, basis=None, shape=None, copy=True, check_symm=True, check_herm=True, check_pcon=True, matrix_formats={}, dtype=<class 'numpy.complex128'>, **basis_args)[source]¶ Constructs parameter-dependent (hermitian and nonhermitian) operators.
The quantum_operator class maps quantum operators to keys of a dictionary. When calling various methods of quantum_operator, it allows one to ‘dynamically’ specify the pre-factors of these operators.
Examples
It is often required to be able to handle a parameter-dependent Hamiltonian \(H(\lambda)=H_1 + \lambda H_2\), e.g.
\[H_1=\sum_j J_{zz}S^z_jS^z_{j+1} + h_xS^x_j, \qquad H_2=\sum_j S^z_j\]The following code snippet shows how to use the quantum_operator class to vary the parameter \(\lambda\) without having to re-build the Hamiltonian every time.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
from quspin.operators import hamiltonian,quantum_operator # operators from quspin.basis import spin_basis_1d # Hilbert spaces import numpy as np # general math functions from numpy.random import uniform # ##### setting parameters for simulation # physical parameters L = 4 # system size J = 1.0 # interaction strength hx = np.sqrt(2) # transverse field strength # ###### create the basis basis = spin_basis_1d(L,pblock=1,pauli=False) # up basis ##### create model # define static (fixed) site-coupling lists J_list = [[J,i,(i+2)%L] for i in range(L)] # nnn interaction PBC hx_list= [[hx,i] for i in range(L)] # onsite field # create static lists for H0 operator_list_0 = [["zz", J_list], ["x", hx_list]] # define parametric lists for H1 (corresponding to operators the coupling of which will be changed) hz_list= [[1.0,i] for i in range(L)] # onsite field operator_list_1 = [["z",hz_list]] # ###### create operator dictionary for quantum_operator class # add keys for TFI operators tring list and the longitudinal field operator_dict=dict(H0=operator_list_0,H1=operator_list_1) # ###### setting up `quantum_operator` hamiltonian dictionary H = quantum_operator(operator_dict,basis=basis) # print Hamiltonian H = H0 + H1 params_dict=dict(H0=1.0,H1=1.0) # dict containing the couplings to operators in keys of operator_dict H_lmbda1 = H.tohamiltonian(params_dict) print(H_lmbda1) # change z-coupling strength: print Hamiltonian H = H0 + 2H1 params_dict=dict(H0=1.0,H1=2.0) # dict containing the couplings to operators in keys of operator_dict H_lmbda2 = H.tohamiltonian(params_dict) print(H_lmbda2)
Attributes: H
quantum_operator
: transposes and conjugates the operator matrix: \(H_{ij}\mapsto H_{ji}^*\).Ns
int: number of states in the (symmetry-reduced) Hilbert space spanned by basis.
T
quantum_operator
: transposes the operator matrix: \(H_{ij}\mapsto H_{ji}\).basis
basis
: basis used to build the hamiltonian object. Defaults to None if quantum_operator hasdtype
type: data type of quantum_operator object.
- get_operators
get_shape
tuple: shape of the quantum_operator object, always equal to (Ns,Ns).
is_dense
bool: True if the quantum_operator contains a dense matrix as a componnent of either
ndim
int: number of dimensions, always equal to 2.
- shape
Methods
__call__
(**pars)Call self as a function. aslinearoperator
([pars])Returns copy of a quantum_operator object for parameters pars as a scipy.sparse.linalg.Linearquantum_operator. astype
(dtype[, copy, casting])Changes data type of quantum_operator object. conj
()Conjugates quantum_operator quantum_operator. conjugate
()Conjugates quantum_operator quantum_operator. copy
()Returns a deep copy of quantum_operator object. diagonal
([pars])Returns diagonal of quantum_operator quantum_operator for parameters pars. dot
(V[, pars, check, out, overwrite_out, a])Matrix-vector multiplication of quantum_operator quantum_operator for parameters pars, with state V. eigh
([pars])Computes COMPLETE eigensystem of hermitian quantum_operator quantum_operator using DENSE hermitian methods. eigsh
([pars])Computes SOME eigenvalues and eigenvectors of hermitian quantum_operator quantum_operator using SPARSE hermitian methods. eigvalsh
([pars])Computes ALL eigenvalues of hermitian quantum_operator quantum_operator using DENSE hermitian methods. expt_value
(V[, pars, check, enforce_pure])Calculates expectation value of hamiltonian operator at time time, in state V. getH
([copy])Calculates hermitian conjugate of quantum_operator quantum_operator. matmat
(X)Matrix-matrix multiplication. matrix_ele
(Vl, Vr[, pars, diagonal, check])Calculates matrix element of quantum_operator quantum_operator for parameters pars in states Vl and Vr. matvec
(x)Matrix-vector multiplication. quant_fluct
(V[, pars, check, enforce_pure])Calculates the quantum fluctuations (variance) of hamiltonian operator at time time, in state V. rdot
(V[, pars, check, out, overwrite_out, a])Vector-matrix multiplication of quantum_operator quantum_operator for parameters pars, with state V. rmatvec
(x)Adjoint matrix-vector multiplication. toarray
([pars, out])Returns copy of a quantum_operator object for parameters pars as a dense array. tocsc
([pars])Returns copy of a quantum_operator object for parameters pars as a scipy.sparse.csc_matrix. tocsr
([pars])Returns copy of a quantum_operator object for parameters pars as a scipy.sparse.csr_matrix. todense
([pars, out])Returns copy of a quantum_operator object for parameters pars as a dense array. tohamiltonian
([pars])Returns copy of a quantum_operator object for parameters pars as a hamiltonian object. trace
([pars])Calculates trace of quantum_operator quantum_operator for parameters pars. transpose
([copy])Transposes quantum_operator quantum_operator. update_matrix_formats
(matrix_formats)Change the internal structure of the matrices in-place. -
__init__
(input_dict, N=None, basis=None, shape=None, copy=True, check_symm=True, check_herm=True, check_pcon=True, matrix_formats={}, dtype=<class 'numpy.complex128'>, **basis_args)[source]¶ Intializes the quantum_operator object (parameter dependent quantum quantum_operators).
Parameters: - input_dict : dict
The values of this dictionary contain quantum_operator lists, in the same format as the static_list argument of the hamiltonian class.
The keys of this dictionary correspond to the parameter values, e.g. \(J_{zz},h_x\), and are used to specify the coupling strength during calls of the quantum_operator class methods.
>>> # use "Jzz" and "hx" keys to specify the zz and x coupling strengths, respectively >>> input_dict = { "Jzz": [["zz",Jzz_bonds]], "hx" : [["x" ,hx_site ]] }
- N : int, optional
Number of lattice sites for the hamiltonian object.
- dtype : ‘type’
Data type (e.g. numpy.float64) to construct the quantum_operator with.
- shape : tuple, optional
Shape to create the hamiltonian object with. Default is shape = None.
- copy: bool, optional
If set to True, this option creates a copy of the input array.
- check_symm : bool, optional
Enable/Disable symmetry check on static_list and dynamic_list.
- check_herm : bool, optional
Enable/Disable hermiticity check on static_list and dynamic_list.
- check_pcon : bool, optional
Enable/Disable particle conservation check on static_list and dynamic_list.
- matrix_formats: dict, optional
Dictionary of key,value pairs which, given a key associated with an operator in input_dict, the value of this key specifies the sparse matrix format {“csr”,”csc”,”dia”,”dense”}.
- kw_args : dict
Optional additional arguments to pass to the basis class, if not already using a basis object to create the quantum_operator.
Methods
__init__
(input_dict[, N, basis, shape, …])Intializes the quantum_operator object (parameter dependent quantum quantum_operators). aslinearoperator
([pars])Returns copy of a quantum_operator object for parameters pars as a scipy.sparse.linalg.Linearquantum_operator. astype
(dtype[, copy, casting])Changes data type of quantum_operator object. conj
()Conjugates quantum_operator quantum_operator. conjugate
()Conjugates quantum_operator quantum_operator. copy
()Returns a deep copy of quantum_operator object. diagonal
([pars])Returns diagonal of quantum_operator quantum_operator for parameters pars. dot
(V[, pars, check, out, overwrite_out, a])Matrix-vector multiplication of quantum_operator quantum_operator for parameters pars, with state V. eigh
([pars])Computes COMPLETE eigensystem of hermitian quantum_operator quantum_operator using DENSE hermitian methods. eigsh
([pars])Computes SOME eigenvalues and eigenvectors of hermitian quantum_operator quantum_operator using SPARSE hermitian methods. eigvalsh
([pars])Computes ALL eigenvalues of hermitian quantum_operator quantum_operator using DENSE hermitian methods. expt_value
(V[, pars, check, enforce_pure])Calculates expectation value of hamiltonian operator at time time, in state V. getH
([copy])Calculates hermitian conjugate of quantum_operator quantum_operator. matmat
(X)Matrix-matrix multiplication. matrix_ele
(Vl, Vr[, pars, diagonal, check])Calculates matrix element of quantum_operator quantum_operator for parameters pars in states Vl and Vr. matvec
(x)Matrix-vector multiplication. quant_fluct
(V[, pars, check, enforce_pure])Calculates the quantum fluctuations (variance) of hamiltonian operator at time time, in state V. rdot
(V[, pars, check, out, overwrite_out, a])Vector-matrix multiplication of quantum_operator quantum_operator for parameters pars, with state V. rmatvec
(x)Adjoint matrix-vector multiplication. toarray
([pars, out])Returns copy of a quantum_operator object for parameters pars as a dense array. tocsc
([pars])Returns copy of a quantum_operator object for parameters pars as a scipy.sparse.csc_matrix. tocsr
([pars])Returns copy of a quantum_operator object for parameters pars as a scipy.sparse.csr_matrix. todense
([pars, out])Returns copy of a quantum_operator object for parameters pars as a dense array. tohamiltonian
([pars])Returns copy of a quantum_operator object for parameters pars as a hamiltonian object. trace
([pars])Calculates trace of quantum_operator quantum_operator for parameters pars. transpose
([copy])Transposes quantum_operator quantum_operator. update_matrix_formats
(matrix_formats)Change the internal structure of the matrices in-place. Attributes
H
quantum_operator
: transposes and conjugates the operator matrix: \(H_{ij}\mapsto H_{ji}^*\).Ns
int: number of states in the (symmetry-reduced) Hilbert space spanned by basis. T
quantum_operator
: transposes the operator matrix: \(H_{ij}\mapsto H_{ji}\).basis
basis
: basis used to build the hamiltonian object.dtype
type: data type of quantum_operator object. get_operators
get_shape
tuple: shape of the quantum_operator object, always equal to (Ns,Ns). is_dense
bool: True if the quantum_operator contains a dense matrix as a componnent of either the static or dynamic lists. ndim
int: number of dimensions, always equal to 2. shape
-
H
¶ quantum_operator
: transposes and conjugates the operator matrix: \(H_{ij}\mapsto H_{ji}^*\).
-
Ns
¶ int: number of states in the (symmetry-reduced) Hilbert space spanned by basis.
-
T
¶ quantum_operator
: transposes the operator matrix: \(H_{ij}\mapsto H_{ji}\).
-
aslinearoperator
(pars={})[source]¶ Returns copy of a quantum_operator object for parameters pars as a scipy.sparse.linalg.Linearquantum_operator.
Casts the quantum_operator object as a scipy.sparse.linalg.Linearquantum_operator object.
Parameters: - pars : dict, optional
Dictionary with same keys as input_dict and coupling strengths as values. Any missing keys are assumed to be set to unity.
Returns: - :obj:`scipy.sparse.linalg.Linearquantum_operator`
Examples
>>> H_aslinop=H.aslinearquantum_operator(pars=pars)
-
astype
(dtype, copy=False, casting='unsafe')[source]¶ Changes data type of quantum_operator object.
Parameters: - dtype : ‘type’
The data type (e.g. numpy.float64) to cast the Hamiltonian with.
- Returns
- `quantum_operator`
quantum_operator with altered data type.
Examples
>>> H_cpx=H.astype(np.complex128)
-
basis
¶ basis
: basis used to build the hamiltonian object. Defaults to None if quantum_operator has no basis (i.e. was created externally and passed as a precalculated array).
-
conj
()[source]¶ Conjugates quantum_operator quantum_operator.
Returns: - :obj:`quantum_operator`
\(H_{ij}\mapsto H_{ij}^*\)
Notes
This function does NOT transpose the quantum_operator.
Examples
>>> H_conj = H.conj()
-
conjugate
()[source]¶ Conjugates quantum_operator quantum_operator.
Returns: - :obj:`quantum_operator`
\(H_{ij}\mapsto H_{ij}^*\)
Notes
This function does NOT transpose the quantum_operator.
Examples
>>> H_conj = H.conj()
-
diagonal
(pars={})[source]¶ Returns diagonal of quantum_operator quantum_operator for parameters pars.
Parameters: - pars : dict, optional
Dictionary with same keys as input_dict and coupling strengths as values. Any missing keys are assumed to be set to unity.
Returns: - numpy.ndarray
array containing the diagonal part of the operator \(diag_j = H_{jj}(\lambda)\).
Examples
>>> H_diagonal = H.diagonal(pars=pars)
-
dot
(V, pars={}, check=True, out=None, overwrite_out=True, a=1.0)[source]¶ Matrix-vector multiplication of quantum_operator quantum_operator for parameters pars, with state V.
\[aH(\lambda)|V\rangle\]Parameters: - V : numpy.ndarray
Vector (quantums tate) to multiply the quantum_operator quantum_operator with.
- pars : dict, optional
Dictionary with same keys as input_dict and coupling strengths as values. Any missing keys are assumed to be set to unity.
- check : bool, optional
Whether or not to do checks for shape compatibility.
- out : array_like, optional
specify the output array for the the result. This is not supported if V is a sparse matrix.
- overwrite_out : bool, optional
flag used to toggle between two different ways to treat out. If set to True all values in out will be overwritten with the result of the dot product. If False the result of the dot product will be added to the values of out.
- a : scalar, optional
scalar to multiply the final product with: \(B = aHV\).
Returns: - numpy.ndarray
Vector corresponding to the quantum_operator quantum_operator applied on the state V.
Examples
>>> B = H.dot(A,pars=pars,check=True)
corresponds to \(B = HA\).
-
dtype
¶ type: data type of quantum_operator object.
-
eigh
(pars={}, **eigh_args)[source]¶ Computes COMPLETE eigensystem of hermitian quantum_operator quantum_operator using DENSE hermitian methods.
This function method solves for all eigenvalues and eigenvectors. It calls numpy.linalg.eigh, and uses wrapped LAPACK functions which are contained in the module py_lapack.
Parameters: - pars : dict, optional
Dictionary with same keys as input_dict and coupling strengths as values. Any missing keys are assumed to be set to unity.
- eigh_args :
For all additional arguments see documentation of numpy.linalg.eigh.
Returns: - tuple
Tuple containing the (eigenvalues, eigenvectors) of the quantum_operator quantum_operator.
Notes
Assumes the quantum_operator is hermitian! If the flat check_hermiticity = False is used, we advise the user to reassure themselves of the hermiticity properties before use.
Examples
>>> eigenvalues,eigenvectors = H.eigh(pars=pars,**eigh_args)
-
eigsh
(pars={}, **eigsh_args)[source]¶ Computes SOME eigenvalues and eigenvectors of hermitian quantum_operator quantum_operator using SPARSE hermitian methods.
This function method solves for eigenvalues and eigenvectors, but can only solve for a few of them accurately. It calls scipy.sparse.linalg.eigsh, which is a wrapper for ARPACK.
Parameters: - pars : dict, optional
Dictionary with same keys as input_dict and coupling strengths as values. Any missing keys are assumed to be set to unity.
- eigsh_args :
For all additional arguments see documentation of scipy.sparse.linalg.eigsh.
Returns: - tuple
Tuple containing the (eigenvalues, eigenvectors) of the quantum_operator quantum_operator.
Notes
Assumes the quantum_operator is hermitian! If the flat check_hermiticity = False is used, we advise the user to reassure themselves of the hermiticity properties before use.
Examples
>>> eigenvalues,eigenvectors = H.eigsh(pars=pars,**eigsh_args)
-
eigvalsh
(pars={}, **eigvalsh_args)[source]¶ Computes ALL eigenvalues of hermitian quantum_operator quantum_operator using DENSE hermitian methods.
This function method solves for all eigenvalues. It calls numpy.linalg.eigvalsh, and uses wrapped LAPACK functions which are contained in the module py_lapack.
Parameters: - pars : dict, optional
Dictionary with same keys as input_dict and coupling strengths as values. Any missing keys are assumed to be set to unity.
- eigvalsh_args :
For all additional arguments see documentation of numpy.linalg.eigvalsh.
Returns: - numpy.ndarray
Eigenvalues of the quantum_operator quantum_operator.
Notes
Assumes the quantum_operator is hermitian! If the flat check_hermiticity = False is used, we advise the user to reassure themselves of the hermiticity properties before use.
Examples
>>> eigenvalues = H.eigvalsh(pars=pars,**eigvalsh_args)
-
expt_value
(V, pars={}, check=True, enforce_pure=False)[source]¶ Calculates expectation value of hamiltonian operator at time time, in state V.
\[\langle V|H(t=\texttt{time})|V\rangle\]Parameters: - V : numpy.ndarray
Depending on the shape, can be a single state or a collection of pure or mixed states [see enforce_pure argument of basis.ent_entropy].
- pars : dict, optional
Dictionary with same keys as input_dict and coupling strengths as values. Any missing keys are assumed to be set to unity.
- enforce_pure : bool, optional
Flag to enforce pure expectation value of V is a square matrix with multiple pure states in the columns.
- check : bool, optional
Returns: - float
Expectation value of hamiltonian operator in state V.
Examples
>>> H_expt = H.expt_value(V,time=0,diagonal=False,check=True)
corresponds to \(H_{expt} = \langle V|H(t=0)|V\rangle\).
-
getH
(copy=False)[source]¶ Calculates hermitian conjugate of quantum_operator quantum_operator.
Parameters: - copy : bool, optional
Whether to return a deep copy of the original object. Default is copy = False.
Returns: - :obj:`quantum_operator`
\(H_{ij}\mapsto H_{ij}^*\)
Examples
>>> H_herm = H.getH()
-
get_shape
¶ tuple: shape of the quantum_operator object, always equal to (Ns,Ns).
-
is_dense
¶ bool: True if the quantum_operator contains a dense matrix as a componnent of either the static or dynamic lists.
-
matmat
(X)[source]¶ Matrix-matrix multiplication.
Performs the operation y=A*X where A is an MxN linear operator and X dense N*K matrix or ndarray.
Parameters: - X : {matrix, ndarray}
An array with shape (N,K).
Returns: - Y : {matrix, ndarray}
A matrix or ndarray with shape (M,K) depending on the type of the X argument.
Notes
This matmat wraps any user-specified matmat routine or overridden _matmat method to ensure that y has the correct type.
-
matrix_ele
(Vl, Vr, pars={}, diagonal=False, check=True)[source]¶ Calculates matrix element of quantum_operator quantum_operator for parameters pars in states Vl and Vr.
\[\langle V_l|H(\lambda)|V_r\rangle\]Parameters: - Vl : numpy.ndarray
Vector(s)/state(s) to multiple with on left side.
- Vl : numpy.ndarray
Vector(s)/state(s) to multiple with on right side.
- pars : dict, optional
Dictionary with same keys as input_dict and coupling strengths as values. Any missing keys are assumed to be set to unity.
- diagonal : bool, optional
When set to True, returs only diagonal part of expectation value. Default is diagonal = False.
- check : bool,
Returns: - float
Matrix element of quantum_operator quantum_operator between the states Vl and Vr.
Notes
Taking the conjugate or transpose of the state Vl is done automatically.
Examples
>>> H_lr = H.expt_value(Vl,Vr,pars=pars,diagonal=False,check=True)
corresponds to \(H_{lr} = \langle V_l|H(\lambda=0)|V_r\rangle\).
-
matvec
(x)[source]¶ Matrix-vector multiplication.
Performs the operation y=A*x where A is an MxN linear operator and x is a column vector or 1-d array.
Parameters: - x : {matrix, ndarray}
An array with shape (N,) or (N,1).
Returns: - y : {matrix, ndarray}
A matrix or ndarray with shape (M,) or (M,1) depending on the type and shape of the x argument.
Notes
This matvec wraps the user-specified matvec routine or overridden _matvec method to ensure that y has the correct shape and type.
-
ndim
¶ int: number of dimensions, always equal to 2.
-
quant_fluct
(V, pars={}, check=True, enforce_pure=False)[source]¶ Calculates the quantum fluctuations (variance) of hamiltonian operator at time time, in state V.
\[\langle V|H^2(t=\texttt{time})|V\rangle - \langle V|H(t=\texttt{time})|V\rangle^2\]Parameters: - V : numpy.ndarray
Depending on the shape, can be a single state or a collection of pure or mixed states [see enforce_pure].
- pars : dict, optional
Dictionary with same keys as input_dict and coupling strengths as values. Any missing keys are assumed to be set to unity.
- enforce_pure : bool, optional
Flag to enforce pure expectation value of V is a square matrix with multiple pure states in the columns.
- check : bool, optional
Returns: - float
Quantum fluctuations of hamiltonian operator in state V.
Examples
>>> H_fluct = H.quant_fluct(V,time=0,diagonal=False,check=True)
corresponds to \(\Delta H = \sqrt{ \langle V|H^2(t=\texttt{time})|V\rangle - \langle V|H(t=\texttt{time})|V\rangle^2 }\).
-
rdot
(V, pars={}, check=False, out=None, overwrite_out=True, a=1.0)[source]¶ Vector-matrix multiplication of quantum_operator quantum_operator for parameters pars, with state V.
\[a\langle V]H(\lambda)\]Parameters: - V : numpy.ndarray
Vector (quantums tate) to multiply the quantum_operator quantum_operator with.
- pars : dict, optional
Dictionary with same keys as input_dict and coupling strengths as values. Any missing keys are assumed to be set to unity.
- check : bool, optional
Whether or not to do checks for shape compatibility.
- out : array_like, optional
specify the output array for the the result. This is not supported if V is a sparse matrix.
- overwrite_out : bool, optional
flag used to toggle between two different ways to treat out. If set to True all values in out will be overwritten with the result. If False the result of the dot product will be added to the values of out.
- a : scalar, optional
scalar to multiply the final product with: \(B = aVH\).
Returns: - numpy.ndarray
Vector corresponding to the quantum_operator quantum_operator applied on the state V.
Examples
>>> B = H.dot(A,pars=pars,check=True)
corresponds to \(B = AH\).
-
rmatvec
(x)[source]¶ Adjoint matrix-vector multiplication.
Performs the operation y = A^H * x where A is an MxN linear operator and x is a column vector or 1-d array.
Parameters: - x : {matrix, ndarray}
An array with shape (M,) or (M,1).
Returns: - y : {matrix, ndarray}
A matrix or ndarray with shape (N,) or (N,1) depending on the type and shape of the x argument.
Notes
This rmatvec wraps the user-specified rmatvec routine or overridden _rmatvec method to ensure that y has the correct shape and type.
-
toarray
(pars={}, out=None)[source]¶ Returns copy of a quantum_operator object for parameters pars as a dense array.
This function can overflow memory if not used carefully!
Parameters: - pars : dict, optional
Dictionary with same keys as input_dict and coupling strengths as values. Any missing keys are assumed to be set to unity.
- out : numpy.ndarray
Array to fill in with the output.
Returns: - numpy.ndarray
Dense array.
Examples
>>> H_dense=H.toarray(pars=pars)
-
tocsc
(pars={})[source]¶ Returns copy of a quantum_operator object for parameters pars as a scipy.sparse.csc_matrix.
Casts the quantum_operator object as a scipy.sparse.csc_matrix object.
Parameters: - pars : dict, optional
Dictionary with same keys as input_dict and coupling strengths as values. Any missing keys are assumed to be set to unity.
Returns: - :obj:`scipy.sparse.csc_matrix`
Examples
>>> H_csc=H.tocsc(pars=pars)
-
tocsr
(pars={})[source]¶ Returns copy of a quantum_operator object for parameters pars as a scipy.sparse.csr_matrix.
Casts the quantum_operator object as a scipy.sparse.csr_matrix object.
Parameters: - pars : dict, optional
Dictionary with same keys as input_dict and coupling strengths as values. Any missing keys are assumed to be set to unity.
Returns: - :obj:`scipy.sparse.csr_matrix`
Examples
>>> H_csr=H.tocsr(pars=pars)
-
todense
(pars={}, out=None)[source]¶ Returns copy of a quantum_operator object for parameters pars as a dense array.
This function can overflow memory if not used carefully!
Parameters: - pars : dict, optional
Dictionary with same keys as input_dict and coupling strengths as values. Any missing keys are assumed to be set to unity.
- out : numpy.ndarray
Array to fill in with the output.
Returns: - obj
Depending of size of array, can be either one of
- numpy.ndarray.
- numpy.matrix.
Notes
If the array dimension is too large, scipy may choose to cast the quantum_operator quantum_operator as a numpy.matrix instead of a numpy.ndarray. In such a case, one can use the quantum_operator.toarray() method.
Examples
>>> H_dense=H.todense(pars=pars)
-
tohamiltonian
(pars={})[source]¶ Returns copy of a quantum_operator object for parameters pars as a hamiltonian object.
Parameters: - pars : dict, optional
Dictionary with same keys as input_dict and coupling strengths as values. Any missing keys are assumed to be set to unity.
Returns: - :obj:`hamiltonian`
Examples
>>> H_aslinop=H.tohamiltonian(pars=pars)
-
trace
(pars={})[source]¶ Calculates trace of quantum_operator quantum_operator for parameters pars.
Parameters: - pars : dict, optional
Dictionary with same keys as input_dict and coupling strengths as values. Any missing keys are assumed to be set to unity.
Returns: - float
Trace of quantum_operator \(\sum_{j=1}^{Ns} H_{jj}(\lambda)\).
Examples
>>> H_tr = H.trace(pars=pars)
-
transpose
(copy=False)[source]¶ Transposes quantum_operator quantum_operator.
Returns: - :obj:`quantum_operator`
\(H_{ij}\mapsto H_{ji}\)
Notes
This function does NOT conjugate the quantum_operator.
Examples
>>> H_tran = H.transpose()
-
update_matrix_formats
(matrix_formats)[source]¶ Change the internal structure of the matrices in-place.
Parameters: - matrix_formats: dict, optional
Dictionary of key,value pairs which, given a key associated with an operator in input_dict, the value of this key specifies the sparse matrix format {“csr”,”csc”,”dia”,”dense”}.
Examples
Given O which has two operators defined by strings: ‘Hx’ for transverse field, and ‘Hising’ is the Ising part. The Ising part must be diagonal therefore it is useful to cast it to a DIA matrix format, while the transverse field is not diagonal so it is most efficient to use CSR matrix format. This can be accomplished by the following:
>>> O.update_matrix_formats(dict(Hx="csr",Hising="dia"))


Chapter 8 Interpreting Regression Coefficients
8.1 Standardized Coefficients
A standardized coefficient is the coefficient on \(X\), when \(X\) is standardized so that \(\mean(X) = 0\) and \(\Var(X) = 1\). In that case, \(\beta_1\) is the change in \(\E(Y)\) associated with a one standard deviation change in \(X\).
Additionally, if all predictors are set so that \(\mean(X) = 0\), \(\beta_0\) is the expected value of \(Y\) when all \(X\) are at their means. However, if any variables appear in multiple terms, then the standardized coefficients are not particularly useful.
Standardized coefficients are generally not used in political science. (King How Not to Lie with Statistics, p. 669) More often, the effects of variables are compared by the first difference between the value of the variable at the mean, and a one standard deviation change. While, this is equivalent to the standardized coefficient
Note, that standardizing variables can help computationally in some cases. In OLS, there is a closed-form solution, so iterative optimization algorithms are not needed in to find the best parameters. However, in more complicated models which require iterative optimization, standardizing variables can often improve the performance of the optimization. Thus standardizing variables before analysis is common in machine learning. However, the purpose is for ease of computation, not for ease of interpretation.
8.2 Marginal Effects and First Difference
The marginal effect of a regressor is the change in the outcome variable associated with a small change in the predictor,
The first difference of a regression of a variable with respect to the dependent variable is for two values of a variable \(x_j\) and \(x_j + h\) as, \[ \frac{\Delta \vec{y}}{\Delta x} = y(x_j) - y(x) \]
The marginal effect is the regression coefficient, \[ \frac{\partial \vec{y}}{\partial \vec{x}} = \beta_1 . \]
For a predictor with only a linear term, \[ \vec{y} = \beta_0 + \beta_1 \vec{x}_1 , \]
However, if a predictor appears in multiple terms, the marginal effect will be a more complicated function. For example, if \(x\) appears as a squared term and an interaction, \[ \vec{y} = \beta_0 + \beta_1 \vec{x} + \beta_2 \vec{x}^2 + \beta_3 \vec{z} + \beta_4 \vec{x} \vec{z} + \beta_5 \vec{x} \vec{z}^2 \] then its marginal effect is a function of both its current value, \(\vec{x}\), and the value of \(\vec{z}\), \[ \frac{\partial \vec{y}}{\partial \vec{x}} = \beta_1 + 2 \beta_2 \vec{x} + \beta_4 \vec{z} + 2 \beta_5 \vec{x} \vec{z} \]
8.3 References
The R package marfx is still under development, but includes the ability to estimate average marginal and finite difference effects.
- ggplot2 and broom: Once point estimates and the confidence interval are calculated, it is easy to plot them.
- coefplot: Plots point estimates and confidence intervals for fitted models.
- dotwhisker: Another point-estimate and confidence interval plot pacakge for fitted models.
Packages for marginal effects or similar
- margins port of the margins command
- Built-in
predict()
function calculates predictions and confidence intervals - mfx marginal effects for beta, logit, negative binomial, poisson and probit models.
- erer:
maBina
: marginal effects for binary choice models;ocME
: marginal effects for ordered logit or probit. - car:
mmps
: Marginal model plots.
References
Cameron, A. Colin, and Pravin K. Trivedi. 2010. Microeconometrics Using Stata. Revised. Stata Press. http://www.ebook.de/de/product/10781503/a_colin_cameron_pravin_k_trivedi_microeconometrics_using_stata.html.
Hanmer, Michael J., and Kerem Ozan Kalkan. 2012. “Behind the Curve: Clarifying the Best Approach to Calculating Predicted Probabilities and Marginal Effects from Limited Dependent Variable Models.” American Journal of Political Science 57 (1). Wiley-Blackwell: 263–77. doi:10.1111/j.1540-5907.2012.00602.x.
Bartus, Tamás. 2005. “Estimation of Marginal Effects Using Margeff.” The Stata Journal. http://www.stata-journal.com/sjpdf.html?articlenum=st0086.
Williams, Richard. 2017. “Using Stata’s Margins Command to Estimate and Interpret Adjusted Predictions and Marginal Effects.” slide deck. https://www3.nd.edu/~rwilliam/stats/Margins01.pdf.


Welcome to the Most Peramoy University
UNIVERSITY OF ASIA PACIFIC
| Pera Khabo |           | Pera Khabo Na |
Welcome to the Most Peramoy University
| Pera Khabo |           | Pera Khabo Na |
er since the 1500s, when an unknown printer took a galleywhen an unknown printer took a galley
during the Renaissance. The first line of Lorem Ipsum, "Lorem
45 BC. This book is a treatise on the theory of ethics, very popula
et Malorum"(The Extremes of Good
and Evil) by Cicero,
et Malorum" (The Extremes of Good and Evil) by Cicero, written in
comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum
literature, discovered the undoubtable source. Lorem Ipsum
professor at Hampden-Sydney College in Virginia, looked up one of