code
stringlengths 4
1.01M
| language
stringclasses 2
values |
|---|---|
// Copyright (c) 2012 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.
#include "chrome/browser/ui/simple_message_box.h"
#include <utility>
#include "base/bind.h"
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/message_loop/message_loop_current.h"
#include "base/run_loop.h"
#include "build/build_config.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/simple_message_box_internal.h"
#include "chrome/browser/ui/views/message_box_dialog.h"
#include "chrome/grit/generated_resources.h"
#include "components/constrained_window/constrained_window_views.h"
#include "components/startup_metric_utils/browser/startup_metric_utils.h"
#include "components/strings/grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/display/screen.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/views/controls/message_box_view.h"
#include "ui/views/widget/widget.h"
#include "ui/views/window/dialog_delegate.h"
#if defined(OS_WIN)
#include "ui/base/win/message_box_win.h"
#include "ui/views/win/hwnd_util.h"
#endif
#if defined(OS_MACOSX)
#include "chrome/browser/ui/cocoa/simple_message_box_cocoa.h"
#endif
namespace {
#if defined(OS_WIN)
UINT GetMessageBoxFlagsFromType(chrome::MessageBoxType type) {
UINT flags = MB_SETFOREGROUND;
switch (type) {
case chrome::MESSAGE_BOX_TYPE_WARNING:
return flags | MB_OK | MB_ICONWARNING;
case chrome::MESSAGE_BOX_TYPE_QUESTION:
return flags | MB_YESNO | MB_ICONQUESTION;
}
NOTREACHED();
return flags | MB_OK | MB_ICONWARNING;
}
#endif
// static
chrome::MessageBoxResult ShowSync(gfx::NativeWindow parent,
const base::string16& title,
const base::string16& message,
chrome::MessageBoxType type,
const base::string16& yes_text,
const base::string16& no_text,
const base::string16& checkbox_text) {
chrome::MessageBoxResult result = chrome::MESSAGE_BOX_RESULT_NO;
// TODO(pkotwicz): Exit message loop when the dialog is closed by some other
// means than |Cancel| or |Accept|. crbug.com/404385
base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed);
MessageBoxDialog::Show(
parent, title, message, type, yes_text, no_text, checkbox_text,
base::BindOnce(
[](base::RunLoop* run_loop, chrome::MessageBoxResult* out_result,
chrome::MessageBoxResult messagebox_result) {
*out_result = messagebox_result;
run_loop->Quit();
},
&run_loop, &result));
run_loop.Run();
return result;
}
} // namespace
////////////////////////////////////////////////////////////////////////////////
// MessageBoxDialog, public:
// static
chrome::MessageBoxResult MessageBoxDialog::Show(
gfx::NativeWindow parent,
const base::string16& title,
const base::string16& message,
chrome::MessageBoxType type,
const base::string16& yes_text,
const base::string16& no_text,
const base::string16& checkbox_text,
MessageBoxDialog::MessageBoxResultCallback callback) {
if (!callback)
return ShowSync(parent, title, message, type, yes_text, no_text,
checkbox_text);
startup_metric_utils::SetNonBrowserUIDisplayed();
if (chrome::internal::g_should_skip_message_box_for_test) {
std::move(callback).Run(chrome::MESSAGE_BOX_RESULT_YES);
return chrome::MESSAGE_BOX_RESULT_DEFERRED;
}
// Views dialogs cannot be shown outside the UI thread message loop or if the
// ResourceBundle is not initialized yet.
// Fallback to logging with a default response or a Windows MessageBox.
#if defined(OS_WIN)
if (!base::MessageLoopCurrentForUI::IsSet() ||
!base::RunLoop::IsRunningOnCurrentThread() ||
!ui::ResourceBundle::HasSharedInstance()) {
LOG_IF(ERROR, !checkbox_text.empty()) << "Dialog checkbox won't be shown";
int result = ui::MessageBox(views::HWNDForNativeWindow(parent), message,
title, GetMessageBoxFlagsFromType(type));
std::move(callback).Run((result == IDYES || result == IDOK)
? chrome::MESSAGE_BOX_RESULT_YES
: chrome::MESSAGE_BOX_RESULT_NO);
return chrome::MESSAGE_BOX_RESULT_DEFERRED;
}
#elif defined(OS_MACOSX)
if (!base::MessageLoopCurrentForUI::IsSet() ||
!base::RunLoop::IsRunningOnCurrentThread() ||
!ui::ResourceBundle::HasSharedInstance()) {
// Even though this function could return a value synchronously here in
// principle, in practice call sites do not expect any behavior other than a
// return of DEFERRED and an invocation of the callback.
std::move(callback).Run(
chrome::ShowMessageBoxCocoa(message, type, checkbox_text));
return chrome::MESSAGE_BOX_RESULT_DEFERRED;
}
#else
if (!base::MessageLoopCurrentForUI::IsSet() ||
!ui::ResourceBundle::HasSharedInstance() ||
!display::Screen::GetScreen()) {
LOG(ERROR) << "Unable to show a dialog outside the UI thread message loop: "
<< title << " - " << message;
std::move(callback).Run(chrome::MESSAGE_BOX_RESULT_NO);
return chrome::MESSAGE_BOX_RESULT_DEFERRED;
}
#endif
bool is_system_modal = !parent;
#if defined(OS_MACOSX)
// Mac does not support system modals, so never ask MessageBoxDialog to
// be system modal.
is_system_modal = false;
#endif
MessageBoxDialog* dialog = new MessageBoxDialog(
title, message, type, yes_text, no_text, checkbox_text, is_system_modal);
views::Widget* widget =
constrained_window::CreateBrowserModalDialogViews(dialog, parent);
#if defined(OS_MACOSX)
// Mac does not support system modal dialogs. If there is no parent window to
// attach to, move the dialog's widget on top so other windows do not obscure
// it.
if (!parent)
widget->SetZOrderLevel(ui::ZOrderLevel::kFloatingWindow);
#endif
widget->Show();
dialog->Run(std::move(callback));
return chrome::MESSAGE_BOX_RESULT_DEFERRED;
}
void MessageBoxDialog::OnDialogAccepted() {
if (!message_box_view_->HasCheckBox() ||
message_box_view_->IsCheckBoxSelected()) {
Done(chrome::MESSAGE_BOX_RESULT_YES);
} else {
Done(chrome::MESSAGE_BOX_RESULT_NO);
}
}
base::string16 MessageBoxDialog::GetWindowTitle() const {
return window_title_;
}
void MessageBoxDialog::DeleteDelegate() {
delete this;
}
ui::ModalType MessageBoxDialog::GetModalType() const {
return is_system_modal_ ? ui::MODAL_TYPE_SYSTEM : ui::MODAL_TYPE_WINDOW;
}
views::View* MessageBoxDialog::GetContentsView() {
return message_box_view_;
}
bool MessageBoxDialog::ShouldShowCloseButton() const {
return true;
}
void MessageBoxDialog::OnWidgetActivationChanged(views::Widget* widget,
bool active) {
if (!active)
GetWidget()->Close();
}
////////////////////////////////////////////////////////////////////////////////
// MessageBoxDialog, private:
MessageBoxDialog::MessageBoxDialog(const base::string16& title,
const base::string16& message,
chrome::MessageBoxType type,
const base::string16& yes_text,
const base::string16& no_text,
const base::string16& checkbox_text,
bool is_system_modal)
: window_title_(title),
type_(type),
message_box_view_(new views::MessageBoxView(
views::MessageBoxView::InitParams(message))),
is_system_modal_(is_system_modal) {
SetButtons(type_ == chrome::MESSAGE_BOX_TYPE_QUESTION
? ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL
: ui::DIALOG_BUTTON_OK);
SetAcceptCallback(base::BindOnce(&MessageBoxDialog::OnDialogAccepted,
base::Unretained(this)));
SetCancelCallback(base::BindOnce(&MessageBoxDialog::Done,
base::Unretained(this),
chrome::MESSAGE_BOX_RESULT_NO));
SetCloseCallback(base::BindOnce(&MessageBoxDialog::Done,
base::Unretained(this),
chrome::MESSAGE_BOX_RESULT_NO));
base::string16 ok_text = yes_text;
if (ok_text.empty()) {
ok_text =
type_ == chrome::MESSAGE_BOX_TYPE_QUESTION
? l10n_util::GetStringUTF16(IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL)
: l10n_util::GetStringUTF16(IDS_OK);
}
SetButtonLabel(ui::DIALOG_BUTTON_OK, ok_text);
// Only MESSAGE_BOX_TYPE_QUESTION has a Cancel button.
if (type_ == chrome::MESSAGE_BOX_TYPE_QUESTION) {
base::string16 cancel_text = no_text;
if (cancel_text.empty())
cancel_text = l10n_util::GetStringUTF16(IDS_CANCEL);
SetButtonLabel(ui::DIALOG_BUTTON_CANCEL, cancel_text);
}
if (!checkbox_text.empty())
message_box_view_->SetCheckBoxLabel(checkbox_text);
chrome::RecordDialogCreation(chrome::DialogIdentifier::SIMPLE_MESSAGE_BOX);
}
MessageBoxDialog::~MessageBoxDialog() {
GetWidget()->RemoveObserver(this);
}
void MessageBoxDialog::Run(MessageBoxResultCallback result_callback) {
GetWidget()->AddObserver(this);
result_callback_ = std::move(result_callback);
}
void MessageBoxDialog::Done(chrome::MessageBoxResult result) {
CHECK(!result_callback_.is_null());
std::move(result_callback_).Run(result);
}
views::Widget* MessageBoxDialog::GetWidget() {
return message_box_view_->GetWidget();
}
const views::Widget* MessageBoxDialog::GetWidget() const {
return message_box_view_->GetWidget();
}
namespace chrome {
void ShowWarningMessageBox(gfx::NativeWindow parent,
const base::string16& title,
const base::string16& message) {
MessageBoxDialog::Show(parent, title, message,
chrome::MESSAGE_BOX_TYPE_WARNING, base::string16(),
base::string16(), base::string16());
}
void ShowWarningMessageBoxWithCheckbox(
gfx::NativeWindow parent,
const base::string16& title,
const base::string16& message,
const base::string16& checkbox_text,
base::OnceCallback<void(bool checked)> callback) {
MessageBoxDialog::Show(parent, title, message,
chrome::MESSAGE_BOX_TYPE_WARNING, base::string16(),
base::string16(), checkbox_text,
base::BindOnce(
[](base::OnceCallback<void(bool checked)> callback,
MessageBoxResult message_box_result) {
std::move(callback).Run(message_box_result ==
MESSAGE_BOX_RESULT_YES);
},
base::Passed(std::move(callback))));
}
MessageBoxResult ShowQuestionMessageBox(gfx::NativeWindow parent,
const base::string16& title,
const base::string16& message) {
return MessageBoxDialog::Show(
parent, title, message, chrome::MESSAGE_BOX_TYPE_QUESTION,
base::string16(), base::string16(), base::string16());
}
MessageBoxResult ShowMessageBoxWithButtonText(gfx::NativeWindow parent,
const base::string16& title,
const base::string16& message,
const base::string16& yes_text,
const base::string16& no_text) {
return MessageBoxDialog::Show(parent, title, message,
chrome::MESSAGE_BOX_TYPE_QUESTION, yes_text,
no_text, base::string16());
}
} // namespace chrome
|
Java
|
<?php
session_start();
// ---------------- PRE DEFINED VARIABLES ---------------- //
if ($_SESSION['user_name']=='') {
$user_name_session = $_POST['id'];
echo "no session set";
} else {
$user_name_session = $_SESSION['user_name'];
}
//print_r($user_name_session);
include_once('/kunden/homepages/0/d643120834/htdocs/config/index.php');
$db = new UserDashboard($_SESSION);
// $user = $db->getUserData($user_name_session);
// //print_r($user);
// $user['stats']['total'] = $db->getUserStats($user_name_session , 'total');
// $user['stats']['total'] = $db->getUserStats($user_name_session , 'fans');
// $user['id'] = $user['user_id'];
// $user['photo'] = $db->getProfilePhoto($user_name_session);
// $user['profile_url'] = 'http://freela.be/l/'.$user['user_name'];
// $user['media']['audio'] = $db->getUserMedia($user_name_session); // Grab Users Posts
// $user['stats']['tracks'] = count($user['media']['audio']);
// $user['twitter'] = $user['media']['audio'][0]['twitter'];
// ------ data fixes ------- //
if (isset($user['photo']) && $user['photo']!='' ) {
$profile_image = '<img src="'.$user['photo'].'" alt="'.$user['photo'].'" style="width:100%;">';
} else {
if (strpos($user['media']['audio'][0]['photo'], 'http://')) {
$media = 'http://freelabel.net/images/'.$user['media']['audio'][0]['photo'];
//echo 'I needs to be formated';
} else {
$media = $user['media']['audio'][0]['photo'];
//echo 'it doesnt need to be!!';
}
$profile_image = '<img src="'.$media.'" alt="from-media-'.$media.'" style="width:100%;">';
}
if ($user['custom']==''){
$user['custom'] = $db->getCustomData($user);
}
//print_r($user['media']['audio']);
//exit;
//print_r($user['user_name']);
//exit;
//echo '<hr><hr><hr>';
//print_r();
//$user_name_session = $user['user_name'];
//echo 'THEUSERER: '.$user_name_session.'<hr>';
$todays_date = date('Y-m-d');
$dashboard_options = '
<div class="btn-group-vertical dashboard-navigation " style="width:100%;">
<a onclick="loadPage(\'http://freelabel.net/submit/views/db/recent_posts.php\', \'#dashboard_view_panel\', \'dashboard\', \''.$user_name_session.'\')" class="btn btn-default btn-lg"><span class="glyphicon glyphicon-dashboard"></span> - Dashboard</a>
<a href="http://freelabel.net/@'.strtolower($user['twitter']).'" class="btn btn-default btn-lg" target="_blank" ><span class="glyphicon glyphicon-user"></span> - View Profile</a>
<a href="#music" onclick="loadPage(\'http://freelabel.net/submit/views/single_uploader.php\', \'#dashboard_view_panel\', \'dashboard\', \''.$user_name_session.'\')" class="btn btn-default btn-lg"><span class="glyphicon glyphicon-music"></span> - Music</a>
<a href="#photos" onclick="loadPage(\'http://freelabel.net/submit/views/db/user_photos.php\', \'#dashboard_view_panel\', \'dashboard\', \''.$user_name_session.'\')" class="btn btn-default btn-lg"><span class="glyphicon glyphicon-picture"></span> - Photos</a>
<a href="#videos" onclick="loadPage(\'http://freelabel.net/submit/views/db/video_saver.php\', \'#dashboard_view_panel\', \'dashboard\', \''.$user_name_session.'\')" class="btn btn-default btn-lg"><span class="glyphicon glyphicon-film"></span> - Videos</a>
<a href="#schedule" onclick="loadPage(\'http://freelabel.net/submit/views/db/showcase_schedule.php\', \'#dashboard_view_panel\', \'dashboard\', \''.$user_name_session.'\')" class="btn btn-default btn-lg"><span class="glyphicon glyphicon-calendar"></span> - Schedule</a>
<a href="#howtouse" onclick="loadPage(\'http://freelabel.net/submit/views/db/howtouse.php\', \'#dashboard_view_panel\', \'dashboard\', \''.$user_name_session.'\')" class="btn btn-default btn-lg" ><span class="glyphicon glyphicon-question-sign"></span> - How To Use</a>
<a href="#email" onclick="loadPage(\'http://freelabel.net/test/send_email.php\', \'#dashboard_view_panel\', \'dashboard\', \''.$user_name_session.'\')" class="btn btn-default btn-lg" ><span class="glyphicon glyphicon-envelope"></span> - Contact Support</a>
<a href="http://freelabel.net/submit/index.php?logout" class="btn btn-danger btn-lg" ><span class="glyphicon glyphicon-log-out"></span> - Logout</a>
';
$admin_options = "
<hr>
<h3>Admin Only:</h3>
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/blog_poster.php', '#main_display_panel', 'dashboard', 'admin')\" class='btn btn-warning btn-lg'> <span class='glyphicon glyphicon-pencil'></span>Post</a>
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/lead_conversion.php', '#main_display_panel', 'dashboard', 'admin')\" class='btn btn-warning btn-lg'> <span class='glyphicon glyphicon-usd'></span>Clients</a>
<a onclick=\"loadPage('http://freelabel.net/twitter/index.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-warning btn-lg'> <span class='glyphicon glyphicon-comment'></span>Twitter</a>
<a onclick=\"loadPage('http://freelabel.net/x/s.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-warning btn-lg'><span class='glyphicon glyphicon-list-alt'></span>Script</a>
<hr>
<h4>Soon-To-Be-Launched</h4>
<a onclick=\"loadPage('http://freelabel.net/twitter/index.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-warning btn-lg'> <span class='glyphicon glyphicon-comment'></span>Respond</a>
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/blog_poster.php', '#main_display_panel', 'dashboard', 'admin')\" class='btn btn-warning btn-lg'> <span class='glyphicon glyphicon-usd'></span>Release</a>
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/current_clients.php', '#main_display_panel', 'dashboard', 'admin')\" class='btn btn-warning btn-lg'> <span class='glyphicon glyphicon-pencil'></span>Reproduce</a>
<hr>
<h4>Still Testing</h4>
<a onclick=\"loadPage('http://freelabel.net/upload/index.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-warning btn-lg'>Uploader</a>
<a onclick=\"loadPage('http://freelabel.net/submit/views/uploadedsingles.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-warning btn-lg'>Payouts</a>
<a onclick=\"loadPage('http://freelabel.net/tweeter.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-warning btn-lg'>Saved</a>
<a onclick=\"loadPage('http://freelabel.net/tweeter.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-warning btn-lg'>Saved</a>
<a onclick=\"loadPage('http://freelabel.net/FullWidthTabs/index.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-warning btn-lg'>Full Width</a>";
$update_successful = '<script type="text/javascript">
function redirectToSite() {
alert("Your Changes Have Been Saved! Now Returning you to your Dashboard..");
window.location.assign("http://freelabel.net/submit/")
}
</script>';
$profile_builder_form = '<div class="create_profile_form_wrapper">';
//$profile_builder_form .= '<h3 >Hello, '.$user_name_session.'! </h3>';
$profile_builder_form .= '<div class="label label-warning" role="alert">You\'ll need to finish completing all the additional information regarding creating your profile, '.$user_name_session.'! </div>';
//$profile_builder_form .= '<div class="alert alert-warning" role="alert">You\'ll need to <a href="#" class="alert-link">make your payment</a> before we can get you booked in rotation!</div>';
$profile_builder_form .= "
<form name='profile_builder_form' action='http://freelabel.net/submit/views/db/campaign_info.php' method='post' enctype=\"multipart/form-data\" class='profile_builder_form panel-body row' >
<h1>Complete Profile</h1>
<p class='section-description text-muted' >Use this form to complete your FREELABEL Profile. We will use this information to build your campaign as well as tag you during promotional campaigns!</p>
<div class='col-md-3 col-sm-6' >
<h4><i class='fa fa-photo' ></i> Upload Profile Photo</h4><input type='file' class='form-control' name='photo' required>
</div>
<div class='col-md-3 col-sm-6' >
<h4><i class='fa fa-comment'></i> Display Name</h4>
<input type='text' class='form-control' name='artist_name' placeholder='What is your Artist or Brand Name?' required>
</div>
<div class='col-md-3 col-sm-6' >
<h4><i class='fa fa-map-marker'></i> Location</h4>
<input type='text' class='form-control' name='artist_location' placeholder='Where are you from?' required>
</div>
<div class='col-md-3 col-sm-6' >
<h4><i class='fa fa-users'></i> Brand or Management <small>(optional)</small></h4>
<input type='text' class='form-control' name='artist_location' placeholder='Enter management contact information (Name, Phone, Email, etc..)' >
</div>
<div class='col-md-12'>
<h4><i class='fa fa-book'></i> Artist Bio</h4><br>
<textarea name='artist_description' class='form-control' rows='4' cols='53' placeholder='Tell us a little (or alot) about yourself..'></textarea>
</div>
<h1>Link Social Media</h1>
<div class=' col-md-4 col-sm-6' >
<h4><i class='fa fa-twitter'></i> Twitter</h4>
<input type='text' class='form-control' name='artist_twitter' placeholder='Enter your Twitter username.. (include \"@\" sign)' required >
</div>
<div class=' col-md-4 col-sm-6' >
<h4><i class='fa fa-instagram'></i> Instagram <small>(optional)</small></h4>
<input type='text' class='form-control' name='artist_twitter' placeholder='Enter Your Instagram Username.. (include \"@\" sign)' >
</div>
<div class=' col-md-4 col-sm-6' >
<h4><i class='fa fa-soundcloud'></i> Soundcloud <small>(optional)</small></h4>
<input type='text' class='form-control' name='artist_twitter' placeholder='Enter Your Soundcloud Username.. (include \"@\" sign)' >
</div>
<div class=' col-md-4 col-sm-6' >
<h4><i class='fa fa-youtube'></i> Youtube <small>(optional)</small></h4>
<input type='text' class='form-control' name='artist_twitter' placeholder='Enter Your Youtube Username.. (include \"@\" sign)' >
</div>
<div class=' col-md-4 col-sm-6' >
<h4><i class='fa fa-paypal'></i> Paypal <small>(optional)</small></h4>
<input type='text' class='form-control' name='artist_twitter' placeholder='Enter Your Paypal Email..' >
</div>
<div class=' col-md-4 col-sm-6' >
<h4><i class='fa fa-snapchat'></i> Snapchat <small>(optional)</small></h4>
<input type='text' class='form-control' name='artist_twitter' placeholder='Enter Your Paypal Email..' >
</div>
<div class='col-md-12'>
<input name='update_profile' type='submit' class='btn btn-warning complete-profile-button' value='SAVE PROFILE'>
</div>
<input type='hidden' name='id' value='".$user_name_session."' >
<input type='hidden' name='update_profile'>
<br>
</form>
<hr>
</div>";
$confirm_profile = "
<h2 id='subtitle'>Confirm Profile!</h2>
<div id='body'>
<h2>Make sure your information is correct before we make these changes to your profile!</h2>
<br><br>
<table id='body'>
<tr>
<td>
<img id='preview_photo' src='".$full_photo_path."'>
</td>
<td>
<span id='sub_label' >Arist Name:</span> <span id='pricing1' >".$artist_name."</span><br>
<span id='sub_label' >Twitter UserName:</span> <span id='pricing1' >".$artist_twitter."</span><br>
<span id='sub_label' >Artist Location:</span> <span id='pricing1' >".$artist_location."</span><br>
<h3>Description:</h3><br>
".$artist_description."
<center>
<button class='confirm_update' type='button' onclick='redirectToSite()'>SAVE CHANGES TO PROFILE</button>
</center>
</td>
</tr>
</table>
<br><br>
</div>";
?>
<style type="text/css">
#preview_photo {
width:400px;
vertical-align: text-top;
}
#profile_builder_form {
width:300px;
}
.download_button {
display:block;
}
.create_profile_form_wrapper h3 {
color:#101010;
}
.uploaded_singles {
border-radius:0px;
}
.more-options-button {
display:none;
}
.events-panel {
text-align: left;
}
.dashboard-panel {
min-height: 50vh;
}
.db-details {
color:#303030;
font-size: 0.75em;
}
.overflow {
max-height:300px;
overflow-y:scroll;
}
.profile_builder_form input, .profile_builder_form textarea, .profile_builder_form select, .profile_builder_form option {
font-size: 125%;
padding:2.5%;
margin-bottom:2.5%;
}
.complete-profile-button {
margin:auto;
display:block;
}
.form-section-title h3 {
color:#e3e3e3;
}
.events-panel {
padding-bottom:0px;
margin-bottom:4%;
border-bottom:2px solid #101010;
}
.overflow, .dashboard-profile-details {
min-height: 80vh;
}
.events-panel .overflow {
height:80vh;
}
</style>
<script type="text/javascript">
$(function(){
var pleaseWait = 'Please wait..';
$('.more-options-button').click(function(){
$('.more-options').slideToggle('fast');
});
$('#edit-default-pxhoto').change(function() {
// ------ NEW NEW NEW NEW ------ //
$('.photo-upload-results').html(' ');
$('#edit-default-photo').append(pleaseWait);
//$('.confirm-upload-buttons').prepend('<p class="wait" style="color:#303030;">Please wait..<p>');
//$('.confirm-upload-buttons').hide('fast');
var path = 'submit/updateprofile.php';
var data;
var formdata_PHO = $('#edit-default-photo')[0].files[0];
var formdata = new FormData();
// Add the file to the request.
formdata.append('photos[]', formdata_PHO);
//var formdata = $('#single_upload_form').serialize();
//console.log(formdata_PHO);
//alert(formdata_PHO);
$.ajax({
// Uncomment the following to send cross-domain cookies:
xhrFields: {withCredentials: true},
url: path,
//dataType: 'json',
method: 'POST',
cache : false,
processData: false,
contentType: false,
fileElementId: 'image-upload',
data: formdata,
beforeSend: function (x) {
if (x && x.overrideMimeType) {
x.overrideMimeType("multipart/form-data");
}
},
// Now you should be able to do this:
mimeType: 'multipart/form-data' //Property added in 1.5.1
}).always(function () {
//alert(formdata_PHO);
console.log(formdata_PHO);
//$('#confirm_upload').html('please wait..');
//$(this).removeClass('fileupload-processing');
}).fail(function(jqXHR){
alert(jqXHR.statusText + 'oh no it didnt work!')
}).done(function (result) {
//alert('YES');
$('.edit-default-form').append(result);
//$('.confirm-upload-buttons').show('fast');
// $('.confirm-upload-buttons').css('opacity',1);
//$('.wait').hide('fast');
})
});
});
function showPhotoOptions(id) {
//alert(id);
$('.edit-profile-block').slideToggle('fast');
}
</script>
<?php
// IF ARTIST PROFILE EXISTS, SHOW PANELS
include(ROOT.'inc/connection.php');
if ($user_name == false) {
$user_name = 'no username';
}
// ------------------------------------------------------- //
// CHECK IF EXISTS IN ARTIST WEBSITE DATABASE
// ------------------------------------------------------- //
$sql ="SELECT * FROM user_profiles WHERE id='".$user_name_session."'";
$result = mysqli_query($con,$sql);
if($row = mysqli_fetch_array($result))
{
// ------------------------------------------------------- //
// IF EXISTS, DISPLAY FULL USER DATA & CONTROL OPTIONS
// ------------------------------------------------------- //
// PROFILE IMAGE
$profile_info = '
<a target="_blank" href="'.$user['profile_url'].'">'.$profile_image.'</a>';
$profile_options.="
<!--
<a onclick=\"loadPage('http://freelabel.net/mag/pull_mag.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-signal\"></span>Feed</a>
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/user_photos.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-picture\"></span>Photos</a>
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/recent_posts.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-envelope\"></span>Messages</a>
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/recent_uploads.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-envelope\"></span>Notifications</a>
-->
<a class='btn btn-default lead_control' href='".$user['profile_url']."' target='_blank' ><span class=\"glyphicon glyphicon-phone\"></span>View Website</a>
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/recent_posts.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-cloud-upload\"></span>Your Uploads</a>
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/showcase_schedule.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-calendar\"></span>Your Schedule</a>
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/howtouse.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-shopping-cart\"></span>Help</a>
<a class='btn btn-default lead_control more-options-button'><span class=\"glyphicon glyphicon-cog\"></span>Settings</a>
<div class='more-options' style='display:none;'>
".$user['custom']."
</div>
";
$profile_info.='
<div class="" id="dashboard_profile_photo" >
<!--<h5 class="sub_title" >http://FREELA.BE/L/'.$user_name_session.'</h5>-->
';
/*$profile_info .= "
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/lead_conversion.php?leads=today', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-usd\"></span>Leads</a>
<a class='btn btn-default lead_control' onclick=\"loadPage('http://freelabel.net/rssreader/cosign.php?control=update&rss=1', '#main_display_panel', 'mag')\" ><span class=\"glyphicon glyphicon-usd\"></span>RSS</a>
<a class='btn btn-default lead_control schedule' onclick=\"loadWidget('schedule')\"><span class=\"glyphicon glyphicon-usd\"></span>Schedule</a>
<a class='btn btn-default lead_control twitter' onclick=\"loadWidget('twitter')\"><span class=\"glyphicon glyphicon-usd\"></span>Twitter</a>
<a class='btn btn-default lead_control submissions' onclick=\"loadWidget('submissions')\"><span class=\"glyphicon glyphicon-usd\"></span>Submissions</a>
<a class='btn btn-default lead_control clients' onclick=\"loadWidget('clients')\"><span class=\"glyphicon glyphicon-usd\"></span>Clients</a>
<a onclick=\"loadPage('http://freelabel.net/x/s.php', '#lead_widget_container', 'dashboard', 'admin')\" class='btn btn-default lead_control'><span class='glyphicon glyphicon-list-alt'></span>Script</a>";*/
/*
$profile_info .= "
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/lead_conversion.php?leads=today', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-signal\"></span>Feed</a>
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/lead_conversion.php?leads=today', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-envelope\"></span>Messages</a>
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/lead_conversion.php?leads=today', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-envelope\"></span>Notifications</a>
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/lead_conversion.php?leads=today', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-music\"></span>Audio</a>
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/lead_conversion.php?leads=today', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-picture\"></span>Photos</a>
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/lead_conversion.php?leads=today', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-shopping-cart\"></span>Products</a>
<a class='btn btn-default lead_control' onclick=\"loadPage('http://freelabel.net/rssreader/cosign.php?control=update&rss=1', '#main_display_panel', 'mag')\" ><span class=\"glyphicon glyphicon-calendar\"></span>Schedule</a>
<a class='btn btn-default lead_control' href='http://freelabel.net/x/?i=".$user_name_session."' target='_blank' ><span class=\"glyphicon glyphicon-user\"></span>View Website</a>
";*/
$profile_info .= '
<div class="panel-body profile_default_options">
<a onclick="showPhotoOptions('.$user['user_id'].')" class=\'btn btn-default btn-xs col-md-6\' id="update_photo_button"> <span class="glyphicon glyphicon-pencil"></span>Change Default</a>
<!--<a onclick="loadPage(\'http://freelabel.net/submit/views/db/user_photos.php\', \'#main_display_panel\', \'dashboard\', \''.$user_name_session.'\')" class=\'btn btn-default btn-xs col-md-6\'> <span class="glyphicon glyphicon-plus"></span>Photos</a>-->
<div id=\'dashboard_navigation\' style=\'margin-top:5%;display:none;\' >
<!--<a class=\'btn btn-primary\' href="http://freelabel.net/submit/" style=\'display:none;\'>Artist Control Panel</a>
<a class=\'btn btn-primary\' href="edit.php">View Profile</a>
<a class=\'btn btn-primary\' href="edit.php">'.WORDING_EDIT_USER_DATA.'</a>
<a class=\'btn btn-danger\' href="../index.php?logout">'.WORDING_LOGOUT.'</a>-->
</div>
</div>
<div class="edit-profile-block" style="display:none;background-color:#e3e3e3;border-radius:10px;padding:2% 1%" >
<form action="http://freelabel.net/submit/updateprofile.php" method="POST" enctype="multipart/form-data" class="edit-default-form">
<span id="photo-upload-results" ></span>
<input type="file" name="file" id="edit-default-photo">
<br>
<input type="hidden" name="user_name" value="'.$user['user_name'].'">
<input type="hidden" name="user_id" value="'.$user['user_id'].'">
<input type="submit" value="UPDATE PHOTO" class="btn btn-primary">
</form>
</div>
</div>';
/*echo "
<div class=''>
<!--<h1 class='panel-heading'>Uploads</h1>-->
<nav class='panel-body upload_buttons'>
<a onclick=\"window.open('http://upload.freelabel.net/?uid=". $user_name_session. "')\" class='btn btn-success btn-lg col-md-3'> <span class=\"glyphicon glyphicon-plus\"></span>Upload</a>
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/user_photos.php', '#main_display_panel', 'dashboard', '". $user_name_session. "')\" class='btn btn-warning btn-lg col-md-3'> <span class=\"glyphicon glyphicon-camera\"></span>Photos</a>
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/recent_posts.php', '#main_display_panel', 'dashboard', '". $user_name_session. "')\" class='btn btn-warning btn-lg col-md-3'> <span class=\"glyphicon glyphicon-music\"></span>Music</a>
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/video_saver.php', '#recent_post_wrapper', 'dashboard', '". $user_name_session. "','','facetime-video')\" class='btn btn-warning btn-lg col-md-3'> <span class=\"glyphicon glyphicon-facetime-video\"></span>Videos</a>
<!--
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/recent_posts.php?control=blog&view=all#blog_posts', '#main_display_panel', 'dashboard', '". $user_name_session. "')\" class='btn btn-default btn-lg col-md-2' >All</a>
<a onclick=\"loadPage('http://freelabel.net/submit/views/db/recent_posts.php?control=blog&view=all#blog_posts', '#main_display_panel', 'dashboard', '". $user_name_session. "')\" class='btn btn-default btn-lg col-md-2' >Recent</a>
<a href='http://freelabel.net/?ctrl=trx&view=submissions#blog_posts' style='display:none;' class='btn btn-default btn-lg col-md-2' >Submissions</a>
-->
</nav>
</div>";*/
echo $upload_options;
echo '<div class="row user-dashboard-panel">';
echo '<div class="col-md-4 col-sm-4 dashboard-profile-details">';
echo $profile_info;
echo $profile_options;
echo '</div>';
echo '<div class="col-md-8 col-sm-8">';
echo '<div class="panel-body col-md-10 col-xs-10 dashboard-panel events-panel ">';
//echo '<h4 class="section_title" style="text-align:left;">Events</h4>';
echo '<div class="overflow" >';
include(ROOT.'submit/views/db/showcase_schedule.php');
echo '</div>';
echo '</div>';
echo '<div class="panel-body col-md-2 col-xs-2 dashboard-panel uploaded_singles">';
echo '<h3 class="db-details">Total Views:<h3> '.$user['stats']['total'];
echo '<h3 class="db-details">Tracks:<h3> '.$user['stats']['tracks'];
//echo 'Total Fans: '.$user['stats'];
//$user_media = $user['media']['audio'];
//include(ROOT.'submit/views/uploadedsingles.php');
echo '</div>';
echo '</div>';
echo '</div>';
// FULL ADMIN DASHBOARD PANEL
$i=0;
if ($user_name_session == 'admin'
OR $user_name_session == 'mayoalexander'
//OR $user_name_session == 'sierra'
OR $user_name_session == 'sales'
OR $user_name_session == 'Mia'
OR $user_name_session == 'nickhustle'
//OR $user_name_session == 'ghost'
) {
$i=1;
//echo $admin_options;
}
// BLOGGER DASHBOARD NAVIGATION
if ($user_name_session == 'sierra'
OR $user_name_session == 'siralexmayo'
OR $user_name_session == 'KingMilitia' ) {
$i=1;
echo $blogger_options;
}
if ($i!=1) {
echo '</div>';
}
} else {
/* --------------------------------------------
IF NOT EXISTING IN DATABASE, DISPLAY FORM OR SAVE FORM DATA
--------------------------------------------*/
if (isset($_POST["update_profile"])) {
// echo 'it worked';
// include('../../../header.php');
//echo '<pre>';
//print_r($_POST);
$profile_data['id'] = $_POST['id'];
$profile_data['name'] = $_POST['artist_name'];
$profile_data['twitter'] = $_POST['artist_twitter'];
$profile_data['location'] = $_POST['artist_location'];
$profile_data['description'] = $_POST['artist_description'];
$profile_data['photo'] = $_POST['photo'];
$profile_data['profile_url'] = $_POST['id'];
$profile_data['photo'] = $_POST['id'];
$profile_data['date_created'] = $_POST['id'];
$id = $_POST['id'];
$artist_name = $_POST['artist_name'];
$artist_twitter = $_POST['artist_twitter'];
// TWITTERFIX
$artist_twitter = str_replace('@@', '@', $artist_twitter);
$artist_twitter = str_replace('@@@', '@', $artist_twitter);
$artist_location = $_POST['artist_location'];
$artist_description = $_POST['artist_description'];
$photo = $_POST['photo'];
$tmp_name = $_FILES["photo"]["tmp_name"];
$ext_arr = explode('.',$_FILES["photo"]["name"]);
$ext_arr = array_reverse($ext_arr);
$ext = $ext_arr[0];
$name = $_FILES["photo"]["name"];
$photo_path = "uploads/".$profile_data['id'].'-'.rand(1111111111,9999999999).'.'.$ext;
$photo_path_save = "../../".$photo_path;
$full_photo_path = "http://freelabel.net/submit/".$photo_path;
//$profile_img_exists = getimagesize($full_photo_path);
$profile_url = 'http://FREELA.BE/'.strtolower($profile_data['id']);
//echo '<pre>';
//print_r($_FILES);
//print_r($photo_path_save);
//exit;
move_uploaded_file($tmp_name, $photo_path_save );
// CONFIRM PROFILE
//echo 'PROFILE UPDATED!';
// CREATE PROFILE
include('../../../inc/connection.php');
// Insert into database
$sql='INSERT INTO `amrusers`.`user_profiles` (
`id` ,
`name` ,
`twitter` ,
`location` ,
`description` ,
`photo`,
`profile_url`,
`date_created`
)
VALUES (
"'.$id.'", "'.$artist_name.'", "'.$artist_twitter.'", "'.$artist_location.'", "'.$artist_description.'", "'.$full_photo_path.'", "'.$profile_url.'", "'.$todays_date.'"
);';
if (mysqli_query($con,$sql)) {
//echo "Entry Created Successfully!";
echo '<script>
alert("Entry Created Successfully!");
window.location.assign("http://freelabel.net/users/dashboard/?ctrl=analytics");
</script>';
} else {
echo "Error creating database entry: " . mysqli_error($con);
}
//echo '<br><br><br><br><br><br>';
} else {
/* --------------------------------------------
IF NO POST DATA SENT, SHOW FORM
--------------------------------------------*/
echo $profile_builder_form;
//exit;
}
}
?>
<script type="text/javascript">
$(function(){
$('.profile_builder_form').submit(function(event){
var data = $(this).seralize();
event.preventDefault();
alert(data);
});
});
</script>
|
Java
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>statsmodels.tsa.statespace.structural.UnobservedComponents.loglike — statsmodels 0.9.0 documentation</title>
<link rel="stylesheet" href="../_static/nature.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="shortcut icon" href="../_static/statsmodels_hybi_favico.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="statsmodels.tsa.statespace.structural.UnobservedComponents.loglikeobs" href="statsmodels.tsa.statespace.structural.UnobservedComponents.loglikeobs.html" />
<link rel="prev" title="statsmodels.tsa.statespace.structural.UnobservedComponents.initialize_stationary" href="statsmodels.tsa.statespace.structural.UnobservedComponents.initialize_stationary.html" />
<link rel="stylesheet" href="../_static/examples.css" type="text/css" />
<link rel="stylesheet" href="../_static/facebox.css" type="text/css" />
<script type="text/javascript" src="../_static/scripts.js">
</script>
<script type="text/javascript" src="../_static/facebox.js">
</script>
<script type="text/javascript">
$.facebox.settings.closeImage = "../_static/closelabel.png"
$.facebox.settings.loadingImage = "../_static/loading.gif"
</script>
</head><body>
<div class="headerwrap">
<div class = "header">
<a href = "../index.html">
<img src="../_static/statsmodels_hybi_banner.png" alt="Logo"
style="padding-left: 15px"/></a>
</div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="statsmodels.tsa.statespace.structural.UnobservedComponents.loglikeobs.html" title="statsmodels.tsa.statespace.structural.UnobservedComponents.loglikeobs"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="statsmodels.tsa.statespace.structural.UnobservedComponents.initialize_stationary.html" title="statsmodels.tsa.statespace.structural.UnobservedComponents.initialize_stationary"
accesskey="P">previous</a> |</li>
<li><a href ="../install.html">Install</a></li> |
<li><a href="https://groups.google.com/forum/?hl=en#!forum/pystatsmodels">Support</a></li> |
<li><a href="https://github.com/statsmodels/statsmodels/issues">Bugs</a></li> |
<li><a href="../dev/index.html">Develop</a></li> |
<li><a href="../examples/index.html">Examples</a></li> |
<li><a href="../faq.html">FAQ</a></li> |
<li class="nav-item nav-item-1"><a href="../statespace.html" >Time Series Analysis by State Space Methods <code class="docutils literal notranslate"><span class="pre">statespace</span></code></a> |</li>
<li class="nav-item nav-item-2"><a href="statsmodels.tsa.statespace.structural.UnobservedComponents.html" accesskey="U">statsmodels.tsa.statespace.structural.UnobservedComponents</a> |</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="statsmodels-tsa-statespace-structural-unobservedcomponents-loglike">
<h1>statsmodels.tsa.statespace.structural.UnobservedComponents.loglike<a class="headerlink" href="#statsmodels-tsa-statespace-structural-unobservedcomponents-loglike" title="Permalink to this headline">¶</a></h1>
<dl class="method">
<dt id="statsmodels.tsa.statespace.structural.UnobservedComponents.loglike">
<code class="descclassname">UnobservedComponents.</code><code class="descname">loglike</code><span class="sig-paren">(</span><em>params</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#statsmodels.tsa.statespace.structural.UnobservedComponents.loglike" title="Permalink to this definition">¶</a></dt>
<dd><p>Loglikelihood evaluation</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>params</strong> (<em>array_like</em>) – Array of parameters at which to evaluate the loglikelihood
function.</li>
<li><strong>transformed</strong> (<em>boolean</em><em>, </em><em>optional</em>) – Whether or not <cite>params</cite> is already transformed. Default is True.</li>
<li><strong>kwargs</strong> – Additional keyword arguments to pass to the Kalman filter. See
<cite>KalmanFilter.filter</cite> for more details.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<p><a class="footnote-reference" href="#id2" id="id1">[1]</a> recommend maximizing the average likelihood to avoid scale issues;
this is done automatically by the base Model fit method.</p>
<p class="rubric">References</p>
<table class="docutils footnote" frame="void" id="id2" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>Koopman, Siem Jan, Neil Shephard, and Jurgen A. Doornik. 1999.
Statistical Algorithms for Models in State Space Using SsfPack 2.2.
Econometrics Journal 2 (1): 107-60. doi:10.1111/1368-423X.00023.</td></tr>
</tbody>
</table>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<dl class="last docutils">
<dt><a class="reference internal" href="statsmodels.tsa.statespace.structural.UnobservedComponents.update.html#statsmodels.tsa.statespace.structural.UnobservedComponents.update" title="statsmodels.tsa.statespace.structural.UnobservedComponents.update"><code class="xref py py-meth docutils literal notranslate"><span class="pre">update</span></code></a></dt>
<dd>modifies the internal state of the state space model to reflect new params</dd>
</dl>
</div>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="statsmodels.tsa.statespace.structural.UnobservedComponents.initialize_stationary.html"
title="previous chapter">statsmodels.tsa.statespace.structural.UnobservedComponents.initialize_stationary</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="statsmodels.tsa.statespace.structural.UnobservedComponents.loglikeobs.html"
title="next chapter">statsmodels.tsa.statespace.structural.UnobservedComponents.loglikeobs</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/generated/statsmodels.tsa.statespace.structural.UnobservedComponents.loglike.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer" role="contentinfo">
© Copyright 2009-2017, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.4.
</div>
</body>
</html>
|
Java
|
/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
*
* Data Differential YATL (i.e. libtest) library
*
* Copyright (C) 2012 Data Differential, http://datadifferential.com/
*
* 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 names of its contributors 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
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#pragma once
#if defined(BUILDING_LIBHOSTILE)
# if defined(HAVE_VISIBILITY) && HAVE_VISIBILITY
# define LIBHOSTILE_API __attribute__ ((visibility("default")))
# define LIBHOSTILE_LOCAL __attribute__ ((visibility("hidden")))
# elif defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550)
# define LIBHOSTILE_API __global
# define LIBHOSTILE_LOCAL __global
# elif defined(_MSC_VER)
# define LIBHOSTILE_API extern __declspec(dllexport)
# define LIBHOSTILE_LOCAL extern __declspec(dllexport)
# else
# define LIBHOSTILE_API
# define LIBHOSTILE_LOCAL
# endif /* defined(HAVE_VISIBILITY) */
#else /* defined(BUILDING_LIBHOSTILE) */
# if defined(_MSC_VER)
# define LIBHOSTILE_API extern __declspec(dllimport)
# define LIBHOSTILE_LOCAL
# else
# define LIBHOSTILE_API
# define LIBHOSTILE_LOCAL
# endif /* defined(_MSC_VER) */
#endif /* defined(BUILDING_LIBHOSTILE) */
|
Java
|
//
// text_recognizer.h
// STR
//
// Created by vampirewalk on 2015/4/14.
// Copyright (c) 2015年 mocacube. All rights reserved.
//
#ifndef __STR__text_recognizer__
#define __STR__text_recognizer__
#include <iostream>
#include <string>
#include <vector>
#include <opencv2/text.hpp>
#include <opencv2/core/utility.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
class TextRecognizer {
public:
TextRecognizer(){};
std::vector<std::string> recognize(std::vector<char> data);
};
#endif /* defined(__STR__text_recognizer__) */
|
Java
|
/*
* ArrayEntryType.h
*
* Created on: Nov 14, 2012
* Author: Mitchell Wills
*/
#ifndef ARRAYENTRYTYPE_H_
#define ARRAYENTRYTYPE_H_
#include <stdlib.h>
#include <stdio.h>
#ifndef _WRS_KERNEL
#include <stdint.h>
#endif
class ArrayEntryType;
#include "ArrayData.h"
#include "ComplexEntryType.h"
struct ArrayEntryData{
uint8_t length;
EntryValue* array;
};
/**
* Represents the size and contents of an array.
*/
typedef struct ArrayEntryData ArrayEntryData;
/**
* Represents the type of an array entry value.
*/
class ArrayEntryType : public ComplexEntryType {//TODO allow for array of complex type
private:
NetworkTableEntryType& m_elementType;
public:
/**
* Creates a new ArrayEntryType.
*
* @param id The ID which identifies this type to other nodes on
* across the network.
* @param elementType The type of the elements this array contains.
*/
ArrayEntryType(TypeId id, NetworkTableEntryType& elementType);
/**
* Creates a copy of an value which is of the type contained by
* this array.
*
* @param value The element, of this array's contained type, to
* copy.
* @return A copy of the given value.
*/
EntryValue copyElement(EntryValue value);
/**
* Deletes a entry value which is of the type contained by
* this array.
*
* After calling this method, the given entry value is
* no longer valid.
*
* @param value The value to delete.
*/
void deleteElement(EntryValue value);
/**
* See {@link NetworkTableEntryType}::sendValue
*/
void sendValue(EntryValue value, DataIOStream& os);
/**
* See {@link NetworkTableEntryType}::readValue
*/
EntryValue readValue(DataIOStream& is);
/**
* See {@link NetworkTableEntryType}::copyValue
*/
EntryValue copyValue(EntryValue value);
/**
* See {@link NetworkTableEntryType}::deleteValue
*/
void deleteValue(EntryValue value);
/**
* See {@link ComplexEntryType}::internalizeValue
*/
EntryValue internalizeValue(std::string& key, ComplexData& externalRepresentation, EntryValue currentInteralValue);
/**
* See {@link ComplexEntryType}::exportValue
*/
void exportValue(std::string& key, EntryValue internalData, ComplexData& externalRepresentation);
};
#endif /* ARRAYENTRYTYPE_H_ */
|
Java
|
#!/usr/bin/env python
import sys
def inv(s):
if s[0] == '-':
return s[1:]
elif s[0] == '+':
return '-' + s[1:]
else: # plain number
return '-' + s
if len(sys.argv) != 1:
print 'Usage:', sys.argv[0]
sys.exit(1)
for line in sys.stdin:
linesplit = line.strip().split()
if len(linesplit) == 3:
assert(linesplit[0] == 'p')
print('p ' + inv(linesplit[2]) + ' ' + linesplit[1])
elif len(linesplit) == 5:
assert(linesplit[0] == 's')
print('s ' + \
inv(linesplit[2]) + ' ' + linesplit[1] + ' ' + \
inv(linesplit[4]) + ' ' + linesplit[3] )
elif len(linesplit) == 0:
print
|
Java
|
def test_default(cookies):
"""
Checks if default configuration is working
"""
result = cookies.bake()
assert result.exit_code == 0
assert result.project.isdir()
assert result.exception is None
|
Java
|
// Test for "sancov.py missing ...".
// First case: coverage from executable. main() is called on every code path.
// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s -o %t -DFOOBAR -DMAIN
// RUN: rm -rf %t-dir
// RUN: mkdir -p %t-dir
// RUN: cd %t-dir
// RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t
// RUN: %sancov print *.sancov > main.txt
// RUN: rm *.sancov
// RUN: count 1 < main.txt
// RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t x
// RUN: %sancov print *.sancov > foo.txt
// RUN: rm *.sancov
// RUN: count 3 < foo.txt
// RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t x x
// RUN: %sancov print *.sancov > bar.txt
// RUN: rm *.sancov
// RUN: count 4 < bar.txt
// RUN: %sancov missing %t < foo.txt > foo-missing.txt
// RUN: sort main.txt foo-missing.txt -o foo-missing-with-main.txt
// The "missing from foo" set may contain a few bogus PCs from the sanitizer
// runtime, but it must include the entire "bar" code path as a subset. Sorted
// lists can be tested for set inclusion with diff + grep.
// RUN: diff bar.txt foo-missing-with-main.txt > %t.log || true
// RUN: not grep "^<" %t.log
// Second case: coverage from DSO.
// cd %t-dir
// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s -o %dynamiclib -DFOOBAR -shared -fPIC
// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s %dynamiclib -o %t -DMAIN
// RUN: cd ..
// RUN: rm -rf %t-dir
// RUN: mkdir -p %t-dir
// RUN: cd %t-dir
// RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t x
// RUN: %sancov print %xdynamiclib_filename.*.sancov > foo.txt
// RUN: rm *.sancov
// RUN: count 2 < foo.txt
// RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t x x
// RUN: %sancov print %xdynamiclib_filename.*.sancov > bar.txt
// RUN: rm *.sancov
// RUN: count 3 < bar.txt
// RUN: %sancov missing %dynamiclib < foo.txt > foo-missing.txt
// RUN: diff bar.txt foo-missing.txt > %t.log || true
// RUN: not grep "^<" %t.log
// REQUIRES: x86-target-arch
// XFAIL: android
#include <stdio.h>
void foo1();
void foo2();
void bar1();
void bar2();
void bar3();
#if defined(FOOBAR)
void foo1() { fprintf(stderr, "foo1\n"); }
void foo2() { fprintf(stderr, "foo2\n"); }
void bar1() { fprintf(stderr, "bar1\n"); }
void bar2() { fprintf(stderr, "bar2\n"); }
void bar3() { fprintf(stderr, "bar3\n"); }
#endif
#if defined(MAIN)
int main(int argc, char **argv) {
switch (argc) {
case 1:
break;
case 2:
foo1();
foo2();
break;
case 3:
bar1();
bar2();
bar3();
break;
}
}
#endif
|
Java
|
# Copyright (c) 2014-2015 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.
# 3. Neither the name of the copyright holder 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 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.
obj-y += dwc_otg_adp.o
obj-y += dwc_otg_cfi.o
obj-y += dwc_otg_cil.o
obj-y += dwc_otg_cil_intr.o
obj-y += dwc_otg_driver.o
obj-y += dwc_common_phabos.o
obj-$(CONFIG_USB_HOST) += dwc_otg_hcd.o
obj-$(CONFIG_USB_HOST) += dwc_otg_hcd_ddma.o
obj-$(CONFIG_USB_HOST) += dwc_otg_hcd_intr.o
obj-$(CONFIG_USB_HOST) += dwc_otg_hcd_queue.o
obj-$(CONFIG_USB_DEVICE) += dwc_otg_pcd.o
obj-$(CONFIG_USB_DEVICE) += dwc_otg_pcd_intr.o
CFLAGS += -DDWC_PHABOS
ifeq ($(CONFIG_USB_DWC2_DEBUG),y)
CFLAGS += -DDEBUG
endif
ifeq ($(CONFIG_USB_DEVICE),y)
ifneq ($(CONFIG_USB_HOST),y)
CFLAGS += -DDWC_DEVICE_ONLY
endif
endif
|
Java
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__char_environment_w32_spawnv_61b.c
Label Definition File: CWE78_OS_Command_Injection.strings.label.xml
Template File: sources-sink-61b.tmpl.c
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: environment Read input from an environment variable
* GoodSource: Fixed string
* Sinks: w32_spawnv
* BadSink : execute command with spawnv
* Flow Variant: 61 Data flow: data returned from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define COMMAND_INT_PATH "%WINDIR%\\system32\\cmd.exe"
#define COMMAND_INT "cmd.exe"
#define COMMAND_ARG1 "/c"
#define COMMAND_ARG2 "dir "
#define COMMAND_ARG3 data
#else /* NOT _WIN32 */
#include <unistd.h>
#define COMMAND_INT_PATH "/bin/sh"
#define COMMAND_INT "sh"
#define COMMAND_ARG1 "-c"
#define COMMAND_ARG2 "ls "
#define COMMAND_ARG3 data
#endif
#define ENV_VARIABLE "ADD"
#ifdef _WIN32
#define GETENV getenv
#else
#define GETENV getenv
#endif
#include <process.h>
#ifndef OMITBAD
char * CWE78_OS_Command_Injection__char_environment_w32_spawnv_61b_badSource(char * data)
{
{
/* Append input from an environment variable to data */
size_t dataLen = strlen(data);
char * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
strncat(data+dataLen, environment, 100-dataLen-1);
}
}
return data;
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B() uses the GoodSource with the BadSink */
char * CWE78_OS_Command_Injection__char_environment_w32_spawnv_61b_goodG2BSource(char * data)
{
/* FIX: Append a fixed string to data (not user / external input) */
strcat(data, "*.*");
return data;
}
#endif /* OMITGOOD */
|
Java
|
#region License Header
// /*******************************************************************************
// * Open Behavioral Health Information Technology Architecture (OBHITA.org)
// *
// * Redistribution and use in source and binary forms, with or without
// * modification, are permitted provided that the following conditions are met:
// * * Redistributions of source code must retain the above copyright
// * notice, this list of conditions and the following disclaimer.
// * * Redistributions in binary form must reproduce the above copyright
// * notice, this list of conditions and the following disclaimer in the
// * documentation and/or other materials provided with the distribution.
// * * Neither the name of the <organization> 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 <COPYRIGHT HOLDER> 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.
// ******************************************************************************/
#endregion
namespace ProCenter.Domain.Psc
{
#region Using Statements
using System;
using Pillar.FluentRuleEngine;
using ProCenter.Domain.AssessmentModule;
using ProCenter.Domain.AssessmentModule.Rules;
#endregion
/// <summary>The PediatricSymptonChecklistRuleCollection rule collection class.</summary>
public class PediatricSymptonChecklistRuleCollection : AbstractAssessmentRuleCollection
{
private readonly IAssessmentDefinitionRepository _assessmentDefinitionRepository;
private static Guid? _pediatricSymptomCheckListAssessmentDefinitionKey;
#region Constructors and Destructors
/// <summary>Initializes a new instance of the <see cref="PediatricSymptonChecklistRuleCollection" /> class.</summary>
/// <param name="assessmentDefinitionRepository">The assessment definition repository.</param>
public PediatricSymptonChecklistRuleCollection(IAssessmentDefinitionRepository assessmentDefinitionRepository)
{
_assessmentDefinitionRepository = assessmentDefinitionRepository;
NewItemSkippingRule(() => SkipItem71250040)
.ForItemInstance<bool>("71250039")
.EqualTo(false)
.SkipItem(GetItemDefinition("71250040"));
NewRuleSet(() => ItemUpdatedRuleSet71250039, SkipItem71250040);
}
#endregion
#region Public Properties
/// <summary>
/// Gets or sets the skip item71250040.
/// </summary>
/// <value>
/// The skip item71250040.
/// </value>
public IItemSkippingRule SkipItem71250040 { get; set; }
/// <summary>
/// Gets or sets the item updated rule set71250039.
/// </summary>
/// <value>
/// The item updated rule set71250039.
/// </value>
public IRuleSet ItemUpdatedRuleSet71250039 { get; set; }
#endregion
/// <summary>
/// Gets the item definition.
/// </summary>
/// <param name="itemDefinitionCode">The item definition code.</param>
/// <returns>Returns and ItemDefinition for the itemDefinitionCode if found by key.</returns>
private ItemDefinition GetItemDefinition(string itemDefinitionCode)
{
if (!_pediatricSymptomCheckListAssessmentDefinitionKey.HasValue)
{
_pediatricSymptomCheckListAssessmentDefinitionKey = _assessmentDefinitionRepository.GetKeyByCode(PediatricSymptonChecklist.AssessmentCodedConcept.Code);
}
var assessmentDefinition = _assessmentDefinitionRepository.GetByKey(_pediatricSymptomCheckListAssessmentDefinitionKey.Value);
return assessmentDefinition.GetItemDefinitionByCode(itemDefinitionCode);
}
}
}
|
Java
|
/*
* Copyright Matt Palmer 2011-2013, All rights reserved.
*
* This code is licensed under a standard 3-clause BSD license:
*
* 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 names of its contributors 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.
*/
package net.byteseek.searcher.sequence.sunday;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import net.byteseek.io.reader.Window;
import net.byteseek.io.reader.WindowReader;
import net.byteseek.matcher.bytes.ByteMatcher;
import net.byteseek.matcher.sequence.SequenceMatcher;
import net.byteseek.object.factory.DoubleCheckImmutableLazyObject;
import net.byteseek.object.factory.LazyObject;
import net.byteseek.object.factory.ObjectFactory;
import net.byteseek.searcher.SearchResult;
import net.byteseek.searcher.SearchUtils;
import net.byteseek.searcher.sequence.AbstractSequenceSearcher;
/**
*
* @author Matt Palmer
*/
public final class SundayQuickSearcher extends AbstractSequenceSearcher {
private final LazyObject<int[]> forwardInfo;
private final LazyObject<int[]> backwardInfo;
/**
* Constructs a Sunday Quick searcher given a {@link SequenceMatcher}
* to search for.
*
* @param sequence The sequence to search for.
*/
public SundayQuickSearcher(final SequenceMatcher sequence) {
super(sequence);
forwardInfo = new DoubleCheckImmutableLazyObject<int[]>(new ForwardInfoFactory());
backwardInfo = new DoubleCheckImmutableLazyObject<int[]>(new BackwardInfoFactory());
}
/**
* {@inheritDoc}
*/
@Override
public List<SearchResult<SequenceMatcher>> searchForwards(final byte[] bytes, final int fromPosition, final int toPosition) {
// Get the objects needed to search:
final int[] safeShifts = forwardInfo.get();
final SequenceMatcher sequence = getMatcher();
// Calculate safe bounds for the search:
final int length = sequence.length();
final int finalPosition = bytes.length - length;
final int lastLoopPosition = finalPosition - 1;
final int lastPosition = toPosition < lastLoopPosition?
toPosition : lastLoopPosition;
int searchPosition = fromPosition > 0?
fromPosition : 0;
// Search forwards. The loop does not check for the final
// position, as we shift on the byte after the sequence.
while (searchPosition <= lastPosition) {
if (sequence.matchesNoBoundsCheck(bytes, searchPosition)) {
return SearchUtils.singleResult(searchPosition, sequence);
}
searchPosition += safeShifts[bytes[searchPosition + length] & 0xFF];
}
// Check the final position if necessary:
if (searchPosition == finalPosition &&
toPosition >= finalPosition &&
sequence.matches(bytes, finalPosition)) {
return SearchUtils.singleResult(finalPosition, sequence);
}
return SearchUtils.noResults();
}
/**
* {@inheritDoc}
*/
@Override
public List<SearchResult<SequenceMatcher>> doSearchForwards(final WindowReader reader,
final long fromPosition, final long toPosition ) throws IOException {
// Initialise
final int[] safeShifts = forwardInfo.get();
final SequenceMatcher sequence = getMatcher();
final int length = sequence.length();
long searchPosition = fromPosition;
// While there is a window to search in...
// If there is no window immediately after the sequence,
// then there is no match, since this is only invoked if the
// sequence is already crossing into another window.
Window window;
while (searchPosition <= toPosition &&
(window = reader.getWindow(searchPosition + length)) != null) {
// Initialise array search:
final byte[] array = window.getArray();
final int arrayStartPosition = reader.getWindowOffset(searchPosition + length);
final int arrayEndPosition = window.length() - 1;
final long distanceToEnd = toPosition - window.getWindowPosition() + length ;
final int finalPosition = distanceToEnd < arrayEndPosition?
(int) distanceToEnd : arrayEndPosition;
int arraySearchPosition = arrayStartPosition;
// Search fowards in the array using the reader interface to match.
// The loop does not check the final position, as we shift on the byte
// after the sequence (so would get an IndexOutOfBoundsException in the final position).
while (arraySearchPosition < finalPosition) {
if (sequence.matches(reader, searchPosition)) {
return SearchUtils.singleResult(searchPosition, sequence);
}
final int shift = safeShifts[array[arraySearchPosition] & 0xFF];
searchPosition += shift;
arraySearchPosition += shift;
}
// Check final position if necessary:
if (arraySearchPosition == finalPosition ||
searchPosition == toPosition) {
if (sequence.matches(reader, searchPosition)) {
return SearchUtils.singleResult(searchPosition, sequence);
}
searchPosition += safeShifts[array[arraySearchPosition] & 0xFF];
}
}
return SearchUtils.noResults();
}
/**
* {@inheritDoc}
*/
@Override
public List<SearchResult<SequenceMatcher>> searchBackwards(final byte[] bytes, final int fromPosition, final int toPosition) {
// Get objects needed to search:
final int[] safeShifts = backwardInfo.get();
final SequenceMatcher sequence = getMatcher();
// Calculate safe bounds for the search:
final int lastLoopPosition = toPosition > 1?
toPosition : 1;
final int firstPossiblePosition = bytes.length - sequence.length();
int searchPosition = fromPosition < firstPossiblePosition ?
fromPosition : firstPossiblePosition;
// Search backwards. The loop does not check the
// first position in the array, because we shift on the byte
// immediately before the current search position.
while (searchPosition >= lastLoopPosition) {
if (sequence.matchesNoBoundsCheck(bytes, searchPosition)) {
return SearchUtils.singleResult(searchPosition, sequence);
}
searchPosition -= safeShifts[bytes[searchPosition - 1] & 0xFF];
}
// Check for first position if necessary:
if (searchPosition == 0 &&
toPosition < 1 &&
sequence.matches(bytes, 0)) {
return SearchUtils.singleResult(0, sequence);
}
return SearchUtils.noResults();
}
/**
* {@inheritDoc}
*/
@Override
public List<SearchResult<SequenceMatcher>> doSearchBackwards(final WindowReader reader,
final long fromPosition, final long toPosition ) throws IOException {
// Initialise
final int[] safeShifts = forwardInfo.get();
final SequenceMatcher sequence = getMatcher();
long searchPosition = fromPosition;
// While there is a window to search in...
// If there is no window immediately before the sequence,
// then there is no match, since this is only invoked if the
// sequence is already crossing into another window.
Window window;
while (searchPosition >= toPosition &&
(window = reader.getWindow(searchPosition - 1)) != null) {
// Initialise array search:
final byte[] array = window.getArray();
final int arrayStartPosition = reader.getWindowOffset(searchPosition - 1);
// Search to the beginning of the array, or the final search position,
// whichver comes first.
final long endRelativeToWindow = toPosition - window.getWindowPosition();
final int arrayEndSearchPosition = endRelativeToWindow > 0?
(int) endRelativeToWindow : 0;
int arraySearchPosition = arrayStartPosition;
// Search backwards in the array using the reader interface to match.
// The loop does not check the final position, as we shift on the byte
// before it.
while (arraySearchPosition > arrayEndSearchPosition) {
if (sequence.matches(reader, searchPosition)) {
return SearchUtils.singleResult(searchPosition, sequence);
}
final int shift = safeShifts[array[arraySearchPosition] & 0xFF];
searchPosition -= shift;
arraySearchPosition -= shift;
}
// Check final position if necessary:
if (arraySearchPosition == arrayEndSearchPosition ||
searchPosition == toPosition) {
if (sequence.matches(reader, searchPosition)) {
return SearchUtils.singleResult(searchPosition, sequence);
}
searchPosition -= safeShifts[array[arraySearchPosition] & 0xFF];
}
}
return SearchUtils.noResults();
}
/**
* {@inheritDoc}
*/
@Override
public void prepareForwards() {
forwardInfo.get();
}
/**
* {@inheritDoc}
*/
@Override
public void prepareBackwards() {
backwardInfo.get();
}
@Override
public String toString() {
return getClass().getSimpleName() + "[sequence:" + matcher + ']';
}
private final class ForwardInfoFactory implements ObjectFactory<int[]> {
private ForwardInfoFactory() {
}
/**
* Calculates the safe shifts to use if searching forwards.
* A safe shift is either the length of the sequence plus one, if the
* byte does not appear in the {@link SequenceMatcher}, or
* the shortest distance it appears from the end of the matcher.
*/
@Override
public int[] create() {
// First set the default shift to the length of the sequence plus one.
final int[] shifts = new int[256];
final SequenceMatcher sequence = getMatcher();
final int numBytes = sequence.length();
Arrays.fill(shifts, numBytes + 1);
// Now set specific byte shifts for the bytes actually in
// the sequence itself. The shift is the distance of each character
// from the end of the sequence, where the last position equals 1.
// Each position can match more than one byte (e.g. if a byte class appears).
for (int sequenceByteIndex = 0; sequenceByteIndex < numBytes; sequenceByteIndex++) {
final ByteMatcher aMatcher = sequence.getMatcherForPosition(sequenceByteIndex);
final byte[] matchingBytes = aMatcher.getMatchingBytes();
final int distanceFromEnd = numBytes - sequenceByteIndex;
for (final byte b : matchingBytes) {
shifts[b & 0xFF] = distanceFromEnd;
}
}
return shifts;
}
}
private final class BackwardInfoFactory implements ObjectFactory<int[]> {
private BackwardInfoFactory() {
}
/**
* Calculates the safe shifts to use if searching backwards.
* A safe shift is either the length of the sequence plus one, if the
* byte does not appear in the {@link SequenceMatcher}, or
* the shortest distance it appears from the beginning of the matcher.
*/
@Override
public int[] create() {
// First set the default shift to the length of the sequence
// (negative if search direction is reversed)
final int[] shifts = new int[256];
final SequenceMatcher sequence = getMatcher();
final int numBytes = sequence.length();
Arrays.fill(shifts, numBytes + 1);
// Now set specific byte shifts for the bytes actually in
// the sequence itself. The shift is the distance of each character
// from the start of the sequence, where the first position equals 1.
// Each position can match more than one byte (e.g. if a byte class appears).
for (int sequenceByteIndex = numBytes - 1; sequenceByteIndex >= 0; sequenceByteIndex--) {
final ByteMatcher aMatcher = sequence.getMatcherForPosition(sequenceByteIndex);
final byte[] matchingBytes = aMatcher.getMatchingBytes();
final int distanceFromStart = sequenceByteIndex + 1;
for (final byte b : matchingBytes) {
shifts[b & 0xFF] = distanceFromStart;
}
}
return shifts;
}
}
}
|
Java
|
# `pub.dev` API for developers
## Stay informed
This document describes the officially supported API of the `pub.dev` site.
`pub.dev` may expose API endpoints that are available publicly, but unless
they are documented here, we don't consider them as officially
supported, and may change or remove them without notice.
Changes to the officially supported `pub.dev` API will be announced at [Dart announce][announce].
## Hosted Pub Repository API
`pub.dev` implements the [Hosted Pub Repository Specification V2][repo-v2],
used by the `pub` command line client application.
## Additional APIs
### Package names for name completion
**GET** `https://pub.dev/api/package-name-completion-data`
**Headers:**
* `accept-encoding: gzip`
**Response**
* `cache-control: public, max-age=28800`
* `content-encoding: gzip`
* `content-type: application/json; charset="utf-8"`
```js
{
"packages": [
"http",
"provider",
/* further package names */
]
}
```
The API returns the top package names on `pub.dev`. To reduce payload size the
result may not include all package names. The size limitation is subject to change.
The response is always a gzip-ed JSON content, and should be cached
on the client side for at least 8 hours between requests (as indicated
by the `cache-control` header).
Notes:
* Not all package names are included in this response.
* The inclusion criteria used by `pub.dev` may change without notice.
## FAQ
### I'd like to implement search, what API can I use?
Please use the above [package names for name completion data](#package-names-for-name-completion)
to fetch the list of package names, and implement search in your app based on that list.
### I'd like to request a new API. What should I do?
Please check if there is already a similar request or open a [new issue][pub-dev-issues].
The following requirements are must have for an API endpoint to be considered as official:
* The data must be public.
* The API must be without side effects (e.g. read-only).
* The response must be cacheable (e.g. we should be able to offload it to a CDN).
[announce]: https://groups.google.com/a/dartlang.org/g/announce
[repo-v2]: https://github.com/dart-lang/pub/blob/master/doc/repository-spec-v2.md
[pub-dev-issues]: https://github.com/dart-lang/pub-dev/issues
|
Java
|
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\models\general\GeneralLabel;
/* @var $this yii\web\View */
/* @var $model app\models\RefPemohonJaringanAntarabangsa */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="ref-pemohon-jaringan-antarabangsa-form">
<p class="text-muted"><span style="color: red">*</span> <?= GeneralLabel::lapangan_mandatori ?></p>
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'desc')->textInput(['maxlength' => true]) ?>
<?php $model->isNewRecord ? $model->aktif = 1: $model->aktif = $model->aktif ; ?>
<?= $form->field($model, 'aktif')->radioList(array(true=>GeneralLabel::yes,false=>GeneralLabel::no)); ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? GeneralLabel::create : GeneralLabel::update, ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
|
Java
|
#! /usr/bin/perl
#
# configure.pl (bootstrap cgixx)
# Use on *nix platforms.
#
# cgixx CGI C++ Class Library
# Copyright (C) 2002-2004 Isaac W. Foraker (isaac at noscience dot net)
# 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 Author 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 AND DOCUMENTATION IS PROVIDED BY THE AUTHOR 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
# AUTHOR 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.
#
# Most of this code is plagerized from configure.pl, written by Peter J Jones
# for use in clo++, and uses Peter's cxxtools.
#####
# Includes
use strict;
use Getopt::Long;
use Cwd qw(cwd chdir);
#####
# Constants
use constant DATE => 'Thu May 10 4:44:54 2002';
use constant ID => '$Id$';
#####
# Global Variables
my $cwd = cwd();
my %clo;
# Possible names for the compiler
my @cxx_guess = qw(g++ c++ CC cl bcc32);
my $mkmf = "${cwd}/tools/mkmf";
my $cxxflags = "${cwd}/tools/cxxflags";
my $mkmf_flags = "--cxxflags '$cxxflags' --quiet ";
my $libname = "cgixx";
my $install_spec= "doc/install.spec";
my $includes = "--include '${cwd}/inc' ";
my $libraries = "--slinkwith '${cwd}/src,$libname' ";
my @compile_dirs = (
"${cwd}/src",
"${cwd}/test"
);
#####
# Code Start
$|++;
GetOptions(
\%clo,
'help',
'bundle',
'developer',
'prefix=s',
'bindir=s',
'incdir=s',
'libdir=s',
'cxx=s'
) or usage();
$clo{'help'} && usage();
sub usage {
print "Usage: $0 [options]\n", <<EOT;
--developer Turn on developer mode
--prefix path Set the install prefix to path [/usr/local]
--bindir path Set the install bin dir to path [PREFIX/bin]
--incdir path Set the install inc dir to path [PREFIX/inc]
--libdir path Set the install lib dir to path [PREFIX/lib]
EOT
exit;
}
$clo{'prefix'} ||= "/usr/local";
$clo{'bindir'} ||= "$clo{'prefix'}/bin";
$clo{'incdir'} ||= "$clo{'prefix'}/include";
$clo{'libdir'} ||= "$clo{'prefix'}/lib";
print "Configuring cgixx...\n";
if ($clo{'developer'}) {
print "Developer extensions... enabled\n";
$mkmf_flags .= "--developer ";
}
#####
# Determine C++ compiler settings
$clo{'cxx'} ||= $ENV{'CXX'};
if (not $clo{'cxx'}) {
print "Checking C++ compiler... ";
my $path;
# search for a compiler
foreach (@cxx_guess) {
if ($path = search_path($_)) {
$clo{'cxx'} = "$path/$_";
last;
}
}
if ($clo{'cxx'}) {
print "$clo{'cxx'}\n";
} else {
print <<EOT;
Not found.
You must specify your C++ compiler with the --cxx parameter or by setting the
CXX environment variable.
EOT
exit;
}
} else {
print "Using C++ compiler... $clo{'cxx'}\n";
}
print "Generating cgixx Makefiles ";
generate_toplevel_makefile();
generate_library_makefile();
generate_tests_makefile();
print "\n";
if (!$clo{'bundle'}) {
print "\n";
print "Install Prefix: $clo{'prefix'}\n";
print "Binary Install Path: $clo{'bindir'}\n";
print "Includes Install Path: $clo{'incdir'}\n";
print "Libraries Install Path: $clo{'libdir'}\n";
print "\n";
print <<EOT;
===============================================================================
Configuration complete. To build, type:
make
To install, type:
make install
===============================================================================
EOT
}
sub generate_toplevel_makefile {
unless (open(SPEC, ">$install_spec")) {
print STDERR "\n$0: can't open $install_spec: $!\n";
exit 1;
}
print SPEC "libdir=$clo{'libdir'}\n";
print SPEC "static-lib src cgixx\n";
print SPEC "includedir=$clo{'incdir'}\n";
print SPEC "include-dir inc/cgixx cgixx\n";
close SPEC;
system("$^X $mkmf $mkmf_flags --install $install_spec --wrapper @compile_dirs");
print ".";
}
sub generate_library_makefile {
if (not chdir("$cwd/src")) {
print STDERR "\n$0: can't chdir to src: $!\n";
exit 1;
}
system("$^X $mkmf $mkmf_flags $includes --static-lib $libname *.cxx");
print ".";
chdir $cwd;
}
sub generate_tests_makefile {
unless (chdir("$cwd/test")) {
print STDERR "\n$0: can't chdir $cwd/test: $!\n";
exit 1;
}
system("$^X $mkmf $mkmf_flags $includes $libraries --quiet --many-exec *.cxx");
print ".";
chdir $cwd;
}
# Search the path for the specified program.
sub search_path {
my $prog = shift;
# Determine search paths
my $path = $ENV{'PATH'} || $ENV{'Path'} || $ENV{'path'};
my @paths = split /[;| |:]/, $path;
my $ext = $^O =~ /win/i ? '.exe' : '';
foreach (@paths) {
if (-e "$_/$prog$ext") {
return $_;
}
}
return undef;
}
|
Java
|
#!/usr/bin/env python
# -*- mode: python; sh-basic-offset: 4; indent-tabs-mode: nil; coding: utf-8 -*-
# vim: tabstop=4 softtabstop=4 expandtab shiftwidth=4 fileencoding=utf-8
#
# Shell command
# Copyright 2010, Jeremy Grosser <synack@digg.com>
import argparse
import os
import sys
import clusto
from clusto import script_helper
class Console(script_helper.Script):
'''
Use clusto's hardware port mappings to console to a remote server
using the serial console.
'''
def __init__(self):
script_helper.Script.__init__(self)
def _add_arguments(self, parser):
user = os.environ.get('USER')
parser.add_argument('--user', '-u', default=user,
help='SSH User (you can also set this in clusto.conf too'
'in console.user: --user > clusto.conf:console.user > "%s")' % user)
parser.add_argument('server', nargs=1,
help='Object to console to (IP or name)')
def add_subparser(self, subparsers):
parser = self._setup_subparser(subparsers)
self._add_arguments(parser)
def run(self, args):
try:
server = clusto.get(args.server[0])
if not server:
raise LookupError('Object "%s" does not exist' % args.server)
except Exception as e:
self.debug(e)
self.error('No object like "%s" was found' % args.server)
return 1
server = server[0]
if not hasattr(server, 'console'):
self.error('The object %s lacks a console method' % server.name)
return 2
user = os.environ.get('USER')
if args.user:
self.debug('Grabbing user from parameter')
user = args.user
else:
self.debug('Grabbing user from config file or default')
user = self.get_conf('console.user', user)
self.debug('User is "%s"' % user)
return(server.console(ssh_user=user))
def main():
console, args = script_helper.init_arguments(Console)
return(console.run(args))
if __name__ == '__main__':
sys.exit(main())
|
Java
|
/**
* Copyright (c) 2013, impossibl.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:
*
* * 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 impossibl.com nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package com.impossibl.postgres.system.procs;
/**
* Marker interface for dynamically loaded postgis data types, to be used by {@link ServiceLoader}.
*/
public interface OptionalProcProvider extends ProcProvider {
}
|
Java
|
//
// $Id$
package org.ductilej.tests;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Tests handling of varags with parameterized variable argument. Edge case extraordinaire!
*/
public class ParamVarArgsTest
{
public static interface Predicate<T> {
boolean apply (T arg);
}
public static <T> Predicate<T> or (final Predicate<? super T>... preds) {
return new Predicate<T>() {
public boolean apply (T arg) {
for (Predicate<? super T> pred : preds) {
if (pred.apply(arg)) {
return true;
}
}
return false;
}
};
}
@SuppressWarnings("unchecked") // this use of parameterized varargs is safe
@Test public void testParamVarArgs () {
Predicate<Integer> test = or(FALSE);
assertEquals(false, test.apply(1));
}
protected static final Predicate<Integer> FALSE = new Predicate<Integer>() {
public boolean apply (Integer arg) {
return false;
}
};
}
|
Java
|
package ga;
import engine.*;
import java.util.*;
public class GAPopulation {
/* Evolutionary parameters: */
public int size; // size of the population
public int ngens; // total number of generations
public int currgen; // current generation
/* Crossover parameters */
int tournamentK; // size of tournament
int elite; // size of elite
int immigrant; // number of new random individuals
double mutrate; // chance that a mutation will occur
double xoverrate; // chance that the xover will occur
/* Containers */
public ArrayList<Genome> individual;
Genome parent;
Trainer T;
/* Progress data */
public double[] max_fitness;
public double[] avg_fitness;
public double[] terminals; // average total number of terminals
public double[] bigterminals; // average total number of sig. terminals
/**
* Initialize and load parameters.
* Parameter comp is a node from a previous
* scenario, which is used for distance calculations.
*/
public GAPopulation(Genome comp)
{
individual = new ArrayList<Genome>();
parent = comp;
// reading parameters
Parameter param = Parameter.getInstance();
String paramval;
paramval = param.getParam("population size");
if (paramval != null)
size = Integer.valueOf(paramval);
else
{
System.err.println("\"population size\" not defined on parameter file.");
size = 10;
}
paramval = param.getParam("generation number");
if (paramval != null)
ngens = Integer.valueOf(paramval);
else
{
System.err.println("\"generation number\" not defined on parameter file.");
ngens = 10;
}
paramval = param.getParam("tournament K");
if (paramval != null)
tournamentK = Integer.valueOf(paramval);
else
{
System.err.println("\"tournament K\" not defined on parameter file.");
tournamentK = 5;
}
paramval = param.getParam("elite size");
if (paramval != null)
elite = Integer.valueOf(paramval);
else
{
System.err.println("\"elite size\" not defined on parameter file.");
elite = 1;
}
paramval = param.getParam("immigrant size");
if (paramval != null)
immigrant = Integer.valueOf(paramval);
else
{
System.err.println("\"immigrant size\" not defined on parameter file.");
immigrant = 0;;
}
paramval = param.getParam("mutation rate");
if (paramval != null)
mutrate = Double.valueOf(paramval);
else
{
System.err.println("\"mutation rate\" not defined on parameter file.");
mutrate = 0.01;
}
paramval = param.getParam("crossover rate");
if (paramval != null)
xoverrate = Double.valueOf(paramval);
else
{
System.err.println("\"crossover rate\" not defined on parameter file.");
xoverrate = 0.9;
}
}
/**
* Initialize the new population and the local
* variables. Startd is the target date for the
* @param startd
*/
public void initPopulation(Date startd)
{
T = new Trainer(startd);
currgen = 0;
for (int i = 0; i < size; i++)
{
Genome n = new Genome();
n.init();
individual.add(n);
}
max_fitness = new double[ngens];
avg_fitness = new double[ngens];
terminals = new double[ngens];
bigterminals = new double[ngens];
}
/**
* Runs one generation loop
*
*/
public void runGeneration()
{
eval();
breed();
currgen++;
}
/**
* update the values of the maxfitness/avg fitness/etc
* public arrays;
*/
public void updateStatus()
{
Parameter p = Parameter.getInstance();
String param = p.getParam("asset treshold");
double tresh = Double.valueOf(param);
avg_fitness[currgen-1] = 0;
terminals[currgen-1] = 0;
bigterminals[currgen-1] = 0;
for (int i = 0; i < individual.size(); i++)
{
avg_fitness[currgen-1] += individual.get(i).fitness;
terminals[currgen-1] += individual.get(i).countAsset(0.0);
bigterminals[currgen-1] += individual.get(i).countAsset(tresh);
}
max_fitness[currgen-1] = individual.get(0).fitness;
avg_fitness[currgen-1] /= size;
terminals[currgen-1] /= size;
bigterminals[currgen-1] /= size;
}
/**
* Calculates the fitness value for each individual
* in the population.
*/
public void eval()
{
for (int i = 0; i < size; i++)
{
individual.get(i).eval(T);
}
Collections.sort(individual);
}
/**
* Perform selection, crossover, mutation in
* order to create a new population.
*
* Assumes the eval function has already been
* performed.
*
*/
public void breed()
{
RNG d = RNG.getInstance();
ArrayList<Genome> nextGen = new ArrayList<Genome>();
Genome p1,p2;
// elite: (few copied individuals)
for (int i = 0; i < elite; i++)
{
nextGen.add(individual.get(i).copy());
}
// immigrant: (usually 0)
for (int i = 0; i < immigrant; i++)
{
Genome n = new Genome();
n.init();
nextGen.add(n);
}
// crossover:
for (int i = 0; i < size - (immigrant + elite); i+=2)
{
// selection - the selection function should
// return copies already.
p1 = Tournament();
p2 = Tournament();
// rolls for xover
if (d.nextDouble() < xoverrate)
{
p1.crossover(p2);
}
// rolls for mutation
if (d.nextDouble() < mutrate)
p1.mutation();
if (d.nextDouble() < mutrate)
p2.mutation();
nextGen.add(p1);
nextGen.add(p2);
}
individual = nextGen;
}
/**
* Select one parent from the population by using
* fitness-proportional tournament selection
* (eat candidate has a chance proportional to his
* fitness of being chosen).
*
* The function copy the chosen candidate and send
* him back.
* @return
*/
public Genome Tournament()
{
RNG d = RNG.getInstance();
Genome[] list = new Genome[tournamentK];
double[] rank = new double[tournamentK];
double sum = 0.0;
double ticket = 0.0;
double min = 0.0;
/* Selects individuals and removes negative fitness */
for (int i = 0; i < tournamentK; i++)
{
list[i] = individual.get(d.nextInt(size));
if (list[i].fitness < min)
min = list[i].fitness;
}
/* I'm not sure if this is the best way to
* make the proportion between the fitnesses.
* Some sort of scaling factor should be put here
* to avoit high fitnesses from superdominating.
*
* But maybe the tournament proccess already guarantees this?
*/
for (int i = 0; i < tournamentK; i++)
{
sum += list[i].fitness - min;
rank[i] = sum;
}
ticket = d.nextDouble()*sum;
for (int i = 0; i < tournamentK; i++)
{
if ((ticket) <= rank[i])
return list[i].copy();
}
// should never get here
System.err.println("x" + ticket + " + " + sum);
System.err.println("Warning: MemeTournament - reached unreachable line");
return list[0].copy();
}
}
|
Java
|
//=====================================================================//
/*! @file
@brief R8C LCD メイン @n
for ST7567 SPI (128 x 32) @n
LCD: Aitendo M-G0812P7567
@author 平松邦仁 (hira@rvf-rc45.net)
@copyright Copyright (C) 2017 Kunihito Hiramatsu @n
Released under the MIT license @n
https://github.com/hirakuni45/R8C/blob/master/LICENSE
*/
//=====================================================================//
#include "common/renesas.hpp"
#include "common/fifo.hpp"
#include "common/uart_io.hpp"
#include "common/command.hpp"
#include "common/format.hpp"
#include "common/trb_io.hpp"
#include "common/spi_io.hpp"
#include "chip/ST7565.hpp"
#include "common/monograph.hpp"
namespace {
device::trb_io<utils::null_task, uint8_t> timer_b_;
typedef utils::fifo<uint8_t, 16> buffer;
typedef device::uart_io<device::UART0, buffer, buffer> uart;
uart uart_;
utils::command<64> command_;
// LCD SCL: P4_2(1)
typedef device::PORT<device::PORT4, device::bitpos::B2> SPI_SCL;
// LCD SDA: P4_5(12)
typedef device::PORT<device::PORT4, device::bitpos::B5> SPI_SDA;
// MISO, MOSI, SCK
typedef device::spi_io<device::NULL_PORT, SPI_SDA, SPI_SCL, device::soft_spi_mode::CK10> SPI;
SPI spi_;
// LCD /CS: P3_7(2)
typedef device::PORT<device::PORT3, device::bitpos::B7> LCD_SEL;
// LCD A0: P1_6(14)
typedef device::PORT<device::PORT1, device::bitpos::B6> LCD_A0;
// LCD RESET
typedef device::NULL_PORT LCD_RES;
typedef chip::ST7565<SPI, LCD_SEL, LCD_A0, LCD_RES> LCD;
LCD lcd_(spi_);
class PLOT {
public:
typedef int8_t value_type;
static const int8_t WIDTH = 128;
static const int8_t HEIGHT = 64;
void clear(uint8_t v = 0)
{
}
void operator() (int8_t x, int8_t y, bool val)
{
if(x < 0 || x >= WIDTH) return;
if(y < 0 || y >= HEIGHT) return;
}
};
graphics::kfont_null kfont_;
graphics::monograph<PLOT> bitmap_(kfont_);
}
extern "C" {
void sci_putch(char ch) {
uart_.putch(ch);
}
char sci_getch(void) {
return uart_.getch();
}
uint16_t sci_length() {
return uart_.length();
}
void sci_puts(const char* str) {
uart_.puts(str);
}
void TIMER_RB_intr(void) {
timer_b_.itask();
}
void UART0_TX_intr(void) {
uart_.isend();
}
void UART0_RX_intr(void) {
uart_.irecv();
}
}
static uint8_t v_ = 91;
static uint8_t m_ = 123;
#if 0
static void randmize_(uint8_t v, uint8_t m)
{
v_ = v;
m_ = m;
}
#endif
static uint8_t rand_()
{
v_ += v_ << 2;
++v_;
uint8_t n = 0;
if(m_ & 0x02) n = 1;
if(m_ & 0x40) n ^= 1;
m_ += m_;
if(n == 0) ++m_;
return v_ ^ m_;
}
// __attribute__ ((section (".exttext")))
int main(int argc, char *argv[])
{
using namespace device;
// クロック関係レジスタ・プロテクト解除
PRCR.PRC0 = 1;
// 高速オンチップオシレーターへ切り替え(20MHz)
// ※ F_CLK を設定する事(Makefile内)
OCOCR.HOCOE = 1;
utils::delay::micro_second(1); // >=30us(125KHz)
SCKCR.HSCKSEL = 1;
CKSTPR.SCKSEL = 1;
// タイマーB初期化
{
uint8_t ir_level = 2;
timer_b_.start(60, ir_level);
}
// UART の設定 (P1_4: TXD0[out], P1_5: RXD0[in])
// ※シリアルライターでは、RXD 端子は、P1_6 となっているので注意!
{
utils::PORT_MAP(utils::port_map::P14::TXD0);
utils::PORT_MAP(utils::port_map::P15::RXD0);
uint8_t ir_level = 1;
uart_.start(57600, ir_level);
}
// SPI 開始
{
spi_.start(10000000);
}
// LCD を開始
{
lcd_.start(0x00);
spi_.start(0); // Boost SPI clock
bitmap_.clear(0);
}
sci_puts("Start R8C LCD monitor\n");
command_.set_prompt("# ");
// LED シグナル用ポートを出力
// PD1.B0 = 1;
uint8_t cnt = 0;
uint16_t x = rand_() & 127;
uint16_t y = rand_() & 31;
uint16_t xx;
uint16_t yy;
uint8_t loop = 20;
while(1) {
timer_b_.sync();
/// lcd_.copy(bitmap_.fb(), bitmap_.page_num());
if(loop >= 20) {
loop = 0;
bitmap_.clear(0);
bitmap_.frame(0, 0, 128, 32, 1);
}
xx = rand_() & 127;
yy = rand_() & 31;
bitmap_.line(x, y, xx, yy, 1);
x = xx;
y = yy;
++loop;
// bitmap_.line(0, 0, 127, 31, 1);
// bitmap_.line(0, 31, 127, 0, 1);
if(cnt >= 20) {
cnt = 0;
}
++cnt;
// コマンド入力と、コマンド解析
if(command_.service()) {
}
}
}
|
Java
|
<?php
namespace Application\Entity\Repository;
use Doctrine\ORM\EntityRepository;
Class RubricsRepository extends EntityRepository{
}
|
Java
|
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE NoImplicitPrelude #-}
module Ircbrowse.View.Template where
import Ircbrowse.View
import Ircbrowse.Types.Import
import qualified Text.Blaze.Html5 as H
import Data.Text (Text)
template :: AttributeValue -> Text -> Html -> Html -> Html
template name thetitle innerhead innerbody = do
docType
html $ do
head $ do H.title $ toHtml thetitle
link ! rel "stylesheet" ! type_ "text/css" ! href "/css/bootstrap.min.css"
link ! rel "stylesheet" ! type_ "text/css" ! href "/css/bootstrap-responsive.css"
link ! rel "stylesheet" ! type_ "text/css" ! href "/css/ircbrowse.css"
meta ! httpEquiv "Content-Type" ! content "text/html; charset=UTF-8"
innerhead
body !# name $ do
innerbody
preEscapedToHtml ("<script type=\"text/javascript\"> var _gaq = _gaq \
\|| []; _gaq.push(['_setAccount', 'UA-38975161-1']);\
\ _gaq.push(['_trackPageview']); (function() {var ga\
\ = document.createElement('script'); ga.type = 'tex\
\t/javascript'; ga.async = true; ga.src = ('https:' \
\== document.location.protocol ? 'https://ssl' : \
\'http://www') + '.google-analytics.com/ga.js'; var\
\ s = document.getElementsByTagName('script')[0]; \
\s.parentNode.insertBefore(ga, s);})(); </script>" :: Text)
channelNav :: Channel -> Html
channelNav channel =
div !. "navbar navbar-static-top navbar-inverse" $
div !. "navbar-inner" $ do
div !. "container" $ do
a !. "brand" ! href "/" $ "IRCBrowse"
ul !. "nav" $ do
li $ a ! href (toValue ("/" ++ showChan channel)) $ do
(toHtml (prettyChan channel))
li $ a ! href (toValue ("/browse/" ++ showChan channel)) $ do
"Browse"
-- li $ a ! href (toValue ("/day/" ++ showChan channel ++ "/today/recent")) $ do
-- "Recent"
-- li $ a ! href (toValue ("/day/" ++ showChan channel ++ "/today")) $ do
-- "Today"
-- li $ a ! href (toValue ("/calendar/" ++ showChan channel)) $ do
-- "Calendar"
-- li $ a ! href (toValue ("/nicks/" ++ showChan channel)) $ do
-- "Nicks"
-- li $ a ! href (toValue ("/pdfs/" ++ showChan channel)) $ do
-- "PDFs"
showCount :: (Show n,Integral n) => n -> String
showCount = reverse . foldr merge "" . zip ("000,00,00,00"::String) . reverse . show where
merge (f,c) rest | f == ',' = "," ++ [c] ++ rest
| otherwise = [c] ++ rest
footer :: Html
footer =
div !# "footer" $
div !. "container" $ do
p !. "muted credit" $ do
a ! href "http://ircbrowse.net" $ "IRC Browse"
" by "
a ! href "http://chrisdone.com" $ "Chris Done"
" | "
a ! href "https://github.com/chrisdone/ircbrowse" $ "Source code"
" | "
a ! href "http://haskell.org/" $ "Haskell"
mainHeading :: Html -> Html
mainHeading inner = h1 $ do
a ! href "/" $ do "IRC Browse"
": "
inner
|
Java
|
<!-- This comment will put IE 6, 7 and 8 in quirks mode -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>eusci_a_uart.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="$relpath/search.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<table width="100%">
<tr>
<td bgcolor="black" width="1"><a href="http://www.ti.com"><img border="0" src="tilogo.gif" /></a></td>
<td bgcolor="red"><img src="titagline.gif" /></td>
</tr>
</table>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">MSP430 Driver Library
 <span id="projectnumber">1.90.00.65</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_e1cf65e5caa5b20be391e0669541b825.html">cygdrive</a></li><li class="navelem"><a class="el" href="dir_7a9e18c03596d8465cf006c2a17f1e00.html">c</a></li><li class="navelem"><a class="el" href="dir_fe6c554c444e3227c5f1951b4a377054.html">msp430-driverlib</a></li><li class="navelem"><a class="el" href="dir_4229c540f648bf499d1f78361c546dba.html">driverlib</a></li><li class="navelem"><a class="el" href="dir_da973e413be0b1716c582265c873f56b.html">MSP430i2xx</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">eusci_a_uart.c File Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include "<a class="el" href="driverlib_2_m_s_p430i2xx_2inc_2hw__regaccess_8h_source.html">inc/hw_regaccess.h</a>"</code><br/>
<code>#include "<a class="el" href="driverlib_2_m_s_p430i2xx_2inc_2hw__memmap_8h_source.html">inc/hw_memmap.h</a>"</code><br/>
<code>#include "<a class="el" href="eusci__a__uart_8h_source.html">eusci_a_uart.h</a>"</code><br/>
<code>#include <assert.h></code><br/>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga2a08645b3003df7cdf0b9bd416efcddf"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#ga2a08645b3003df7cdf0b9bd416efcddf">EUSCI_A_UART_init</a> (uint16_t baseAddress, <a class="el" href="struct_e_u_s_c_i___a___u_a_r_t__init_param.html">EUSCI_A_UART_initParam</a> *param)</td></tr>
<tr class="memdesc:ga2a08645b3003df7cdf0b9bd416efcddf"><td class="mdescLeft"> </td><td class="mdescRight">Advanced initialization routine for the UART block. The values to be written into the clockPrescalar, firstModReg, secondModReg and overSampling parameters should be pre-computed and passed into the initialization function. <a href="group__eusci__a__uart__api.html#ga2a08645b3003df7cdf0b9bd416efcddf">More...</a><br/></td></tr>
<tr class="separator:ga2a08645b3003df7cdf0b9bd416efcddf"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaf637ca8f96fc93101f1111b23da6c87f"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#gaf637ca8f96fc93101f1111b23da6c87f">EUSCI_A_UART_transmitData</a> (uint16_t baseAddress, uint8_t transmitData)</td></tr>
<tr class="memdesc:gaf637ca8f96fc93101f1111b23da6c87f"><td class="mdescLeft"> </td><td class="mdescRight">Transmits a byte from the UART Module. <a href="group__eusci__a__uart__api.html#gaf637ca8f96fc93101f1111b23da6c87f">More...</a><br/></td></tr>
<tr class="separator:gaf637ca8f96fc93101f1111b23da6c87f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gab18364db57b4719f71e83a5f69897d66"><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#gab18364db57b4719f71e83a5f69897d66">EUSCI_A_UART_receiveData</a> (uint16_t baseAddress)</td></tr>
<tr class="memdesc:gab18364db57b4719f71e83a5f69897d66"><td class="mdescLeft"> </td><td class="mdescRight">Receives a byte that has been sent to the UART Module. <a href="group__eusci__a__uart__api.html#gab18364db57b4719f71e83a5f69897d66">More...</a><br/></td></tr>
<tr class="separator:gab18364db57b4719f71e83a5f69897d66"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga8264a417944411b5fbe988d94ae21d20"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#ga8264a417944411b5fbe988d94ae21d20">EUSCI_A_UART_enableInterrupt</a> (uint16_t baseAddress, uint8_t mask)</td></tr>
<tr class="memdesc:ga8264a417944411b5fbe988d94ae21d20"><td class="mdescLeft"> </td><td class="mdescRight">Enables individual UART interrupt sources. <a href="group__eusci__a__uart__api.html#ga8264a417944411b5fbe988d94ae21d20">More...</a><br/></td></tr>
<tr class="separator:ga8264a417944411b5fbe988d94ae21d20"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaf1c34e38356e6918732151dc92b47b50"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#gaf1c34e38356e6918732151dc92b47b50">EUSCI_A_UART_disableInterrupt</a> (uint16_t baseAddress, uint8_t mask)</td></tr>
<tr class="memdesc:gaf1c34e38356e6918732151dc92b47b50"><td class="mdescLeft"> </td><td class="mdescRight">Disables individual UART interrupt sources. <a href="group__eusci__a__uart__api.html#gaf1c34e38356e6918732151dc92b47b50">More...</a><br/></td></tr>
<tr class="separator:gaf1c34e38356e6918732151dc92b47b50"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gab10882f5122070c22250ab4241ea7a6f"><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#gab10882f5122070c22250ab4241ea7a6f">EUSCI_A_UART_getInterruptStatus</a> (uint16_t baseAddress, uint8_t mask)</td></tr>
<tr class="memdesc:gab10882f5122070c22250ab4241ea7a6f"><td class="mdescLeft"> </td><td class="mdescRight">Gets the current UART interrupt status. <a href="group__eusci__a__uart__api.html#gab10882f5122070c22250ab4241ea7a6f">More...</a><br/></td></tr>
<tr class="separator:gab10882f5122070c22250ab4241ea7a6f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gacec66a5ffbc9c60bb52b7a1dacc445ad"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#gacec66a5ffbc9c60bb52b7a1dacc445ad">EUSCI_A_UART_clearInterruptFlag</a> (uint16_t baseAddress, uint8_t mask)</td></tr>
<tr class="memdesc:gacec66a5ffbc9c60bb52b7a1dacc445ad"><td class="mdescLeft"> </td><td class="mdescRight">Clears UART interrupt sources. <a href="group__eusci__a__uart__api.html#gacec66a5ffbc9c60bb52b7a1dacc445ad">More...</a><br/></td></tr>
<tr class="separator:gacec66a5ffbc9c60bb52b7a1dacc445ad"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaf2bd04f23261ebafd4890c35945a7877"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#gaf2bd04f23261ebafd4890c35945a7877">EUSCI_A_UART_enable</a> (uint16_t baseAddress)</td></tr>
<tr class="memdesc:gaf2bd04f23261ebafd4890c35945a7877"><td class="mdescLeft"> </td><td class="mdescRight">Enables the UART block. <a href="group__eusci__a__uart__api.html#gaf2bd04f23261ebafd4890c35945a7877">More...</a><br/></td></tr>
<tr class="separator:gaf2bd04f23261ebafd4890c35945a7877"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaae82375105abc8655ef50f8c36ffcf13"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#gaae82375105abc8655ef50f8c36ffcf13">EUSCI_A_UART_disable</a> (uint16_t baseAddress)</td></tr>
<tr class="memdesc:gaae82375105abc8655ef50f8c36ffcf13"><td class="mdescLeft"> </td><td class="mdescRight">Disables the UART block. <a href="group__eusci__a__uart__api.html#gaae82375105abc8655ef50f8c36ffcf13">More...</a><br/></td></tr>
<tr class="separator:gaae82375105abc8655ef50f8c36ffcf13"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga8c4cf3e29c3200191506e8d576393c26"><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#ga8c4cf3e29c3200191506e8d576393c26">EUSCI_A_UART_queryStatusFlags</a> (uint16_t baseAddress, uint8_t mask)</td></tr>
<tr class="memdesc:ga8c4cf3e29c3200191506e8d576393c26"><td class="mdescLeft"> </td><td class="mdescRight">Gets the current UART status flags. <a href="group__eusci__a__uart__api.html#ga8c4cf3e29c3200191506e8d576393c26">More...</a><br/></td></tr>
<tr class="separator:ga8c4cf3e29c3200191506e8d576393c26"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga929c7fbd7c476127cd511beea6d01294"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#ga929c7fbd7c476127cd511beea6d01294">EUSCI_A_UART_setDormant</a> (uint16_t baseAddress)</td></tr>
<tr class="memdesc:ga929c7fbd7c476127cd511beea6d01294"><td class="mdescLeft"> </td><td class="mdescRight">Sets the UART module in dormant mode. <a href="group__eusci__a__uart__api.html#ga929c7fbd7c476127cd511beea6d01294">More...</a><br/></td></tr>
<tr class="separator:ga929c7fbd7c476127cd511beea6d01294"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga36bc7fc49217a06c33a397cd71c571ee"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#ga36bc7fc49217a06c33a397cd71c571ee">EUSCI_A_UART_resetDormant</a> (uint16_t baseAddress)</td></tr>
<tr class="memdesc:ga36bc7fc49217a06c33a397cd71c571ee"><td class="mdescLeft"> </td><td class="mdescRight">Re-enables UART module from dormant mode. <a href="group__eusci__a__uart__api.html#ga36bc7fc49217a06c33a397cd71c571ee">More...</a><br/></td></tr>
<tr class="separator:ga36bc7fc49217a06c33a397cd71c571ee"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga1b4fa41e9447eef4c5f270369b8902c7"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#ga1b4fa41e9447eef4c5f270369b8902c7">EUSCI_A_UART_transmitAddress</a> (uint16_t baseAddress, uint8_t transmitAddress)</td></tr>
<tr class="memdesc:ga1b4fa41e9447eef4c5f270369b8902c7"><td class="mdescLeft"> </td><td class="mdescRight">Transmits the next byte to be transmitted marked as address depending on selected multiprocessor mode. <a href="group__eusci__a__uart__api.html#ga1b4fa41e9447eef4c5f270369b8902c7">More...</a><br/></td></tr>
<tr class="separator:ga1b4fa41e9447eef4c5f270369b8902c7"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gae0a01876b95bcd1396eddbb26e7ffabe"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#gae0a01876b95bcd1396eddbb26e7ffabe">EUSCI_A_UART_transmitBreak</a> (uint16_t baseAddress)</td></tr>
<tr class="memdesc:gae0a01876b95bcd1396eddbb26e7ffabe"><td class="mdescLeft"> </td><td class="mdescRight">Transmit break. <a href="group__eusci__a__uart__api.html#gae0a01876b95bcd1396eddbb26e7ffabe">More...</a><br/></td></tr>
<tr class="separator:gae0a01876b95bcd1396eddbb26e7ffabe"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga97ed7748495844b3506d778ecdbb5dfa"><td class="memItemLeft" align="right" valign="top">uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#ga97ed7748495844b3506d778ecdbb5dfa">EUSCI_A_UART_getReceiveBufferAddress</a> (uint16_t baseAddress)</td></tr>
<tr class="memdesc:ga97ed7748495844b3506d778ecdbb5dfa"><td class="mdescLeft"> </td><td class="mdescRight">Returns the address of the RX Buffer of the UART for the DMA module. <a href="group__eusci__a__uart__api.html#ga97ed7748495844b3506d778ecdbb5dfa">More...</a><br/></td></tr>
<tr class="separator:ga97ed7748495844b3506d778ecdbb5dfa"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaf873d22baa0ed6b207b5f3aebbea1a4c"><td class="memItemLeft" align="right" valign="top">uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#gaf873d22baa0ed6b207b5f3aebbea1a4c">EUSCI_A_UART_getTransmitBufferAddress</a> (uint16_t baseAddress)</td></tr>
<tr class="memdesc:gaf873d22baa0ed6b207b5f3aebbea1a4c"><td class="mdescLeft"> </td><td class="mdescRight">Returns the address of the TX Buffer of the UART for the DMA module. <a href="group__eusci__a__uart__api.html#gaf873d22baa0ed6b207b5f3aebbea1a4c">More...</a><br/></td></tr>
<tr class="separator:gaf873d22baa0ed6b207b5f3aebbea1a4c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga09f2b714ce0556e210b5c054b3138eaa"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#ga09f2b714ce0556e210b5c054b3138eaa">EUSCI_A_UART_selectDeglitchTime</a> (uint16_t baseAddress, uint16_t deglitchTime)</td></tr>
<tr class="memdesc:ga09f2b714ce0556e210b5c054b3138eaa"><td class="mdescLeft"> </td><td class="mdescRight">Sets the deglitch time. <a href="group__eusci__a__uart__api.html#ga09f2b714ce0556e210b5c054b3138eaa">More...</a><br/></td></tr>
<tr class="separator:ga09f2b714ce0556e210b5c054b3138eaa"><td class="memSeparator" colspan="2"> </td></tr>
</table>
</div><!-- contents -->
<hr size="1" /><small>
Copyright 2014, Texas Instruments Incorporated</small>
</body>
</html>
|
Java
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="lang:clipboard.copy" content="Copy to clipboard">
<meta name="lang:clipboard.copied" content="Copied to clipboard">
<meta name="lang:search.language" content="en">
<meta name="lang:search.pipeline.stopwords" content="True">
<meta name="lang:search.pipeline.trimmer" content="True">
<meta name="lang:search.result.none" content="No matching documents">
<meta name="lang:search.result.one" content="1 matching document">
<meta name="lang:search.result.other" content="# matching documents">
<meta name="lang:search.tokenizer" content="[\s\-]+">
<link href="https://fonts.gstatic.com/" rel="preconnect" crossorigin>
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:300,400,400i,700&display=fallback" rel="stylesheet">
<style>
body,
input {
font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif
}
code,
kbd,
pre {
font-family: "Roboto Mono", "Courier New", Courier, monospace
}
</style>
<link rel="stylesheet" href="../_static/stylesheets/application.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-palette.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-fixes.css"/>
<link rel="stylesheet" href="../_static/fonts/material-icons.css"/>
<meta name="theme-color" content="#3f51b5">
<script src="../_static/javascripts/modernizr.js"></script>
<title>statsmodels.tsa.holtwinters.Holt.initialize — statsmodels</title>
<link rel="icon" type="image/png" sizes="32x32" href="../_static/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="../_static/icons/favicon-16x16.png">
<link rel="manifest" href="../_static/icons/site.webmanifest">
<link rel="mask-icon" href="../_static/icons/safari-pinned-tab.svg" color="#919191">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="../_static/icons/browserconfig.xml">
<link rel="stylesheet" href="../_static/stylesheets/examples.css">
<link rel="stylesheet" href="../_static/stylesheets/deprecation.css">
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../_static/material.css" />
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
<link rel="stylesheet" type="text/css" href="../_static/plot_directive.css" />
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="statsmodels.tsa.holtwinters.Holt.loglike" href="statsmodels.tsa.holtwinters.Holt.loglike.html" />
<link rel="prev" title="statsmodels.tsa.holtwinters.Holt.initial_values" href="statsmodels.tsa.holtwinters.Holt.initial_values.html" />
</head>
<body dir=ltr
data-md-color-primary=indigo data-md-color-accent=blue>
<svg class="md-svg">
<defs data-children-count="0">
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg>
</defs>
</svg>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search">
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
<a href="#generated/statsmodels.tsa.holtwinters.Holt.initialize" tabindex="1" class="md-skip"> Skip to content </a>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid">
<div class="md-flex navheader">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="../index.html" title="statsmodels"
class="md-header-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" height="26"
alt="statsmodels logo">
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
<span class="md-header-nav__topic">statsmodels v0.14.0.dev0 (+325)</span>
<span class="md-header-nav__topic"> statsmodels.tsa.holtwinters.Holt.initialize </span>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" action="../search.html" method="get" name="search">
<input type="text" class="md-search__input" name="q" placeholder="Search"
autocapitalize="off" autocomplete="off" spellcheck="false"
data-md-component="query" data-md-state="active">
<label class="md-icon md-search__icon" for="__search"></label>
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">

</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="result">
<div class="md-search-result__meta">
Type to start searching
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
</div>
<script src="../_static/javascripts/version_dropdown.js"></script>
<script>
var json_loc = "../../versions-v2.json",
target_loc = "../../",
text = "Versions";
$( document ).ready( add_version_dropdown(json_loc, target_loc, text));
</script>
</div>
</nav>
</header>
<div class="md-container">
<nav class="md-tabs" data-md-component="tabs">
<div class="md-tabs__inner md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item"><a href="../user-guide.html" class="md-tabs__link">User Guide</a></li>
<li class="md-tabs__item"><a href="../tsa.html" class="md-tabs__link">Time Series analysis <code class="xref py py-mod docutils literal notranslate"><span class="pre">tsa</span></code></a></li>
<li class="md-tabs__item"><a href="statsmodels.tsa.holtwinters.Holt.html" class="md-tabs__link">statsmodels.tsa.holtwinters.Holt</a></li>
</ul>
</div>
</nav>
<main class="md-main">
<div class="md-main__inner md-grid" data-md-component="container">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="__drawer">
<a href="../index.html" title="statsmodels" class="md-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" alt=" logo" width="48" height="48">
</a>
<a href="../index.html"
title="statsmodels">statsmodels v0.14.0.dev0 (+325)</a>
</label>
<div class="md-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../install.html" class="md-nav__link">Installing statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../gettingstarted.html" class="md-nav__link">Getting started</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html" class="md-nav__link">User Guide</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../user-guide.html#background" class="md-nav__link">Background</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#regression-and-linear-models" class="md-nav__link">Regression and Linear Models</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#time-series-analysis" class="md-nav__link">Time Series Analysis</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../tsa.html" class="md-nav__link">Time Series analysis <code class="xref py py-mod docutils literal notranslate"><span class="pre">tsa</span></code></a>
</li>
<li class="md-nav__item">
<a href="../statespace.html" class="md-nav__link">Time Series Analysis by State Space Methods <code class="xref py py-mod docutils literal notranslate"><span class="pre">statespace</span></code></a>
</li>
<li class="md-nav__item">
<a href="../vector_ar.html" class="md-nav__link">Vector Autoregressions <code class="xref py py-mod docutils literal notranslate"><span class="pre">tsa.vector_ar</span></code></a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#other-models" class="md-nav__link">Other Models</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#statistics-and-tools" class="md-nav__link">Statistics and Tools</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#data-sets" class="md-nav__link">Data Sets</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#sandbox" class="md-nav__link">Sandbox</a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../examples/index.html" class="md-nav__link">Examples</a>
</li>
<li class="md-nav__item">
<a href="../api.html" class="md-nav__link">API Reference</a>
</li>
<li class="md-nav__item">
<a href="../about.html" class="md-nav__link">About statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../dev/index.html" class="md-nav__link">Developer Page</a>
</li>
<li class="md-nav__item">
<a href="../release/index.html" class="md-nav__link">Release Notes</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary">
<ul class="md-nav__list" data-md-scrollfix="">
<li class="md-nav__item"><a class="md-nav__extra_link" href="../_sources/generated/statsmodels.tsa.holtwinters.Holt.initialize.rst.txt">Show Source</a> </li>
<li id="searchbox" class="md-nav__item"></li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset" role="main">
<section id="statsmodels-tsa-holtwinters-holt-initialize">
<h1 id="generated-statsmodels-tsa-holtwinters-holt-initialize--page-root">statsmodels.tsa.holtwinters.Holt.initialize<a class="headerlink" href="#generated-statsmodels-tsa-holtwinters-holt-initialize--page-root" title="Permalink to this headline">¶</a></h1>
<dl class="py method">
<dt class="sig sig-object py" id="statsmodels.tsa.holtwinters.Holt.initialize">
<span class="sig-prename descclassname"><span class="pre">Holt.</span></span><span class="sig-name descname"><span class="pre">initialize</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#statsmodels.tsa.holtwinters.Holt.initialize" title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize (possibly re-initialize) a Model instance.</p>
<p>For example, if the the design matrix of a linear model changes then
initialized can be used to recompute values using the modified design
matrix.</p>
</dd></dl>
</section>
</article>
</div>
</div>
</main>
</div>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a href="statsmodels.tsa.holtwinters.Holt.initial_values.html" title="statsmodels.tsa.holtwinters.Holt.initial_values"
class="md-flex md-footer-nav__link md-footer-nav__link--prev"
rel="prev">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span
class="md-footer-nav__direction"> Previous </span> statsmodels.tsa.holtwinters.Holt.initial_values </span>
</div>
</a>
<a href="statsmodels.tsa.holtwinters.Holt.loglike.html" title="statsmodels.tsa.holtwinters.Holt.loglike"
class="md-flex md-footer-nav__link md-footer-nav__link--next"
rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"><span
class="md-flex__ellipsis"> <span
class="md-footer-nav__direction"> Next </span> statsmodels.tsa.holtwinters.Holt.loglike </span>
</div>
<div class="md-flex__cell md-flex__cell--shrink"><i
class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
© Copyright 2009-2019, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
</div>
Last updated on
Feb 23, 2022.
<br/>
Created using
<a href="http://www.sphinx-doc.org/">Sphinx</a> 4.4.0.
and
<a href="https://github.com/bashtage/sphinx-material/">Material for
Sphinx</a>
</div>
</div>
</div>
</footer>
<script src="../_static/javascripts/application.js"></script>
<script>app.initialize({version: "1.0.4", url: {base: ".."}})</script>
</body>
</html>
|
Java
|
// Copyright 2021-present 650 Industries. All rights reserved.
#import <Foundation/Foundation.h>
#import <ABI44_0_0UMTaskManagerInterface/ABI44_0_0UMTaskConsumerInterface.h>
NS_ASSUME_NONNULL_BEGIN
@interface ABI44_0_0EXBackgroundRemoteNotificationConsumer : NSObject <ABI44_0_0UMTaskConsumerInterface>
@property (nonatomic, strong) id<ABI44_0_0UMTaskInterface> task;
@end
NS_ASSUME_NONNULL_END
|
Java
|
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hodograph — MetPy 0.8</title>
<link rel="shortcut icon" href="../../_static/metpy_32x32.ico"/>
<link rel="canonical" href="https://unidata.github.io/MetPy/latest/api/generated/metpy.plots.Hodograph.html"/>
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../_static/gallery.css" type="text/css" />
<link rel="stylesheet" href="../../_static/theme_override.css" type="text/css" />
<link rel="index" title="Index"
href="../../genindex.html"/>
<link rel="search" title="Search" href="../../search.html"/>
<link rel="top" title="MetPy 0.8" href="../../index.html"/>
<link rel="up" title="plots" href="metpy.plots.html"/>
<link rel="next" title="SkewT" href="metpy.plots.SkewT.html"/>
<link rel="prev" title="read_colortable" href="metpy.plots.read_colortable.html"/>
<script src="../../_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="../../index.html" class="icon icon-home"> MetPy
<img src="../../_static/metpy_150x150.png" class="logo" />
</a>
<div class="version">
<div class="version-dropdown">
<select class="version-list" id="version-list">
<option value=''>0.8</option>
<option value="../latest">latest</option>
<option value="../dev">dev</option>
</select>
</div>
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../installguide.html">Installation Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../units.html">Unit Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../examples/index.html">MetPy Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../tutorials/index.html">MetPy Tutorials</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">The MetPy API</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="metpy.constants.html">constants</a></li>
<li class="toctree-l2"><a class="reference internal" href="metpy.units.html">units</a></li>
<li class="toctree-l2"><a class="reference internal" href="metpy.io.html">io</a></li>
<li class="toctree-l2"><a class="reference internal" href="metpy.io.cdm.html">cdm</a></li>
<li class="toctree-l2"><a class="reference internal" href="metpy.calc.html">calc</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="metpy.plots.html">plots</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="metpy.plots.add_metpy_logo.html">add_metpy_logo</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.plots.add_timestamp.html">add_timestamp</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.plots.add_unidata_logo.html">add_unidata_logo</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.plots.read_colortable.html">read_colortable</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">Hodograph</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#examples-using-metpy-plots-hodograph">Examples using <code class="docutils literal notranslate"><span class="pre">metpy.plots.Hodograph</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="metpy.plots.SkewT.html">SkewT</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.plots.StationPlot.html">StationPlot</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.plots.StationPlotLayout.html">StationPlotLayout</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="metpy.plots.ctables.html">ctables</a></li>
<li class="toctree-l2"><a class="reference internal" href="metpy.gridding.html">gridding</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../gempak.html">GEMPAK Conversion Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../CONTRIBUTING.html">Contributors Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../infrastructureguide.html">Infrastructure Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../citing.html">Citing MetPy</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../references.html">References</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../../index.html">MetPy</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../../index.html">Docs</a> »</li>
<li><a href="../index.html">The MetPy API</a> »</li>
<li><a href="metpy.plots.html">plots</a> »</li>
<li>Hodograph</li>
<li class="source-link">
<a href="https://github.com/Unidata/MetPy/issues/new?title=Suggested%20improvement%20for%20api/generated/metpy.plots.Hodograph&body=Please%20describe%20what%20could%20be%20improved%20about%20this%20page%20or%20the%20typo/mistake%20that%20you%20found%3A"
class="fa fa-github"> Improve this page</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="hodograph">
<h1>Hodograph<a class="headerlink" href="#hodograph" title="Permalink to this headline">¶</a></h1>
<dl class="class">
<dt id="metpy.plots.Hodograph">
<em class="property">class </em><code class="descclassname">metpy.plots.</code><code class="descname">Hodograph</code><span class="sig-paren">(</span><em>ax=None</em>, <em>component_range=80</em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/metpy/plots/skewt.html#Hodograph"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#metpy.plots.Hodograph" title="Permalink to this definition">¶</a></dt>
<dd><p>Make a hodograph of wind data.</p>
<p>Plots the u and v components of the wind along the x and y axes, respectively.</p>
<p>This class simplifies the process of creating a hodograph using matplotlib.
It provides helpers for creating a circular grid and for plotting the wind as a line
colored by another value (such as wind speed).</p>
<dl class="attribute">
<dt id="metpy.plots.Hodograph.ax">
<code class="descname">ax</code><a class="headerlink" href="#metpy.plots.Hodograph.ax" title="Permalink to this definition">¶</a></dt>
<dd><p><a class="reference external" href="https://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes" title="(in Matplotlib v2.2.2)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">matplotlib.axes.Axes</span></code></a> – The underlying Axes instance used for all plotting</p>
</dd></dl>
<p>Create a Hodograph instance.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>ax</strong> (<a class="reference external" href="https://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes" title="(in Matplotlib v2.2.2)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">matplotlib.axes.Axes</span></code></a>, optional) – The <em class="xref py py-obj">Axes</em> instance used for plotting</li>
<li><strong>component_range</strong> (<em>value</em>) – The maximum range of the plot. Used to set plot bounds and control the maximum
number of grid rings needed.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Methods Summary</p>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%" />
<col width="90%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#metpy.plots.Hodograph.__init__" title="metpy.plots.Hodograph.__init__"><code class="xref py py-obj docutils literal notranslate"><span class="pre">__init__</span></code></a>([ax, component_range])</td>
<td>Create a Hodograph instance.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#metpy.plots.Hodograph.add_grid" title="metpy.plots.Hodograph.add_grid"><code class="xref py py-obj docutils literal notranslate"><span class="pre">add_grid</span></code></a>([increment])</td>
<td>Add grid lines to hodograph.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#metpy.plots.Hodograph.plot" title="metpy.plots.Hodograph.plot"><code class="xref py py-obj docutils literal notranslate"><span class="pre">plot</span></code></a>(u, v, **kwargs)</td>
<td>Plot u, v data.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#metpy.plots.Hodograph.plot_colormapped" title="metpy.plots.Hodograph.plot_colormapped"><code class="xref py py-obj docutils literal notranslate"><span class="pre">plot_colormapped</span></code></a>(u, v, c[, bounds, colors])</td>
<td>Plot u, v data, with line colored based on a third set of data.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#metpy.plots.Hodograph.wind_vectors" title="metpy.plots.Hodograph.wind_vectors"><code class="xref py py-obj docutils literal notranslate"><span class="pre">wind_vectors</span></code></a>(u, v, **kwargs)</td>
<td>Plot u, v data as wind vectors.</td>
</tr>
</tbody>
</table>
<p class="rubric">Methods Documentation</p>
<dl class="method">
<dt id="metpy.plots.Hodograph.__init__">
<code class="descname">__init__</code><span class="sig-paren">(</span><em>ax=None</em>, <em>component_range=80</em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/metpy/plots/skewt.html#Hodograph.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#metpy.plots.Hodograph.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a Hodograph instance.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>ax</strong> (<a class="reference external" href="https://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes" title="(in Matplotlib v2.2.2)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">matplotlib.axes.Axes</span></code></a>, optional) – The <em class="xref py py-obj">Axes</em> instance used for plotting</li>
<li><strong>component_range</strong> (<em>value</em>) – The maximum range of the plot. Used to set plot bounds and control the maximum
number of grid rings needed.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="metpy.plots.Hodograph.add_grid">
<code class="descname">add_grid</code><span class="sig-paren">(</span><em>increment=10.0</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/metpy/plots/skewt.html#Hodograph.add_grid"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#metpy.plots.Hodograph.add_grid" title="Permalink to this definition">¶</a></dt>
<dd><p>Add grid lines to hodograph.</p>
<p>Creates lines for the x- and y-axes, as well as circles denoting wind speed values.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>increment</strong> (<em>value</em><em>, </em><em>optional</em>) – The value increment between rings</li>
<li><strong>kwargs</strong> – Other kwargs to control appearance of lines</li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a class="reference external" href="https://matplotlib.org/api/_as_gen/matplotlib.patches.Circle.html#matplotlib.patches.Circle" title="(in Matplotlib v2.2.2)"><code class="xref py py-class docutils literal notranslate"><span class="pre">matplotlib.patches.Circle</span></code></a>, <a class="reference external" href="https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.axhline.html#matplotlib.axes.Axes.axhline" title="(in Matplotlib v2.2.2)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">matplotlib.axes.Axes.axhline()</span></code></a>, <a class="reference external" href="https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.axvline.html#matplotlib.axes.Axes.axvline" title="(in Matplotlib v2.2.2)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">matplotlib.axes.Axes.axvline()</span></code></a></p>
</div>
</dd></dl>
<dl class="method">
<dt id="metpy.plots.Hodograph.plot">
<code class="descname">plot</code><span class="sig-paren">(</span><em>u</em>, <em>v</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/metpy/plots/skewt.html#Hodograph.plot"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#metpy.plots.Hodograph.plot" title="Permalink to this definition">¶</a></dt>
<dd><p>Plot u, v data.</p>
<p>Plots the wind data on the hodograph.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>u</strong> (<em>array_like</em>) – u-component of wind</li>
<li><strong>v</strong> (<em>array_like</em>) – v-component of wind</li>
<li><strong>kwargs</strong> – Other keyword arguments to pass to <a class="reference external" href="https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.plot.html#matplotlib.axes.Axes.plot" title="(in Matplotlib v2.2.2)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">matplotlib.axes.Axes.plot()</span></code></a></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><em>list[matplotlib.lines.Line2D]</em> – lines plotted</p>
</td>
</tr>
</tbody>
</table>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a class="reference internal" href="#metpy.plots.Hodograph.plot_colormapped" title="metpy.plots.Hodograph.plot_colormapped"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Hodograph.plot_colormapped()</span></code></a></p>
</div>
</dd></dl>
<dl class="method">
<dt id="metpy.plots.Hodograph.plot_colormapped">
<code class="descname">plot_colormapped</code><span class="sig-paren">(</span><em>u</em>, <em>v</em>, <em>c</em>, <em>bounds=None</em>, <em>colors=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/metpy/plots/skewt.html#Hodograph.plot_colormapped"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#metpy.plots.Hodograph.plot_colormapped" title="Permalink to this definition">¶</a></dt>
<dd><p>Plot u, v data, with line colored based on a third set of data.</p>
<p>Plots the wind data on the hodograph, but with a colormapped line. Takes a third
variable besides the winds and either a colormap to color it with or a series of
bounds and colors to create a colormap and norm to control colormapping.
The bounds must always be in increasing order. For using custom bounds with
height data, the function will automatically interpolate to the actual bounds from the
height and wind data, as well as convert the input bounds from
height AGL to height above MSL to work with the provided heights.</p>
<p>Simple wrapper around plot so that pressure is the first (independent)
input. This is essentially a wrapper around <em class="xref py py-obj">semilogy</em>. It also
sets some appropriate ticking and plot ranges.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>u</strong> (<em>array_like</em>) – u-component of wind</li>
<li><strong>v</strong> (<em>array_like</em>) – v-component of wind</li>
<li><strong>c</strong> (<em>array_like</em>) – data to use for colormapping</li>
<li><strong>bounds</strong> (<em>array-like</em><em>, </em><em>optional</em>) – Array of bounds for c to use in coloring the hodograph.</li>
<li><strong>colors</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.6)"><em>list</em></a><em>, </em><em>optional</em>) – Array of strings representing colors for the hodograph segments.</li>
<li><strong>kwargs</strong> – Other keyword arguments to pass to <a class="reference external" href="https://matplotlib.org/api/collections_api.html#matplotlib.collections.LineCollection" title="(in Matplotlib v2.2.2)"><code class="xref py py-class docutils literal notranslate"><span class="pre">matplotlib.collections.LineCollection</span></code></a></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><em>matplotlib.collections.LineCollection</em> – instance created</p>
</td>
</tr>
</tbody>
</table>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a class="reference internal" href="#metpy.plots.Hodograph.plot" title="metpy.plots.Hodograph.plot"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Hodograph.plot()</span></code></a></p>
</div>
</dd></dl>
<dl class="method">
<dt id="metpy.plots.Hodograph.wind_vectors">
<code class="descname">wind_vectors</code><span class="sig-paren">(</span><em>u</em>, <em>v</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/metpy/plots/skewt.html#Hodograph.wind_vectors"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#metpy.plots.Hodograph.wind_vectors" title="Permalink to this definition">¶</a></dt>
<dd><p>Plot u, v data as wind vectors.</p>
<p>Plot the wind data as vectors for each level, beginning at the origin.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>u</strong> (<em>array_like</em>) – u-component of wind</li>
<li><strong>v</strong> (<em>array_like</em>) – v-component of wind</li>
<li><strong>kwargs</strong> – Other keyword arguments to pass to <a class="reference external" href="https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.quiver.html#matplotlib.axes.Axes.quiver" title="(in Matplotlib v2.2.2)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">matplotlib.axes.Axes.quiver()</span></code></a></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><em>matplotlib.quiver.Quiver</em> – arrows plotted</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<div class="section" id="examples-using-metpy-plots-hodograph">
<h2>Examples using <code class="docutils literal notranslate"><span class="pre">metpy.plots.Hodograph</span></code><a class="headerlink" href="#examples-using-metpy-plots-hodograph" title="Permalink to this headline">¶</a></h2>
<div class="sphx-glr-thumbcontainer" tooltip="Combine a Skew-T and a hodograph using Matplotlib's `GridSpec` layout capability. "><div class="figure" id="id1">
<img alt="../../_images/sphx_glr_Skew-T_Layout_thumb.png" src="../../_images/sphx_glr_Skew-T_Layout_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../examples/plots/Skew-T_Layout.html#sphx-glr-examples-plots-skew-t-layout-py"><span class="std std-ref">Skew-T with Complex Layout</span></a></span></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="Layout a Skew-T plot with a hodograph inset into the plot. "><div class="figure" id="id2">
<img alt="../../_images/sphx_glr_Hodograph_Inset_thumb.png" src="../../_images/sphx_glr_Hodograph_Inset_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../examples/plots/Hodograph_Inset.html#sphx-glr-examples-plots-hodograph-inset-py"><span class="std std-ref">Hodograph Inset</span></a></span></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="Upper air analysis is a staple of many synoptic and mesoscale analysis problems. In this tutori..."><div class="figure" id="id3">
<img alt="../../_images/sphx_glr_upperair_soundings_thumb.png" src="../../_images/sphx_glr_upperair_soundings_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../tutorials/upperair_soundings.html#sphx-glr-tutorials-upperair-soundings-py"><span class="std std-ref">Upper Air Sounding Tutorial</span></a></span></p>
</div>
</div><div style='clear:both'></div></div>
</div>
</div>
<div class="articleComments">
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="metpy.plots.SkewT.html" class="btn btn-neutral float-right" title="SkewT" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="metpy.plots.read_colortable.html" class="btn btn-neutral" title="read_colortable" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
© Copyright 2017, MetPy Developers.
Last updated on May 17, 2018 at 20:56:37.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-92978945-1', 'auto');
ga('send', 'pageview');
</script>
<script>var version_json_loc = "../../../versions.json";</script>
<p>Do you enjoy using MetPy?
<a href="https://saythanks.io/to/unidata" class="btn btn-neutral" title="Say Thanks!" accesskey="n">Say Thanks!</a>
</p>
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'0.8.0',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="../../_static/pop_ver.js"></script>
<script type="text/javascript" src="../../_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
</body>
</html>
|
Java
|
/*
Document : mycss
Created on : 8/06/2013, 09:43:46 AM
Author : RobertoCarlos
Description:
Purpose of the stylesheet follows.
*/
.mydesing{
border: solid 2px #333;
background-color: #0008cc;
color: #e9322d;
font-size: 20px;
margin: 0 auto 0 auto;
width: 1200px
}
|
Java
|
// Copyright 2017 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.
#include "third_party/blink/renderer/core/script/dynamic_module_resolver.h"
#include "base/test/scoped_feature_list.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/renderer/bindings/core/v8/referrer_script_info.h"
#include "third_party/blink/renderer/bindings/core/v8/script_function.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/core/v8/script_value.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/loader/modulescript/module_script_fetch_request.h"
#include "third_party/blink/renderer/core/script/js_module_script.h"
#include "third_party/blink/renderer/core/testing/dummy_modulator.h"
#include "third_party/blink/renderer/core/testing/module_test_base.h"
#include "v8/include/v8.h"
namespace blink {
namespace {
constexpr const char* kTestReferrerURL = "https://example.com/referrer.js";
constexpr const char* kTestDependencyURL = "https://example.com/dependency.js";
const KURL TestReferrerURL() {
return KURL(kTestReferrerURL);
}
const KURL TestDependencyURL() {
return KURL(kTestDependencyURL);
}
class DynamicModuleResolverTestModulator final : public DummyModulator {
public:
explicit DynamicModuleResolverTestModulator(ScriptState* script_state)
: script_state_(script_state) {}
~DynamicModuleResolverTestModulator() override = default;
void ResolveTreeFetch(ModuleScript* module_script) {
ASSERT_TRUE(pending_client_);
pending_client_->NotifyModuleTreeLoadFinished(module_script);
pending_client_ = nullptr;
}
void SetExpectedFetchTreeURL(const KURL& url) {
expected_fetch_tree_url_ = url;
}
bool fetch_tree_was_called() const { return fetch_tree_was_called_; }
void Trace(Visitor*) override;
private:
// Implements Modulator:
ScriptState* GetScriptState() final { return script_state_; }
ModuleScript* GetFetchedModuleScript(const KURL& url) final {
EXPECT_EQ(TestReferrerURL(), url);
ModuleScript* module_script =
JSModuleScript::CreateForTest(this, v8::Local<v8::Module>(), url);
return module_script;
}
KURL ResolveModuleSpecifier(const String& module_request,
const KURL& base_url,
String* failure_reason) final {
if (module_request == "invalid-specifier")
return KURL();
return KURL(base_url, module_request);
}
void ClearIsAcquiringImportMaps() final {}
void FetchTree(const KURL& url,
ResourceFetcher*,
mojom::RequestContextType,
network::mojom::RequestDestination,
const ScriptFetchOptions&,
ModuleScriptCustomFetchType custom_fetch_type,
ModuleTreeClient* client) final {
EXPECT_EQ(expected_fetch_tree_url_, url);
// Currently there are no usage of custom fetch hooks for dynamic import in
// web specifications.
EXPECT_EQ(ModuleScriptCustomFetchType::kNone, custom_fetch_type);
pending_client_ = client;
fetch_tree_was_called_ = true;
}
ModuleEvaluationResult ExecuteModule(
ModuleScript* module_script,
CaptureEvalErrorFlag capture_error) final {
EXPECT_EQ(CaptureEvalErrorFlag::kCapture, capture_error);
ScriptState::EscapableScope scope(script_state_);
ModuleEvaluationResult result = ModuleRecord::Evaluate(
script_state_, module_script->V8Module(), module_script->SourceURL());
return result.Escape(&scope);
}
Member<ScriptState> script_state_;
Member<ModuleTreeClient> pending_client_;
KURL expected_fetch_tree_url_;
bool fetch_tree_was_called_ = false;
};
void DynamicModuleResolverTestModulator::Trace(Visitor* visitor) {
visitor->Trace(script_state_);
visitor->Trace(pending_client_);
DummyModulator::Trace(visitor);
}
// CaptureExportedStringFunction implements a javascript function
// with a single argument of type module namespace.
// CaptureExportedStringFunction captures the exported string value
// from the module namespace as a WTF::String, exposed via CapturedValue().
class CaptureExportedStringFunction final : public ScriptFunction {
public:
CaptureExportedStringFunction(ScriptState* script_state,
const String& export_name)
: ScriptFunction(script_state), export_name_(export_name) {}
v8::Local<v8::Function> Bind() { return BindToV8Function(); }
bool WasCalled() const { return was_called_; }
const String& CapturedValue() const { return captured_value_; }
private:
ScriptValue Call(ScriptValue value) override {
was_called_ = true;
v8::Isolate* isolate = GetScriptState()->GetIsolate();
v8::Local<v8::Context> context = GetScriptState()->GetContext();
v8::Local<v8::Object> module_namespace =
value.V8Value()->ToObject(context).ToLocalChecked();
v8::Local<v8::Value> exported_value =
module_namespace->Get(context, V8String(isolate, export_name_))
.ToLocalChecked();
captured_value_ =
ToCoreString(exported_value->ToString(context).ToLocalChecked());
return ScriptValue();
}
const String export_name_;
bool was_called_ = false;
String captured_value_;
};
// CaptureErrorFunction implements a javascript function which captures
// name and error of the exception passed as its argument.
class CaptureErrorFunction final : public ScriptFunction {
public:
explicit CaptureErrorFunction(ScriptState* script_state)
: ScriptFunction(script_state) {}
v8::Local<v8::Function> Bind() { return BindToV8Function(); }
bool WasCalled() const { return was_called_; }
const String& Name() const { return name_; }
const String& Message() const { return message_; }
private:
ScriptValue Call(ScriptValue value) override {
was_called_ = true;
v8::Isolate* isolate = GetScriptState()->GetIsolate();
v8::Local<v8::Context> context = GetScriptState()->GetContext();
v8::Local<v8::Object> error_object =
value.V8Value()->ToObject(context).ToLocalChecked();
v8::Local<v8::Value> name =
error_object->Get(context, V8String(isolate, "name")).ToLocalChecked();
name_ = ToCoreString(name->ToString(context).ToLocalChecked());
v8::Local<v8::Value> message =
error_object->Get(context, V8String(isolate, "message"))
.ToLocalChecked();
message_ = ToCoreString(message->ToString(context).ToLocalChecked());
return ScriptValue();
}
bool was_called_ = false;
String name_;
String message_;
};
class DynamicModuleResolverTestNotReached final : public ScriptFunction {
public:
static v8::Local<v8::Function> CreateFunction(ScriptState* script_state) {
auto* not_reached =
MakeGarbageCollected<DynamicModuleResolverTestNotReached>(script_state);
return not_reached->BindToV8Function();
}
explicit DynamicModuleResolverTestNotReached(ScriptState* script_state)
: ScriptFunction(script_state) {}
private:
ScriptValue Call(ScriptValue) override {
ADD_FAILURE();
return ScriptValue();
}
};
class DynamicModuleResolverTest : public testing::Test,
public ParametrizedModuleTest {
public:
void SetUp() override { ParametrizedModuleTest::SetUp(); }
void TearDown() override { ParametrizedModuleTest::TearDown(); }
};
} // namespace
TEST_P(DynamicModuleResolverTest, ResolveSuccess) {
V8TestingScope scope;
auto* modulator = MakeGarbageCollected<DynamicModuleResolverTestModulator>(
scope.GetScriptState());
modulator->SetExpectedFetchTreeURL(TestDependencyURL());
auto* promise_resolver =
MakeGarbageCollected<ScriptPromiseResolver>(scope.GetScriptState());
ScriptPromise promise = promise_resolver->Promise();
auto* capture = MakeGarbageCollected<CaptureExportedStringFunction>(
scope.GetScriptState(), "foo");
promise.Then(capture->Bind(),
DynamicModuleResolverTestNotReached::CreateFunction(
scope.GetScriptState()));
auto* resolver = MakeGarbageCollected<DynamicModuleResolver>(modulator);
resolver->ResolveDynamically("./dependency.js", TestReferrerURL(),
ReferrerScriptInfo(), promise_resolver);
v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate());
EXPECT_FALSE(capture->WasCalled());
v8::Local<v8::Module> record = ModuleRecord::Compile(
scope.GetIsolate(), "export const foo = 'hello';", TestReferrerURL(),
TestReferrerURL(), ScriptFetchOptions(), TextPosition::MinimumPosition(),
ASSERT_NO_EXCEPTION);
ModuleScript* module_script =
JSModuleScript::CreateForTest(modulator, record, TestDependencyURL());
EXPECT_TRUE(ModuleRecord::Instantiate(scope.GetScriptState(), record,
TestReferrerURL())
.IsEmpty());
modulator->ResolveTreeFetch(module_script);
v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate());
EXPECT_TRUE(capture->WasCalled());
EXPECT_EQ("hello", capture->CapturedValue());
}
TEST_P(DynamicModuleResolverTest, ResolveSpecifierFailure) {
V8TestingScope scope;
auto* modulator = MakeGarbageCollected<DynamicModuleResolverTestModulator>(
scope.GetScriptState());
modulator->SetExpectedFetchTreeURL(TestDependencyURL());
auto* promise_resolver =
MakeGarbageCollected<ScriptPromiseResolver>(scope.GetScriptState());
ScriptPromise promise = promise_resolver->Promise();
auto* capture =
MakeGarbageCollected<CaptureErrorFunction>(scope.GetScriptState());
promise.Then(DynamicModuleResolverTestNotReached::CreateFunction(
scope.GetScriptState()),
capture->Bind());
auto* resolver = MakeGarbageCollected<DynamicModuleResolver>(modulator);
resolver->ResolveDynamically("invalid-specifier", TestReferrerURL(),
ReferrerScriptInfo(), promise_resolver);
v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate());
EXPECT_TRUE(capture->WasCalled());
EXPECT_EQ("TypeError", capture->Name());
EXPECT_TRUE(capture->Message().StartsWith("Failed to resolve"));
}
TEST_P(DynamicModuleResolverTest, FetchFailure) {
V8TestingScope scope;
auto* modulator = MakeGarbageCollected<DynamicModuleResolverTestModulator>(
scope.GetScriptState());
modulator->SetExpectedFetchTreeURL(TestDependencyURL());
auto* promise_resolver =
MakeGarbageCollected<ScriptPromiseResolver>(scope.GetScriptState());
ScriptPromise promise = promise_resolver->Promise();
auto* capture =
MakeGarbageCollected<CaptureErrorFunction>(scope.GetScriptState());
promise.Then(DynamicModuleResolverTestNotReached::CreateFunction(
scope.GetScriptState()),
capture->Bind());
auto* resolver = MakeGarbageCollected<DynamicModuleResolver>(modulator);
resolver->ResolveDynamically("./dependency.js", TestReferrerURL(),
ReferrerScriptInfo(), promise_resolver);
EXPECT_FALSE(capture->WasCalled());
modulator->ResolveTreeFetch(nullptr);
v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate());
EXPECT_TRUE(capture->WasCalled());
EXPECT_EQ("TypeError", capture->Name());
EXPECT_TRUE(capture->Message().StartsWith("Failed to fetch"));
}
TEST_P(DynamicModuleResolverTest, ExceptionThrown) {
V8TestingScope scope;
auto* modulator = MakeGarbageCollected<DynamicModuleResolverTestModulator>(
scope.GetScriptState());
modulator->SetExpectedFetchTreeURL(TestDependencyURL());
auto* promise_resolver =
MakeGarbageCollected<ScriptPromiseResolver>(scope.GetScriptState());
ScriptPromise promise = promise_resolver->Promise();
auto* capture =
MakeGarbageCollected<CaptureErrorFunction>(scope.GetScriptState());
promise.Then(DynamicModuleResolverTestNotReached::CreateFunction(
scope.GetScriptState()),
capture->Bind());
auto* resolver = MakeGarbageCollected<DynamicModuleResolver>(modulator);
resolver->ResolveDynamically("./dependency.js", TestReferrerURL(),
ReferrerScriptInfo(), promise_resolver);
EXPECT_FALSE(capture->WasCalled());
v8::Local<v8::Module> record = ModuleRecord::Compile(
scope.GetIsolate(), "throw Error('bar')", TestReferrerURL(),
TestReferrerURL(), ScriptFetchOptions(), TextPosition::MinimumPosition(),
ASSERT_NO_EXCEPTION);
ModuleScript* module_script =
JSModuleScript::CreateForTest(modulator, record, TestDependencyURL());
EXPECT_TRUE(ModuleRecord::Instantiate(scope.GetScriptState(), record,
TestReferrerURL())
.IsEmpty());
modulator->ResolveTreeFetch(module_script);
v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate());
EXPECT_TRUE(capture->WasCalled());
EXPECT_EQ("Error", capture->Name());
EXPECT_EQ("bar", capture->Message());
}
TEST_P(DynamicModuleResolverTest, ResolveWithNullReferrerScriptSuccess) {
V8TestingScope scope;
scope.GetDocument().SetURL(KURL("https://example.com"));
auto* modulator = MakeGarbageCollected<DynamicModuleResolverTestModulator>(
scope.GetScriptState());
modulator->SetExpectedFetchTreeURL(TestDependencyURL());
auto* promise_resolver =
MakeGarbageCollected<ScriptPromiseResolver>(scope.GetScriptState());
ScriptPromise promise = promise_resolver->Promise();
auto* capture = MakeGarbageCollected<CaptureExportedStringFunction>(
scope.GetScriptState(), "foo");
promise.Then(capture->Bind(),
DynamicModuleResolverTestNotReached::CreateFunction(
scope.GetScriptState()));
auto* resolver = MakeGarbageCollected<DynamicModuleResolver>(modulator);
resolver->ResolveDynamically("./dependency.js", /* null referrer */ KURL(),
ReferrerScriptInfo(), promise_resolver);
v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate());
EXPECT_FALSE(capture->WasCalled());
v8::Local<v8::Module> record = ModuleRecord::Compile(
scope.GetIsolate(), "export const foo = 'hello';", TestDependencyURL(),
TestDependencyURL(), ScriptFetchOptions(),
TextPosition::MinimumPosition(), ASSERT_NO_EXCEPTION);
ModuleScript* module_script =
JSModuleScript::CreateForTest(modulator, record, TestDependencyURL());
EXPECT_TRUE(ModuleRecord::Instantiate(scope.GetScriptState(), record,
TestDependencyURL())
.IsEmpty());
modulator->ResolveTreeFetch(module_script);
v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate());
EXPECT_TRUE(capture->WasCalled());
EXPECT_EQ("hello", capture->CapturedValue());
}
TEST_P(DynamicModuleResolverTest, ResolveWithReferrerScriptInfoBaseURL) {
V8TestingScope scope;
scope.GetDocument().SetURL(KURL("https://example.com"));
auto* modulator = MakeGarbageCollected<DynamicModuleResolverTestModulator>(
scope.GetScriptState());
modulator->SetExpectedFetchTreeURL(
KURL("https://example.com/correct/dependency.js"));
auto* promise_resolver =
MakeGarbageCollected<ScriptPromiseResolver>(scope.GetScriptState());
auto* resolver = MakeGarbageCollected<DynamicModuleResolver>(modulator);
KURL wrong_base_url("https://example.com/wrong/bar.js");
KURL correct_base_url("https://example.com/correct/baz.js");
resolver->ResolveDynamically(
"./dependency.js", wrong_base_url,
ReferrerScriptInfo(correct_base_url, ScriptFetchOptions()),
promise_resolver);
v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate());
EXPECT_TRUE(modulator->fetch_tree_was_called());
}
// Instantiate tests once with TLA and once without:
INSTANTIATE_TEST_SUITE_P(DynamicModuleResolverTestGroup,
DynamicModuleResolverTest,
testing::Bool(),
ParametrizedModuleTestParamName());
} // namespace blink
|
Java
|
<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "book".
*
* @property integer $id
* @property string $title
* @property string $published_date
*
* @property BookAuthor[] $bookAuthors
* @property BookGenre[] $bookGenres
*/
class Book extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'book';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['title', 'published_date'], 'required'],
[['published_date'], 'safe'],
[['title'], 'string', 'max' => 256]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'title' => 'Title',
'published_date' => 'Published Date',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getBookAuthors()
{
return $this->hasMany('book_author', ['book_id' => 'id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getBookGenres()
{
return $this->hasMany('book_genre', ['book_id' => 'id']);
}
/**
* @inheritdoc
* @return BookQuery the active query used by this AR class.
*/
public static function find()
{
return new BookQuery(get_called_class());
}
}
|
Java
|
--------------------------------------------------------------------------------
-- |
-- Module : Graphics.Rendering.OpenGL.Raw.Compatibility31
-- Copyright : (c) Sven Panne 2015
-- License : BSD3
--
-- Maintainer : Sven Panne <svenpanne@gmail.com>
-- Stability : stable
-- Portability : portable
--
--------------------------------------------------------------------------------
module Graphics.Rendering.OpenGL.Raw.Compatibility31 (
-- * Types
GLbitfield,
GLboolean,
GLbyte,
GLchar,
GLclampd,
GLclampf,
GLdouble,
GLenum,
GLfloat,
GLhalf,
GLint,
GLintptr,
GLshort,
GLsizei,
GLsizeiptr,
GLubyte,
GLuint,
GLushort,
GLvoid,
-- * Enums
gl_2D,
gl_2_BYTES,
gl_3D,
gl_3D_COLOR,
gl_3D_COLOR_TEXTURE,
gl_3_BYTES,
gl_4D_COLOR_TEXTURE,
gl_4_BYTES,
gl_ACCUM,
gl_ACCUM_ALPHA_BITS,
gl_ACCUM_BLUE_BITS,
gl_ACCUM_BUFFER_BIT,
gl_ACCUM_CLEAR_VALUE,
gl_ACCUM_GREEN_BITS,
gl_ACCUM_RED_BITS,
gl_ACTIVE_ATTRIBUTES,
gl_ACTIVE_ATTRIBUTE_MAX_LENGTH,
gl_ACTIVE_TEXTURE,
gl_ACTIVE_UNIFORMS,
gl_ACTIVE_UNIFORM_BLOCKS,
gl_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH,
gl_ACTIVE_UNIFORM_MAX_LENGTH,
gl_ADD,
gl_ADD_SIGNED,
gl_ALIASED_LINE_WIDTH_RANGE,
gl_ALIASED_POINT_SIZE_RANGE,
gl_ALL_ATTRIB_BITS,
gl_ALPHA,
gl_ALPHA12,
gl_ALPHA16,
gl_ALPHA4,
gl_ALPHA8,
gl_ALPHA_BIAS,
gl_ALPHA_BITS,
gl_ALPHA_INTEGER,
gl_ALPHA_SCALE,
gl_ALPHA_TEST,
gl_ALPHA_TEST_FUNC,
gl_ALPHA_TEST_REF,
gl_ALWAYS,
gl_AMBIENT,
gl_AMBIENT_AND_DIFFUSE,
gl_AND,
gl_AND_INVERTED,
gl_AND_REVERSE,
gl_ARRAY_BUFFER,
gl_ARRAY_BUFFER_BINDING,
gl_ATTACHED_SHADERS,
gl_ATTRIB_STACK_DEPTH,
gl_AUTO_NORMAL,
gl_AUX0,
gl_AUX1,
gl_AUX2,
gl_AUX3,
gl_AUX_BUFFERS,
gl_BACK,
gl_BACK_LEFT,
gl_BACK_RIGHT,
gl_BGR,
gl_BGRA,
gl_BGRA_INTEGER,
gl_BGR_INTEGER,
gl_BITMAP,
gl_BITMAP_TOKEN,
gl_BLEND,
gl_BLEND_DST,
gl_BLEND_DST_ALPHA,
gl_BLEND_DST_RGB,
gl_BLEND_EQUATION_ALPHA,
gl_BLEND_EQUATION_RGB,
gl_BLEND_SRC,
gl_BLEND_SRC_ALPHA,
gl_BLEND_SRC_RGB,
gl_BLUE,
gl_BLUE_BIAS,
gl_BLUE_BITS,
gl_BLUE_INTEGER,
gl_BLUE_SCALE,
gl_BOOL,
gl_BOOL_VEC2,
gl_BOOL_VEC3,
gl_BOOL_VEC4,
gl_BUFFER_ACCESS,
gl_BUFFER_ACCESS_FLAGS,
gl_BUFFER_MAPPED,
gl_BUFFER_MAP_LENGTH,
gl_BUFFER_MAP_OFFSET,
gl_BUFFER_MAP_POINTER,
gl_BUFFER_SIZE,
gl_BUFFER_USAGE,
gl_BYTE,
gl_C3F_V3F,
gl_C4F_N3F_V3F,
gl_C4UB_V2F,
gl_C4UB_V3F,
gl_CCW,
gl_CLAMP,
gl_CLAMP_FRAGMENT_COLOR,
gl_CLAMP_READ_COLOR,
gl_CLAMP_TO_BORDER,
gl_CLAMP_TO_EDGE,
gl_CLAMP_VERTEX_COLOR,
gl_CLEAR,
gl_CLIENT_ACTIVE_TEXTURE,
gl_CLIENT_ALL_ATTRIB_BITS,
gl_CLIENT_ATTRIB_STACK_DEPTH,
gl_CLIENT_PIXEL_STORE_BIT,
gl_CLIENT_VERTEX_ARRAY_BIT,
gl_CLIP_DISTANCE0,
gl_CLIP_DISTANCE1,
gl_CLIP_DISTANCE2,
gl_CLIP_DISTANCE3,
gl_CLIP_DISTANCE4,
gl_CLIP_DISTANCE5,
gl_CLIP_DISTANCE6,
gl_CLIP_DISTANCE7,
gl_CLIP_PLANE0,
gl_CLIP_PLANE1,
gl_CLIP_PLANE2,
gl_CLIP_PLANE3,
gl_CLIP_PLANE4,
gl_CLIP_PLANE5,
gl_COEFF,
gl_COLOR,
gl_COLOR_ARRAY,
gl_COLOR_ARRAY_BUFFER_BINDING,
gl_COLOR_ARRAY_POINTER,
gl_COLOR_ARRAY_SIZE,
gl_COLOR_ARRAY_STRIDE,
gl_COLOR_ARRAY_TYPE,
gl_COLOR_ATTACHMENT0,
gl_COLOR_ATTACHMENT1,
gl_COLOR_ATTACHMENT10,
gl_COLOR_ATTACHMENT11,
gl_COLOR_ATTACHMENT12,
gl_COLOR_ATTACHMENT13,
gl_COLOR_ATTACHMENT14,
gl_COLOR_ATTACHMENT15,
gl_COLOR_ATTACHMENT2,
gl_COLOR_ATTACHMENT3,
gl_COLOR_ATTACHMENT4,
gl_COLOR_ATTACHMENT5,
gl_COLOR_ATTACHMENT6,
gl_COLOR_ATTACHMENT7,
gl_COLOR_ATTACHMENT8,
gl_COLOR_ATTACHMENT9,
gl_COLOR_BUFFER_BIT,
gl_COLOR_CLEAR_VALUE,
gl_COLOR_INDEX,
gl_COLOR_INDEXES,
gl_COLOR_LOGIC_OP,
gl_COLOR_MATERIAL,
gl_COLOR_MATERIAL_FACE,
gl_COLOR_MATERIAL_PARAMETER,
gl_COLOR_SUM,
gl_COLOR_WRITEMASK,
gl_COMBINE,
gl_COMBINE_ALPHA,
gl_COMBINE_RGB,
gl_COMPARE_REF_TO_TEXTURE,
gl_COMPARE_R_TO_TEXTURE,
gl_COMPILE,
gl_COMPILE_AND_EXECUTE,
gl_COMPILE_STATUS,
gl_COMPRESSED_ALPHA,
gl_COMPRESSED_INTENSITY,
gl_COMPRESSED_LUMINANCE,
gl_COMPRESSED_LUMINANCE_ALPHA,
gl_COMPRESSED_RED,
gl_COMPRESSED_RED_RGTC1,
gl_COMPRESSED_RG,
gl_COMPRESSED_RGB,
gl_COMPRESSED_RGBA,
gl_COMPRESSED_RG_RGTC2,
gl_COMPRESSED_SIGNED_RED_RGTC1,
gl_COMPRESSED_SIGNED_RG_RGTC2,
gl_COMPRESSED_SLUMINANCE,
gl_COMPRESSED_SLUMINANCE_ALPHA,
gl_COMPRESSED_SRGB,
gl_COMPRESSED_SRGB_ALPHA,
gl_COMPRESSED_TEXTURE_FORMATS,
gl_CONSTANT,
gl_CONSTANT_ALPHA,
gl_CONSTANT_ATTENUATION,
gl_CONSTANT_COLOR,
gl_CONTEXT_FLAGS,
gl_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT,
gl_COORD_REPLACE,
gl_COPY,
gl_COPY_INVERTED,
gl_COPY_PIXEL_TOKEN,
gl_COPY_READ_BUFFER,
gl_COPY_WRITE_BUFFER,
gl_CULL_FACE,
gl_CULL_FACE_MODE,
gl_CURRENT_BIT,
gl_CURRENT_COLOR,
gl_CURRENT_FOG_COORD,
gl_CURRENT_FOG_COORDINATE,
gl_CURRENT_INDEX,
gl_CURRENT_NORMAL,
gl_CURRENT_PROGRAM,
gl_CURRENT_QUERY,
gl_CURRENT_RASTER_COLOR,
gl_CURRENT_RASTER_DISTANCE,
gl_CURRENT_RASTER_INDEX,
gl_CURRENT_RASTER_POSITION,
gl_CURRENT_RASTER_POSITION_VALID,
gl_CURRENT_RASTER_SECONDARY_COLOR,
gl_CURRENT_RASTER_TEXTURE_COORDS,
gl_CURRENT_SECONDARY_COLOR,
gl_CURRENT_TEXTURE_COORDS,
gl_CURRENT_VERTEX_ATTRIB,
gl_CW,
gl_DECAL,
gl_DECR,
gl_DECR_WRAP,
gl_DELETE_STATUS,
gl_DEPTH,
gl_DEPTH24_STENCIL8,
gl_DEPTH32F_STENCIL8,
gl_DEPTH_ATTACHMENT,
gl_DEPTH_BIAS,
gl_DEPTH_BITS,
gl_DEPTH_BUFFER_BIT,
gl_DEPTH_CLEAR_VALUE,
gl_DEPTH_COMPONENT,
gl_DEPTH_COMPONENT16,
gl_DEPTH_COMPONENT24,
gl_DEPTH_COMPONENT32,
gl_DEPTH_COMPONENT32F,
gl_DEPTH_FUNC,
gl_DEPTH_RANGE,
gl_DEPTH_SCALE,
gl_DEPTH_STENCIL,
gl_DEPTH_STENCIL_ATTACHMENT,
gl_DEPTH_TEST,
gl_DEPTH_TEXTURE_MODE,
gl_DEPTH_WRITEMASK,
gl_DIFFUSE,
gl_DITHER,
gl_DOMAIN,
gl_DONT_CARE,
gl_DOT3_RGB,
gl_DOT3_RGBA,
gl_DOUBLE,
gl_DOUBLEBUFFER,
gl_DRAW_BUFFER,
gl_DRAW_BUFFER0,
gl_DRAW_BUFFER1,
gl_DRAW_BUFFER10,
gl_DRAW_BUFFER11,
gl_DRAW_BUFFER12,
gl_DRAW_BUFFER13,
gl_DRAW_BUFFER14,
gl_DRAW_BUFFER15,
gl_DRAW_BUFFER2,
gl_DRAW_BUFFER3,
gl_DRAW_BUFFER4,
gl_DRAW_BUFFER5,
gl_DRAW_BUFFER6,
gl_DRAW_BUFFER7,
gl_DRAW_BUFFER8,
gl_DRAW_BUFFER9,
gl_DRAW_FRAMEBUFFER,
gl_DRAW_FRAMEBUFFER_BINDING,
gl_DRAW_PIXEL_TOKEN,
gl_DST_ALPHA,
gl_DST_COLOR,
gl_DYNAMIC_COPY,
gl_DYNAMIC_DRAW,
gl_DYNAMIC_READ,
gl_EDGE_FLAG,
gl_EDGE_FLAG_ARRAY,
gl_EDGE_FLAG_ARRAY_BUFFER_BINDING,
gl_EDGE_FLAG_ARRAY_POINTER,
gl_EDGE_FLAG_ARRAY_STRIDE,
gl_ELEMENT_ARRAY_BUFFER,
gl_ELEMENT_ARRAY_BUFFER_BINDING,
gl_EMISSION,
gl_ENABLE_BIT,
gl_EQUAL,
gl_EQUIV,
gl_EVAL_BIT,
gl_EXP,
gl_EXP2,
gl_EXTENSIONS,
gl_EYE_LINEAR,
gl_EYE_PLANE,
gl_FALSE,
gl_FASTEST,
gl_FEEDBACK,
gl_FEEDBACK_BUFFER_POINTER,
gl_FEEDBACK_BUFFER_SIZE,
gl_FEEDBACK_BUFFER_TYPE,
gl_FILL,
gl_FIXED_ONLY,
gl_FLAT,
gl_FLOAT,
gl_FLOAT_32_UNSIGNED_INT_24_8_REV,
gl_FLOAT_MAT2,
gl_FLOAT_MAT2x3,
gl_FLOAT_MAT2x4,
gl_FLOAT_MAT3,
gl_FLOAT_MAT3x2,
gl_FLOAT_MAT3x4,
gl_FLOAT_MAT4,
gl_FLOAT_MAT4x2,
gl_FLOAT_MAT4x3,
gl_FLOAT_VEC2,
gl_FLOAT_VEC3,
gl_FLOAT_VEC4,
gl_FOG,
gl_FOG_BIT,
gl_FOG_COLOR,
gl_FOG_COORD,
gl_FOG_COORDINATE,
gl_FOG_COORDINATE_ARRAY,
gl_FOG_COORDINATE_ARRAY_BUFFER_BINDING,
gl_FOG_COORDINATE_ARRAY_POINTER,
gl_FOG_COORDINATE_ARRAY_STRIDE,
gl_FOG_COORDINATE_ARRAY_TYPE,
gl_FOG_COORDINATE_SOURCE,
gl_FOG_COORD_ARRAY,
gl_FOG_COORD_ARRAY_BUFFER_BINDING,
gl_FOG_COORD_ARRAY_POINTER,
gl_FOG_COORD_ARRAY_STRIDE,
gl_FOG_COORD_ARRAY_TYPE,
gl_FOG_COORD_SRC,
gl_FOG_DENSITY,
gl_FOG_END,
gl_FOG_HINT,
gl_FOG_INDEX,
gl_FOG_MODE,
gl_FOG_START,
gl_FRAGMENT_DEPTH,
gl_FRAGMENT_SHADER,
gl_FRAGMENT_SHADER_DERIVATIVE_HINT,
gl_FRAMEBUFFER,
gl_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE,
gl_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE,
gl_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING,
gl_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE,
gl_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE,
gl_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE,
gl_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME,
gl_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE,
gl_FRAMEBUFFER_ATTACHMENT_RED_SIZE,
gl_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE,
gl_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE,
gl_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER,
gl_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL,
gl_FRAMEBUFFER_BINDING,
gl_FRAMEBUFFER_COMPLETE,
gl_FRAMEBUFFER_DEFAULT,
gl_FRAMEBUFFER_INCOMPLETE_ATTACHMENT,
gl_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER,
gl_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT,
gl_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE,
gl_FRAMEBUFFER_INCOMPLETE_READ_BUFFER,
gl_FRAMEBUFFER_SRGB,
gl_FRAMEBUFFER_UNDEFINED,
gl_FRAMEBUFFER_UNSUPPORTED,
gl_FRONT,
gl_FRONT_AND_BACK,
gl_FRONT_FACE,
gl_FRONT_LEFT,
gl_FRONT_RIGHT,
gl_FUNC_ADD,
gl_FUNC_REVERSE_SUBTRACT,
gl_FUNC_SUBTRACT,
gl_GENERATE_MIPMAP,
gl_GENERATE_MIPMAP_HINT,
gl_GEQUAL,
gl_GREATER,
gl_GREEN,
gl_GREEN_BIAS,
gl_GREEN_BITS,
gl_GREEN_INTEGER,
gl_GREEN_SCALE,
gl_HALF_FLOAT,
gl_HINT_BIT,
gl_INCR,
gl_INCR_WRAP,
gl_INDEX,
gl_INDEX_ARRAY,
gl_INDEX_ARRAY_BUFFER_BINDING,
gl_INDEX_ARRAY_POINTER,
gl_INDEX_ARRAY_STRIDE,
gl_INDEX_ARRAY_TYPE,
gl_INDEX_BITS,
gl_INDEX_CLEAR_VALUE,
gl_INDEX_LOGIC_OP,
gl_INDEX_MODE,
gl_INDEX_OFFSET,
gl_INDEX_SHIFT,
gl_INDEX_WRITEMASK,
gl_INFO_LOG_LENGTH,
gl_INT,
gl_INTENSITY,
gl_INTENSITY12,
gl_INTENSITY16,
gl_INTENSITY4,
gl_INTENSITY8,
gl_INTERLEAVED_ATTRIBS,
gl_INTERPOLATE,
gl_INT_SAMPLER_1D,
gl_INT_SAMPLER_1D_ARRAY,
gl_INT_SAMPLER_2D,
gl_INT_SAMPLER_2D_ARRAY,
gl_INT_SAMPLER_2D_RECT,
gl_INT_SAMPLER_3D,
gl_INT_SAMPLER_BUFFER,
gl_INT_SAMPLER_CUBE,
gl_INT_VEC2,
gl_INT_VEC3,
gl_INT_VEC4,
gl_INVALID_ENUM,
gl_INVALID_FRAMEBUFFER_OPERATION,
gl_INVALID_INDEX,
gl_INVALID_OPERATION,
gl_INVALID_VALUE,
gl_INVERT,
gl_KEEP,
gl_LEFT,
gl_LEQUAL,
gl_LESS,
gl_LIGHT0,
gl_LIGHT1,
gl_LIGHT2,
gl_LIGHT3,
gl_LIGHT4,
gl_LIGHT5,
gl_LIGHT6,
gl_LIGHT7,
gl_LIGHTING,
gl_LIGHTING_BIT,
gl_LIGHT_MODEL_AMBIENT,
gl_LIGHT_MODEL_COLOR_CONTROL,
gl_LIGHT_MODEL_LOCAL_VIEWER,
gl_LIGHT_MODEL_TWO_SIDE,
gl_LINE,
gl_LINEAR,
gl_LINEAR_ATTENUATION,
gl_LINEAR_MIPMAP_LINEAR,
gl_LINEAR_MIPMAP_NEAREST,
gl_LINES,
gl_LINE_BIT,
gl_LINE_LOOP,
gl_LINE_RESET_TOKEN,
gl_LINE_SMOOTH,
gl_LINE_SMOOTH_HINT,
gl_LINE_STIPPLE,
gl_LINE_STIPPLE_PATTERN,
gl_LINE_STIPPLE_REPEAT,
gl_LINE_STRIP,
gl_LINE_TOKEN,
gl_LINE_WIDTH,
gl_LINE_WIDTH_GRANULARITY,
gl_LINE_WIDTH_RANGE,
gl_LINK_STATUS,
gl_LIST_BASE,
gl_LIST_BIT,
gl_LIST_INDEX,
gl_LIST_MODE,
gl_LOAD,
gl_LOGIC_OP,
gl_LOGIC_OP_MODE,
gl_LOWER_LEFT,
gl_LUMINANCE,
gl_LUMINANCE12,
gl_LUMINANCE12_ALPHA12,
gl_LUMINANCE12_ALPHA4,
gl_LUMINANCE16,
gl_LUMINANCE16_ALPHA16,
gl_LUMINANCE4,
gl_LUMINANCE4_ALPHA4,
gl_LUMINANCE6_ALPHA2,
gl_LUMINANCE8,
gl_LUMINANCE8_ALPHA8,
gl_LUMINANCE_ALPHA,
gl_MAJOR_VERSION,
gl_MAP1_COLOR_4,
gl_MAP1_GRID_DOMAIN,
gl_MAP1_GRID_SEGMENTS,
gl_MAP1_INDEX,
gl_MAP1_NORMAL,
gl_MAP1_TEXTURE_COORD_1,
gl_MAP1_TEXTURE_COORD_2,
gl_MAP1_TEXTURE_COORD_3,
gl_MAP1_TEXTURE_COORD_4,
gl_MAP1_VERTEX_3,
gl_MAP1_VERTEX_4,
gl_MAP2_COLOR_4,
gl_MAP2_GRID_DOMAIN,
gl_MAP2_GRID_SEGMENTS,
gl_MAP2_INDEX,
gl_MAP2_NORMAL,
gl_MAP2_TEXTURE_COORD_1,
gl_MAP2_TEXTURE_COORD_2,
gl_MAP2_TEXTURE_COORD_3,
gl_MAP2_TEXTURE_COORD_4,
gl_MAP2_VERTEX_3,
gl_MAP2_VERTEX_4,
gl_MAP_COLOR,
gl_MAP_FLUSH_EXPLICIT_BIT,
gl_MAP_INVALIDATE_BUFFER_BIT,
gl_MAP_INVALIDATE_RANGE_BIT,
gl_MAP_READ_BIT,
gl_MAP_STENCIL,
gl_MAP_UNSYNCHRONIZED_BIT,
gl_MAP_WRITE_BIT,
gl_MATRIX_MODE,
gl_MAX,
gl_MAX_3D_TEXTURE_SIZE,
gl_MAX_ARRAY_TEXTURE_LAYERS,
gl_MAX_ATTRIB_STACK_DEPTH,
gl_MAX_CLIENT_ATTRIB_STACK_DEPTH,
gl_MAX_CLIP_DISTANCES,
gl_MAX_CLIP_PLANES,
gl_MAX_COLOR_ATTACHMENTS,
gl_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS,
gl_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS,
gl_MAX_COMBINED_TEXTURE_IMAGE_UNITS,
gl_MAX_COMBINED_UNIFORM_BLOCKS,
gl_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS,
gl_MAX_CUBE_MAP_TEXTURE_SIZE,
gl_MAX_DRAW_BUFFERS,
gl_MAX_ELEMENTS_INDICES,
gl_MAX_ELEMENTS_VERTICES,
gl_MAX_EVAL_ORDER,
gl_MAX_FRAGMENT_UNIFORM_BLOCKS,
gl_MAX_FRAGMENT_UNIFORM_COMPONENTS,
gl_MAX_GEOMETRY_UNIFORM_BLOCKS,
gl_MAX_LIGHTS,
gl_MAX_LIST_NESTING,
gl_MAX_MODELVIEW_STACK_DEPTH,
gl_MAX_NAME_STACK_DEPTH,
gl_MAX_PIXEL_MAP_TABLE,
gl_MAX_PROGRAM_TEXEL_OFFSET,
gl_MAX_PROJECTION_STACK_DEPTH,
gl_MAX_RECTANGLE_TEXTURE_SIZE,
gl_MAX_RENDERBUFFER_SIZE,
gl_MAX_SAMPLES,
gl_MAX_TEXTURE_BUFFER_SIZE,
gl_MAX_TEXTURE_COORDS,
gl_MAX_TEXTURE_IMAGE_UNITS,
gl_MAX_TEXTURE_LOD_BIAS,
gl_MAX_TEXTURE_SIZE,
gl_MAX_TEXTURE_STACK_DEPTH,
gl_MAX_TEXTURE_UNITS,
gl_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS,
gl_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS,
gl_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS,
gl_MAX_UNIFORM_BLOCK_SIZE,
gl_MAX_UNIFORM_BUFFER_BINDINGS,
gl_MAX_VARYING_COMPONENTS,
gl_MAX_VARYING_FLOATS,
gl_MAX_VERTEX_ATTRIBS,
gl_MAX_VERTEX_TEXTURE_IMAGE_UNITS,
gl_MAX_VERTEX_UNIFORM_BLOCKS,
gl_MAX_VERTEX_UNIFORM_COMPONENTS,
gl_MAX_VIEWPORT_DIMS,
gl_MIN,
gl_MINOR_VERSION,
gl_MIN_PROGRAM_TEXEL_OFFSET,
gl_MIRRORED_REPEAT,
gl_MODELVIEW,
gl_MODELVIEW_MATRIX,
gl_MODELVIEW_STACK_DEPTH,
gl_MODULATE,
gl_MULT,
gl_MULTISAMPLE,
gl_MULTISAMPLE_BIT,
gl_N3F_V3F,
gl_NAME_STACK_DEPTH,
gl_NAND,
gl_NEAREST,
gl_NEAREST_MIPMAP_LINEAR,
gl_NEAREST_MIPMAP_NEAREST,
gl_NEVER,
gl_NICEST,
gl_NONE,
gl_NOOP,
gl_NOR,
gl_NORMALIZE,
gl_NORMAL_ARRAY,
gl_NORMAL_ARRAY_BUFFER_BINDING,
gl_NORMAL_ARRAY_POINTER,
gl_NORMAL_ARRAY_STRIDE,
gl_NORMAL_ARRAY_TYPE,
gl_NORMAL_MAP,
gl_NOTEQUAL,
gl_NO_ERROR,
gl_NUM_COMPRESSED_TEXTURE_FORMATS,
gl_NUM_EXTENSIONS,
gl_OBJECT_LINEAR,
gl_OBJECT_PLANE,
gl_ONE,
gl_ONE_MINUS_CONSTANT_ALPHA,
gl_ONE_MINUS_CONSTANT_COLOR,
gl_ONE_MINUS_DST_ALPHA,
gl_ONE_MINUS_DST_COLOR,
gl_ONE_MINUS_SRC_ALPHA,
gl_ONE_MINUS_SRC_COLOR,
gl_OPERAND0_ALPHA,
gl_OPERAND0_RGB,
gl_OPERAND1_ALPHA,
gl_OPERAND1_RGB,
gl_OPERAND2_ALPHA,
gl_OPERAND2_RGB,
gl_OR,
gl_ORDER,
gl_OR_INVERTED,
gl_OR_REVERSE,
gl_OUT_OF_MEMORY,
gl_PACK_ALIGNMENT,
gl_PACK_IMAGE_HEIGHT,
gl_PACK_LSB_FIRST,
gl_PACK_ROW_LENGTH,
gl_PACK_SKIP_IMAGES,
gl_PACK_SKIP_PIXELS,
gl_PACK_SKIP_ROWS,
gl_PACK_SWAP_BYTES,
gl_PASS_THROUGH_TOKEN,
gl_PERSPECTIVE_CORRECTION_HINT,
gl_PIXEL_MAP_A_TO_A,
gl_PIXEL_MAP_A_TO_A_SIZE,
gl_PIXEL_MAP_B_TO_B,
gl_PIXEL_MAP_B_TO_B_SIZE,
gl_PIXEL_MAP_G_TO_G,
gl_PIXEL_MAP_G_TO_G_SIZE,
gl_PIXEL_MAP_I_TO_A,
gl_PIXEL_MAP_I_TO_A_SIZE,
gl_PIXEL_MAP_I_TO_B,
gl_PIXEL_MAP_I_TO_B_SIZE,
gl_PIXEL_MAP_I_TO_G,
gl_PIXEL_MAP_I_TO_G_SIZE,
gl_PIXEL_MAP_I_TO_I,
gl_PIXEL_MAP_I_TO_I_SIZE,
gl_PIXEL_MAP_I_TO_R,
gl_PIXEL_MAP_I_TO_R_SIZE,
gl_PIXEL_MAP_R_TO_R,
gl_PIXEL_MAP_R_TO_R_SIZE,
gl_PIXEL_MAP_S_TO_S,
gl_PIXEL_MAP_S_TO_S_SIZE,
gl_PIXEL_MODE_BIT,
gl_PIXEL_PACK_BUFFER,
gl_PIXEL_PACK_BUFFER_BINDING,
gl_PIXEL_UNPACK_BUFFER,
gl_PIXEL_UNPACK_BUFFER_BINDING,
gl_POINT,
gl_POINTS,
gl_POINT_BIT,
gl_POINT_DISTANCE_ATTENUATION,
gl_POINT_FADE_THRESHOLD_SIZE,
gl_POINT_SIZE,
gl_POINT_SIZE_GRANULARITY,
gl_POINT_SIZE_MAX,
gl_POINT_SIZE_MIN,
gl_POINT_SIZE_RANGE,
gl_POINT_SMOOTH,
gl_POINT_SMOOTH_HINT,
gl_POINT_SPRITE,
gl_POINT_SPRITE_COORD_ORIGIN,
gl_POINT_TOKEN,
gl_POLYGON,
gl_POLYGON_BIT,
gl_POLYGON_MODE,
gl_POLYGON_OFFSET_FACTOR,
gl_POLYGON_OFFSET_FILL,
gl_POLYGON_OFFSET_LINE,
gl_POLYGON_OFFSET_POINT,
gl_POLYGON_OFFSET_UNITS,
gl_POLYGON_SMOOTH,
gl_POLYGON_SMOOTH_HINT,
gl_POLYGON_STIPPLE,
gl_POLYGON_STIPPLE_BIT,
gl_POLYGON_TOKEN,
gl_POSITION,
gl_PREVIOUS,
gl_PRIMARY_COLOR,
gl_PRIMITIVES_GENERATED,
gl_PRIMITIVE_RESTART,
gl_PRIMITIVE_RESTART_INDEX,
gl_PROJECTION,
gl_PROJECTION_MATRIX,
gl_PROJECTION_STACK_DEPTH,
gl_PROXY_TEXTURE_1D,
gl_PROXY_TEXTURE_1D_ARRAY,
gl_PROXY_TEXTURE_2D,
gl_PROXY_TEXTURE_2D_ARRAY,
gl_PROXY_TEXTURE_3D,
gl_PROXY_TEXTURE_CUBE_MAP,
gl_PROXY_TEXTURE_RECTANGLE,
gl_Q,
gl_QUADRATIC_ATTENUATION,
gl_QUADS,
gl_QUAD_STRIP,
gl_QUERY_BY_REGION_NO_WAIT,
gl_QUERY_BY_REGION_WAIT,
gl_QUERY_COUNTER_BITS,
gl_QUERY_NO_WAIT,
gl_QUERY_RESULT,
gl_QUERY_RESULT_AVAILABLE,
gl_QUERY_WAIT,
gl_R,
gl_R11F_G11F_B10F,
gl_R16,
gl_R16F,
gl_R16I,
gl_R16UI,
gl_R16_SNORM,
gl_R32F,
gl_R32I,
gl_R32UI,
gl_R3_G3_B2,
gl_R8,
gl_R8I,
gl_R8UI,
gl_R8_SNORM,
gl_RASTERIZER_DISCARD,
gl_READ_BUFFER,
gl_READ_FRAMEBUFFER,
gl_READ_FRAMEBUFFER_BINDING,
gl_READ_ONLY,
gl_READ_WRITE,
gl_RED,
gl_RED_BIAS,
gl_RED_BITS,
gl_RED_INTEGER,
gl_RED_SCALE,
gl_REFLECTION_MAP,
gl_RENDER,
gl_RENDERBUFFER,
gl_RENDERBUFFER_ALPHA_SIZE,
gl_RENDERBUFFER_BINDING,
gl_RENDERBUFFER_BLUE_SIZE,
gl_RENDERBUFFER_DEPTH_SIZE,
gl_RENDERBUFFER_GREEN_SIZE,
gl_RENDERBUFFER_HEIGHT,
gl_RENDERBUFFER_INTERNAL_FORMAT,
gl_RENDERBUFFER_RED_SIZE,
gl_RENDERBUFFER_SAMPLES,
gl_RENDERBUFFER_STENCIL_SIZE,
gl_RENDERBUFFER_WIDTH,
gl_RENDERER,
gl_RENDER_MODE,
gl_REPEAT,
gl_REPLACE,
gl_RESCALE_NORMAL,
gl_RETURN,
gl_RG,
gl_RG16,
gl_RG16F,
gl_RG16I,
gl_RG16UI,
gl_RG16_SNORM,
gl_RG32F,
gl_RG32I,
gl_RG32UI,
gl_RG8,
gl_RG8I,
gl_RG8UI,
gl_RG8_SNORM,
gl_RGB,
gl_RGB10,
gl_RGB10_A2,
gl_RGB12,
gl_RGB16,
gl_RGB16F,
gl_RGB16I,
gl_RGB16UI,
gl_RGB16_SNORM,
gl_RGB32F,
gl_RGB32I,
gl_RGB32UI,
gl_RGB4,
gl_RGB5,
gl_RGB5_A1,
gl_RGB8,
gl_RGB8I,
gl_RGB8UI,
gl_RGB8_SNORM,
gl_RGB9_E5,
gl_RGBA,
gl_RGBA12,
gl_RGBA16,
gl_RGBA16F,
gl_RGBA16I,
gl_RGBA16UI,
gl_RGBA16_SNORM,
gl_RGBA2,
gl_RGBA32F,
gl_RGBA32I,
gl_RGBA32UI,
gl_RGBA4,
gl_RGBA8,
gl_RGBA8I,
gl_RGBA8UI,
gl_RGBA8_SNORM,
gl_RGBA_INTEGER,
gl_RGBA_MODE,
gl_RGB_INTEGER,
gl_RGB_SCALE,
gl_RG_INTEGER,
gl_RIGHT,
gl_S,
gl_SAMPLER_1D,
gl_SAMPLER_1D_ARRAY,
gl_SAMPLER_1D_ARRAY_SHADOW,
gl_SAMPLER_1D_SHADOW,
gl_SAMPLER_2D,
gl_SAMPLER_2D_ARRAY,
gl_SAMPLER_2D_ARRAY_SHADOW,
gl_SAMPLER_2D_RECT,
gl_SAMPLER_2D_RECT_SHADOW,
gl_SAMPLER_2D_SHADOW,
gl_SAMPLER_3D,
gl_SAMPLER_BUFFER,
gl_SAMPLER_CUBE,
gl_SAMPLER_CUBE_SHADOW,
gl_SAMPLES,
gl_SAMPLES_PASSED,
gl_SAMPLE_ALPHA_TO_COVERAGE,
gl_SAMPLE_ALPHA_TO_ONE,
gl_SAMPLE_BUFFERS,
gl_SAMPLE_COVERAGE,
gl_SAMPLE_COVERAGE_INVERT,
gl_SAMPLE_COVERAGE_VALUE,
gl_SCISSOR_BIT,
gl_SCISSOR_BOX,
gl_SCISSOR_TEST,
gl_SECONDARY_COLOR_ARRAY,
gl_SECONDARY_COLOR_ARRAY_BUFFER_BINDING,
gl_SECONDARY_COLOR_ARRAY_POINTER,
gl_SECONDARY_COLOR_ARRAY_SIZE,
gl_SECONDARY_COLOR_ARRAY_STRIDE,
gl_SECONDARY_COLOR_ARRAY_TYPE,
gl_SELECT,
gl_SELECTION_BUFFER_POINTER,
gl_SELECTION_BUFFER_SIZE,
gl_SEPARATE_ATTRIBS,
gl_SEPARATE_SPECULAR_COLOR,
gl_SET,
gl_SHADER_SOURCE_LENGTH,
gl_SHADER_TYPE,
gl_SHADE_MODEL,
gl_SHADING_LANGUAGE_VERSION,
gl_SHININESS,
gl_SHORT,
gl_SIGNED_NORMALIZED,
gl_SINGLE_COLOR,
gl_SLUMINANCE,
gl_SLUMINANCE8,
gl_SLUMINANCE8_ALPHA8,
gl_SLUMINANCE_ALPHA,
gl_SMOOTH,
gl_SMOOTH_LINE_WIDTH_GRANULARITY,
gl_SMOOTH_LINE_WIDTH_RANGE,
gl_SMOOTH_POINT_SIZE_GRANULARITY,
gl_SMOOTH_POINT_SIZE_RANGE,
gl_SOURCE0_ALPHA,
gl_SOURCE0_RGB,
gl_SOURCE1_ALPHA,
gl_SOURCE1_RGB,
gl_SOURCE2_ALPHA,
gl_SOURCE2_RGB,
gl_SPECULAR,
gl_SPHERE_MAP,
gl_SPOT_CUTOFF,
gl_SPOT_DIRECTION,
gl_SPOT_EXPONENT,
gl_SRC0_ALPHA,
gl_SRC0_RGB,
gl_SRC1_ALPHA,
gl_SRC1_RGB,
gl_SRC2_ALPHA,
gl_SRC2_RGB,
gl_SRC_ALPHA,
gl_SRC_ALPHA_SATURATE,
gl_SRC_COLOR,
gl_SRGB,
gl_SRGB8,
gl_SRGB8_ALPHA8,
gl_SRGB_ALPHA,
gl_STACK_OVERFLOW,
gl_STACK_UNDERFLOW,
gl_STATIC_COPY,
gl_STATIC_DRAW,
gl_STATIC_READ,
gl_STENCIL,
gl_STENCIL_ATTACHMENT,
gl_STENCIL_BACK_FAIL,
gl_STENCIL_BACK_FUNC,
gl_STENCIL_BACK_PASS_DEPTH_FAIL,
gl_STENCIL_BACK_PASS_DEPTH_PASS,
gl_STENCIL_BACK_REF,
gl_STENCIL_BACK_VALUE_MASK,
gl_STENCIL_BACK_WRITEMASK,
gl_STENCIL_BITS,
gl_STENCIL_BUFFER_BIT,
gl_STENCIL_CLEAR_VALUE,
gl_STENCIL_FAIL,
gl_STENCIL_FUNC,
gl_STENCIL_INDEX,
gl_STENCIL_INDEX1,
gl_STENCIL_INDEX16,
gl_STENCIL_INDEX4,
gl_STENCIL_INDEX8,
gl_STENCIL_PASS_DEPTH_FAIL,
gl_STENCIL_PASS_DEPTH_PASS,
gl_STENCIL_REF,
gl_STENCIL_TEST,
gl_STENCIL_VALUE_MASK,
gl_STENCIL_WRITEMASK,
gl_STEREO,
gl_STREAM_COPY,
gl_STREAM_DRAW,
gl_STREAM_READ,
gl_SUBPIXEL_BITS,
gl_SUBTRACT,
gl_T,
gl_T2F_C3F_V3F,
gl_T2F_C4F_N3F_V3F,
gl_T2F_C4UB_V3F,
gl_T2F_N3F_V3F,
gl_T2F_V3F,
gl_T4F_C4F_N3F_V4F,
gl_T4F_V4F,
gl_TEXTURE,
gl_TEXTURE0,
gl_TEXTURE1,
gl_TEXTURE10,
gl_TEXTURE11,
gl_TEXTURE12,
gl_TEXTURE13,
gl_TEXTURE14,
gl_TEXTURE15,
gl_TEXTURE16,
gl_TEXTURE17,
gl_TEXTURE18,
gl_TEXTURE19,
gl_TEXTURE2,
gl_TEXTURE20,
gl_TEXTURE21,
gl_TEXTURE22,
gl_TEXTURE23,
gl_TEXTURE24,
gl_TEXTURE25,
gl_TEXTURE26,
gl_TEXTURE27,
gl_TEXTURE28,
gl_TEXTURE29,
gl_TEXTURE3,
gl_TEXTURE30,
gl_TEXTURE31,
gl_TEXTURE4,
gl_TEXTURE5,
gl_TEXTURE6,
gl_TEXTURE7,
gl_TEXTURE8,
gl_TEXTURE9,
gl_TEXTURE_1D,
gl_TEXTURE_1D_ARRAY,
gl_TEXTURE_2D,
gl_TEXTURE_2D_ARRAY,
gl_TEXTURE_3D,
gl_TEXTURE_ALPHA_SIZE,
gl_TEXTURE_ALPHA_TYPE,
gl_TEXTURE_BASE_LEVEL,
gl_TEXTURE_BINDING_1D,
gl_TEXTURE_BINDING_1D_ARRAY,
gl_TEXTURE_BINDING_2D,
gl_TEXTURE_BINDING_2D_ARRAY,
gl_TEXTURE_BINDING_3D,
gl_TEXTURE_BINDING_BUFFER,
gl_TEXTURE_BINDING_CUBE_MAP,
gl_TEXTURE_BINDING_RECTANGLE,
gl_TEXTURE_BIT,
gl_TEXTURE_BLUE_SIZE,
gl_TEXTURE_BLUE_TYPE,
gl_TEXTURE_BORDER,
gl_TEXTURE_BORDER_COLOR,
gl_TEXTURE_BUFFER,
gl_TEXTURE_BUFFER_DATA_STORE_BINDING,
gl_TEXTURE_COMPARE_FUNC,
gl_TEXTURE_COMPARE_MODE,
gl_TEXTURE_COMPONENTS,
gl_TEXTURE_COMPRESSED,
gl_TEXTURE_COMPRESSED_IMAGE_SIZE,
gl_TEXTURE_COMPRESSION_HINT,
gl_TEXTURE_COORD_ARRAY,
gl_TEXTURE_COORD_ARRAY_BUFFER_BINDING,
gl_TEXTURE_COORD_ARRAY_POINTER,
gl_TEXTURE_COORD_ARRAY_SIZE,
gl_TEXTURE_COORD_ARRAY_STRIDE,
gl_TEXTURE_COORD_ARRAY_TYPE,
gl_TEXTURE_CUBE_MAP,
gl_TEXTURE_CUBE_MAP_NEGATIVE_X,
gl_TEXTURE_CUBE_MAP_NEGATIVE_Y,
gl_TEXTURE_CUBE_MAP_NEGATIVE_Z,
gl_TEXTURE_CUBE_MAP_POSITIVE_X,
gl_TEXTURE_CUBE_MAP_POSITIVE_Y,
gl_TEXTURE_CUBE_MAP_POSITIVE_Z,
gl_TEXTURE_DEPTH,
gl_TEXTURE_DEPTH_SIZE,
gl_TEXTURE_DEPTH_TYPE,
gl_TEXTURE_ENV,
gl_TEXTURE_ENV_COLOR,
gl_TEXTURE_ENV_MODE,
gl_TEXTURE_FILTER_CONTROL,
gl_TEXTURE_GEN_MODE,
gl_TEXTURE_GEN_Q,
gl_TEXTURE_GEN_R,
gl_TEXTURE_GEN_S,
gl_TEXTURE_GEN_T,
gl_TEXTURE_GREEN_SIZE,
gl_TEXTURE_GREEN_TYPE,
gl_TEXTURE_HEIGHT,
gl_TEXTURE_INTENSITY_SIZE,
gl_TEXTURE_INTENSITY_TYPE,
gl_TEXTURE_INTERNAL_FORMAT,
gl_TEXTURE_LOD_BIAS,
gl_TEXTURE_LUMINANCE_SIZE,
gl_TEXTURE_LUMINANCE_TYPE,
gl_TEXTURE_MAG_FILTER,
gl_TEXTURE_MATRIX,
gl_TEXTURE_MAX_LEVEL,
gl_TEXTURE_MAX_LOD,
gl_TEXTURE_MIN_FILTER,
gl_TEXTURE_MIN_LOD,
gl_TEXTURE_PRIORITY,
gl_TEXTURE_RECTANGLE,
gl_TEXTURE_RED_SIZE,
gl_TEXTURE_RED_TYPE,
gl_TEXTURE_RESIDENT,
gl_TEXTURE_SHARED_SIZE,
gl_TEXTURE_STACK_DEPTH,
gl_TEXTURE_STENCIL_SIZE,
gl_TEXTURE_WIDTH,
gl_TEXTURE_WRAP_R,
gl_TEXTURE_WRAP_S,
gl_TEXTURE_WRAP_T,
gl_TRANSFORM_BIT,
gl_TRANSFORM_FEEDBACK_BUFFER,
gl_TRANSFORM_FEEDBACK_BUFFER_BINDING,
gl_TRANSFORM_FEEDBACK_BUFFER_MODE,
gl_TRANSFORM_FEEDBACK_BUFFER_SIZE,
gl_TRANSFORM_FEEDBACK_BUFFER_START,
gl_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN,
gl_TRANSFORM_FEEDBACK_VARYINGS,
gl_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH,
gl_TRANSPOSE_COLOR_MATRIX,
gl_TRANSPOSE_MODELVIEW_MATRIX,
gl_TRANSPOSE_PROJECTION_MATRIX,
gl_TRANSPOSE_TEXTURE_MATRIX,
gl_TRIANGLES,
gl_TRIANGLE_FAN,
gl_TRIANGLE_STRIP,
gl_TRUE,
gl_UNIFORM_ARRAY_STRIDE,
gl_UNIFORM_BLOCK_ACTIVE_UNIFORMS,
gl_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES,
gl_UNIFORM_BLOCK_BINDING,
gl_UNIFORM_BLOCK_DATA_SIZE,
gl_UNIFORM_BLOCK_INDEX,
gl_UNIFORM_BLOCK_NAME_LENGTH,
gl_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER,
gl_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER,
gl_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER,
gl_UNIFORM_BUFFER,
gl_UNIFORM_BUFFER_BINDING,
gl_UNIFORM_BUFFER_OFFSET_ALIGNMENT,
gl_UNIFORM_BUFFER_SIZE,
gl_UNIFORM_BUFFER_START,
gl_UNIFORM_IS_ROW_MAJOR,
gl_UNIFORM_MATRIX_STRIDE,
gl_UNIFORM_NAME_LENGTH,
gl_UNIFORM_OFFSET,
gl_UNIFORM_SIZE,
gl_UNIFORM_TYPE,
gl_UNPACK_ALIGNMENT,
gl_UNPACK_IMAGE_HEIGHT,
gl_UNPACK_LSB_FIRST,
gl_UNPACK_ROW_LENGTH,
gl_UNPACK_SKIP_IMAGES,
gl_UNPACK_SKIP_PIXELS,
gl_UNPACK_SKIP_ROWS,
gl_UNPACK_SWAP_BYTES,
gl_UNSIGNED_BYTE,
gl_UNSIGNED_BYTE_2_3_3_REV,
gl_UNSIGNED_BYTE_3_3_2,
gl_UNSIGNED_INT,
gl_UNSIGNED_INT_10F_11F_11F_REV,
gl_UNSIGNED_INT_10_10_10_2,
gl_UNSIGNED_INT_24_8,
gl_UNSIGNED_INT_2_10_10_10_REV,
gl_UNSIGNED_INT_5_9_9_9_REV,
gl_UNSIGNED_INT_8_8_8_8,
gl_UNSIGNED_INT_8_8_8_8_REV,
gl_UNSIGNED_INT_SAMPLER_1D,
gl_UNSIGNED_INT_SAMPLER_1D_ARRAY,
gl_UNSIGNED_INT_SAMPLER_2D,
gl_UNSIGNED_INT_SAMPLER_2D_ARRAY,
gl_UNSIGNED_INT_SAMPLER_2D_RECT,
gl_UNSIGNED_INT_SAMPLER_3D,
gl_UNSIGNED_INT_SAMPLER_BUFFER,
gl_UNSIGNED_INT_SAMPLER_CUBE,
gl_UNSIGNED_INT_VEC2,
gl_UNSIGNED_INT_VEC3,
gl_UNSIGNED_INT_VEC4,
gl_UNSIGNED_NORMALIZED,
gl_UNSIGNED_SHORT,
gl_UNSIGNED_SHORT_1_5_5_5_REV,
gl_UNSIGNED_SHORT_4_4_4_4,
gl_UNSIGNED_SHORT_4_4_4_4_REV,
gl_UNSIGNED_SHORT_5_5_5_1,
gl_UNSIGNED_SHORT_5_6_5,
gl_UNSIGNED_SHORT_5_6_5_REV,
gl_UPPER_LEFT,
gl_V2F,
gl_V3F,
gl_VALIDATE_STATUS,
gl_VENDOR,
gl_VERSION,
gl_VERTEX_ARRAY,
gl_VERTEX_ARRAY_BINDING,
gl_VERTEX_ARRAY_BUFFER_BINDING,
gl_VERTEX_ARRAY_POINTER,
gl_VERTEX_ARRAY_SIZE,
gl_VERTEX_ARRAY_STRIDE,
gl_VERTEX_ARRAY_TYPE,
gl_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING,
gl_VERTEX_ATTRIB_ARRAY_ENABLED,
gl_VERTEX_ATTRIB_ARRAY_INTEGER,
gl_VERTEX_ATTRIB_ARRAY_NORMALIZED,
gl_VERTEX_ATTRIB_ARRAY_POINTER,
gl_VERTEX_ATTRIB_ARRAY_SIZE,
gl_VERTEX_ATTRIB_ARRAY_STRIDE,
gl_VERTEX_ATTRIB_ARRAY_TYPE,
gl_VERTEX_PROGRAM_POINT_SIZE,
gl_VERTEX_PROGRAM_TWO_SIDE,
gl_VERTEX_SHADER,
gl_VIEWPORT,
gl_VIEWPORT_BIT,
gl_WEIGHT_ARRAY_BUFFER_BINDING,
gl_WRITE_ONLY,
gl_XOR,
gl_ZERO,
gl_ZOOM_X,
gl_ZOOM_Y,
-- * Functions
glAccum,
glActiveTexture,
glAlphaFunc,
glAreTexturesResident,
glArrayElement,
glAttachShader,
glBegin,
glBeginConditionalRender,
glBeginQuery,
glBeginTransformFeedback,
glBindAttribLocation,
glBindBuffer,
glBindBufferBase,
glBindBufferRange,
glBindFragDataLocation,
glBindFramebuffer,
glBindRenderbuffer,
glBindTexture,
glBindVertexArray,
glBitmap,
glBlendColor,
glBlendEquation,
glBlendEquationSeparate,
glBlendFunc,
glBlendFuncSeparate,
glBlitFramebuffer,
glBufferData,
glBufferSubData,
glCallList,
glCallLists,
glCheckFramebufferStatus,
glClampColor,
glClear,
glClearAccum,
glClearBufferfi,
glClearBufferfv,
glClearBufferiv,
glClearBufferuiv,
glClearColor,
glClearDepth,
glClearIndex,
glClearStencil,
glClientActiveTexture,
glClipPlane,
glColor3b,
glColor3bv,
glColor3d,
glColor3dv,
glColor3f,
glColor3fv,
glColor3i,
glColor3iv,
glColor3s,
glColor3sv,
glColor3ub,
glColor3ubv,
glColor3ui,
glColor3uiv,
glColor3us,
glColor3usv,
glColor4b,
glColor4bv,
glColor4d,
glColor4dv,
glColor4f,
glColor4fv,
glColor4i,
glColor4iv,
glColor4s,
glColor4sv,
glColor4ub,
glColor4ubv,
glColor4ui,
glColor4uiv,
glColor4us,
glColor4usv,
glColorMask,
glColorMaski,
glColorMaterial,
glColorPointer,
glCompileShader,
glCompressedTexImage1D,
glCompressedTexImage2D,
glCompressedTexImage3D,
glCompressedTexSubImage1D,
glCompressedTexSubImage2D,
glCompressedTexSubImage3D,
glCopyBufferSubData,
glCopyPixels,
glCopyTexImage1D,
glCopyTexImage2D,
glCopyTexSubImage1D,
glCopyTexSubImage2D,
glCopyTexSubImage3D,
glCreateProgram,
glCreateShader,
glCullFace,
glDeleteBuffers,
glDeleteFramebuffers,
glDeleteLists,
glDeleteProgram,
glDeleteQueries,
glDeleteRenderbuffers,
glDeleteShader,
glDeleteTextures,
glDeleteVertexArrays,
glDepthFunc,
glDepthMask,
glDepthRange,
glDetachShader,
glDisable,
glDisableClientState,
glDisableVertexAttribArray,
glDisablei,
glDrawArrays,
glDrawArraysInstanced,
glDrawBuffer,
glDrawBuffers,
glDrawElements,
glDrawElementsInstanced,
glDrawPixels,
glDrawRangeElements,
glEdgeFlag,
glEdgeFlagPointer,
glEdgeFlagv,
glEnable,
glEnableClientState,
glEnableVertexAttribArray,
glEnablei,
glEnd,
glEndConditionalRender,
glEndList,
glEndQuery,
glEndTransformFeedback,
glEvalCoord1d,
glEvalCoord1dv,
glEvalCoord1f,
glEvalCoord1fv,
glEvalCoord2d,
glEvalCoord2dv,
glEvalCoord2f,
glEvalCoord2fv,
glEvalMesh1,
glEvalMesh2,
glEvalPoint1,
glEvalPoint2,
glFeedbackBuffer,
glFinish,
glFlush,
glFlushMappedBufferRange,
glFogCoordPointer,
glFogCoordd,
glFogCoorddv,
glFogCoordf,
glFogCoordfv,
glFogf,
glFogfv,
glFogi,
glFogiv,
glFramebufferRenderbuffer,
glFramebufferTexture1D,
glFramebufferTexture2D,
glFramebufferTexture3D,
glFramebufferTextureLayer,
glFrontFace,
glFrustum,
glGenBuffers,
glGenFramebuffers,
glGenLists,
glGenQueries,
glGenRenderbuffers,
glGenTextures,
glGenVertexArrays,
glGenerateMipmap,
glGetActiveAttrib,
glGetActiveUniform,
glGetActiveUniformBlockName,
glGetActiveUniformBlockiv,
glGetActiveUniformName,
glGetActiveUniformsiv,
glGetAttachedShaders,
glGetAttribLocation,
glGetBooleani_v,
glGetBooleanv,
glGetBufferParameteriv,
glGetBufferPointerv,
glGetBufferSubData,
glGetClipPlane,
glGetCompressedTexImage,
glGetDoublev,
glGetError,
glGetFloatv,
glGetFragDataLocation,
glGetFramebufferAttachmentParameteriv,
glGetIntegeri_v,
glGetIntegerv,
glGetLightfv,
glGetLightiv,
glGetMapdv,
glGetMapfv,
glGetMapiv,
glGetMaterialfv,
glGetMaterialiv,
glGetPixelMapfv,
glGetPixelMapuiv,
glGetPixelMapusv,
glGetPointerv,
glGetPolygonStipple,
glGetProgramInfoLog,
glGetProgramiv,
glGetQueryObjectiv,
glGetQueryObjectuiv,
glGetQueryiv,
glGetRenderbufferParameteriv,
glGetShaderInfoLog,
glGetShaderSource,
glGetShaderiv,
glGetString,
glGetStringi,
glGetTexEnvfv,
glGetTexEnviv,
glGetTexGendv,
glGetTexGenfv,
glGetTexGeniv,
glGetTexImage,
glGetTexLevelParameterfv,
glGetTexLevelParameteriv,
glGetTexParameterIiv,
glGetTexParameterIuiv,
glGetTexParameterfv,
glGetTexParameteriv,
glGetTransformFeedbackVarying,
glGetUniformBlockIndex,
glGetUniformIndices,
glGetUniformLocation,
glGetUniformfv,
glGetUniformiv,
glGetUniformuiv,
glGetVertexAttribIiv,
glGetVertexAttribIuiv,
glGetVertexAttribPointerv,
glGetVertexAttribdv,
glGetVertexAttribfv,
glGetVertexAttribiv,
glHint,
glIndexMask,
glIndexPointer,
glIndexd,
glIndexdv,
glIndexf,
glIndexfv,
glIndexi,
glIndexiv,
glIndexs,
glIndexsv,
glIndexub,
glIndexubv,
glInitNames,
glInterleavedArrays,
glIsBuffer,
glIsEnabled,
glIsEnabledi,
glIsFramebuffer,
glIsList,
glIsProgram,
glIsQuery,
glIsRenderbuffer,
glIsShader,
glIsTexture,
glIsVertexArray,
glLightModelf,
glLightModelfv,
glLightModeli,
glLightModeliv,
glLightf,
glLightfv,
glLighti,
glLightiv,
glLineStipple,
glLineWidth,
glLinkProgram,
glListBase,
glLoadIdentity,
glLoadMatrixd,
glLoadMatrixf,
glLoadName,
glLoadTransposeMatrixd,
glLoadTransposeMatrixf,
glLogicOp,
glMap1d,
glMap1f,
glMap2d,
glMap2f,
glMapBuffer,
glMapBufferRange,
glMapGrid1d,
glMapGrid1f,
glMapGrid2d,
glMapGrid2f,
glMaterialf,
glMaterialfv,
glMateriali,
glMaterialiv,
glMatrixMode,
glMultMatrixd,
glMultMatrixf,
glMultTransposeMatrixd,
glMultTransposeMatrixf,
glMultiDrawArrays,
glMultiDrawElements,
glMultiTexCoord1d,
glMultiTexCoord1dv,
glMultiTexCoord1f,
glMultiTexCoord1fv,
glMultiTexCoord1i,
glMultiTexCoord1iv,
glMultiTexCoord1s,
glMultiTexCoord1sv,
glMultiTexCoord2d,
glMultiTexCoord2dv,
glMultiTexCoord2f,
glMultiTexCoord2fv,
glMultiTexCoord2i,
glMultiTexCoord2iv,
glMultiTexCoord2s,
glMultiTexCoord2sv,
glMultiTexCoord3d,
glMultiTexCoord3dv,
glMultiTexCoord3f,
glMultiTexCoord3fv,
glMultiTexCoord3i,
glMultiTexCoord3iv,
glMultiTexCoord3s,
glMultiTexCoord3sv,
glMultiTexCoord4d,
glMultiTexCoord4dv,
glMultiTexCoord4f,
glMultiTexCoord4fv,
glMultiTexCoord4i,
glMultiTexCoord4iv,
glMultiTexCoord4s,
glMultiTexCoord4sv,
glNewList,
glNormal3b,
glNormal3bv,
glNormal3d,
glNormal3dv,
glNormal3f,
glNormal3fv,
glNormal3i,
glNormal3iv,
glNormal3s,
glNormal3sv,
glNormalPointer,
glOrtho,
glPassThrough,
glPixelMapfv,
glPixelMapuiv,
glPixelMapusv,
glPixelStoref,
glPixelStorei,
glPixelTransferf,
glPixelTransferi,
glPixelZoom,
glPointParameterf,
glPointParameterfv,
glPointParameteri,
glPointParameteriv,
glPointSize,
glPolygonMode,
glPolygonOffset,
glPolygonStipple,
glPopAttrib,
glPopClientAttrib,
glPopMatrix,
glPopName,
glPrimitiveRestartIndex,
glPrioritizeTextures,
glPushAttrib,
glPushClientAttrib,
glPushMatrix,
glPushName,
glRasterPos2d,
glRasterPos2dv,
glRasterPos2f,
glRasterPos2fv,
glRasterPos2i,
glRasterPos2iv,
glRasterPos2s,
glRasterPos2sv,
glRasterPos3d,
glRasterPos3dv,
glRasterPos3f,
glRasterPos3fv,
glRasterPos3i,
glRasterPos3iv,
glRasterPos3s,
glRasterPos3sv,
glRasterPos4d,
glRasterPos4dv,
glRasterPos4f,
glRasterPos4fv,
glRasterPos4i,
glRasterPos4iv,
glRasterPos4s,
glRasterPos4sv,
glReadBuffer,
glReadPixels,
glRectd,
glRectdv,
glRectf,
glRectfv,
glRecti,
glRectiv,
glRects,
glRectsv,
glRenderMode,
glRenderbufferStorage,
glRenderbufferStorageMultisample,
glRotated,
glRotatef,
glSampleCoverage,
glScaled,
glScalef,
glScissor,
glSecondaryColor3b,
glSecondaryColor3bv,
glSecondaryColor3d,
glSecondaryColor3dv,
glSecondaryColor3f,
glSecondaryColor3fv,
glSecondaryColor3i,
glSecondaryColor3iv,
glSecondaryColor3s,
glSecondaryColor3sv,
glSecondaryColor3ub,
glSecondaryColor3ubv,
glSecondaryColor3ui,
glSecondaryColor3uiv,
glSecondaryColor3us,
glSecondaryColor3usv,
glSecondaryColorPointer,
glSelectBuffer,
glShadeModel,
glShaderSource,
glStencilFunc,
glStencilFuncSeparate,
glStencilMask,
glStencilMaskSeparate,
glStencilOp,
glStencilOpSeparate,
glTexBuffer,
glTexCoord1d,
glTexCoord1dv,
glTexCoord1f,
glTexCoord1fv,
glTexCoord1i,
glTexCoord1iv,
glTexCoord1s,
glTexCoord1sv,
glTexCoord2d,
glTexCoord2dv,
glTexCoord2f,
glTexCoord2fv,
glTexCoord2i,
glTexCoord2iv,
glTexCoord2s,
glTexCoord2sv,
glTexCoord3d,
glTexCoord3dv,
glTexCoord3f,
glTexCoord3fv,
glTexCoord3i,
glTexCoord3iv,
glTexCoord3s,
glTexCoord3sv,
glTexCoord4d,
glTexCoord4dv,
glTexCoord4f,
glTexCoord4fv,
glTexCoord4i,
glTexCoord4iv,
glTexCoord4s,
glTexCoord4sv,
glTexCoordPointer,
glTexEnvf,
glTexEnvfv,
glTexEnvi,
glTexEnviv,
glTexGend,
glTexGendv,
glTexGenf,
glTexGenfv,
glTexGeni,
glTexGeniv,
glTexImage1D,
glTexImage2D,
glTexImage3D,
glTexParameterIiv,
glTexParameterIuiv,
glTexParameterf,
glTexParameterfv,
glTexParameteri,
glTexParameteriv,
glTexSubImage1D,
glTexSubImage2D,
glTexSubImage3D,
glTransformFeedbackVaryings,
glTranslated,
glTranslatef,
glUniform1f,
glUniform1fv,
glUniform1i,
glUniform1iv,
glUniform1ui,
glUniform1uiv,
glUniform2f,
glUniform2fv,
glUniform2i,
glUniform2iv,
glUniform2ui,
glUniform2uiv,
glUniform3f,
glUniform3fv,
glUniform3i,
glUniform3iv,
glUniform3ui,
glUniform3uiv,
glUniform4f,
glUniform4fv,
glUniform4i,
glUniform4iv,
glUniform4ui,
glUniform4uiv,
glUniformBlockBinding,
glUniformMatrix2fv,
glUniformMatrix2x3fv,
glUniformMatrix2x4fv,
glUniformMatrix3fv,
glUniformMatrix3x2fv,
glUniformMatrix3x4fv,
glUniformMatrix4fv,
glUniformMatrix4x2fv,
glUniformMatrix4x3fv,
glUnmapBuffer,
glUseProgram,
glValidateProgram,
glVertex2d,
glVertex2dv,
glVertex2f,
glVertex2fv,
glVertex2i,
glVertex2iv,
glVertex2s,
glVertex2sv,
glVertex3d,
glVertex3dv,
glVertex3f,
glVertex3fv,
glVertex3i,
glVertex3iv,
glVertex3s,
glVertex3sv,
glVertex4d,
glVertex4dv,
glVertex4f,
glVertex4fv,
glVertex4i,
glVertex4iv,
glVertex4s,
glVertex4sv,
glVertexAttrib1d,
glVertexAttrib1dv,
glVertexAttrib1f,
glVertexAttrib1fv,
glVertexAttrib1s,
glVertexAttrib1sv,
glVertexAttrib2d,
glVertexAttrib2dv,
glVertexAttrib2f,
glVertexAttrib2fv,
glVertexAttrib2s,
glVertexAttrib2sv,
glVertexAttrib3d,
glVertexAttrib3dv,
glVertexAttrib3f,
glVertexAttrib3fv,
glVertexAttrib3s,
glVertexAttrib3sv,
glVertexAttrib4Nbv,
glVertexAttrib4Niv,
glVertexAttrib4Nsv,
glVertexAttrib4Nub,
glVertexAttrib4Nubv,
glVertexAttrib4Nuiv,
glVertexAttrib4Nusv,
glVertexAttrib4bv,
glVertexAttrib4d,
glVertexAttrib4dv,
glVertexAttrib4f,
glVertexAttrib4fv,
glVertexAttrib4iv,
glVertexAttrib4s,
glVertexAttrib4sv,
glVertexAttrib4ubv,
glVertexAttrib4uiv,
glVertexAttrib4usv,
glVertexAttribI1i,
glVertexAttribI1iv,
glVertexAttribI1ui,
glVertexAttribI1uiv,
glVertexAttribI2i,
glVertexAttribI2iv,
glVertexAttribI2ui,
glVertexAttribI2uiv,
glVertexAttribI3i,
glVertexAttribI3iv,
glVertexAttribI3ui,
glVertexAttribI3uiv,
glVertexAttribI4bv,
glVertexAttribI4i,
glVertexAttribI4iv,
glVertexAttribI4sv,
glVertexAttribI4ubv,
glVertexAttribI4ui,
glVertexAttribI4uiv,
glVertexAttribI4usv,
glVertexAttribIPointer,
glVertexAttribPointer,
glVertexPointer,
glViewport,
glWindowPos2d,
glWindowPos2dv,
glWindowPos2f,
glWindowPos2fv,
glWindowPos2i,
glWindowPos2iv,
glWindowPos2s,
glWindowPos2sv,
glWindowPos3d,
glWindowPos3dv,
glWindowPos3f,
glWindowPos3fv,
glWindowPos3i,
glWindowPos3iv,
glWindowPos3s,
glWindowPos3sv
) where
import Graphics.Rendering.OpenGL.Raw.Types
import Graphics.Rendering.OpenGL.Raw.Tokens
import Graphics.Rendering.OpenGL.Raw.Functions
|
Java
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="lang:clipboard.copy" content="Copy to clipboard">
<meta name="lang:clipboard.copied" content="Copied to clipboard">
<meta name="lang:search.language" content="en">
<meta name="lang:search.pipeline.stopwords" content="True">
<meta name="lang:search.pipeline.trimmer" content="True">
<meta name="lang:search.result.none" content="No matching documents">
<meta name="lang:search.result.one" content="1 matching document">
<meta name="lang:search.result.other" content="# matching documents">
<meta name="lang:search.tokenizer" content="[\s\-]+">
<link href="https://fonts.gstatic.com/" rel="preconnect" crossorigin>
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:300,400,400i,700&display=fallback" rel="stylesheet">
<style>
body,
input {
font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif
}
code,
kbd,
pre {
font-family: "Roboto Mono", "Courier New", Courier, monospace
}
</style>
<link rel="stylesheet" href="../_static/stylesheets/application.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-palette.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-fixes.css"/>
<link rel="stylesheet" href="../_static/fonts/material-icons.css"/>
<meta name="theme-color" content="#3f51b5">
<script src="../_static/javascripts/modernizr.js"></script>
<title>Release 0.11.1 — statsmodels</title>
<link rel="icon" type="image/png" sizes="32x32" href="../_static/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="../_static/icons/favicon-16x16.png">
<link rel="manifest" href="../_static/icons/site.webmanifest">
<link rel="mask-icon" href="../_static/icons/safari-pinned-tab.svg" color="#919191">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="../_static/icons/browserconfig.xml">
<link rel="stylesheet" href="../_static/stylesheets/examples.css">
<link rel="stylesheet" href="../_static/stylesheets/deprecation.css">
<link rel="stylesheet" href="../_static/material.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/language_data.js"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
<script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true, "ignoreClass": "document", "processClass": "math|output_area"}})</script>
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Release 0.11.0" href="version0.11.html" />
<link rel="prev" title="Release 0.12.0" href="version0.12.html" />
</head>
<body dir=ltr
data-md-color-primary=indigo data-md-color-accent=blue>
<svg class="md-svg">
<defs data-children-count="0">
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg>
</defs>
</svg>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search">
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
<a href="#release/version0.11.1" tabindex="1" class="md-skip"> Skip to content </a>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid">
<div class="md-flex navheader">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="../index.html" title="statsmodels"
class="md-header-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" height="26"
alt="statsmodels logo">
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
<span class="md-header-nav__topic">statsmodels v0.12.0</span>
<span class="md-header-nav__topic"> Release 0.11.1 </span>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" action="../search.html" method="GET" name="search">
<input type="text" class="md-search__input" name="q" placeholder="Search"
autocapitalize="off" autocomplete="off" spellcheck="false"
data-md-component="query" data-md-state="active">
<label class="md-icon md-search__icon" for="__search"></label>
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">

</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="result">
<div class="md-search-result__meta">
Type to start searching
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
</div>
<script src="../_static/javascripts/version_dropdown.js"></script>
<script>
var json_loc = "../_static/versions.json",
target_loc = "../../",
text = "Versions";
$( document ).ready( add_version_dropdown(json_loc, target_loc, text));
</script>
</div>
</nav>
</header>
<div class="md-container">
<nav class="md-tabs" data-md-component="tabs">
<div class="md-tabs__inner md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item"><a href="index.html" class="md-tabs__link">Release Notes</a></li>
</ul>
</div>
</nav>
<main class="md-main">
<div class="md-main__inner md-grid" data-md-component="container">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="__drawer">
<a href="../index.html" title="statsmodels" class="md-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" alt=" logo" width="48" height="48">
</a>
<a href="../index.html"
title="statsmodels">statsmodels v0.12.0</a>
</label>
<div class="md-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../install.html" class="md-nav__link">Installing statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../gettingstarted.html" class="md-nav__link">Getting started</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html" class="md-nav__link">User Guide</a>
</li>
<li class="md-nav__item">
<a href="../examples/index.html" class="md-nav__link">Examples</a>
</li>
<li class="md-nav__item">
<a href="../api.html" class="md-nav__link">API Reference</a>
</li>
<li class="md-nav__item">
<a href="../about.html" class="md-nav__link">About statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../dev/index.html" class="md-nav__link">Developer Page</a>
</li>
<li class="md-nav__item">
<a href="index.html" class="md-nav__link">Release Notes</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="version0.12.html" class="md-nav__link">Release 0.12.0</a>
</li>
<li class="md-nav__item">
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc"> Release 0.11.1 </label>
<a href="#" class="md-nav__link md-nav__link--active">Release 0.11.1</a>
<nav class="md-nav md-nav--secondary">
<label class="md-nav__title" for="__toc">Contents</label>
<ul class="md-nav__list" data-md-scrollfix="">
<li class="md-nav__item"><a href="#release-version0-11-1--page-root" class="md-nav__link">Release 0.11.1</a><nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item"><a href="#release-summary" class="md-nav__link">Release summary</a>
</li>
<li class="md-nav__item"><a href="#development-summary-and-credits" class="md-nav__link">Development summary and credits</a><nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item"><a href="#merged-pull-requests" class="md-nav__link">Merged Pull Requests</a>
</li></ul>
</nav>
</li></ul>
</nav>
</li>
<li class="md-nav__item"><a class="md-nav__extra_link" href="../_sources/release/version0.11.1.rst.txt">Show Source</a> </li>
</ul>
</nav>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#release-summary" class="md-nav__link">Release summary</a>
</li>
<li class="md-nav__item">
<a href="#development-summary-and-credits" class="md-nav__link">Development summary and credits</a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="version0.11.html" class="md-nav__link">Release 0.11.0</a>
</li>
<li class="md-nav__item">
<a href="version0.10.2.html" class="md-nav__link">Release 0.10.2</a>
</li>
<li class="md-nav__item">
<a href="version0.10.1.html" class="md-nav__link">Release 0.10.1</a>
</li>
<li class="md-nav__item">
<a href="version0.10.html" class="md-nav__link">Release 0.10.0</a>
</li>
<li class="md-nav__item">
<a href="version0.9.html" class="md-nav__link">Release 0.9.0</a>
</li>
<li class="md-nav__item">
<a href="version0.8.html" class="md-nav__link">Release 0.8.0</a>
</li>
<li class="md-nav__item">
<a href="version0.7.html" class="md-nav__link">Release 0.7.0</a>
</li>
<li class="md-nav__item">
<a href="version0.6.html" class="md-nav__link">Release 0.6.1</a>
</li>
<li class="md-nav__item">
<a href="version0.6.html#release-0-6-0" class="md-nav__link">Release 0.6.0</a>
</li>
<li class="md-nav__item">
<a href="version0.5.html" class="md-nav__link">Release 0.5.0</a>
</li></ul>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary">
<label class="md-nav__title" for="__toc">Contents</label>
<ul class="md-nav__list" data-md-scrollfix="">
<li class="md-nav__item"><a href="#release-version0-11-1--page-root" class="md-nav__link">Release 0.11.1</a><nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item"><a href="#release-summary" class="md-nav__link">Release summary</a>
</li>
<li class="md-nav__item"><a href="#development-summary-and-credits" class="md-nav__link">Development summary and credits</a><nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item"><a href="#merged-pull-requests" class="md-nav__link">Merged Pull Requests</a>
</li></ul>
</nav>
</li></ul>
</nav>
</li>
<li class="md-nav__item"><a class="md-nav__extra_link" href="../_sources/release/version0.11.1.rst.txt">Show Source</a> </li>
<li id="searchbox" class="md-nav__item"></li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset" role="main">
<h1 id="release-version0-11-1--page-root">Release 0.11.1<a class="headerlink" href="#release-version0-11-1--page-root" title="Permalink to this headline">¶</a></h1>
<h2 id="release-summary">Release summary<a class="headerlink" href="#release-summary" title="Permalink to this headline">¶</a></h2>
<p>This is a bug release.</p>
<h2 id="development-summary-and-credits">Development summary and credits<a class="headerlink" href="#development-summary-and-credits" title="Permalink to this headline">¶</a></h2>
<p>Besides receiving contributions for new and improved features and for bugfixes,
important contributions to general maintenance for this release came from</p>
<ul class="simple">
<li><p>Kerby Shedden</p></li>
<li><p>Josef Perktold</p></li>
<li><p>Alex Lyttle</p></li>
<li><p>Chad Fulton</p></li>
<li><p>Kevin Sheppard</p></li>
<li><p>Wouter De Coster</p></li>
</ul>
<h3 id="merged-pull-requests">Merged Pull Requests<a class="headerlink" href="#merged-pull-requests" title="Permalink to this headline">¶</a></h3>
<p>The following Pull Requests were merged since the last release:</p>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6433">PR #6433</a>: TST/BUG: use reset_randomstate</p></li>
<li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6438">PR #6438</a>: BUG: Change default optimizer for glm/ridge and make it user-settable</p></li>
<li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6453">PR #6453</a>: DOC: Fix the version that appears in the documentation</p></li>
<li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6456">PR #6456</a>: DOC: Send log to dev/null/</p></li>
<li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6461">PR #6461</a>: MAINT: correcting typo</p></li>
<li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6465">PR #6465</a>: MAINT: Avoid noise in f-pvalue</p></li>
<li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6469">PR #6469</a>: MAINT: Fix future warnings</p></li>
<li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6470">PR #6470</a>: BUG: fix tukey-hsd for 1 pvalue</p></li>
<li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6471">PR #6471</a>: MAINT: Fix issue with ragged array</p></li>
<li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6474">PR #6474</a>: BLD: Use pip on Azure</p></li>
<li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6515">PR #6515</a>: BUG: fix #6511</p></li>
<li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6520">PR #6520</a>: BUG: fix GAM for 1-dim exog_linear</p></li>
<li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6534">PR #6534</a>: MAINT: Relax tolerance on test that occasionally fails</p></li>
<li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6535">PR #6535</a>: MAINT: Restrict to Python 3.5+</p></li>
</ul>
</article>
</div>
</div>
</main>
</div>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a href="version0.12.html" title="Release 0.12.0"
class="md-flex md-footer-nav__link md-footer-nav__link--prev"
rel="prev">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span
class="md-footer-nav__direction"> Previous </span> Release 0.12.0 </span>
</div>
</a>
<a href="version0.11.html" title="Release 0.11.0"
class="md-flex md-footer-nav__link md-footer-nav__link--next"
rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"><span
class="md-flex__ellipsis"> <span
class="md-footer-nav__direction"> Next </span> Release 0.11.0 </span>
</div>
<div class="md-flex__cell md-flex__cell--shrink"><i
class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
© Copyright 2009-2019, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
</div>
Last updated on
Aug 27, 2020.
<br/>
Created using
<a href="http://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
and
<a href="https://github.com/bashtage/sphinx-material/">Material for
Sphinx</a>
</div>
</div>
</div>
</footer>
<script src="../_static/javascripts/application.js"></script>
<script>app.initialize({version: "1.0.4", url: {base: ".."}})</script>
</body>
</html>
|
Java
|
<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "content".
*
* @property integer $id
* @property string $title
* @property integer $moderation
* @property integer $listsql_id
* @property integer $parent_id
* @property integer $grade_id
* @property string $comment_TutorAboutPupil1
* @property integer $mark_TutorAboutPupil1
* @property string $date_TutorAboutPupil1
* @property string $comment_Pupil1AboutTutor
* @property integer $mark_Pupil1AboutTutor
* @property string $date_Pupil1AboutTutor
* @property string $commentMaximum_TutorAboutPupil1
* @property integer $markMaximum_TutorAboutPupil1
* @property string $dateMaximum_TutorAboutPupil1
* @property string $commentMaximum_Pupil1AboutTutor
* @property integer $markMaximum_Pupil1AboutTutor
* @property string $dateMaximum_Pupil1AboutTutor
* @property string $comment_Pupil1AboutPupil1
* @property integer $mark_Pupil1AboutPupil1
* @property string $date_Pupil1AboutPupil1
* @property string $commentMaximum_Pupil1AboutPupil1
* @property integer $markMaximum_Pupil1AboutPupil1
* @property string $dateMaximum_Pupil1AboutPupil1
*/
class Content extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'content';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['title', 'moderation', 'listsql_id', 'parent_id', 'comment_TutorAboutPupil1', 'mark_TutorAboutPupil1', 'date_TutorAboutPupil1', 'comment_Pupil1AboutTutor', 'mark_Pupil1AboutTutor', 'date_Pupil1AboutTutor', 'commentMaximum_TutorAboutPupil1', 'markMaximum_TutorAboutPupil1', 'dateMaximum_TutorAboutPupil1', 'commentMaximum_Pupil1AboutTutor', 'markMaximum_Pupil1AboutTutor', 'dateMaximum_Pupil1AboutTutor', 'comment_Pupil1AboutPupil1', 'mark_Pupil1AboutPupil1', 'date_Pupil1AboutPupil1', 'commentMaximum_Pupil1AboutPupil1', 'markMaximum_Pupil1AboutPupil1', 'dateMaximum_Pupil1AboutPupil1'], 'required'],
[['moderation', 'listsql_id', 'parent_id', 'grade_id', 'mark_TutorAboutPupil1', 'mark_Pupil1AboutTutor', 'markMaximum_TutorAboutPupil1', 'markMaximum_Pupil1AboutTutor', 'mark_Pupil1AboutPupil1', 'markMaximum_Pupil1AboutPupil1'], 'integer'],
[['comment_TutorAboutPupil1', 'comment_Pupil1AboutTutor', 'commentMaximum_TutorAboutPupil1', 'commentMaximum_Pupil1AboutTutor', 'comment_Pupil1AboutPupil1', 'commentMaximum_Pupil1AboutPupil1'], 'string'],
[['date_TutorAboutPupil1', 'date_Pupil1AboutTutor', 'dateMaximum_TutorAboutPupil1', 'dateMaximum_Pupil1AboutTutor', 'date_Pupil1AboutPupil1', 'dateMaximum_Pupil1AboutPupil1'], 'safe'],
[['title'], 'string', 'max' => 500],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'title' => 'Title',
'moderation' => 'Moderation',
'listsql_id' => 'Listsql ID',
'parent_id' => 'Parent ID',
'grade_id' => 'Grade ID',
'comment_TutorAboutPupil1' => 'Comment Tutor About Pupil1',
'mark_TutorAboutPupil1' => 'Mark Tutor About Pupil1',
'date_TutorAboutPupil1' => 'Date Tutor About Pupil1',
'comment_Pupil1AboutTutor' => 'Comment Pupil1 About Tutor',
'mark_Pupil1AboutTutor' => 'Mark Pupil1 About Tutor',
'date_Pupil1AboutTutor' => 'Date Pupil1 About Tutor',
'commentMaximum_TutorAboutPupil1' => 'Comment Maximum Tutor About Pupil1',
'markMaximum_TutorAboutPupil1' => 'Mark Maximum Tutor About Pupil1',
'dateMaximum_TutorAboutPupil1' => 'Date Maximum Tutor About Pupil1',
'commentMaximum_Pupil1AboutTutor' => 'Comment Maximum Pupil1 About Tutor',
'markMaximum_Pupil1AboutTutor' => 'Mark Maximum Pupil1 About Tutor',
'dateMaximum_Pupil1AboutTutor' => 'Date Maximum Pupil1 About Tutor',
'comment_Pupil1AboutPupil1' => 'Comment Pupil1 About Pupil1',
'mark_Pupil1AboutPupil1' => 'Mark Pupil1 About Pupil1',
'date_Pupil1AboutPupil1' => 'Date Pupil1 About Pupil1',
'commentMaximum_Pupil1AboutPupil1' => 'Comment Maximum Pupil1 About Pupil1',
'markMaximum_Pupil1AboutPupil1' => 'Mark Maximum Pupil1 About Pupil1',
'dateMaximum_Pupil1AboutPupil1' => 'Date Maximum Pupil1 About Pupil1',
];
}
}
|
Java
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="lang:clipboard.copy" content="Copy to clipboard">
<meta name="lang:clipboard.copied" content="Copied to clipboard">
<meta name="lang:search.language" content="en">
<meta name="lang:search.pipeline.stopwords" content="True">
<meta name="lang:search.pipeline.trimmer" content="True">
<meta name="lang:search.result.none" content="No matching documents">
<meta name="lang:search.result.one" content="1 matching document">
<meta name="lang:search.result.other" content="# matching documents">
<meta name="lang:search.tokenizer" content="[\s\-]+">
<link href="https://fonts.gstatic.com/" rel="preconnect" crossorigin>
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:300,400,400i,700&display=fallback" rel="stylesheet">
<style>
body,
input {
font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif
}
code,
kbd,
pre {
font-family: "Roboto Mono", "Courier New", Courier, monospace
}
</style>
<link rel="stylesheet" href="../../../../_static/stylesheets/application.css"/>
<link rel="stylesheet" href="../../../../_static/stylesheets/application-palette.css"/>
<link rel="stylesheet" href="../../../../_static/stylesheets/application-fixes.css"/>
<link rel="stylesheet" href="../../../../_static/fonts/material-icons.css"/>
<meta name="theme-color" content="#3f51b5">
<script src="../../../../_static/javascripts/modernizr.js"></script>
<title>statsmodels.tsa.statespace.representation — statsmodels</title>
<link rel="icon" type="image/png" sizes="32x32" href="../../../../_static/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="../../../../_static/icons/favicon-16x16.png">
<link rel="manifest" href="../../../../_static/icons/site.webmanifest">
<link rel="mask-icon" href="../../../../_static/icons/safari-pinned-tab.svg" color="#919191">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="../../../../_static/icons/browserconfig.xml">
<link rel="stylesheet" href="../../../../_static/stylesheets/examples.css">
<link rel="stylesheet" href="../../../../_static/stylesheets/deprecation.css">
<link rel="stylesheet" type="text/css" href="../../../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../../../_static/material.css" />
<link rel="stylesheet" type="text/css" href="../../../../_static/graphviz.css" />
<link rel="stylesheet" type="text/css" href="../../../../_static/plot_directive.css" />
<script data-url_root="../../../../" id="documentation_options" src="../../../../_static/documentation_options.js"></script>
<script src="../../../../_static/jquery.js"></script>
<script src="../../../../_static/underscore.js"></script>
<script src="../../../../_static/doctools.js"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
<link rel="shortcut icon" href="../../../../_static/favicon.ico"/>
<link rel="author" title="About these documents" href="../../../../about.html" />
<link rel="index" title="Index" href="../../../../genindex.html" />
<link rel="search" title="Search" href="../../../../search.html" />
</head>
<body dir=ltr
data-md-color-primary=indigo data-md-color-accent=blue>
<svg class="md-svg">
<defs data-children-count="0">
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg>
</defs>
</svg>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search">
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
<a href="#_modules/statsmodels/tsa/statespace/representation" tabindex="1" class="md-skip"> Skip to content </a>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid">
<div class="md-flex navheader">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="../../../../index.html" title="statsmodels"
class="md-header-nav__button md-logo">
<img src="../../../../_static/statsmodels-logo-v2-bw.svg" height="26"
alt="statsmodels logo">
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
<span class="md-header-nav__topic">statsmodels v0.13.0</span>
<span class="md-header-nav__topic"> statsmodels.tsa.statespace.representation </span>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" action="../../../../search.html" method="get" name="search">
<input type="text" class="md-search__input" name="q" placeholder="Search"
autocapitalize="off" autocomplete="off" spellcheck="false"
data-md-component="query" data-md-state="active">
<label class="md-icon md-search__icon" for="__search"></label>
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">

</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="result">
<div class="md-search-result__meta">
Type to start searching
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
</div>
<script src="../../../../_static/javascripts/version_dropdown.js"></script>
<script>
var json_loc = "../../../../../versions-v2.json",
target_loc = "../../../../../",
text = "Versions";
$( document ).ready( add_version_dropdown(json_loc, target_loc, text));
</script>
</div>
</nav>
</header>
<div class="md-container">
<nav class="md-tabs" data-md-component="tabs">
<div class="md-tabs__inner md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item"><a href="../../../index.html" class="md-tabs__link">Module code</a></li>
</ul>
</div>
</nav>
<main class="md-main">
<div class="md-main__inner md-grid" data-md-component="container">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="__drawer">
<a href="../../../../index.html" title="statsmodels" class="md-nav__button md-logo">
<img src="../../../../_static/statsmodels-logo-v2-bw.svg" alt=" logo" width="48" height="48">
</a>
<a href="../../../../index.html"
title="statsmodels">statsmodels v0.13.0</a>
</label>
<div class="md-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../../../../install.html" class="md-nav__link">Installing statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../../../../gettingstarted.html" class="md-nav__link">Getting started</a>
</li>
<li class="md-nav__item">
<a href="../../../../user-guide.html" class="md-nav__link">User Guide</a>
</li>
<li class="md-nav__item">
<a href="../../../../examples/index.html" class="md-nav__link">Examples</a>
</li>
<li class="md-nav__item">
<a href="../../../../api.html" class="md-nav__link">API Reference</a>
</li>
<li class="md-nav__item">
<a href="../../../../about.html" class="md-nav__link">About statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../../../../dev/index.html" class="md-nav__link">Developer Page</a>
</li>
<li class="md-nav__item">
<a href="../../../../release/index.html" class="md-nav__link">Release Notes</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary">
<ul class="md-nav__list" data-md-scrollfix="">
<li id="searchbox" class="md-nav__item"></li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset" role="main">
<h1 id="modules-statsmodels-tsa-statespace-representation--page-root">Source code for statsmodels.tsa.statespace.representation</h1><div class="highlight"><pre>
<span></span><span class="sd">"""</span>
<span class="sd">State Space Representation</span>
<span class="sd">Author: Chad Fulton</span>
<span class="sd">License: Simplified-BSD</span>
<span class="sd">"""</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">from</span> <span class="nn">.tools</span> <span class="kn">import</span> <span class="p">(</span>
<span class="n">find_best_blas_type</span><span class="p">,</span> <span class="n">validate_matrix_shape</span><span class="p">,</span> <span class="n">validate_vector_shape</span>
<span class="p">)</span>
<span class="kn">from</span> <span class="nn">.initialization</span> <span class="kn">import</span> <span class="n">Initialization</span>
<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">tools</span>
<span class="k">class</span> <span class="nc">OptionWrapper</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">mask_attribute</span><span class="p">,</span> <span class="n">mask_value</span><span class="p">):</span>
<span class="c1"># Name of the class-level bitmask attribute</span>
<span class="bp">self</span><span class="o">.</span><span class="n">mask_attribute</span> <span class="o">=</span> <span class="n">mask_attribute</span>
<span class="c1"># Value of this option</span>
<span class="bp">self</span><span class="o">.</span><span class="n">mask_value</span> <span class="o">=</span> <span class="n">mask_value</span>
<span class="k">def</span> <span class="fm">__get__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">,</span> <span class="n">objtype</span><span class="p">):</span>
<span class="c1"># Return True / False based on whether the bit is set in the bitmask</span>
<span class="k">return</span> <span class="nb">bool</span><span class="p">(</span><span class="nb">getattr</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">mask_attribute</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="o">&</span> <span class="bp">self</span><span class="o">.</span><span class="n">mask_value</span><span class="p">)</span>
<span class="k">def</span> <span class="fm">__set__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
<span class="n">mask_attribute_value</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">mask_attribute</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<span class="k">if</span> <span class="nb">bool</span><span class="p">(</span><span class="n">value</span><span class="p">):</span>
<span class="n">value</span> <span class="o">=</span> <span class="n">mask_attribute_value</span> <span class="o">|</span> <span class="bp">self</span><span class="o">.</span><span class="n">mask_value</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">value</span> <span class="o">=</span> <span class="n">mask_attribute_value</span> <span class="o">&</span> <span class="o">~</span><span class="bp">self</span><span class="o">.</span><span class="n">mask_value</span>
<span class="nb">setattr</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">mask_attribute</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
<span class="k">class</span> <span class="nc">MatrixWrapper</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">attribute</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
<span class="bp">self</span><span class="o">.</span><span class="n">attribute</span> <span class="o">=</span> <span class="n">attribute</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_attribute</span> <span class="o">=</span> <span class="s1">'_'</span> <span class="o">+</span> <span class="n">attribute</span>
<span class="k">def</span> <span class="fm">__get__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">,</span> <span class="n">objtype</span><span class="p">):</span>
<span class="n">matrix</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_attribute</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="c1"># # Remove last dimension if the array is not actually time-varying</span>
<span class="c1"># if matrix is not None and matrix.shape[-1] == 1:</span>
<span class="c1"># return np.squeeze(matrix, -1)</span>
<span class="k">return</span> <span class="n">matrix</span>
<span class="k">def</span> <span class="fm">__set__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
<span class="n">value</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">asarray</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">order</span><span class="o">=</span><span class="s2">"F"</span><span class="p">)</span>
<span class="n">shape</span> <span class="o">=</span> <span class="n">obj</span><span class="o">.</span><span class="n">shapes</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">attribute</span><span class="p">]</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">shape</span><span class="p">)</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span>
<span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_matrix</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">shape</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_vector</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">shape</span><span class="p">)</span>
<span class="nb">setattr</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_attribute</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
<span class="n">obj</span><span class="o">.</span><span class="n">shapes</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">attribute</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span><span class="o">.</span><span class="n">shape</span>
<span class="k">def</span> <span class="nf">_set_matrix</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">shape</span><span class="p">):</span>
<span class="c1"># Expand 1-dimensional array if possible</span>
<span class="k">if</span> <span class="p">(</span><span class="n">value</span><span class="o">.</span><span class="n">ndim</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span>
<span class="n">value</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]):</span>
<span class="n">value</span> <span class="o">=</span> <span class="n">value</span><span class="p">[</span><span class="kc">None</span><span class="p">,</span> <span class="p">:]</span>
<span class="c1"># Enforce that the matrix is appropriate size</span>
<span class="n">validate_matrix_shape</span><span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="o">.</span><span class="n">shape</span><span class="p">,</span> <span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">obj</span><span class="o">.</span><span class="n">nobs</span>
<span class="p">)</span>
<span class="c1"># Expand time-invariant matrix</span>
<span class="k">if</span> <span class="n">value</span><span class="o">.</span><span class="n">ndim</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
<span class="n">value</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">value</span><span class="p">[:,</span> <span class="p">:,</span> <span class="kc">None</span><span class="p">],</span> <span class="n">order</span><span class="o">=</span><span class="s2">"F"</span><span class="p">)</span>
<span class="k">return</span> <span class="n">value</span>
<span class="k">def</span> <span class="nf">_set_vector</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">shape</span><span class="p">):</span>
<span class="c1"># Enforce that the vector has appropriate length</span>
<span class="n">validate_vector_shape</span><span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="o">.</span><span class="n">shape</span><span class="p">,</span> <span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">obj</span><span class="o">.</span><span class="n">nobs</span>
<span class="p">)</span>
<span class="c1"># Expand the time-invariant vector</span>
<span class="k">if</span> <span class="n">value</span><span class="o">.</span><span class="n">ndim</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
<span class="n">value</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">value</span><span class="p">[:,</span> <span class="kc">None</span><span class="p">],</span> <span class="n">order</span><span class="o">=</span><span class="s2">"F"</span><span class="p">)</span>
<span class="k">return</span> <span class="n">value</span>
<div class="viewcode-block" id="Representation"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.Representation.html#statsmodels.tsa.statespace.kalman_filter.Representation">[docs]</a><span class="k">class</span> <span class="nc">Representation</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="sa">r</span><span class="sd">"""</span>
<span class="sd"> State space representation of a time series process</span>
<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>
<span class="sd"> k_endog : {array_like, int}</span>
<span class="sd"> The observed time-series process :math:`y` if array like or the</span>
<span class="sd"> number of variables in the process if an integer.</span>
<span class="sd"> k_states : int</span>
<span class="sd"> The dimension of the unobserved state process.</span>
<span class="sd"> k_posdef : int, optional</span>
<span class="sd"> The dimension of a guaranteed positive definite covariance matrix</span>
<span class="sd"> describing the shocks in the measurement equation. Must be less than</span>
<span class="sd"> or equal to `k_states`. Default is `k_states`.</span>
<span class="sd"> initial_variance : float, optional</span>
<span class="sd"> Initial variance used when approximate diffuse initialization is</span>
<span class="sd"> specified. Default is 1e6.</span>
<span class="sd"> initialization : Initialization object or str, optional</span>
<span class="sd"> Initialization method for the initial state. If a string, must be one</span>
<span class="sd"> of {'diffuse', 'approximate_diffuse', 'stationary', 'known'}.</span>
<span class="sd"> initial_state : array_like, optional</span>
<span class="sd"> If `initialization='known'` is used, the mean of the initial state's</span>
<span class="sd"> distribution.</span>
<span class="sd"> initial_state_cov : array_like, optional</span>
<span class="sd"> If `initialization='known'` is used, the covariance matrix of the</span>
<span class="sd"> initial state's distribution.</span>
<span class="sd"> nobs : int, optional</span>
<span class="sd"> If an endogenous vector is not given (i.e. `k_endog` is an integer),</span>
<span class="sd"> the number of observations can optionally be specified. If not</span>
<span class="sd"> specified, they will be set to zero until data is bound to the model.</span>
<span class="sd"> dtype : np.dtype, optional</span>
<span class="sd"> If an endogenous vector is not given (i.e. `k_endog` is an integer),</span>
<span class="sd"> the default datatype of the state space matrices can optionally be</span>
<span class="sd"> specified. Default is `np.float64`.</span>
<span class="sd"> design : array_like, optional</span>
<span class="sd"> The design matrix, :math:`Z`. Default is set to zeros.</span>
<span class="sd"> obs_intercept : array_like, optional</span>
<span class="sd"> The intercept for the observation equation, :math:`d`. Default is set</span>
<span class="sd"> to zeros.</span>
<span class="sd"> obs_cov : array_like, optional</span>
<span class="sd"> The covariance matrix for the observation equation :math:`H`. Default</span>
<span class="sd"> is set to zeros.</span>
<span class="sd"> transition : array_like, optional</span>
<span class="sd"> The transition matrix, :math:`T`. Default is set to zeros.</span>
<span class="sd"> state_intercept : array_like, optional</span>
<span class="sd"> The intercept for the transition equation, :math:`c`. Default is set to</span>
<span class="sd"> zeros.</span>
<span class="sd"> selection : array_like, optional</span>
<span class="sd"> The selection matrix, :math:`R`. Default is set to zeros.</span>
<span class="sd"> state_cov : array_like, optional</span>
<span class="sd"> The covariance matrix for the state equation :math:`Q`. Default is set</span>
<span class="sd"> to zeros.</span>
<span class="sd"> **kwargs</span>
<span class="sd"> Additional keyword arguments. Not used directly. It is present to</span>
<span class="sd"> improve compatibility with subclasses, so that they can use `**kwargs`</span>
<span class="sd"> to specify any default state space matrices (e.g. `design`) without</span>
<span class="sd"> having to clean out any other keyword arguments they might have been</span>
<span class="sd"> passed.</span>
<span class="sd"> Attributes</span>
<span class="sd"> ----------</span>
<span class="sd"> nobs : int</span>
<span class="sd"> The number of observations.</span>
<span class="sd"> k_endog : int</span>
<span class="sd"> The dimension of the observation series.</span>
<span class="sd"> k_states : int</span>
<span class="sd"> The dimension of the unobserved state process.</span>
<span class="sd"> k_posdef : int</span>
<span class="sd"> The dimension of a guaranteed positive</span>
<span class="sd"> definite covariance matrix describing</span>
<span class="sd"> the shocks in the measurement equation.</span>
<span class="sd"> shapes : dictionary of name:tuple</span>
<span class="sd"> A dictionary recording the initial shapes</span>
<span class="sd"> of each of the representation matrices as</span>
<span class="sd"> tuples.</span>
<span class="sd"> initialization : str</span>
<span class="sd"> Kalman filter initialization method. Default is unset.</span>
<span class="sd"> initial_variance : float</span>
<span class="sd"> Initial variance for approximate diffuse</span>
<span class="sd"> initialization. Default is 1e6.</span>
<span class="sd"> Notes</span>
<span class="sd"> -----</span>
<span class="sd"> A general state space model is of the form</span>
<span class="sd"> .. math::</span>
<span class="sd"> y_t & = Z_t \alpha_t + d_t + \varepsilon_t \\</span>
<span class="sd"> \alpha_t & = T_t \alpha_{t-1} + c_t + R_t \eta_t \\</span>
<span class="sd"> where :math:`y_t` refers to the observation vector at time :math:`t`,</span>
<span class="sd"> :math:`\alpha_t` refers to the (unobserved) state vector at time</span>
<span class="sd"> :math:`t`, and where the irregular components are defined as</span>
<span class="sd"> .. math::</span>
<span class="sd"> \varepsilon_t \sim N(0, H_t) \\</span>
<span class="sd"> \eta_t \sim N(0, Q_t) \\</span>
<span class="sd"> The remaining variables (:math:`Z_t, d_t, H_t, T_t, c_t, R_t, Q_t`) in the</span>
<span class="sd"> equations are matrices describing the process. Their variable names and</span>
<span class="sd"> dimensions are as follows</span>
<span class="sd"> Z : `design` :math:`(k\_endog \times k\_states \times nobs)`</span>
<span class="sd"> d : `obs_intercept` :math:`(k\_endog \times nobs)`</span>
<span class="sd"> H : `obs_cov` :math:`(k\_endog \times k\_endog \times nobs)`</span>
<span class="sd"> T : `transition` :math:`(k\_states \times k\_states \times nobs)`</span>
<span class="sd"> c : `state_intercept` :math:`(k\_states \times nobs)`</span>
<span class="sd"> R : `selection` :math:`(k\_states \times k\_posdef \times nobs)`</span>
<span class="sd"> Q : `state_cov` :math:`(k\_posdef \times k\_posdef \times nobs)`</span>
<span class="sd"> In the case that one of the matrices is time-invariant (so that, for</span>
<span class="sd"> example, :math:`Z_t = Z_{t+1} ~ \forall ~ t`), its last dimension may</span>
<span class="sd"> be of size :math:`1` rather than size `nobs`.</span>
<span class="sd"> References</span>
<span class="sd"> ----------</span>
<span class="sd"> .. [*] Durbin, James, and Siem Jan Koopman. 2012.</span>
<span class="sd"> Time Series Analysis by State Space Methods: Second Edition.</span>
<span class="sd"> Oxford University Press.</span>
<span class="sd"> """</span>
<span class="n">endog</span> <span class="o">=</span> <span class="kc">None</span>
<span class="sa">r</span><span class="sd">"""</span>
<span class="sd"> (array) The observation vector, alias for `obs`.</span>
<span class="sd"> """</span>
<span class="n">design</span> <span class="o">=</span> <span class="n">MatrixWrapper</span><span class="p">(</span><span class="s1">'design'</span><span class="p">,</span> <span class="s1">'design'</span><span class="p">)</span>
<span class="sa">r</span><span class="sd">"""</span>
<span class="sd"> (array) Design matrix: :math:`Z~(k\_endog \times k\_states \times nobs)`</span>
<span class="sd"> """</span>
<span class="n">obs_intercept</span> <span class="o">=</span> <span class="n">MatrixWrapper</span><span class="p">(</span><span class="s1">'observation intercept'</span><span class="p">,</span> <span class="s1">'obs_intercept'</span><span class="p">)</span>
<span class="sa">r</span><span class="sd">"""</span>
<span class="sd"> (array) Observation intercept: :math:`d~(k\_endog \times nobs)`</span>
<span class="sd"> """</span>
<span class="n">obs_cov</span> <span class="o">=</span> <span class="n">MatrixWrapper</span><span class="p">(</span><span class="s1">'observation covariance matrix'</span><span class="p">,</span> <span class="s1">'obs_cov'</span><span class="p">)</span>
<span class="sa">r</span><span class="sd">"""</span>
<span class="sd"> (array) Observation covariance matrix:</span>
<span class="sd"> :math:`H~(k\_endog \times k\_endog \times nobs)`</span>
<span class="sd"> """</span>
<span class="n">transition</span> <span class="o">=</span> <span class="n">MatrixWrapper</span><span class="p">(</span><span class="s1">'transition'</span><span class="p">,</span> <span class="s1">'transition'</span><span class="p">)</span>
<span class="sa">r</span><span class="sd">"""</span>
<span class="sd"> (array) Transition matrix:</span>
<span class="sd"> :math:`T~(k\_states \times k\_states \times nobs)`</span>
<span class="sd"> """</span>
<span class="n">state_intercept</span> <span class="o">=</span> <span class="n">MatrixWrapper</span><span class="p">(</span><span class="s1">'state intercept'</span><span class="p">,</span> <span class="s1">'state_intercept'</span><span class="p">)</span>
<span class="sa">r</span><span class="sd">"""</span>
<span class="sd"> (array) State intercept: :math:`c~(k\_states \times nobs)`</span>
<span class="sd"> """</span>
<span class="n">selection</span> <span class="o">=</span> <span class="n">MatrixWrapper</span><span class="p">(</span><span class="s1">'selection'</span><span class="p">,</span> <span class="s1">'selection'</span><span class="p">)</span>
<span class="sa">r</span><span class="sd">"""</span>
<span class="sd"> (array) Selection matrix:</span>
<span class="sd"> :math:`R~(k\_states \times k\_posdef \times nobs)`</span>
<span class="sd"> """</span>
<span class="n">state_cov</span> <span class="o">=</span> <span class="n">MatrixWrapper</span><span class="p">(</span><span class="s1">'state covariance matrix'</span><span class="p">,</span> <span class="s1">'state_cov'</span><span class="p">)</span>
<span class="sa">r</span><span class="sd">"""</span>
<span class="sd"> (array) State covariance matrix:</span>
<span class="sd"> :math:`Q~(k\_posdef \times k\_posdef \times nobs)`</span>
<span class="sd"> """</span>
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">k_endog</span><span class="p">,</span> <span class="n">k_states</span><span class="p">,</span> <span class="n">k_posdef</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">initial_variance</span><span class="o">=</span><span class="mf">1e6</span><span class="p">,</span> <span class="n">nobs</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">float64</span><span class="p">,</span>
<span class="n">design</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">obs_intercept</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">obs_cov</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">transition</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">state_intercept</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">selection</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">state_cov</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">statespace_classes</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">shapes</span> <span class="o">=</span> <span class="p">{}</span>
<span class="c1"># Check if k_endog is actually the endog array</span>
<span class="n">endog</span> <span class="o">=</span> <span class="kc">None</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">k_endog</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">):</span>
<span class="n">endog</span> <span class="o">=</span> <span class="n">k_endog</span>
<span class="c1"># If so, assume that it is either column-ordered and in wide format</span>
<span class="c1"># or row-ordered and in long format</span>
<span class="k">if</span> <span class="p">(</span><span class="n">endog</span><span class="o">.</span><span class="n">flags</span><span class="p">[</span><span class="s1">'C_CONTIGUOUS'</span><span class="p">]</span> <span class="ow">and</span>
<span class="p">(</span><span class="n">endog</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">></span> <span class="mi">1</span> <span class="ow">or</span> <span class="n">nobs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">)):</span>
<span class="n">endog</span> <span class="o">=</span> <span class="n">endog</span><span class="o">.</span><span class="n">T</span>
<span class="n">k_endog</span> <span class="o">=</span> <span class="n">endog</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="c1"># Endogenous array, dimensions, dtype</span>
<span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span> <span class="o">=</span> <span class="n">k_endog</span>
<span class="k">if</span> <span class="n">k_endog</span> <span class="o"><</span> <span class="mi">1</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Number of endogenous variables in statespace'</span>
<span class="s1">' model must be a positive number.'</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">nobs</span> <span class="o">=</span> <span class="n">nobs</span>
<span class="c1"># Get dimensions from transition equation</span>
<span class="k">if</span> <span class="n">k_states</span> <span class="o"><</span> <span class="mi">1</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Number of states in statespace model must be a'</span>
<span class="s1">' positive number.'</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">k_states</span> <span class="o">=</span> <span class="n">k_states</span>
<span class="bp">self</span><span class="o">.</span><span class="n">k_posdef</span> <span class="o">=</span> <span class="n">k_posdef</span> <span class="k">if</span> <span class="n">k_posdef</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">k_states</span>
<span class="c1"># Make sure k_posdef <= k_states</span>
<span class="c1"># TODO: we could technically allow k_posdef > k_states, but the Cython</span>
<span class="c1"># code needs to be more thoroughly checked to avoid seg faults.</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_posdef</span> <span class="o">></span> <span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Dimension of state innovation `k_posdef` cannot'</span>
<span class="s1">' be larger than the dimension of the state.'</span><span class="p">)</span>
<span class="c1"># Bind endog, if it was given</span>
<span class="k">if</span> <span class="n">endog</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">bind</span><span class="p">(</span><span class="n">endog</span><span class="p">)</span>
<span class="c1"># Record the shapes of all of our matrices</span>
<span class="c1"># Note: these are time-invariant shapes; in practice the last dimension</span>
<span class="c1"># may also be `self.nobs` for any or all of these.</span>
<span class="bp">self</span><span class="o">.</span><span class="n">shapes</span> <span class="o">=</span> <span class="p">{</span>
<span class="s1">'obs'</span><span class="p">:</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">nobs</span><span class="p">),</span>
<span class="s1">'design'</span><span class="p">:</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
<span class="s1">'obs_intercept'</span><span class="p">:</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
<span class="s1">'obs_cov'</span><span class="p">:</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
<span class="s1">'transition'</span><span class="p">:</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
<span class="s1">'state_intercept'</span><span class="p">:</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
<span class="s1">'selection'</span><span class="p">:</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_posdef</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
<span class="s1">'state_cov'</span><span class="p">:</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_posdef</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_posdef</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
<span class="p">}</span>
<span class="c1"># Representation matrices</span>
<span class="c1"># These matrices are only used in the Python object as containers,</span>
<span class="c1"># which will be copied to the appropriate _statespace object if a</span>
<span class="c1"># filter is called.</span>
<span class="n">scope</span> <span class="o">=</span> <span class="nb">locals</span><span class="p">()</span>
<span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">shape</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s1">'obs'</span><span class="p">:</span>
<span class="k">continue</span>
<span class="c1"># Create the initial storage array for each matrix</span>
<span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s1">'_'</span> <span class="o">+</span> <span class="n">name</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="n">shape</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">dtype</span><span class="p">,</span> <span class="n">order</span><span class="o">=</span><span class="s2">"F"</span><span class="p">))</span>
<span class="c1"># If we were given an initial value for the matrix, set it</span>
<span class="c1"># (notice it is being set via the descriptor)</span>
<span class="k">if</span> <span class="n">scope</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">scope</span><span class="p">[</span><span class="n">name</span><span class="p">])</span>
<span class="c1"># Options</span>
<span class="bp">self</span><span class="o">.</span><span class="n">initial_variance</span> <span class="o">=</span> <span class="n">initial_variance</span>
<span class="bp">self</span><span class="o">.</span><span class="n">prefix_statespace_map</span> <span class="o">=</span> <span class="p">(</span><span class="n">statespace_classes</span>
<span class="k">if</span> <span class="n">statespace_classes</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span>
<span class="k">else</span> <span class="n">tools</span><span class="o">.</span><span class="n">prefix_statespace_map</span><span class="o">.</span><span class="n">copy</span><span class="p">())</span>
<span class="c1"># State-space initialization data</span>
<span class="bp">self</span><span class="o">.</span><span class="n">initialization</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'initialization'</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="n">basic_inits</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'diffuse'</span><span class="p">,</span> <span class="s1">'approximate_diffuse'</span><span class="p">,</span> <span class="s1">'stationary'</span><span class="p">]</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">initialization</span> <span class="ow">in</span> <span class="n">basic_inits</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">initialize</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">initialization</span><span class="p">)</span>
<span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">initialization</span> <span class="o">==</span> <span class="s1">'known'</span><span class="p">:</span>
<span class="k">if</span> <span class="s1">'constant'</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
<span class="n">constant</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s1">'constant'</span><span class="p">]</span>
<span class="k">elif</span> <span class="s1">'initial_state'</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
<span class="c1"># TODO deprecation warning</span>
<span class="n">constant</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s1">'initial_state'</span><span class="p">]</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Initial state must be provided when "known"'</span>
<span class="s1">' is the specified initialization method.'</span><span class="p">)</span>
<span class="k">if</span> <span class="s1">'stationary_cov'</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
<span class="n">stationary_cov</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s1">'stationary_cov'</span><span class="p">]</span>
<span class="k">elif</span> <span class="s1">'initial_state_cov'</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
<span class="c1"># TODO deprecation warning</span>
<span class="n">stationary_cov</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s1">'initial_state_cov'</span><span class="p">]</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Initial state covariance matrix must be'</span>
<span class="s1">' provided when "known" is the specified'</span>
<span class="s1">' initialization method.'</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">initialize</span><span class="p">(</span><span class="s1">'known'</span><span class="p">,</span> <span class="n">constant</span><span class="o">=</span><span class="n">constant</span><span class="p">,</span>
<span class="n">stationary_cov</span><span class="o">=</span><span class="n">stationary_cov</span><span class="p">)</span>
<span class="k">elif</span> <span class="p">(</span><span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">initialization</span><span class="p">,</span> <span class="n">Initialization</span><span class="p">)</span> <span class="ow">and</span>
<span class="bp">self</span><span class="o">.</span><span class="n">initialization</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Invalid state space initialization method."</span><span class="p">)</span>
<span class="c1"># Matrix representations storage</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_representations</span> <span class="o">=</span> <span class="p">{}</span>
<span class="c1"># Setup the underlying statespace object storage</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_statespaces</span> <span class="o">=</span> <span class="p">{}</span>
<span class="c1"># Caches</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_time_invariant</span> <span class="o">=</span> <span class="kc">None</span>
<span class="k">def</span> <span class="fm">__getitem__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">):</span>
<span class="n">_type</span> <span class="o">=</span> <span class="nb">type</span><span class="p">(</span><span class="n">key</span><span class="p">)</span>
<span class="c1"># If only a string is given then we must be getting an entire matrix</span>
<span class="k">if</span> <span class="n">_type</span> <span class="ow">is</span> <span class="nb">str</span><span class="p">:</span>
<span class="k">if</span> <span class="n">key</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">IndexError</span><span class="p">(</span><span class="s1">'"</span><span class="si">%s</span><span class="s1">" is an invalid state space matrix name'</span>
<span class="o">%</span> <span class="n">key</span><span class="p">)</span>
<span class="n">matrix</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s1">'_'</span> <span class="o">+</span> <span class="n">key</span><span class="p">)</span>
<span class="c1"># See note on time-varying arrays, below</span>
<span class="k">if</span> <span class="n">matrix</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
<span class="k">return</span> <span class="n">matrix</span><span class="p">[(</span><span class="nb">slice</span><span class="p">(</span><span class="kc">None</span><span class="p">),)</span><span class="o">*</span><span class="p">(</span><span class="n">matrix</span><span class="o">.</span><span class="n">ndim</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">+</span> <span class="p">(</span><span class="mi">0</span><span class="p">,)]</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="n">matrix</span>
<span class="c1"># Otherwise if we have a tuple, we want a slice of a matrix</span>
<span class="k">elif</span> <span class="n">_type</span> <span class="ow">is</span> <span class="nb">tuple</span><span class="p">:</span>
<span class="n">name</span><span class="p">,</span> <span class="n">slice_</span> <span class="o">=</span> <span class="n">key</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">key</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
<span class="k">if</span> <span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">IndexError</span><span class="p">(</span><span class="s1">'"</span><span class="si">%s</span><span class="s1">" is an invalid state space matrix name'</span>
<span class="o">%</span> <span class="n">name</span><span class="p">)</span>
<span class="n">matrix</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s1">'_'</span> <span class="o">+</span> <span class="n">name</span><span class="p">)</span>
<span class="c1"># Since the model can support time-varying arrays, but often we</span>
<span class="c1"># will instead have time-invariant arrays, we want to allow setting</span>
<span class="c1"># a matrix slice like mod['transition',0,:] even though technically</span>
<span class="c1"># it should be mod['transition',0,:,0]. Thus if the array in</span>
<span class="c1"># question is time-invariant but the last slice was excluded,</span>
<span class="c1"># add it in as a zero.</span>
<span class="k">if</span> <span class="n">matrix</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">slice_</span><span class="p">)</span> <span class="o"><=</span> <span class="n">matrix</span><span class="o">.</span><span class="n">ndim</span><span class="o">-</span><span class="mi">1</span><span class="p">:</span>
<span class="n">slice_</span> <span class="o">=</span> <span class="n">slice_</span> <span class="o">+</span> <span class="p">(</span><span class="mi">0</span><span class="p">,)</span>
<span class="k">return</span> <span class="n">matrix</span><span class="p">[</span><span class="n">slice_</span><span class="p">]</span>
<span class="c1"># Otherwise, we have only a single slice index, but it is not a string</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">IndexError</span><span class="p">(</span><span class="s1">'First index must the name of a valid state space'</span>
<span class="s1">' matrix.'</span><span class="p">)</span>
<span class="k">def</span> <span class="fm">__setitem__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
<span class="n">_type</span> <span class="o">=</span> <span class="nb">type</span><span class="p">(</span><span class="n">key</span><span class="p">)</span>
<span class="c1"># If only a string is given then we must be setting an entire matrix</span>
<span class="k">if</span> <span class="n">_type</span> <span class="ow">is</span> <span class="nb">str</span><span class="p">:</span>
<span class="k">if</span> <span class="n">key</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">IndexError</span><span class="p">(</span><span class="s1">'"</span><span class="si">%s</span><span class="s1">" is an invalid state space matrix name'</span>
<span class="o">%</span> <span class="n">key</span><span class="p">)</span>
<span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
<span class="c1"># If it's a tuple (with a string as the first element) then we must be</span>
<span class="c1"># setting a slice of a matrix</span>
<span class="k">elif</span> <span class="n">_type</span> <span class="ow">is</span> <span class="nb">tuple</span><span class="p">:</span>
<span class="n">name</span><span class="p">,</span> <span class="n">slice_</span> <span class="o">=</span> <span class="n">key</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">key</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
<span class="k">if</span> <span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">IndexError</span><span class="p">(</span><span class="s1">'"</span><span class="si">%s</span><span class="s1">" is an invalid state space matrix name'</span>
<span class="o">%</span> <span class="n">key</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="c1"># Change the dtype of the corresponding matrix</span>
<span class="n">dtype</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">value</span><span class="p">)</span><span class="o">.</span><span class="n">dtype</span>
<span class="n">matrix</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s1">'_'</span> <span class="o">+</span> <span class="n">name</span><span class="p">)</span>
<span class="n">valid_types</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'f'</span><span class="p">,</span> <span class="s1">'d'</span><span class="p">,</span> <span class="s1">'F'</span><span class="p">,</span> <span class="s1">'D'</span><span class="p">]</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">matrix</span><span class="o">.</span><span class="n">dtype</span> <span class="o">==</span> <span class="n">dtype</span> <span class="ow">and</span> <span class="n">dtype</span><span class="o">.</span><span class="n">char</span> <span class="ow">in</span> <span class="n">valid_types</span><span class="p">:</span>
<span class="n">matrix</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s1">'_'</span> <span class="o">+</span> <span class="n">name</span><span class="p">)</span><span class="o">.</span><span class="n">real</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span>
<span class="c1"># Since the model can support time-varying arrays, but often we</span>
<span class="c1"># will instead have time-invariant arrays, we want to allow setting</span>
<span class="c1"># a matrix slice like mod['transition',0,:] even though technically</span>
<span class="c1"># it should be mod['transition',0,:,0]. Thus if the array in</span>
<span class="c1"># question is time-invariant but the last slice was excluded,</span>
<span class="c1"># add it in as a zero.</span>
<span class="k">if</span> <span class="n">matrix</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">slice_</span><span class="p">)</span> <span class="o">==</span> <span class="n">matrix</span><span class="o">.</span><span class="n">ndim</span><span class="o">-</span><span class="mi">1</span><span class="p">:</span>
<span class="n">slice_</span> <span class="o">=</span> <span class="n">slice_</span> <span class="o">+</span> <span class="p">(</span><span class="mi">0</span><span class="p">,)</span>
<span class="c1"># Set the new value</span>
<span class="n">matrix</span><span class="p">[</span><span class="n">slice_</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span>
<span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">matrix</span><span class="p">)</span>
<span class="c1"># Otherwise we got a single non-string key, (e.g. mod[:]), which is</span>
<span class="c1"># invalid</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">IndexError</span><span class="p">(</span><span class="s1">'First index must the name of a valid state space'</span>
<span class="s1">' matrix.'</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">_clone_kwargs</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">endog</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Construct keyword arguments for cloning a state space model</span>
<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>
<span class="sd"> endog : array_like</span>
<span class="sd"> An observed time-series process :math:`y`.</span>
<span class="sd"> **kwargs</span>
<span class="sd"> Keyword arguments to pass to the new state space representation</span>
<span class="sd"> model constructor. Those that are not specified are copied from</span>
<span class="sd"> the specification of the current state space model.</span>
<span class="sd"> """</span>
<span class="c1"># We always need the base dimensions, but they cannot change from</span>
<span class="c1"># the base model when cloning (the idea is: if these need to change,</span>
<span class="c1"># need to make a new instance manually, since it's not really cloning).</span>
<span class="n">kwargs</span><span class="p">[</span><span class="s1">'nobs'</span><span class="p">]</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">endog</span><span class="p">)</span>
<span class="n">kwargs</span><span class="p">[</span><span class="s1">'k_endog'</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span>
<span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">'k_states'</span><span class="p">,</span> <span class="s1">'k_posdef'</span><span class="p">]:</span>
<span class="n">val</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">)</span>
<span class="k">if</span> <span class="n">key</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">kwargs</span> <span class="ow">or</span> <span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">val</span>
<span class="k">if</span> <span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">!=</span> <span class="n">val</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Cannot change the dimension of </span><span class="si">%s</span><span class="s1"> when'</span>
<span class="s1">' cloning.'</span> <span class="o">%</span> <span class="n">key</span><span class="p">)</span>
<span class="c1"># Get defaults for time-invariant system matrices, if not otherwise</span>
<span class="c1"># provided</span>
<span class="c1"># Time-varying matrices must be replaced.</span>
<span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
<span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s1">'obs'</span><span class="p">:</span>
<span class="k">continue</span>
<span class="k">if</span> <span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
<span class="n">mat</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
<span class="k">if</span> <span class="n">mat</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">!=</span> <span class="mi">1</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'The `</span><span class="si">%s</span><span class="s1">` matrix is time-varying. Cloning'</span>
<span class="s1">' this model requires specifying an'</span>
<span class="s1">' updated matrix.'</span> <span class="o">%</span> <span class="n">name</span><span class="p">)</span>
<span class="n">kwargs</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">mat</span>
<span class="c1"># Default is to use the same initialization</span>
<span class="n">kwargs</span><span class="o">.</span><span class="n">setdefault</span><span class="p">(</span><span class="s1">'initialization'</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">initialization</span><span class="p">)</span>
<span class="k">return</span> <span class="n">kwargs</span>
<div class="viewcode-block" id="Representation.clone"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.Representation.clone.html#statsmodels.tsa.statespace.kalman_filter.Representation.clone">[docs]</a> <span class="k">def</span> <span class="nf">clone</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">endog</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Clone a state space representation while overriding some elements</span>
<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>
<span class="sd"> endog : array_like</span>
<span class="sd"> An observed time-series process :math:`y`.</span>
<span class="sd"> **kwargs</span>
<span class="sd"> Keyword arguments to pass to the new state space representation</span>
<span class="sd"> model constructor. Those that are not specified are copied from</span>
<span class="sd"> the specification of the current state space model.</span>
<span class="sd"> Returns</span>
<span class="sd"> -------</span>
<span class="sd"> Representation</span>
<span class="sd"> Notes</span>
<span class="sd"> -----</span>
<span class="sd"> If some system matrices are time-varying, then new time-varying</span>
<span class="sd"> matrices *must* be provided.</span>
<span class="sd"> """</span>
<span class="n">kwargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_clone_kwargs</span><span class="p">(</span><span class="n">endog</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="n">mod</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="n">mod</span><span class="o">.</span><span class="n">bind</span><span class="p">(</span><span class="n">endog</span><span class="p">)</span>
<span class="k">return</span> <span class="n">mod</span></div>
<div class="viewcode-block" id="Representation.extend"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.Representation.extend.html#statsmodels.tsa.statespace.kalman_filter.Representation.extend">[docs]</a> <span class="k">def</span> <span class="nf">extend</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">endog</span><span class="p">,</span> <span class="n">start</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">end</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Extend the current state space model, or a specific (time) subset</span>
<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>
<span class="sd"> endog : array_like</span>
<span class="sd"> An observed time-series process :math:`y`.</span>
<span class="sd"> start : int, optional</span>
<span class="sd"> The first period of a time-varying state space model to include in</span>
<span class="sd"> the new model. Has no effect if the state space model is</span>
<span class="sd"> time-invariant. Default is the initial period.</span>
<span class="sd"> end : int, optional</span>
<span class="sd"> The last period of a time-varying state space model to include in</span>
<span class="sd"> the new model. Has no effect if the state space model is</span>
<span class="sd"> time-invariant. Default is the final period.</span>
<span class="sd"> **kwargs</span>
<span class="sd"> Keyword arguments to pass to the new state space representation</span>
<span class="sd"> model constructor. Those that are not specified are copied from</span>
<span class="sd"> the specification of the current state space model.</span>
<span class="sd"> Returns</span>
<span class="sd"> -------</span>
<span class="sd"> Representation</span>
<span class="sd"> Notes</span>
<span class="sd"> -----</span>
<span class="sd"> This method does not allow replacing a time-varying system matrix with</span>
<span class="sd"> a time-invariant one (or vice-versa). If that is required, use `clone`.</span>
<span class="sd"> """</span>
<span class="n">endog</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">atleast_1d</span><span class="p">(</span><span class="n">endog</span><span class="p">)</span>
<span class="k">if</span> <span class="n">endog</span><span class="o">.</span><span class="n">ndim</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
<span class="n">endog</span> <span class="o">=</span> <span class="n">endog</span><span class="p">[:,</span> <span class="n">np</span><span class="o">.</span><span class="n">newaxis</span><span class="p">]</span>
<span class="n">nobs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">endog</span><span class="p">)</span>
<span class="k">if</span> <span class="n">start</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">start</span> <span class="o">=</span> <span class="mi">0</span>
<span class="k">if</span> <span class="n">end</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">nobs</span>
<span class="k">if</span> <span class="n">start</span> <span class="o"><</span> <span class="mi">0</span><span class="p">:</span>
<span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">nobs</span> <span class="o">+</span> <span class="n">start</span>
<span class="k">if</span> <span class="n">end</span> <span class="o"><</span> <span class="mi">0</span><span class="p">:</span>
<span class="n">end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">nobs</span> <span class="o">+</span> <span class="n">end</span>
<span class="k">if</span> <span class="n">start</span> <span class="o">></span> <span class="bp">self</span><span class="o">.</span><span class="n">nobs</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'The `start` argument of the extension within the'</span>
<span class="s1">' base model cannot be after the end of the'</span>
<span class="s1">' base model.'</span><span class="p">)</span>
<span class="k">if</span> <span class="n">end</span> <span class="o">></span> <span class="bp">self</span><span class="o">.</span><span class="n">nobs</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'The `end` argument of the extension within the'</span>
<span class="s1">' base model cannot be after the end of the'</span>
<span class="s1">' base model.'</span><span class="p">)</span>
<span class="k">if</span> <span class="n">start</span> <span class="o">></span> <span class="n">end</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'The `start` argument of the extension within the'</span>
<span class="s1">' base model cannot be after the `end` argument.'</span><span class="p">)</span>
<span class="c1"># Note: if start == end or if end < self.nobs, then we're just cloning</span>
<span class="c1"># (no extension)</span>
<span class="n">endog</span> <span class="o">=</span> <span class="n">tools</span><span class="o">.</span><span class="n">concat</span><span class="p">([</span><span class="bp">self</span><span class="o">.</span><span class="n">endog</span><span class="p">[:,</span> <span class="n">start</span><span class="p">:</span><span class="n">end</span><span class="p">]</span><span class="o">.</span><span class="n">T</span><span class="p">,</span> <span class="n">endog</span><span class="p">])</span>
<span class="c1"># Extend any time-varying arrays</span>
<span class="n">error_ti</span> <span class="o">=</span> <span class="p">(</span><span class="s1">'Model has time-invariant </span><span class="si">%s</span><span class="s1"> matrix, so cannot provide'</span>
<span class="s1">' an extended matrix.'</span><span class="p">)</span>
<span class="n">error_tv</span> <span class="o">=</span> <span class="p">(</span><span class="s1">'Model has time-varying </span><span class="si">%s</span><span class="s1"> matrix, so an updated'</span>
<span class="s1">' time-varying matrix for the extension period'</span>
<span class="s1">' is required.'</span><span class="p">)</span>
<span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">shape</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s1">'obs'</span><span class="p">:</span>
<span class="k">continue</span>
<span class="n">mat</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
<span class="c1"># If we were *not* given an extended value for this matrix...</span>
<span class="k">if</span> <span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
<span class="c1"># If this is a time-varying matrix in the existing model</span>
<span class="k">if</span> <span class="n">mat</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span>
<span class="c1"># If we have an extension period, then raise an error</span>
<span class="c1"># because we should have been given an extended value</span>
<span class="k">if</span> <span class="n">end</span> <span class="o">+</span> <span class="n">nobs</span> <span class="o">></span> <span class="bp">self</span><span class="o">.</span><span class="n">nobs</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="n">error_tv</span> <span class="o">%</span> <span class="n">name</span><span class="p">)</span>
<span class="c1"># If we do not have an extension period, then set the new</span>
<span class="c1"># time-varying matrix to be the portion of the existing</span>
<span class="c1"># time-varying matrix that corresponds to the period of</span>
<span class="c1"># interest</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">kwargs</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">mat</span><span class="p">[</span><span class="o">...</span><span class="p">,</span> <span class="n">start</span><span class="p">:</span><span class="n">end</span> <span class="o">+</span> <span class="n">nobs</span><span class="p">]</span>
<span class="k">elif</span> <span class="n">nobs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Extension is being performed within-sample'</span>
<span class="s1">' so cannot provide an extended matrix'</span><span class="p">)</span>
<span class="c1"># If we were given an extended value for this matrix</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># TODO: Need to add a check for ndim, and if the matrix has</span>
<span class="c1"># one fewer dimensions than the existing matrix, add a new axis</span>
<span class="c1"># If this is a time-invariant matrix in the existing model,</span>
<span class="c1"># raise an error</span>
<span class="k">if</span> <span class="n">mat</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">nobs</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="n">error_ti</span> <span class="o">%</span> <span class="n">name</span><span class="p">)</span>
<span class="c1"># Otherwise, validate the shape of the given extended value</span>
<span class="c1"># Note: we do not validate the number of observations here</span>
<span class="c1"># (so we pass in updated_mat.shape[-1] as the nobs argument</span>
<span class="c1"># in the validate_* calls); instead, we check below that we</span>
<span class="c1"># at least `nobs` values were passed in and then only take the</span>
<span class="c1"># first of them as required. This can be useful when e.g. the</span>
<span class="c1"># end user knows the extension values up to some maximum</span>
<span class="c1"># endpoint, but does not know what the calling methods may</span>
<span class="c1"># specifically require.</span>
<span class="n">updated_mat</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">asarray</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="n">name</span><span class="p">])</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">shape</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
<span class="n">validate_vector_shape</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">updated_mat</span><span class="o">.</span><span class="n">shape</span><span class="p">,</span> <span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
<span class="n">updated_mat</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">validate_matrix_shape</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">updated_mat</span><span class="o">.</span><span class="n">shape</span><span class="p">,</span> <span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
<span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">updated_mat</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span>
<span class="k">if</span> <span class="n">updated_mat</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o"><</span> <span class="n">nobs</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="n">error_tv</span> <span class="o">%</span> <span class="n">name</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">updated_mat</span> <span class="o">=</span> <span class="n">updated_mat</span><span class="p">[</span><span class="o">...</span><span class="p">,</span> <span class="p">:</span><span class="n">nobs</span><span class="p">]</span>
<span class="c1"># Concatenate to get the new time-varying matrix</span>
<span class="n">kwargs</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">c_</span><span class="p">[</span><span class="n">mat</span><span class="p">[</span><span class="o">...</span><span class="p">,</span> <span class="n">start</span><span class="p">:</span><span class="n">end</span><span class="p">],</span> <span class="n">updated_mat</span><span class="p">]</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">clone</span><span class="p">(</span><span class="n">endog</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></div>
<div class="viewcode-block" id="Representation.diff_endog"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.Representation.diff_endog.html#statsmodels.tsa.statespace.kalman_filter.Representation.diff_endog">[docs]</a> <span class="k">def</span> <span class="nf">diff_endog</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">new_endog</span><span class="p">,</span> <span class="n">tolerance</span><span class="o">=</span><span class="mf">1e-10</span><span class="p">):</span>
<span class="c1"># TODO: move this function to tools?</span>
<span class="n">endog</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">endog</span><span class="o">.</span><span class="n">T</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">new_endog</span><span class="p">)</span> <span class="o"><</span> <span class="nb">len</span><span class="p">(</span><span class="n">endog</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Given data (length </span><span class="si">%d</span><span class="s1">) is too short to diff'</span>
<span class="s1">' against model data (length </span><span class="si">%d</span><span class="s1">).'</span>
<span class="o">%</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">new_endog</span><span class="p">),</span> <span class="nb">len</span><span class="p">(</span><span class="n">endog</span><span class="p">)))</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">new_endog</span><span class="p">)</span> <span class="o">></span> <span class="nb">len</span><span class="p">(</span><span class="n">endog</span><span class="p">):</span>
<span class="n">nobs_append</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">new_endog</span><span class="p">)</span> <span class="o">-</span> <span class="nb">len</span><span class="p">(</span><span class="n">endog</span><span class="p">)</span>
<span class="n">endog</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">c_</span><span class="p">[</span><span class="n">endog</span><span class="o">.</span><span class="n">T</span><span class="p">,</span> <span class="n">new_endog</span><span class="p">[</span><span class="o">-</span><span class="n">nobs_append</span><span class="p">:]</span><span class="o">.</span><span class="n">T</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">nan</span><span class="p">]</span><span class="o">.</span><span class="n">T</span>
<span class="n">new_nan</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">isnan</span><span class="p">(</span><span class="n">new_endog</span><span class="p">)</span>
<span class="n">existing_nan</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">isnan</span><span class="p">(</span><span class="n">endog</span><span class="p">)</span>
<span class="n">diff</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">abs</span><span class="p">(</span><span class="n">new_endog</span> <span class="o">-</span> <span class="n">endog</span><span class="p">)</span>
<span class="n">diff</span><span class="p">[</span><span class="n">new_nan</span> <span class="o">^</span> <span class="n">existing_nan</span><span class="p">]</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">inf</span>
<span class="n">diff</span><span class="p">[</span><span class="n">new_nan</span> <span class="o">&</span> <span class="n">existing_nan</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.</span>
<span class="n">is_revision</span> <span class="o">=</span> <span class="p">(</span><span class="n">diff</span> <span class="o">></span> <span class="n">tolerance</span><span class="p">)</span>
<span class="n">is_new</span> <span class="o">=</span> <span class="n">existing_nan</span> <span class="o">&</span> <span class="o">~</span><span class="n">new_nan</span>
<span class="n">is_revision</span><span class="p">[</span><span class="n">is_new</span><span class="p">]</span> <span class="o">=</span> <span class="kc">False</span>
<span class="n">revision_ix</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">zip</span><span class="p">(</span><span class="o">*</span><span class="n">np</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">is_revision</span><span class="p">)))</span>
<span class="n">new_ix</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">zip</span><span class="p">(</span><span class="o">*</span><span class="n">np</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">is_new</span><span class="p">)))</span>
<span class="k">return</span> <span class="n">revision_ix</span><span class="p">,</span> <span class="n">new_ix</span></div>
<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">prefix</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> (str) BLAS prefix of currently active representation matrices</span>
<span class="sd"> """</span>
<span class="n">arrays</span> <span class="o">=</span> <span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_design</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obs_intercept</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obs_cov</span><span class="p">,</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_transition</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_state_intercept</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_selection</span><span class="p">,</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_state_cov</span>
<span class="p">)</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">endog</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">arrays</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">endog</span><span class="p">,)</span> <span class="o">+</span> <span class="n">arrays</span>
<span class="k">return</span> <span class="n">find_best_blas_type</span><span class="p">(</span><span class="n">arrays</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">dtype</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> (dtype) Datatype of currently active representation matrices</span>
<span class="sd"> """</span>
<span class="k">return</span> <span class="n">tools</span><span class="o">.</span><span class="n">prefix_dtype_map</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">prefix</span><span class="p">]</span>
<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">time_invariant</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> (bool) Whether or not currently active representation matrices are</span>
<span class="sd"> time-invariant</span>
<span class="sd"> """</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_time_invariant</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">return</span> <span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_design</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obs_intercept</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_obs_cov</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">_transition</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_state_intercept</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">_selection</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_state_cov</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span>
<span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_time_invariant</span>
<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">_statespace</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">prefix</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">prefix</span>
<span class="k">if</span> <span class="n">prefix</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">:</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">[</span><span class="n">prefix</span><span class="p">]</span>
<span class="k">return</span> <span class="kc">None</span>
<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">obs</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sa">r</span><span class="sd">"""</span>
<span class="sd"> (array) Observation vector: :math:`y~(k\_endog \times nobs)`</span>
<span class="sd"> """</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">endog</span>
<div class="viewcode-block" id="Representation.bind"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.Representation.bind.html#statsmodels.tsa.statespace.kalman_filter.Representation.bind">[docs]</a> <span class="k">def</span> <span class="nf">bind</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">endog</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Bind data to the statespace representation</span>
<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>
<span class="sd"> endog : ndarray</span>
<span class="sd"> Endogenous data to bind to the model. Must be column-ordered</span>
<span class="sd"> ndarray with shape (`k_endog`, `nobs`) or row-ordered ndarray with</span>
<span class="sd"> shape (`nobs`, `k_endog`).</span>
<span class="sd"> Notes</span>
<span class="sd"> -----</span>
<span class="sd"> The strict requirements arise because the underlying statespace and</span>
<span class="sd"> Kalman filtering classes require Fortran-ordered arrays in the wide</span>
<span class="sd"> format (shaped (`k_endog`, `nobs`)), and this structure is setup to</span>
<span class="sd"> prevent copying arrays in memory.</span>
<span class="sd"> By default, numpy arrays are row (C)-ordered and most time series are</span>
<span class="sd"> represented in the long format (with time on the 0-th axis). In this</span>
<span class="sd"> case, no copying or re-ordering needs to be performed, instead the</span>
<span class="sd"> array can simply be transposed to get it in the right order and shape.</span>
<span class="sd"> Although this class (Representation) has stringent `bind` requirements,</span>
<span class="sd"> it is assumed that it will rarely be used directly.</span>
<span class="sd"> """</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">endog</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Invalid endogenous array; must be an ndarray."</span><span class="p">)</span>
<span class="c1"># Make sure we have a 2-dimensional array</span>
<span class="c1"># Note: reshaping a 1-dim array into a 2-dim array by changing the</span>
<span class="c1"># shape tuple always results in a row (C)-ordered array, so it</span>
<span class="c1"># must be shaped (nobs, k_endog)</span>
<span class="k">if</span> <span class="n">endog</span><span class="o">.</span><span class="n">ndim</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
<span class="c1"># In the case of nobs x 0 arrays</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
<span class="n">endog</span><span class="o">.</span><span class="n">shape</span> <span class="o">=</span> <span class="p">(</span><span class="n">endog</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="mi">1</span><span class="p">)</span>
<span class="c1"># In the case of k_endog x 0 arrays</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">endog</span><span class="o">.</span><span class="n">shape</span> <span class="o">=</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">endog</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">endog</span><span class="o">.</span><span class="n">ndim</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Invalid endogenous array provided; must be'</span>
<span class="s1">' 2-dimensional.'</span><span class="p">)</span>
<span class="c1"># Check for valid column-ordered arrays</span>
<span class="k">if</span> <span class="n">endog</span><span class="o">.</span><span class="n">flags</span><span class="p">[</span><span class="s1">'F_CONTIGUOUS'</span><span class="p">]</span> <span class="ow">and</span> <span class="n">endog</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span><span class="p">:</span>
<span class="k">pass</span>
<span class="c1"># Check for valid row-ordered arrays, and transpose them to be the</span>
<span class="c1"># correct column-ordered array</span>
<span class="k">elif</span> <span class="n">endog</span><span class="o">.</span><span class="n">flags</span><span class="p">[</span><span class="s1">'C_CONTIGUOUS'</span><span class="p">]</span> <span class="ow">and</span> <span class="n">endog</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span><span class="p">:</span>
<span class="n">endog</span> <span class="o">=</span> <span class="n">endog</span><span class="o">.</span><span class="n">T</span>
<span class="c1"># Invalid column-ordered arrays</span>
<span class="k">elif</span> <span class="n">endog</span><span class="o">.</span><span class="n">flags</span><span class="p">[</span><span class="s1">'F_CONTIGUOUS'</span><span class="p">]:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Invalid endogenous array; column-ordered'</span>
<span class="s1">' arrays must have first axis shape of'</span>
<span class="s1">' `k_endog`.'</span><span class="p">)</span>
<span class="c1"># Invalid row-ordered arrays</span>
<span class="k">elif</span> <span class="n">endog</span><span class="o">.</span><span class="n">flags</span><span class="p">[</span><span class="s1">'C_CONTIGUOUS'</span><span class="p">]:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Invalid endogenous array; row-ordered'</span>
<span class="s1">' arrays must have last axis shape of'</span>
<span class="s1">' `k_endog`.'</span><span class="p">)</span>
<span class="c1"># Non-contiguous arrays</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Invalid endogenous array; must be ordered in'</span>
<span class="s1">' contiguous memory.'</span><span class="p">)</span>
<span class="c1"># We may still have a non-fortran contiguous array, so double-check</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">endog</span><span class="o">.</span><span class="n">flags</span><span class="p">[</span><span class="s1">'F_CONTIGUOUS'</span><span class="p">]:</span>
<span class="n">endog</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">asfortranarray</span><span class="p">(</span><span class="n">endog</span><span class="p">)</span>
<span class="c1"># Set a flag for complex data</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_complex_endog</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">iscomplexobj</span><span class="p">(</span><span class="n">endog</span><span class="p">)</span>
<span class="c1"># Set the data</span>
<span class="bp">self</span><span class="o">.</span><span class="n">endog</span> <span class="o">=</span> <span class="n">endog</span>
<span class="bp">self</span><span class="o">.</span><span class="n">nobs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">endog</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
<span class="c1"># Reset shapes</span>
<span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s1">'shapes'</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="p">[</span><span class="s1">'obs'</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">endog</span><span class="o">.</span><span class="n">shape</span></div>
<div class="viewcode-block" id="Representation.initialize"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.Representation.initialize.html#statsmodels.tsa.statespace.kalman_filter.Representation.initialize">[docs]</a> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">initialization</span><span class="p">,</span> <span class="n">approximate_diffuse_variance</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">constant</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">stationary_cov</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="sd">"""Create an Initialization object if necessary"""</span>
<span class="k">if</span> <span class="n">initialization</span> <span class="o">==</span> <span class="s1">'known'</span><span class="p">:</span>
<span class="n">initialization</span> <span class="o">=</span> <span class="n">Initialization</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="s1">'known'</span><span class="p">,</span>
<span class="n">constant</span><span class="o">=</span><span class="n">constant</span><span class="p">,</span>
<span class="n">stationary_cov</span><span class="o">=</span><span class="n">stationary_cov</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">initialization</span> <span class="o">==</span> <span class="s1">'approximate_diffuse'</span><span class="p">:</span>
<span class="k">if</span> <span class="n">approximate_diffuse_variance</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">approximate_diffuse_variance</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">initial_variance</span>
<span class="n">initialization</span> <span class="o">=</span> <span class="n">Initialization</span><span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="s1">'approximate_diffuse'</span><span class="p">,</span>
<span class="n">approximate_diffuse_variance</span><span class="o">=</span><span class="n">approximate_diffuse_variance</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">initialization</span> <span class="o">==</span> <span class="s1">'stationary'</span><span class="p">:</span>
<span class="n">initialization</span> <span class="o">=</span> <span class="n">Initialization</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="s1">'stationary'</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">initialization</span> <span class="o">==</span> <span class="s1">'diffuse'</span><span class="p">:</span>
<span class="n">initialization</span> <span class="o">=</span> <span class="n">Initialization</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="s1">'diffuse'</span><span class="p">)</span>
<span class="c1"># We must have an initialization object at this point</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">initialization</span><span class="p">,</span> <span class="n">Initialization</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Invalid state space initialization method."</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">initialization</span> <span class="o">=</span> <span class="n">initialization</span></div>
<div class="viewcode-block" id="Representation.initialize_known"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.Representation.initialize_known.html#statsmodels.tsa.statespace.kalman_filter.Representation.initialize_known">[docs]</a> <span class="k">def</span> <span class="nf">initialize_known</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">constant</span><span class="p">,</span> <span class="n">stationary_cov</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Initialize the statespace model with known distribution for initial</span>
<span class="sd"> state.</span>
<span class="sd"> These values are assumed to be known with certainty or else</span>
<span class="sd"> filled with parameters during, for example, maximum likelihood</span>
<span class="sd"> estimation.</span>
<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>
<span class="sd"> constant : array_like</span>
<span class="sd"> Known mean of the initial state vector.</span>
<span class="sd"> stationary_cov : array_like</span>
<span class="sd"> Known covariance matrix of the initial state vector.</span>
<span class="sd"> """</span>
<span class="n">constant</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">asarray</span><span class="p">(</span><span class="n">constant</span><span class="p">,</span> <span class="n">order</span><span class="o">=</span><span class="s2">"F"</span><span class="p">)</span>
<span class="n">stationary_cov</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">asarray</span><span class="p">(</span><span class="n">stationary_cov</span><span class="p">,</span> <span class="n">order</span><span class="o">=</span><span class="s2">"F"</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">constant</span><span class="o">.</span><span class="n">shape</span> <span class="o">==</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,):</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Invalid dimensions for constant state vector.'</span>
<span class="s1">' Requires shape (</span><span class="si">%d</span><span class="s1">,), got </span><span class="si">%s</span><span class="s1">'</span> <span class="o">%</span>
<span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">constant</span><span class="o">.</span><span class="n">shape</span><span class="p">)))</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">stationary_cov</span><span class="o">.</span><span class="n">shape</span> <span class="o">==</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Invalid dimensions for stationary covariance'</span>
<span class="s1">' matrix. Requires shape (</span><span class="si">%d</span><span class="s1">,</span><span class="si">%d</span><span class="s1">), got </span><span class="si">%s</span><span class="s1">'</span> <span class="o">%</span>
<span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span>
<span class="nb">str</span><span class="p">(</span><span class="n">stationary_cov</span><span class="o">.</span><span class="n">shape</span><span class="p">)))</span>
<span class="bp">self</span><span class="o">.</span><span class="n">initialize</span><span class="p">(</span><span class="s1">'known'</span><span class="p">,</span> <span class="n">constant</span><span class="o">=</span><span class="n">constant</span><span class="p">,</span>
<span class="n">stationary_cov</span><span class="o">=</span><span class="n">stationary_cov</span><span class="p">)</span></div>
<div class="viewcode-block" id="Representation.initialize_approximate_diffuse"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.Representation.initialize_approximate_diffuse.html#statsmodels.tsa.statespace.kalman_filter.Representation.initialize_approximate_diffuse">[docs]</a> <span class="k">def</span> <span class="nf">initialize_approximate_diffuse</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">variance</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Initialize the statespace model with approximate diffuse values.</span>
<span class="sd"> Rather than following the exact diffuse treatment (which is developed</span>
<span class="sd"> for the case that the variance becomes infinitely large), this assigns</span>
<span class="sd"> an arbitrary large number for the variance.</span>
<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>
<span class="sd"> variance : float, optional</span>
<span class="sd"> The variance for approximating diffuse initial conditions. Default</span>
<span class="sd"> is 1e6.</span>
<span class="sd"> """</span>
<span class="k">if</span> <span class="n">variance</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">variance</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">initial_variance</span>
<span class="bp">self</span><span class="o">.</span><span class="n">initialize</span><span class="p">(</span><span class="s1">'approximate_diffuse'</span><span class="p">,</span>
<span class="n">approximate_diffuse_variance</span><span class="o">=</span><span class="n">variance</span><span class="p">)</span></div>
<div class="viewcode-block" id="Representation.initialize_stationary"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.Representation.initialize_stationary.html#statsmodels.tsa.statespace.kalman_filter.Representation.initialize_stationary">[docs]</a> <span class="k">def</span> <span class="nf">initialize_stationary</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Initialize the statespace model as stationary.</span>
<span class="sd"> """</span>
<span class="bp">self</span><span class="o">.</span><span class="n">initialize</span><span class="p">(</span><span class="s1">'stationary'</span><span class="p">)</span></div>
<div class="viewcode-block" id="Representation.initialize_diffuse"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.Representation.initialize_diffuse.html#statsmodels.tsa.statespace.kalman_filter.Representation.initialize_diffuse">[docs]</a> <span class="k">def</span> <span class="nf">initialize_diffuse</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Initialize the statespace model as stationary.</span>
<span class="sd"> """</span>
<span class="bp">self</span><span class="o">.</span><span class="n">initialize</span><span class="p">(</span><span class="s1">'diffuse'</span><span class="p">)</span></div>
<span class="k">def</span> <span class="nf">_initialize_representation</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="k">if</span> <span class="n">prefix</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">prefix</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">prefix</span>
<span class="n">dtype</span> <span class="o">=</span> <span class="n">tools</span><span class="o">.</span><span class="n">prefix_dtype_map</span><span class="p">[</span><span class="n">prefix</span><span class="p">]</span>
<span class="c1"># If the dtype-specific representation matrices do not exist, create</span>
<span class="c1"># them</span>
<span class="k">if</span> <span class="n">prefix</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">:</span>
<span class="c1"># Copy the statespace representation matrices</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">for</span> <span class="n">matrix</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
<span class="k">if</span> <span class="n">matrix</span> <span class="o">==</span> <span class="s1">'obs'</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="n">matrix</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">obs</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span>
<span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># Note: this always makes a copy</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="n">matrix</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span>
<span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s1">'_'</span> <span class="o">+</span> <span class="n">matrix</span><span class="p">)</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span>
<span class="p">)</span>
<span class="c1"># If they do exist, update them</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">for</span> <span class="n">matrix</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
<span class="n">existing</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="n">matrix</span><span class="p">]</span>
<span class="k">if</span> <span class="n">matrix</span> <span class="o">==</span> <span class="s1">'obs'</span><span class="p">:</span>
<span class="c1"># existing[:] = self.obs.astype(dtype)</span>
<span class="k">pass</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">new</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s1">'_'</span> <span class="o">+</span> <span class="n">matrix</span><span class="p">)</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span>
<span class="k">if</span> <span class="n">existing</span><span class="o">.</span><span class="n">shape</span> <span class="o">==</span> <span class="n">new</span><span class="o">.</span><span class="n">shape</span><span class="p">:</span>
<span class="n">existing</span><span class="p">[:]</span> <span class="o">=</span> <span class="n">new</span><span class="p">[:]</span>
<span class="k">else</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="n">matrix</span><span class="p">]</span> <span class="o">=</span> <span class="n">new</span>
<span class="c1"># Determine if we need to (re-)create the _statespace models</span>
<span class="c1"># (if time-varying matrices changed)</span>
<span class="k">if</span> <span class="n">prefix</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">:</span>
<span class="n">ss</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">[</span><span class="n">prefix</span><span class="p">]</span>
<span class="n">create</span> <span class="o">=</span> <span class="p">(</span>
<span class="ow">not</span> <span class="n">ss</span><span class="o">.</span><span class="n">obs</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">endog</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="ow">or</span>
<span class="ow">not</span> <span class="n">ss</span><span class="o">.</span><span class="n">design</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">design</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="ow">or</span>
<span class="ow">not</span> <span class="n">ss</span><span class="o">.</span><span class="n">obs_intercept</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">obs_intercept</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="ow">or</span>
<span class="ow">not</span> <span class="n">ss</span><span class="o">.</span><span class="n">obs_cov</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">obs_cov</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="ow">or</span>
<span class="ow">not</span> <span class="n">ss</span><span class="o">.</span><span class="n">transition</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">transition</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="ow">or</span>
<span class="ow">not</span> <span class="p">(</span><span class="n">ss</span><span class="o">.</span><span class="n">state_intercept</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span>
<span class="bp">self</span><span class="o">.</span><span class="n">state_intercept</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span> <span class="ow">or</span>
<span class="ow">not</span> <span class="n">ss</span><span class="o">.</span><span class="n">selection</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">selection</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="ow">or</span>
<span class="ow">not</span> <span class="n">ss</span><span class="o">.</span><span class="n">state_cov</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">state_cov</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span>
<span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">create</span> <span class="o">=</span> <span class="kc">True</span>
<span class="c1"># (re-)create if necessary</span>
<span class="k">if</span> <span class="n">create</span><span class="p">:</span>
<span class="k">if</span> <span class="n">prefix</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">:</span>
<span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">[</span><span class="n">prefix</span><span class="p">]</span>
<span class="c1"># Setup the base statespace object</span>
<span class="bp">cls</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">prefix_statespace_map</span><span class="p">[</span><span class="n">prefix</span><span class="p">]</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">[</span><span class="n">prefix</span><span class="p">]</span> <span class="o">=</span> <span class="bp">cls</span><span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="s1">'obs'</span><span class="p">],</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="s1">'design'</span><span class="p">],</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="s1">'obs_intercept'</span><span class="p">],</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="s1">'obs_cov'</span><span class="p">],</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="s1">'transition'</span><span class="p">],</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="s1">'state_intercept'</span><span class="p">],</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="s1">'selection'</span><span class="p">],</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="s1">'state_cov'</span><span class="p">]</span>
<span class="p">)</span>
<span class="k">return</span> <span class="n">prefix</span><span class="p">,</span> <span class="n">dtype</span><span class="p">,</span> <span class="n">create</span>
<span class="k">def</span> <span class="nf">_initialize_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">complex_step</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
<span class="c1"># TODO once the transition to using the Initialization objects is</span>
<span class="c1"># complete, this should be moved entirely to the _{{prefix}}Statespace</span>
<span class="c1"># object.</span>
<span class="k">if</span> <span class="n">prefix</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">prefix</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">prefix</span>
<span class="c1"># (Re-)initialize the statespace model</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">initialization</span><span class="p">,</span> <span class="n">Initialization</span><span class="p">):</span>
<span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">initialization</span><span class="o">.</span><span class="n">initialized</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s1">'Initialization is incomplete.'</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">[</span><span class="n">prefix</span><span class="p">]</span><span class="o">.</span><span class="n">initialize</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">initialization</span><span class="p">,</span>
<span class="n">complex_step</span><span class="o">=</span><span class="n">complex_step</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s1">'Statespace model not initialized.'</span><span class="p">)</span></div>
<div class="viewcode-block" id="FrozenRepresentation"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.FrozenRepresentation.html#statsmodels.tsa.statespace.kalman_filter.FrozenRepresentation">[docs]</a><span class="k">class</span> <span class="nc">FrozenRepresentation</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Frozen Statespace Model</span>
<span class="sd"> Takes a snapshot of a Statespace model.</span>
<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>
<span class="sd"> model : Representation</span>
<span class="sd"> A Statespace representation</span>
<span class="sd"> Attributes</span>
<span class="sd"> ----------</span>
<span class="sd"> nobs : int</span>
<span class="sd"> Number of observations.</span>
<span class="sd"> k_endog : int</span>
<span class="sd"> The dimension of the observation series.</span>
<span class="sd"> k_states : int</span>
<span class="sd"> The dimension of the unobserved state process.</span>
<span class="sd"> k_posdef : int</span>
<span class="sd"> The dimension of a guaranteed positive definite</span>
<span class="sd"> covariance matrix describing the shocks in the</span>
<span class="sd"> measurement equation.</span>
<span class="sd"> dtype : dtype</span>
<span class="sd"> Datatype of representation matrices</span>
<span class="sd"> prefix : str</span>
<span class="sd"> BLAS prefix of representation matrices</span>
<span class="sd"> shapes : dictionary of name:tuple</span>
<span class="sd"> A dictionary recording the shapes of each of</span>
<span class="sd"> the representation matrices as tuples.</span>
<span class="sd"> endog : ndarray</span>
<span class="sd"> The observation vector.</span>
<span class="sd"> design : ndarray</span>
<span class="sd"> The design matrix, :math:`Z`.</span>
<span class="sd"> obs_intercept : ndarray</span>
<span class="sd"> The intercept for the observation equation, :math:`d`.</span>
<span class="sd"> obs_cov : ndarray</span>
<span class="sd"> The covariance matrix for the observation equation :math:`H`.</span>
<span class="sd"> transition : ndarray</span>
<span class="sd"> The transition matrix, :math:`T`.</span>
<span class="sd"> state_intercept : ndarray</span>
<span class="sd"> The intercept for the transition equation, :math:`c`.</span>
<span class="sd"> selection : ndarray</span>
<span class="sd"> The selection matrix, :math:`R`.</span>
<span class="sd"> state_cov : ndarray</span>
<span class="sd"> The covariance matrix for the state equation :math:`Q`.</span>
<span class="sd"> missing : array of bool</span>
<span class="sd"> An array of the same size as `endog`, filled</span>
<span class="sd"> with boolean values that are True if the</span>
<span class="sd"> corresponding entry in `endog` is NaN and False</span>
<span class="sd"> otherwise.</span>
<span class="sd"> nmissing : array of int</span>
<span class="sd"> An array of size `nobs`, where the ith entry</span>
<span class="sd"> is the number (between 0 and `k_endog`) of NaNs in</span>
<span class="sd"> the ith row of the `endog` array.</span>
<span class="sd"> time_invariant : bool</span>
<span class="sd"> Whether or not the representation matrices are time-invariant</span>
<span class="sd"> initialization : Initialization object</span>
<span class="sd"> Kalman filter initialization method.</span>
<span class="sd"> initial_state : array_like</span>
<span class="sd"> The state vector used to initialize the Kalamn filter.</span>
<span class="sd"> initial_state_cov : array_like</span>
<span class="sd"> The state covariance matrix used to initialize the Kalamn filter.</span>
<span class="sd"> """</span>
<span class="n">_model_attributes</span> <span class="o">=</span> <span class="p">[</span>
<span class="s1">'model'</span><span class="p">,</span> <span class="s1">'prefix'</span><span class="p">,</span> <span class="s1">'dtype'</span><span class="p">,</span> <span class="s1">'nobs'</span><span class="p">,</span> <span class="s1">'k_endog'</span><span class="p">,</span> <span class="s1">'k_states'</span><span class="p">,</span>
<span class="s1">'k_posdef'</span><span class="p">,</span> <span class="s1">'time_invariant'</span><span class="p">,</span> <span class="s1">'endog'</span><span class="p">,</span> <span class="s1">'design'</span><span class="p">,</span> <span class="s1">'obs_intercept'</span><span class="p">,</span>
<span class="s1">'obs_cov'</span><span class="p">,</span> <span class="s1">'transition'</span><span class="p">,</span> <span class="s1">'state_intercept'</span><span class="p">,</span> <span class="s1">'selection'</span><span class="p">,</span>
<span class="s1">'state_cov'</span><span class="p">,</span> <span class="s1">'missing'</span><span class="p">,</span> <span class="s1">'nmissing'</span><span class="p">,</span> <span class="s1">'shapes'</span><span class="p">,</span> <span class="s1">'initialization'</span><span class="p">,</span>
<span class="s1">'initial_state'</span><span class="p">,</span> <span class="s1">'initial_state_cov'</span><span class="p">,</span> <span class="s1">'initial_variance'</span>
<span class="p">]</span>
<span class="n">_attributes</span> <span class="o">=</span> <span class="n">_model_attributes</span>
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">model</span><span class="p">):</span>
<span class="c1"># Initialize all attributes to None</span>
<span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_attributes</span><span class="p">:</span>
<span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="c1"># Update the representation attributes</span>
<span class="bp">self</span><span class="o">.</span><span class="n">update_representation</span><span class="p">(</span><span class="n">model</span><span class="p">)</span>
<div class="viewcode-block" id="FrozenRepresentation.update_representation"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.FrozenRepresentation.update_representation.html#statsmodels.tsa.statespace.kalman_filter.FrozenRepresentation.update_representation">[docs]</a> <span class="k">def</span> <span class="nf">update_representation</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">model</span><span class="p">):</span>
<span class="sd">"""Update model Representation"""</span>
<span class="c1"># Model</span>
<span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="n">model</span>
<span class="c1"># Data type</span>
<span class="bp">self</span><span class="o">.</span><span class="n">prefix</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">prefix</span>
<span class="bp">self</span><span class="o">.</span><span class="n">dtype</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">dtype</span>
<span class="c1"># Copy the model dimensions</span>
<span class="bp">self</span><span class="o">.</span><span class="n">nobs</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">nobs</span>
<span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">k_endog</span>
<span class="bp">self</span><span class="o">.</span><span class="n">k_states</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">k_states</span>
<span class="bp">self</span><span class="o">.</span><span class="n">k_posdef</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">k_posdef</span>
<span class="bp">self</span><span class="o">.</span><span class="n">time_invariant</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">time_invariant</span>
<span class="c1"># Save the state space representation at the time</span>
<span class="bp">self</span><span class="o">.</span><span class="n">endog</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">endog</span>
<span class="bp">self</span><span class="o">.</span><span class="n">design</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">_design</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">obs_intercept</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">_obs_intercept</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">obs_cov</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">_obs_cov</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">transition</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">_transition</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">state_intercept</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">_state_intercept</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">selection</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">_selection</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">state_cov</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">_state_cov</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">missing</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">prefix</span><span class="p">]</span><span class="o">.</span><span class="n">missing</span><span class="p">,</span>
<span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">nmissing</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">prefix</span><span class="p">]</span><span class="o">.</span><span class="n">nmissing</span><span class="p">,</span>
<span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="c1"># Save the final shapes of the matrices</span>
<span class="bp">self</span><span class="o">.</span><span class="n">shapes</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">shapes</span><span class="p">)</span>
<span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
<span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s1">'obs'</span><span class="p">:</span>
<span class="k">continue</span>
<span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span><span class="o">.</span><span class="n">shape</span>
<span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="p">[</span><span class="s1">'obs'</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">endog</span><span class="o">.</span><span class="n">shape</span>
<span class="c1"># Save the state space initialization</span>
<span class="bp">self</span><span class="o">.</span><span class="n">initialization</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">initialization</span>
<span class="k">if</span> <span class="n">model</span><span class="o">.</span><span class="n">initialization</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">model</span><span class="o">.</span><span class="n">_initialize_state</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">initial_state</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span>
<span class="n">model</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">prefix</span><span class="p">]</span><span class="o">.</span><span class="n">initial_state</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">initial_state_cov</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span>
<span class="n">model</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">prefix</span><span class="p">]</span><span class="o">.</span><span class="n">initial_state_cov</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">initial_diffuse_state_cov</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span>
<span class="n">model</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">prefix</span><span class="p">]</span><span class="o">.</span><span class="n">initial_diffuse_state_cov</span><span class="p">,</span>
<span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span></div></div>
</pre></div>
</article>
</div>
</div>
</main>
</div>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
© Copyright 2009-2019, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
</div>
Last updated on
Oct 06, 2021.
<br/>
Created using
<a href="http://www.sphinx-doc.org/">Sphinx</a> 4.0.3.
and
<a href="https://github.com/bashtage/sphinx-material/">Material for
Sphinx</a>
</div>
</div>
</div>
</footer>
<script src="../../../../_static/javascripts/application.js"></script>
<script>app.initialize({version: "1.0.4", url: {base: ".."}})</script>
</body>
</html>
|
Java
|
# thingy.js
a super aewesome buzzword framework
|
Java
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_18) on Thu Jan 06 21:19:32 CET 2011 -->
<TITLE>
Uses of Package util
</TITLE>
<META NAME="date" CONTENT="2011-01-06">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Package util";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../index.html?util/package-use.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-use.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Package<br>util</B></H2>
</CENTER>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Packages that use <A HREF="../util/package-summary.html">util</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#util"><B>util</B></A></TD>
<TD>contains some helper classes used by this framework </TD>
</TR>
</TABLE>
<P>
<A NAME="util"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Classes in <A HREF="../util/package-summary.html">util</A> used by <A HREF="../util/package-summary.html">util</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><B><A HREF="../util/class-use/PackedArray.html#util"><B>PackedArray</B></A></B>
<BR>
This is the implementation of a simple packing algorithm,
to reduce the size of an integer array with a fixed number of positive elements and
where the highest value is known.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><B><A HREF="../util/class-use/SortedQueue.html#util"><B>SortedQueue</B></A></B>
<BR>
An unbounded sorted queue able to update its elements.</TD>
</TR>
</TABLE>
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../index.html?util/package-use.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-use.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
|
Java
|
module Scheme.DataType (
module Scheme.DataType.Misc,
EvalError, ScmError, TryError,
Expr(..),
ScmCode(..), ScmFile,
Var(..),
Return(..), ReturnE,
Name, AFunc, WAFunc, RFunc, Proc, Synt,
Scm, runScm,
ScmEnv, ScmStates, ScmRef,
MetaInfo(..), Config(..), setConfig, setMSP,
MetaData(..), setTryHeap, setStackTrace,
GEnv, LEnv, MLEnv,
StackTrace(..), Trace, TraceR, initStackTrace, setTraceHeap, setTraceRHeap, setTraceLength,
Try(..), initTry, setDepthLimit, setLoopCount, setBinary, setCapturedDisplays,
DepthLimit(..),
) where
import Config
import Scheme.DataType.Error (ScmError)
import Scheme.DataType.Error.Eval (EvalError)
import Scheme.DataType.Error.Try (TryError)
import Scheme.DataType.Misc
import DeepControl.Applicative
import DeepControl.Monad
import DeepControl.MonadTrans
import DeepControl.Monad.RWS
import DeepControl.Monad.Except
import MonadX.Monad.Reference
import qualified Data.Map as M
import Data.List (intersperse)
type Name = String
----------------------------------------------------------------------------------------------------------------
-- Scm
----------------------------------------------------------------------------------------------------------------
type Scm a = (ExceptT ScmError
(ReferenceT Var
(RWST ScmEnv () ScmStates IO))) a
runScm :: Scm a
-> ScmRef -- Reference
-> ScmEnv -- Reader
-> ScmStates -- State
-> IO ((Either ScmError a, ScmRef), ScmStates, ())
runScm scm ref env states = scm >- runExceptT
>- (unReferenceT >-> (|>ref))
>- (runRWST >-> (|>env) >-> (|>states))
type ScmStates = (GEnv, MetaData) -- State
type ScmEnv = (MLEnv, MetaInfo) -- Reader
type ScmRef = RefEnv Var -- Reference
--
-- Env
--
type GEnv = M.Map Name Expr -- Global Environment
type LEnv = Ref Var{-Vm-} -- Local Environment
type MLEnv = Maybe LEnv
--
-- Variable for RefEnv
--
data Var = Ve Expr
| Vm (M.Map Name Expr{-REF-}) -- for LEnv
deriving (Eq)
instance Show Var where
show (Ve e) = show e
show (Vm map) = show map
--------------------------------------------------
-- Eval
--------------------------------------------------
-- TODO Functor
data Return a = RETURN a
| VOID
deriving (Show, Eq)
type ReturnE = Return Expr
--------------------------------------------------
-- Expr
--------------------------------------------------
-- Scheme Expression
data Expr = NIL
| INT !Integer
| REAL !Double
| SYM !String MSP
| STR !String
| CELL !Expr !Expr MSP
--
| AFUNC Name AFunc -- actual function: +, -, *, /, etc.
| WAFUNC Name WAFunc -- weekly actual function: length, append, etc.
| RFUNC Name RFunc -- referencial function: car, cdr, cons, set!, set-car!, set-cdr!, etc.
| PROC Name Proc -- procedure: display, newline, etc.
| SYNT Name Synt -- syntax: quote, if, define, etc.
| CLOS Expr MLEnv -- closure: λ
| CLOSM Expr MLEnv -- macro-closure
-- for set!, set-car!, set-cdr!, car and cdr; reference manipulation
| REF (Ref Var{-Ve-})
-- for lazy evaluation
| THUNK (Expr, ScmEnv)
instance Show Expr where
show NIL = "()"
show (INT x) = show x
show (REAL x) = show x
show (SYM x _) = x
show (STR x) = show x
show (CELL (SYM "quote" _) (CELL expr NIL _) _) = "'" ++ show expr
show (CELL (SYM "quasiquote" _) (CELL expr NIL _) _) = "`" ++ show expr
show (CELL (SYM "unquote" _) (CELL expr NIL _) _) = "," ++ show expr
show (CELL (SYM "unquote-splicing" _) (CELL expr NIL _) _) = ",@" ++ show expr
show c@(CELL a d _) = "(" ++ showCELL c ++ ")"
where
showCELL NIL = ""
showCELL (CELL a d _) = show a ++ case d of
NIL -> ""
c@(CELL _ _ _) -> " " ++ showCELL c
e -> " . " ++ show e
show (AFUNC x _) = "<" ++ x ++ ">"
show (WAFUNC x _) = "<" ++ x ++ ">"
show (RFUNC x _) = "<" ++ x ++ ">"
show (SYNT x _) = "<" ++ x ++ ">"
show (PROC x _) = "<" ++ x ++ ">"
show (CLOS (CELL args seq _) mlenv) = "(\\"++ show args ++" -> "++ showExprSeq seq ++")"
where
showExprSeq :: Expr -> String
showExprSeq NIL = ""
showExprSeq (CELL s NIL _) = show s
showExprSeq (CELL s1 s2 _) = show s1 ++" >> "++ showExprSeq s2
showExprSeq e = show e
show (CLOSM (CELL args seq _) mlenv) = "(#"++ show args ++" -> "++ showExprSeq seq ++")"
where
showExprSeq :: Expr -> String
showExprSeq NIL = ""
showExprSeq (CELL s NIL _) = show s
showExprSeq (CELL s1 s2 _) = show s1 ++" >> "++ showExprSeq s2
showExprSeq e = show e
show (THUNK (e, _)) = "[" ++ show e ++ "]"
show (REF ref) = "_"
type AFunc = Expr -> Scm Expr -- actual function
type WAFunc = Expr -> Scm Expr -- weekly actual function
type RFunc = Expr -> Scm Expr -- referencial function
type Proc = Expr -> Scm ReturnE -- procedure
type Synt = Expr -> Scm ReturnE -- syntax
instance Eq Expr where
NIL == NIL = True
INT x == INT y = x == y
REAL x == REAL y = x == y
SYM x _ == SYM y _ = x == y
STR x == STR y = x == y
CELL l r _ == CELL l' r' _ = (l,r) == (l',r')
CLOS x a == CLOS y b = (x,a) == (y,b)
CLOSM x a == CLOSM y b = (x,a) == (y,b)
AFUNC x a == AFUNC y b = x == y
WAFUNC x a == WAFUNC y b = x == y
RFUNC x a == RFUNC y b = x == y
SYNT x a == SYNT y b = x == y
PROC x a == PROC y b = x == y
REF x == REF y = x == y
THUNK x == THUNK y = x == y
_ == _ = False
--------------------------------------------------
-- SCode, SFile, SFiles
--------------------------------------------------
data ScmCode = EXPR Expr
| COMMENT String
| LINEBREAK
| EOF
instance Show ScmCode where
show (EXPR x) = show x
show (COMMENT s) = s
show LINEBREAK = ""
type ScmFile = [ScmCode]
----------------------------------------------------------------------------------------------------------------
-- RWS
----------------------------------------------------------------------------------------------------------------
--
-- MetaInfo
--
data MetaInfo = MetaInfo { config :: Config
, msp :: MSP
}
deriving (Show, Eq)
setConfig :: Config -> MetaInfo -> MetaInfo
setConfig x (MetaInfo _ b) = MetaInfo x b
setMSP :: MSP -> MetaInfo -> MetaInfo
setMSP x (MetaInfo a _) = MetaInfo a x
--
-- MetaData
--
data MetaData = MetaData { tryHeap :: [Try]
, stackTrace :: StackTrace
}
deriving (Show)
setTryHeap :: [Try] -> MetaData -> MetaData
setTryHeap x (MetaData _ b) = MetaData x b
setStackTrace :: StackTrace -> MetaData -> MetaData
setStackTrace x (MetaData a _) = MetaData a x
data StackTrace = StackTrace {
traceHeap :: [Trace]
, traceRHeap :: [TraceR] -- trace rusult
, traceLength :: Int
}
deriving (Show)
type Trace = (String, MSP, Maybe String)
type TraceR = Trace
initStackTrace :: StackTrace
initStackTrace = StackTrace [] [] 10
setTraceHeap :: [Trace] -> StackTrace -> StackTrace
setTraceHeap x (StackTrace _ b c) = StackTrace x b c
setTraceRHeap :: [TraceR] -> StackTrace -> StackTrace
setTraceRHeap x (StackTrace a _ c) = StackTrace a x c
setTraceLength :: Int -> StackTrace -> StackTrace
setTraceLength x (StackTrace a b _) = StackTrace a b x
-- TODO: ChaitinTry
data Try = Try { depthLimit :: DepthLimit
, loopCount :: Int
, binary :: Expr
, capturedDisplays :: [Expr]
}
deriving (Show)
data DepthLimit = NOTIMELIMIT
| DEPTHLIMIT Int
deriving (Show, Eq)
instance Ord DepthLimit where
compare NOTIMELIMIT NOTIMELIMIT = EQ
compare NOTIMELIMIT (DEPTHLIMIT _) = GT
compare (DEPTHLIMIT _) NOTIMELIMIT = LT
compare (DEPTHLIMIT n) (DEPTHLIMIT n') = compare n n'
initTry :: Try
initTry = Try NOTIMELIMIT 0 NIL []
setDepthLimit :: DepthLimit -> Try -> Try
setDepthLimit dl (Try _ lc bn cd) = Try dl lc bn cd
setLoopCount :: Int -> Try -> Try
setLoopCount lc (Try dl _ bn cd) = Try dl lc bn cd
setBinary :: Expr -> Try -> Try
setBinary bn (Try dl lc _ cd) = Try dl lc bn cd
setCapturedDisplays :: [Expr] -> Try -> Try
setCapturedDisplays cd (Try dl lc bn _) = Try dl lc bn cd
----------------------------------------------------------------------------------------------------------------
-- Misc
----------------------------------------------------------------------------------------------------------------
|
Java
|
from unittest import TestCase
from django.core.management import call_command
class SendAiPicsStatsTestCase(TestCase):
def test_run_command(self):
call_command('send_ai_pics_stats')
|
Java
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE194_Unexpected_Sign_Extension__fgets_malloc_03.c
Label Definition File: CWE194_Unexpected_Sign_Extension.label.xml
Template File: sources-sink-03.tmpl.c
*/
/*
* @description
* CWE: 194 Unexpected Sign Extension
* BadSource: fgets Read data from the console using fgets()
* GoodSource: Positive integer
* Sink: malloc
* BadSink : Allocate memory using malloc() with the size of data
* Flow Variant: 03 Control flow: if(5==5) and if(5!=5)
*
* */
#include "std_testcase.h"
/* Must be at least 8 for atoi() to work properly */
#define CHAR_ARRAY_SIZE 8
#ifndef OMITBAD
void CWE194_Unexpected_Sign_Extension__fgets_malloc_03_bad()
{
short data;
/* Initialize data */
data = 0;
if(5==5)
{
{
char inputBuffer[CHAR_ARRAY_SIZE] = "";
/* FLAW: Use a value input from the console using fgets() */
if (fgets(inputBuffer, CHAR_ARRAY_SIZE, stdin) != NULL)
{
/* Convert to short */
data = (short)atoi(inputBuffer);
}
else
{
printLine("fgets() failed.");
}
}
}
/* Assume we want to allocate a relatively small buffer */
if (data < 100)
{
/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,
* the conversion will cause malloc() to allocate a very large amount of data or fail */
char * dataBuffer = (char *)malloc(data);
if (dataBuffer == NULL) {exit(-1);}
/* Do something with dataBuffer */
memset(dataBuffer, 'A', data-1);
dataBuffer[data-1] = '\0';
printLine(dataBuffer);
free(dataBuffer);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B1() - use goodsource and badsink by changing the 5==5 to 5!=5 */
static void goodG2B1()
{
short data;
/* Initialize data */
data = 0;
if(5!=5)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Use a positive integer less than &InitialDataSize&*/
data = 100-1;
}
/* Assume we want to allocate a relatively small buffer */
if (data < 100)
{
/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,
* the conversion will cause malloc() to allocate a very large amount of data or fail */
char * dataBuffer = (char *)malloc(data);
if (dataBuffer == NULL) {exit(-1);}
/* Do something with dataBuffer */
memset(dataBuffer, 'A', data-1);
dataBuffer[data-1] = '\0';
printLine(dataBuffer);
free(dataBuffer);
}
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */
static void goodG2B2()
{
short data;
/* Initialize data */
data = 0;
if(5==5)
{
/* FIX: Use a positive integer less than &InitialDataSize&*/
data = 100-1;
}
/* Assume we want to allocate a relatively small buffer */
if (data < 100)
{
/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,
* the conversion will cause malloc() to allocate a very large amount of data or fail */
char * dataBuffer = (char *)malloc(data);
if (dataBuffer == NULL) {exit(-1);}
/* Do something with dataBuffer */
memset(dataBuffer, 'A', data-1);
dataBuffer[data-1] = '\0';
printLine(dataBuffer);
free(dataBuffer);
}
}
void CWE194_Unexpected_Sign_Extension__fgets_malloc_03_good()
{
goodG2B1();
goodG2B2();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE194_Unexpected_Sign_Extension__fgets_malloc_03_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE194_Unexpected_Sign_Extension__fgets_malloc_03_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
Java
|
// Copyright (c) 2012 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.
#include "ash/system/settings/tray_settings.h"
#include "ash/shell.h"
#include "ash/system/power/power_status_view.h"
#include "ash/system/tray/system_tray_delegate.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_views.h"
#include "base/logging.h"
#include "base/utf_string_conversions.h"
#include "grit/ash_resources.h"
#include "grit/ash_strings.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/accessibility/accessible_view_state.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/image/image.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/view.h"
namespace ash {
namespace internal {
namespace tray {
class SettingsDefaultView : public ash::internal::ActionableView {
public:
explicit SettingsDefaultView(user::LoginStatus status)
: login_status_(status),
label_(NULL),
power_status_view_(NULL) {
SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal,
ash::kTrayPopupPaddingHorizontal, 0,
ash::kTrayPopupPaddingBetweenItems));
bool power_view_right_align = false;
if (login_status_ != user::LOGGED_IN_NONE &&
login_status_ != user::LOGGED_IN_LOCKED) {
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
views::ImageView* icon =
new ash::internal::FixedSizedImageView(0, ash::kTrayPopupItemHeight);
icon->SetImage(
rb.GetImageNamed(IDR_AURA_UBER_TRAY_SETTINGS).ToImageSkia());
AddChildView(icon);
string16 text = rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_SETTINGS);
label_ = new views::Label(text);
AddChildView(label_);
SetAccessibleName(text);
power_view_right_align = true;
}
PowerSupplyStatus power_status =
ash::Shell::GetInstance()->tray_delegate()->GetPowerSupplyStatus();
if (power_status.battery_is_present) {
power_status_view_ = new ash::internal::PowerStatusView(
ash::internal::PowerStatusView::VIEW_DEFAULT, power_view_right_align);
AddChildView(power_status_view_);
UpdatePowerStatus(power_status);
}
}
virtual ~SettingsDefaultView() {}
void UpdatePowerStatus(const PowerSupplyStatus& status) {
if (power_status_view_)
power_status_view_->UpdatePowerStatus(status);
}
// Overridden from ash::internal::ActionableView.
virtual bool PerformAction(const ui::Event& event) OVERRIDE {
if (login_status_ == user::LOGGED_IN_NONE ||
login_status_ == user::LOGGED_IN_LOCKED)
return false;
ash::Shell::GetInstance()->tray_delegate()->ShowSettings();
return true;
}
// Overridden from views::View.
virtual void Layout() OVERRIDE {
views::View::Layout();
if (label_ && power_status_view_) {
// Let the box-layout do the layout first. Then move power_status_view_
// to right align if it is created.
gfx::Size size = power_status_view_->GetPreferredSize();
gfx::Rect bounds(size);
bounds.set_x(width() - size.width() - ash::kTrayPopupPaddingBetweenItems);
bounds.set_y((height() - size.height()) / 2);
power_status_view_->SetBoundsRect(bounds);
}
}
// Overridden from views::View.
virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE {
views::View::ChildPreferredSizeChanged(child);
Layout();
}
private:
user::LoginStatus login_status_;
views::Label* label_;
ash::internal::PowerStatusView* power_status_view_;
DISALLOW_COPY_AND_ASSIGN(SettingsDefaultView);
};
} // namespace tray
TraySettings::TraySettings(SystemTray* system_tray)
: SystemTrayItem(system_tray),
default_view_(NULL) {
}
TraySettings::~TraySettings() {}
views::View* TraySettings::CreateTrayView(user::LoginStatus status) {
return NULL;
}
views::View* TraySettings::CreateDefaultView(user::LoginStatus status) {
if ((status == user::LOGGED_IN_NONE || status == user::LOGGED_IN_LOCKED) &&
(!ash::Shell::GetInstance()->tray_delegate()->
GetPowerSupplyStatus().battery_is_present))
return NULL;
CHECK(default_view_ == NULL);
default_view_ = new tray::SettingsDefaultView(status);
return default_view_;
}
views::View* TraySettings::CreateDetailedView(user::LoginStatus status) {
NOTIMPLEMENTED();
return NULL;
}
void TraySettings::DestroyTrayView() {
}
void TraySettings::DestroyDefaultView() {
default_view_ = NULL;
}
void TraySettings::DestroyDetailedView() {
}
void TraySettings::UpdateAfterLoginStatusChange(user::LoginStatus status) {
}
// Overridden from PowerStatusObserver.
void TraySettings::OnPowerStatusChanged(const PowerSupplyStatus& status) {
if (default_view_)
default_view_->UpdatePowerStatus(status);
}
} // namespace internal
} // namespace ash
|
Java
|
var Turtle = function () {
this.d = 0;
this.x = 0;
this.y = 0;
this.rounding = false;
this.invert = false;
}
Turtle.prototype.setX = function (val) {
this.x = val;
return this;
}
Turtle.prototype.setY = function (val) {
this.y = val;
return this;
}
Turtle.prototype.setDegree = function (deg) {
this.d = deg;
return this;
}
Turtle.prototype.setInvert = function (bool) {
this.invert = bool;
return this;
}
Turtle.prototype.setRounding = function (bool) {
this.rounding = bool;
return this;
}
Turtle.prototype.rt = function (degrees) {
if (this.invert) {
this.d += degrees;
} else {
this.d -= degrees;
this.d += 360; // to ensure that the number is positive
}
this.d %= 360;
return this;
}
Turtle.prototype.lt = function (degrees) {
if (this.invert) {
this.d -= degrees;
this.d += 360; // to ensure that the number is positive
} else {
this.d += degrees;
}
this.d %= 360;
return this;
}
Turtle.prototype.adj = function (degrees, hyp) {
var adj = Math.cos(degrees * Math.PI / 180) * hyp;
if (this.rounding) {
return Math.round(adj);
} else {
return adj;
}
}
Turtle.prototype.opp = function (degrees, hyp) {
var opp = Math.sin(degrees * Math.PI / 180) * hyp;
if (this.rounding) {
return Math.round(opp);
} else {
return opp;
}
}
Turtle.prototype.fd = function (magnitude) {
if (this.d < 90) {
// x == adjacent
this.x += this.adj(this.d, magnitude);
// y == opposite
this.y += this.opp(this.d, magnitude);
} else if (this.d < 180) {
// x == -opposite
this.x -= this.opp(this.d - 90, magnitude);
// y == adjacent
this.y += this.adj(this.d - 90, magnitude);
} else if (this.d < 270) {
// x == -adjacent
this.x -= this.adj(this.d - 180, magnitude);
// y == -opposite
this.y -= this.opp(this.d - 180, magnitude);
} else if (this.d < 360) {
// x == opposite
this.x += this.opp(this.d - 270, magnitude);
// y == -adjacent
this.y -= this.adj(this.d - 270, magnitude);
}
return this;
}
Turtle.prototype.bk = function (magnitude) {
if (this.d < 90) {
// x -= adjacent
this.x -= this.adj(this.d, magnitude);
// y -= opposite
this.y -= this.opp(this.d, magnitude);
} else if (this.d < 180) {
// x == +opposite
this.x += this.opp(this.d - 90, magnitude);
// y == -adjacent
this.y -= this.adj(this.d - 90, magnitude);
} else if (this.d < 270) {
// x == opposite
this.x += this.adj(this.d - 180, magnitude);
// y == adjacent
this.y += this.opp(this.d - 180, magnitude);
} else if (this.d < 360) {
// x == -opposite
this.x -= this.opp(this.d - 270, magnitude);
// y == adjacent
this.y += this.adj(this.d - 270, magnitude);
}
return this;
}
|
Java
|
# Copyright (c) 2012 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality of the software
# licensed hereunder. You may use the software subject to the license
# terms below provided that you ensure that this notice is replicated
# unmodified and in its entirety in all distributions of the software,
# modified or unmodified, in source code or in binary form.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer;
# redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution;
# neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Authors: Andreas Sandberg
from m5.objects import *
from arm_generic import *
import switcheroo
root = LinuxArmFSSwitcheroo(
mem_class=DDR3_1600_x64,
cpu_classes=(AtomicSimpleCPU, AtomicSimpleCPU)
).create_root()
# Setup a custom test method that uses the switcheroo tester that
# switches between CPU models.
run_test = switcheroo.run_test
|
Java
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Code Coverage for /var/www/html/Album/vendor/zendframework/zendframework/library/Zend/Loader/StandardAutoloader.php</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/bootstrap-responsive.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<header>
<div class="container">
<div class="row">
<div class="span12">
<ul class="breadcrumb">
<li><a href="index.html">/var/www/html/Album</a> <span class="divider">/</span></li>
<li><a href="vendor.html">vendor</a> <span class="divider">/</span></li>
<li><a href="vendor_zendframework.html">zendframework</a> <span class="divider">/</span></li>
<li><a href="vendor_zendframework_zendframework.html">zendframework</a> <span class="divider">/</span></li>
<li><a href="vendor_zendframework_zendframework_library.html">library</a> <span class="divider">/</span></li>
<li><a href="vendor_zendframework_zendframework_library_Zend.html">Zend</a> <span class="divider">/</span></li>
<li><a href="vendor_zendframework_zendframework_library_Zend_Loader.html">Loader</a> <span class="divider">/</span></li>
<li class="active">StandardAutoloader.php</li>
</ul>
</div>
</div>
</div>
</header>
<div class="container">
<table class="table table-bordered">
<thead>
<tr>
<td> </td>
<td colspan="10"><div align="center"><strong>Code Coverage</strong></div></td>
</tr>
<tr>
<td> </td>
<td colspan="3"><div align="center"><strong>Classes and Traits</strong></div></td>
<td colspan="4"><div align="center"><strong>Functions and Methods</strong></div></td>
<td colspan="3"><div align="center"><strong>Lines</strong></div></td>
</tr>
</thead>
<tbody>
<tr>
<td class="danger">Total</td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 15.38%;"></div>
</div>
</td>
<td class="danger small"><div align="right">15.38%</div></td>
<td class="danger small"><div align="right">2 / 13</div></td>
<td class="danger small"><abbr title="Change Risk Anti-Patterns (CRAP) Index">CRAP</abbr></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 20.59%;"></div>
</div>
</td>
<td class="danger small"><div align="right">20.59%</div></td>
<td class="danger small"><div align="right">21 / 102</div></td>
</tr>
<tr>
<td class="danger">StandardAutoloader</td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 15.38%;"></div>
</div>
</td>
<td class="danger small"><div align="right">15.38%</div></td>
<td class="danger small"><div align="right">2 / 13</div></td>
<td class="danger small">1201.82</td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 20.59%;"></div>
</div>
</td>
<td class="danger small"><div align="right">20.59%</div></td>
<td class="danger small"><div align="right">21 / 102</div></td>
</tr>
<tr>
<td class="danger" colspan="4"> <a href="#51">__construct($options = null)</a></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
<td class="danger small">6</td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 4</div></td>
</tr>
<tr>
<td class="danger" colspan="4"> <a href="#80">setOptions($options)</a></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
<td class="danger small">182</td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 26</div></td>
</tr>
<tr>
<td class="danger" colspan="4"> <a href="#120">setFallbackAutoloader($flag)</a></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
<td class="danger small">2</td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 2</div></td>
</tr>
<tr>
<td class="success" colspan="4"> <a href="#131">isFallbackAutoloader()</a></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 100.00%;"></div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1 / 1</div></td>
<td class="success small">1</td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 100.00%;"></div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1 / 1</div></td>
</tr>
<tr>
<td class="danger" colspan="4"> <a href="#143">registerNamespace($namespace, $directory)</a></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
<td class="danger small">2</td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 3</div></td>
</tr>
<tr>
<td class="danger" colspan="4"> <a href="#157">registerNamespaces($namespaces)</a></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
<td class="danger small">20</td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 7</div></td>
</tr>
<tr>
<td class="danger" colspan="4"> <a href="#177">registerPrefix($prefix, $directory)</a></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
<td class="danger small">2</td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 3</div></td>
</tr>
<tr>
<td class="danger" colspan="4"> <a href="#191">registerPrefixes($prefixes)</a></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
<td class="danger small">20</td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 7</div></td>
</tr>
<tr>
<td class="danger" colspan="4"> <a href="#210">autoload($class)</a></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
<td class="danger small">35.00</td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 25.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">25.00%</div></td>
<td class="danger small"><div align="right">4 / 16</div></td>
</tr>
<tr>
<td class="danger" colspan="4"> <a href="#240">register()</a></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
<td class="danger small">2</td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 2</div></td>
</tr>
<tr>
<td class="success" colspan="4"> <a href="#252">transformClassNameToFilename($class, $directory)</a></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 100.00%;"></div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1 / 1</div></td>
<td class="success small">3</td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 100.00%;"></div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">7 / 7</div></td>
</tr>
<tr>
<td class="danger" colspan="4"> <a href="#276">loadClass($class, $type)</a></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
<td class="danger small">13.12</td>
<td class="warning big"> <div class="progress progress-warning" style="width: 100px;">
<div class="bar" style="width: 50.00%;"></div>
</div>
</td>
<td class="warning small"><div align="right">50.00%</div></td>
<td class="warning small"><div align="right">9 / 18</div></td>
</tr>
<tr>
<td class="danger" colspan="4"> <a href="#317">normalizeDirectory($directory)</a></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
<td class="danger small">6</td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 6</div></td>
</tr>
</tbody>
</table>
<table class="table table-borderless table-condensed">
<tbody>
<tr><td><div align="right"><a name="1"></a><a href="#1">1</a></div></td><td class="codeLine"><?php</td></tr>
<tr><td><div align="right"><a name="2"></a><a href="#2">2</a></div></td><td class="codeLine">/**</td></tr>
<tr><td><div align="right"><a name="3"></a><a href="#3">3</a></div></td><td class="codeLine"> * Zend Framework (http://framework.zend.com/)</td></tr>
<tr><td><div align="right"><a name="4"></a><a href="#4">4</a></div></td><td class="codeLine"> *</td></tr>
<tr><td><div align="right"><a name="5"></a><a href="#5">5</a></div></td><td class="codeLine"> * @link http://github.com/zendframework/zf2 for the canonical source repository</td></tr>
<tr><td><div align="right"><a name="6"></a><a href="#6">6</a></div></td><td class="codeLine"> * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)</td></tr>
<tr><td><div align="right"><a name="7"></a><a href="#7">7</a></div></td><td class="codeLine"> * @license http://framework.zend.com/license/new-bsd New BSD License</td></tr>
<tr><td><div align="right"><a name="8"></a><a href="#8">8</a></div></td><td class="codeLine"> */</td></tr>
<tr><td><div align="right"><a name="9"></a><a href="#9">9</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="10"></a><a href="#10">10</a></div></td><td class="codeLine">namespace Zend\Loader;</td></tr>
<tr><td><div align="right"><a name="11"></a><a href="#11">11</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="12"></a><a href="#12">12</a></div></td><td class="codeLine">// Grab SplAutoloader interface</td></tr>
<tr><td><div align="right"><a name="13"></a><a href="#13">13</a></div></td><td class="codeLine">require_once __DIR__ . '/SplAutoloader.php';</td></tr>
<tr><td><div align="right"><a name="14"></a><a href="#14">14</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="15"></a><a href="#15">15</a></div></td><td class="codeLine">/**</td></tr>
<tr><td><div align="right"><a name="16"></a><a href="#16">16</a></div></td><td class="codeLine"> * PSR-0 compliant autoloader</td></tr>
<tr><td><div align="right"><a name="17"></a><a href="#17">17</a></div></td><td class="codeLine"> *</td></tr>
<tr><td><div align="right"><a name="18"></a><a href="#18">18</a></div></td><td class="codeLine"> * Allows autoloading both namespaced and vendor-prefixed classes. Class</td></tr>
<tr><td><div align="right"><a name="19"></a><a href="#19">19</a></div></td><td class="codeLine"> * lookups are performed on the filesystem. If a class file for the referenced</td></tr>
<tr><td><div align="right"><a name="20"></a><a href="#20">20</a></div></td><td class="codeLine"> * class is not found, a PHP warning will be raised by include().</td></tr>
<tr><td><div align="right"><a name="21"></a><a href="#21">21</a></div></td><td class="codeLine"> */</td></tr>
<tr><td><div align="right"><a name="22"></a><a href="#22">22</a></div></td><td class="codeLine">class StandardAutoloader implements SplAutoloader</td></tr>
<tr><td><div align="right"><a name="23"></a><a href="#23">23</a></div></td><td class="codeLine">{</td></tr>
<tr><td><div align="right"><a name="24"></a><a href="#24">24</a></div></td><td class="codeLine"> const NS_SEPARATOR = '\\';</td></tr>
<tr><td><div align="right"><a name="25"></a><a href="#25">25</a></div></td><td class="codeLine"> const PREFIX_SEPARATOR = '_';</td></tr>
<tr><td><div align="right"><a name="26"></a><a href="#26">26</a></div></td><td class="codeLine"> const LOAD_NS = 'namespaces';</td></tr>
<tr><td><div align="right"><a name="27"></a><a href="#27">27</a></div></td><td class="codeLine"> const LOAD_PREFIX = 'prefixes';</td></tr>
<tr><td><div align="right"><a name="28"></a><a href="#28">28</a></div></td><td class="codeLine"> const ACT_AS_FALLBACK = 'fallback_autoloader';</td></tr>
<tr><td><div align="right"><a name="29"></a><a href="#29">29</a></div></td><td class="codeLine"> const AUTOREGISTER_ZF = 'autoregister_zf';</td></tr>
<tr><td><div align="right"><a name="30"></a><a href="#30">30</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="31"></a><a href="#31">31</a></div></td><td class="codeLine"> /**</td></tr>
<tr><td><div align="right"><a name="32"></a><a href="#32">32</a></div></td><td class="codeLine"> * @var array Namespace/directory pairs to search; ZF library added by default</td></tr>
<tr><td><div align="right"><a name="33"></a><a href="#33">33</a></div></td><td class="codeLine"> */</td></tr>
<tr><td><div align="right"><a name="34"></a><a href="#34">34</a></div></td><td class="codeLine"> protected $namespaces = array();</td></tr>
<tr><td><div align="right"><a name="35"></a><a href="#35">35</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="36"></a><a href="#36">36</a></div></td><td class="codeLine"> /**</td></tr>
<tr><td><div align="right"><a name="37"></a><a href="#37">37</a></div></td><td class="codeLine"> * @var array Prefix/directory pairs to search</td></tr>
<tr><td><div align="right"><a name="38"></a><a href="#38">38</a></div></td><td class="codeLine"> */</td></tr>
<tr><td><div align="right"><a name="39"></a><a href="#39">39</a></div></td><td class="codeLine"> protected $prefixes = array();</td></tr>
<tr><td><div align="right"><a name="40"></a><a href="#40">40</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="41"></a><a href="#41">41</a></div></td><td class="codeLine"> /**</td></tr>
<tr><td><div align="right"><a name="42"></a><a href="#42">42</a></div></td><td class="codeLine"> * @var bool Whether or not the autoloader should also act as a fallback autoloader</td></tr>
<tr><td><div align="right"><a name="43"></a><a href="#43">43</a></div></td><td class="codeLine"> */</td></tr>
<tr><td><div align="right"><a name="44"></a><a href="#44">44</a></div></td><td class="codeLine"> protected $fallbackAutoloaderFlag = false;</td></tr>
<tr><td><div align="right"><a name="45"></a><a href="#45">45</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="46"></a><a href="#46">46</a></div></td><td class="codeLine"> /**</td></tr>
<tr><td><div align="right"><a name="47"></a><a href="#47">47</a></div></td><td class="codeLine"> * Constructor</td></tr>
<tr><td><div align="right"><a name="48"></a><a href="#48">48</a></div></td><td class="codeLine"> *</td></tr>
<tr><td><div align="right"><a name="49"></a><a href="#49">49</a></div></td><td class="codeLine"> * @param null|array|\Traversable $options</td></tr>
<tr><td><div align="right"><a name="50"></a><a href="#50">50</a></div></td><td class="codeLine"> */</td></tr>
<tr><td><div align="right"><a name="51"></a><a href="#51">51</a></div></td><td class="codeLine"> public function __construct($options = null)</td></tr>
<tr><td><div align="right"><a name="52"></a><a href="#52">52</a></div></td><td class="codeLine"> {</td></tr>
<tr class="danger"><td><div align="right"><a name="53"></a><a href="#53">53</a></div></td><td class="codeLine"> if (null !== $options) {</td></tr>
<tr class="danger"><td><div align="right"><a name="54"></a><a href="#54">54</a></div></td><td class="codeLine"> $this->setOptions($options);</td></tr>
<tr class="danger"><td><div align="right"><a name="55"></a><a href="#55">55</a></div></td><td class="codeLine"> }</td></tr>
<tr class="danger"><td><div align="right"><a name="56"></a><a href="#56">56</a></div></td><td class="codeLine"> }</td></tr>
<tr><td><div align="right"><a name="57"></a><a href="#57">57</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="58"></a><a href="#58">58</a></div></td><td class="codeLine"> /**</td></tr>
<tr><td><div align="right"><a name="59"></a><a href="#59">59</a></div></td><td class="codeLine"> * Configure autoloader</td></tr>
<tr><td><div align="right"><a name="60"></a><a href="#60">60</a></div></td><td class="codeLine"> *</td></tr>
<tr><td><div align="right"><a name="61"></a><a href="#61">61</a></div></td><td class="codeLine"> * Allows specifying both "namespace" and "prefix" pairs, using the</td></tr>
<tr><td><div align="right"><a name="62"></a><a href="#62">62</a></div></td><td class="codeLine"> * following structure:</td></tr>
<tr><td><div align="right"><a name="63"></a><a href="#63">63</a></div></td><td class="codeLine"> * <code></td></tr>
<tr><td><div align="right"><a name="64"></a><a href="#64">64</a></div></td><td class="codeLine"> * array(</td></tr>
<tr><td><div align="right"><a name="65"></a><a href="#65">65</a></div></td><td class="codeLine"> * 'namespaces' => array(</td></tr>
<tr><td><div align="right"><a name="66"></a><a href="#66">66</a></div></td><td class="codeLine"> * 'Zend' => '/path/to/Zend/library',</td></tr>
<tr><td><div align="right"><a name="67"></a><a href="#67">67</a></div></td><td class="codeLine"> * 'Doctrine' => '/path/to/Doctrine/library',</td></tr>
<tr><td><div align="right"><a name="68"></a><a href="#68">68</a></div></td><td class="codeLine"> * ),</td></tr>
<tr><td><div align="right"><a name="69"></a><a href="#69">69</a></div></td><td class="codeLine"> * 'prefixes' => array(</td></tr>
<tr><td><div align="right"><a name="70"></a><a href="#70">70</a></div></td><td class="codeLine"> * 'Phly_' => '/path/to/Phly/library',</td></tr>
<tr><td><div align="right"><a name="71"></a><a href="#71">71</a></div></td><td class="codeLine"> * ),</td></tr>
<tr><td><div align="right"><a name="72"></a><a href="#72">72</a></div></td><td class="codeLine"> * 'fallback_autoloader' => true,</td></tr>
<tr><td><div align="right"><a name="73"></a><a href="#73">73</a></div></td><td class="codeLine"> * )</td></tr>
<tr><td><div align="right"><a name="74"></a><a href="#74">74</a></div></td><td class="codeLine"> * </code></td></tr>
<tr><td><div align="right"><a name="75"></a><a href="#75">75</a></div></td><td class="codeLine"> *</td></tr>
<tr><td><div align="right"><a name="76"></a><a href="#76">76</a></div></td><td class="codeLine"> * @param array|\Traversable $options</td></tr>
<tr><td><div align="right"><a name="77"></a><a href="#77">77</a></div></td><td class="codeLine"> * @throws Exception\InvalidArgumentException</td></tr>
<tr><td><div align="right"><a name="78"></a><a href="#78">78</a></div></td><td class="codeLine"> * @return StandardAutoloader</td></tr>
<tr><td><div align="right"><a name="79"></a><a href="#79">79</a></div></td><td class="codeLine"> */</td></tr>
<tr><td><div align="right"><a name="80"></a><a href="#80">80</a></div></td><td class="codeLine"> public function setOptions($options)</td></tr>
<tr><td><div align="right"><a name="81"></a><a href="#81">81</a></div></td><td class="codeLine"> {</td></tr>
<tr class="danger"><td><div align="right"><a name="82"></a><a href="#82">82</a></div></td><td class="codeLine"> if (!is_array($options) && !($options instanceof \Traversable)) {</td></tr>
<tr class="danger"><td><div align="right"><a name="83"></a><a href="#83">83</a></div></td><td class="codeLine"> require_once __DIR__ . '/Exception/InvalidArgumentException.php';</td></tr>
<tr class="danger"><td><div align="right"><a name="84"></a><a href="#84">84</a></div></td><td class="codeLine"> throw new Exception\InvalidArgumentException('Options must be either an array or Traversable');</td></tr>
<tr><td><div align="right"><a name="85"></a><a href="#85">85</a></div></td><td class="codeLine"> }</td></tr>
<tr><td><div align="right"><a name="86"></a><a href="#86">86</a></div></td><td class="codeLine"></td></tr>
<tr class="danger"><td><div align="right"><a name="87"></a><a href="#87">87</a></div></td><td class="codeLine"> foreach ($options as $type => $pairs) {</td></tr>
<tr><td><div align="right"><a name="88"></a><a href="#88">88</a></div></td><td class="codeLine"> switch ($type) {</td></tr>
<tr class="danger"><td><div align="right"><a name="89"></a><a href="#89">89</a></div></td><td class="codeLine"> case self::AUTOREGISTER_ZF:</td></tr>
<tr class="danger"><td><div align="right"><a name="90"></a><a href="#90">90</a></div></td><td class="codeLine"> if ($pairs) {</td></tr>
<tr class="danger"><td><div align="right"><a name="91"></a><a href="#91">91</a></div></td><td class="codeLine"> $this->registerNamespace('Zend', dirname(__DIR__));</td></tr>
<tr class="danger"><td><div align="right"><a name="92"></a><a href="#92">92</a></div></td><td class="codeLine"> }</td></tr>
<tr class="danger"><td><div align="right"><a name="93"></a><a href="#93">93</a></div></td><td class="codeLine"> break;</td></tr>
<tr class="danger"><td><div align="right"><a name="94"></a><a href="#94">94</a></div></td><td class="codeLine"> case self::LOAD_NS:</td></tr>
<tr class="danger"><td><div align="right"><a name="95"></a><a href="#95">95</a></div></td><td class="codeLine"> if (is_array($pairs) || $pairs instanceof \Traversable) {</td></tr>
<tr class="danger"><td><div align="right"><a name="96"></a><a href="#96">96</a></div></td><td class="codeLine"> $this->registerNamespaces($pairs);</td></tr>
<tr class="danger"><td><div align="right"><a name="97"></a><a href="#97">97</a></div></td><td class="codeLine"> }</td></tr>
<tr class="danger"><td><div align="right"><a name="98"></a><a href="#98">98</a></div></td><td class="codeLine"> break;</td></tr>
<tr class="danger"><td><div align="right"><a name="99"></a><a href="#99">99</a></div></td><td class="codeLine"> case self::LOAD_PREFIX:</td></tr>
<tr class="danger"><td><div align="right"><a name="100"></a><a href="#100">100</a></div></td><td class="codeLine"> if (is_array($pairs) || $pairs instanceof \Traversable) {</td></tr>
<tr class="danger"><td><div align="right"><a name="101"></a><a href="#101">101</a></div></td><td class="codeLine"> $this->registerPrefixes($pairs);</td></tr>
<tr class="danger"><td><div align="right"><a name="102"></a><a href="#102">102</a></div></td><td class="codeLine"> }</td></tr>
<tr class="danger"><td><div align="right"><a name="103"></a><a href="#103">103</a></div></td><td class="codeLine"> break;</td></tr>
<tr class="danger"><td><div align="right"><a name="104"></a><a href="#104">104</a></div></td><td class="codeLine"> case self::ACT_AS_FALLBACK:</td></tr>
<tr class="danger"><td><div align="right"><a name="105"></a><a href="#105">105</a></div></td><td class="codeLine"> $this->setFallbackAutoloader($pairs);</td></tr>
<tr class="danger"><td><div align="right"><a name="106"></a><a href="#106">106</a></div></td><td class="codeLine"> break;</td></tr>
<tr class="danger"><td><div align="right"><a name="107"></a><a href="#107">107</a></div></td><td class="codeLine"> default:</td></tr>
<tr><td><div align="right"><a name="108"></a><a href="#108">108</a></div></td><td class="codeLine"> // ignore</td></tr>
<tr class="danger"><td><div align="right"><a name="109"></a><a href="#109">109</a></div></td><td class="codeLine"> }</td></tr>
<tr class="danger"><td><div align="right"><a name="110"></a><a href="#110">110</a></div></td><td class="codeLine"> }</td></tr>
<tr class="danger"><td><div align="right"><a name="111"></a><a href="#111">111</a></div></td><td class="codeLine"> return $this;</td></tr>
<tr><td><div align="right"><a name="112"></a><a href="#112">112</a></div></td><td class="codeLine"> }</td></tr>
<tr><td><div align="right"><a name="113"></a><a href="#113">113</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="114"></a><a href="#114">114</a></div></td><td class="codeLine"> /**</td></tr>
<tr><td><div align="right"><a name="115"></a><a href="#115">115</a></div></td><td class="codeLine"> * Set flag indicating fallback autoloader status</td></tr>
<tr><td><div align="right"><a name="116"></a><a href="#116">116</a></div></td><td class="codeLine"> *</td></tr>
<tr><td><div align="right"><a name="117"></a><a href="#117">117</a></div></td><td class="codeLine"> * @param bool $flag</td></tr>
<tr><td><div align="right"><a name="118"></a><a href="#118">118</a></div></td><td class="codeLine"> * @return StandardAutoloader</td></tr>
<tr><td><div align="right"><a name="119"></a><a href="#119">119</a></div></td><td class="codeLine"> */</td></tr>
<tr><td><div align="right"><a name="120"></a><a href="#120">120</a></div></td><td class="codeLine"> public function setFallbackAutoloader($flag)</td></tr>
<tr><td><div align="right"><a name="121"></a><a href="#121">121</a></div></td><td class="codeLine"> {</td></tr>
<tr class="danger"><td><div align="right"><a name="122"></a><a href="#122">122</a></div></td><td class="codeLine"> $this->fallbackAutoloaderFlag = (bool) $flag;</td></tr>
<tr class="danger"><td><div align="right"><a name="123"></a><a href="#123">123</a></div></td><td class="codeLine"> return $this;</td></tr>
<tr><td><div align="right"><a name="124"></a><a href="#124">124</a></div></td><td class="codeLine"> }</td></tr>
<tr><td><div align="right"><a name="125"></a><a href="#125">125</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="126"></a><a href="#126">126</a></div></td><td class="codeLine"> /**</td></tr>
<tr><td><div align="right"><a name="127"></a><a href="#127">127</a></div></td><td class="codeLine"> * Is this autoloader acting as a fallback autoloader?</td></tr>
<tr><td><div align="right"><a name="128"></a><a href="#128">128</a></div></td><td class="codeLine"> *</td></tr>
<tr><td><div align="right"><a name="129"></a><a href="#129">129</a></div></td><td class="codeLine"> * @return bool</td></tr>
<tr><td><div align="right"><a name="130"></a><a href="#130">130</a></div></td><td class="codeLine"> */</td></tr>
<tr><td><div align="right"><a name="131"></a><a href="#131">131</a></div></td><td class="codeLine"> public function isFallbackAutoloader()</td></tr>
<tr><td><div align="right"><a name="132"></a><a href="#132">132</a></div></td><td class="codeLine"> {</td></tr>
<tr class="success popin" data-title="2 tests cover line 133" data-content="<ul><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable</li><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="133"></a><a href="#133">133</a></div></td><td class="codeLine"> return $this->fallbackAutoloaderFlag;</td></tr>
<tr><td><div align="right"><a name="134"></a><a href="#134">134</a></div></td><td class="codeLine"> }</td></tr>
<tr><td><div align="right"><a name="135"></a><a href="#135">135</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="136"></a><a href="#136">136</a></div></td><td class="codeLine"> /**</td></tr>
<tr><td><div align="right"><a name="137"></a><a href="#137">137</a></div></td><td class="codeLine"> * Register a namespace/directory pair</td></tr>
<tr><td><div align="right"><a name="138"></a><a href="#138">138</a></div></td><td class="codeLine"> *</td></tr>
<tr><td><div align="right"><a name="139"></a><a href="#139">139</a></div></td><td class="codeLine"> * @param string $namespace</td></tr>
<tr><td><div align="right"><a name="140"></a><a href="#140">140</a></div></td><td class="codeLine"> * @param string $directory</td></tr>
<tr><td><div align="right"><a name="141"></a><a href="#141">141</a></div></td><td class="codeLine"> * @return StandardAutoloader</td></tr>
<tr><td><div align="right"><a name="142"></a><a href="#142">142</a></div></td><td class="codeLine"> */</td></tr>
<tr><td><div align="right"><a name="143"></a><a href="#143">143</a></div></td><td class="codeLine"> public function registerNamespace($namespace, $directory)</td></tr>
<tr><td><div align="right"><a name="144"></a><a href="#144">144</a></div></td><td class="codeLine"> {</td></tr>
<tr class="danger"><td><div align="right"><a name="145"></a><a href="#145">145</a></div></td><td class="codeLine"> $namespace = rtrim($namespace, self::NS_SEPARATOR) . self::NS_SEPARATOR;</td></tr>
<tr class="danger"><td><div align="right"><a name="146"></a><a href="#146">146</a></div></td><td class="codeLine"> $this->namespaces[$namespace] = $this->normalizeDirectory($directory);</td></tr>
<tr class="danger"><td><div align="right"><a name="147"></a><a href="#147">147</a></div></td><td class="codeLine"> return $this;</td></tr>
<tr><td><div align="right"><a name="148"></a><a href="#148">148</a></div></td><td class="codeLine"> }</td></tr>
<tr><td><div align="right"><a name="149"></a><a href="#149">149</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="150"></a><a href="#150">150</a></div></td><td class="codeLine"> /**</td></tr>
<tr><td><div align="right"><a name="151"></a><a href="#151">151</a></div></td><td class="codeLine"> * Register many namespace/directory pairs at once</td></tr>
<tr><td><div align="right"><a name="152"></a><a href="#152">152</a></div></td><td class="codeLine"> *</td></tr>
<tr><td><div align="right"><a name="153"></a><a href="#153">153</a></div></td><td class="codeLine"> * @param array $namespaces</td></tr>
<tr><td><div align="right"><a name="154"></a><a href="#154">154</a></div></td><td class="codeLine"> * @throws Exception\InvalidArgumentException</td></tr>
<tr><td><div align="right"><a name="155"></a><a href="#155">155</a></div></td><td class="codeLine"> * @return StandardAutoloader</td></tr>
<tr><td><div align="right"><a name="156"></a><a href="#156">156</a></div></td><td class="codeLine"> */</td></tr>
<tr><td><div align="right"><a name="157"></a><a href="#157">157</a></div></td><td class="codeLine"> public function registerNamespaces($namespaces)</td></tr>
<tr><td><div align="right"><a name="158"></a><a href="#158">158</a></div></td><td class="codeLine"> {</td></tr>
<tr class="danger"><td><div align="right"><a name="159"></a><a href="#159">159</a></div></td><td class="codeLine"> if (!is_array($namespaces) && !$namespaces instanceof \Traversable) {</td></tr>
<tr class="danger"><td><div align="right"><a name="160"></a><a href="#160">160</a></div></td><td class="codeLine"> require_once __DIR__ . '/Exception/InvalidArgumentException.php';</td></tr>
<tr class="danger"><td><div align="right"><a name="161"></a><a href="#161">161</a></div></td><td class="codeLine"> throw new Exception\InvalidArgumentException('Namespace pairs must be either an array or Traversable');</td></tr>
<tr><td><div align="right"><a name="162"></a><a href="#162">162</a></div></td><td class="codeLine"> }</td></tr>
<tr><td><div align="right"><a name="163"></a><a href="#163">163</a></div></td><td class="codeLine"></td></tr>
<tr class="danger"><td><div align="right"><a name="164"></a><a href="#164">164</a></div></td><td class="codeLine"> foreach ($namespaces as $namespace => $directory) {</td></tr>
<tr class="danger"><td><div align="right"><a name="165"></a><a href="#165">165</a></div></td><td class="codeLine"> $this->registerNamespace($namespace, $directory);</td></tr>
<tr class="danger"><td><div align="right"><a name="166"></a><a href="#166">166</a></div></td><td class="codeLine"> }</td></tr>
<tr class="danger"><td><div align="right"><a name="167"></a><a href="#167">167</a></div></td><td class="codeLine"> return $this;</td></tr>
<tr><td><div align="right"><a name="168"></a><a href="#168">168</a></div></td><td class="codeLine"> }</td></tr>
<tr><td><div align="right"><a name="169"></a><a href="#169">169</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="170"></a><a href="#170">170</a></div></td><td class="codeLine"> /**</td></tr>
<tr><td><div align="right"><a name="171"></a><a href="#171">171</a></div></td><td class="codeLine"> * Register a prefix/directory pair</td></tr>
<tr><td><div align="right"><a name="172"></a><a href="#172">172</a></div></td><td class="codeLine"> *</td></tr>
<tr><td><div align="right"><a name="173"></a><a href="#173">173</a></div></td><td class="codeLine"> * @param string $prefix</td></tr>
<tr><td><div align="right"><a name="174"></a><a href="#174">174</a></div></td><td class="codeLine"> * @param string $directory</td></tr>
<tr><td><div align="right"><a name="175"></a><a href="#175">175</a></div></td><td class="codeLine"> * @return StandardAutoloader</td></tr>
<tr><td><div align="right"><a name="176"></a><a href="#176">176</a></div></td><td class="codeLine"> */</td></tr>
<tr><td><div align="right"><a name="177"></a><a href="#177">177</a></div></td><td class="codeLine"> public function registerPrefix($prefix, $directory)</td></tr>
<tr><td><div align="right"><a name="178"></a><a href="#178">178</a></div></td><td class="codeLine"> {</td></tr>
<tr class="danger"><td><div align="right"><a name="179"></a><a href="#179">179</a></div></td><td class="codeLine"> $prefix = rtrim($prefix, self::PREFIX_SEPARATOR). self::PREFIX_SEPARATOR;</td></tr>
<tr class="danger"><td><div align="right"><a name="180"></a><a href="#180">180</a></div></td><td class="codeLine"> $this->prefixes[$prefix] = $this->normalizeDirectory($directory);</td></tr>
<tr class="danger"><td><div align="right"><a name="181"></a><a href="#181">181</a></div></td><td class="codeLine"> return $this;</td></tr>
<tr><td><div align="right"><a name="182"></a><a href="#182">182</a></div></td><td class="codeLine"> }</td></tr>
<tr><td><div align="right"><a name="183"></a><a href="#183">183</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="184"></a><a href="#184">184</a></div></td><td class="codeLine"> /**</td></tr>
<tr><td><div align="right"><a name="185"></a><a href="#185">185</a></div></td><td class="codeLine"> * Register many namespace/directory pairs at once</td></tr>
<tr><td><div align="right"><a name="186"></a><a href="#186">186</a></div></td><td class="codeLine"> *</td></tr>
<tr><td><div align="right"><a name="187"></a><a href="#187">187</a></div></td><td class="codeLine"> * @param array $prefixes</td></tr>
<tr><td><div align="right"><a name="188"></a><a href="#188">188</a></div></td><td class="codeLine"> * @throws Exception\InvalidArgumentException</td></tr>
<tr><td><div align="right"><a name="189"></a><a href="#189">189</a></div></td><td class="codeLine"> * @return StandardAutoloader</td></tr>
<tr><td><div align="right"><a name="190"></a><a href="#190">190</a></div></td><td class="codeLine"> */</td></tr>
<tr><td><div align="right"><a name="191"></a><a href="#191">191</a></div></td><td class="codeLine"> public function registerPrefixes($prefixes)</td></tr>
<tr><td><div align="right"><a name="192"></a><a href="#192">192</a></div></td><td class="codeLine"> {</td></tr>
<tr class="danger"><td><div align="right"><a name="193"></a><a href="#193">193</a></div></td><td class="codeLine"> if (!is_array($prefixes) && !$prefixes instanceof \Traversable) {</td></tr>
<tr class="danger"><td><div align="right"><a name="194"></a><a href="#194">194</a></div></td><td class="codeLine"> require_once __DIR__ . '/Exception/InvalidArgumentException.php';</td></tr>
<tr class="danger"><td><div align="right"><a name="195"></a><a href="#195">195</a></div></td><td class="codeLine"> throw new Exception\InvalidArgumentException('Prefix pairs must be either an array or Traversable');</td></tr>
<tr><td><div align="right"><a name="196"></a><a href="#196">196</a></div></td><td class="codeLine"> }</td></tr>
<tr><td><div align="right"><a name="197"></a><a href="#197">197</a></div></td><td class="codeLine"></td></tr>
<tr class="danger"><td><div align="right"><a name="198"></a><a href="#198">198</a></div></td><td class="codeLine"> foreach ($prefixes as $prefix => $directory) {</td></tr>
<tr class="danger"><td><div align="right"><a name="199"></a><a href="#199">199</a></div></td><td class="codeLine"> $this->registerPrefix($prefix, $directory);</td></tr>
<tr class="danger"><td><div align="right"><a name="200"></a><a href="#200">200</a></div></td><td class="codeLine"> }</td></tr>
<tr class="danger"><td><div align="right"><a name="201"></a><a href="#201">201</a></div></td><td class="codeLine"> return $this;</td></tr>
<tr><td><div align="right"><a name="202"></a><a href="#202">202</a></div></td><td class="codeLine"> }</td></tr>
<tr><td><div align="right"><a name="203"></a><a href="#203">203</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="204"></a><a href="#204">204</a></div></td><td class="codeLine"> /**</td></tr>
<tr><td><div align="right"><a name="205"></a><a href="#205">205</a></div></td><td class="codeLine"> * Defined by Autoloadable; autoload a class</td></tr>
<tr><td><div align="right"><a name="206"></a><a href="#206">206</a></div></td><td class="codeLine"> *</td></tr>
<tr><td><div align="right"><a name="207"></a><a href="#207">207</a></div></td><td class="codeLine"> * @param string $class</td></tr>
<tr><td><div align="right"><a name="208"></a><a href="#208">208</a></div></td><td class="codeLine"> * @return false|string</td></tr>
<tr><td><div align="right"><a name="209"></a><a href="#209">209</a></div></td><td class="codeLine"> */</td></tr>
<tr><td><div align="right"><a name="210"></a><a href="#210">210</a></div></td><td class="codeLine"> public function autoload($class)</td></tr>
<tr><td><div align="right"><a name="211"></a><a href="#211">211</a></div></td><td class="codeLine"> {</td></tr>
<tr class="success popin" data-title="2 tests cover line 212" data-content="<ul><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable</li><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="212"></a><a href="#212">212</a></div></td><td class="codeLine"> $isFallback = $this->isFallbackAutoloader();</td></tr>
<tr class="success popin" data-title="2 tests cover line 213" data-content="<ul><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable</li><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="213"></a><a href="#213">213</a></div></td><td class="codeLine"> if (false !== strpos($class, self::NS_SEPARATOR)) {</td></tr>
<tr class="success popin" data-title="2 tests cover line 214" data-content="<ul><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable</li><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="214"></a><a href="#214">214</a></div></td><td class="codeLine"> if ($this->loadClass($class, self::LOAD_NS)) {</td></tr>
<tr class="success popin" data-title="2 tests cover line 215" data-content="<ul><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable</li><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="215"></a><a href="#215">215</a></div></td><td class="codeLine"> return $class;</td></tr>
<tr class="danger"><td><div align="right"><a name="216"></a><a href="#216">216</a></div></td><td class="codeLine"> } elseif ($isFallback) {</td></tr>
<tr class="danger"><td><div align="right"><a name="217"></a><a href="#217">217</a></div></td><td class="codeLine"> return $this->loadClass($class, self::ACT_AS_FALLBACK);</td></tr>
<tr><td><div align="right"><a name="218"></a><a href="#218">218</a></div></td><td class="codeLine"> }</td></tr>
<tr class="danger"><td><div align="right"><a name="219"></a><a href="#219">219</a></div></td><td class="codeLine"> return false;</td></tr>
<tr><td><div align="right"><a name="220"></a><a href="#220">220</a></div></td><td class="codeLine"> }</td></tr>
<tr class="danger"><td><div align="right"><a name="221"></a><a href="#221">221</a></div></td><td class="codeLine"> if (false !== strpos($class, self::PREFIX_SEPARATOR)) {</td></tr>
<tr class="danger"><td><div align="right"><a name="222"></a><a href="#222">222</a></div></td><td class="codeLine"> if ($this->loadClass($class, self::LOAD_PREFIX)) {</td></tr>
<tr class="danger"><td><div align="right"><a name="223"></a><a href="#223">223</a></div></td><td class="codeLine"> return $class;</td></tr>
<tr class="danger"><td><div align="right"><a name="224"></a><a href="#224">224</a></div></td><td class="codeLine"> } elseif ($isFallback) {</td></tr>
<tr class="danger"><td><div align="right"><a name="225"></a><a href="#225">225</a></div></td><td class="codeLine"> return $this->loadClass($class, self::ACT_AS_FALLBACK);</td></tr>
<tr><td><div align="right"><a name="226"></a><a href="#226">226</a></div></td><td class="codeLine"> }</td></tr>
<tr class="danger"><td><div align="right"><a name="227"></a><a href="#227">227</a></div></td><td class="codeLine"> return false;</td></tr>
<tr><td><div align="right"><a name="228"></a><a href="#228">228</a></div></td><td class="codeLine"> }</td></tr>
<tr class="danger"><td><div align="right"><a name="229"></a><a href="#229">229</a></div></td><td class="codeLine"> if ($isFallback) {</td></tr>
<tr class="danger"><td><div align="right"><a name="230"></a><a href="#230">230</a></div></td><td class="codeLine"> return $this->loadClass($class, self::ACT_AS_FALLBACK);</td></tr>
<tr><td><div align="right"><a name="231"></a><a href="#231">231</a></div></td><td class="codeLine"> }</td></tr>
<tr class="danger"><td><div align="right"><a name="232"></a><a href="#232">232</a></div></td><td class="codeLine"> return false;</td></tr>
<tr><td><div align="right"><a name="233"></a><a href="#233">233</a></div></td><td class="codeLine"> }</td></tr>
<tr><td><div align="right"><a name="234"></a><a href="#234">234</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="235"></a><a href="#235">235</a></div></td><td class="codeLine"> /**</td></tr>
<tr><td><div align="right"><a name="236"></a><a href="#236">236</a></div></td><td class="codeLine"> * Register the autoloader with spl_autoload</td></tr>
<tr><td><div align="right"><a name="237"></a><a href="#237">237</a></div></td><td class="codeLine"> *</td></tr>
<tr><td><div align="right"><a name="238"></a><a href="#238">238</a></div></td><td class="codeLine"> * @return void</td></tr>
<tr><td><div align="right"><a name="239"></a><a href="#239">239</a></div></td><td class="codeLine"> */</td></tr>
<tr><td><div align="right"><a name="240"></a><a href="#240">240</a></div></td><td class="codeLine"> public function register()</td></tr>
<tr><td><div align="right"><a name="241"></a><a href="#241">241</a></div></td><td class="codeLine"> {</td></tr>
<tr class="danger"><td><div align="right"><a name="242"></a><a href="#242">242</a></div></td><td class="codeLine"> spl_autoload_register(array($this, 'autoload'));</td></tr>
<tr class="danger"><td><div align="right"><a name="243"></a><a href="#243">243</a></div></td><td class="codeLine"> }</td></tr>
<tr><td><div align="right"><a name="244"></a><a href="#244">244</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="245"></a><a href="#245">245</a></div></td><td class="codeLine"> /**</td></tr>
<tr><td><div align="right"><a name="246"></a><a href="#246">246</a></div></td><td class="codeLine"> * Transform the class name to a filename</td></tr>
<tr><td><div align="right"><a name="247"></a><a href="#247">247</a></div></td><td class="codeLine"> *</td></tr>
<tr><td><div align="right"><a name="248"></a><a href="#248">248</a></div></td><td class="codeLine"> * @param string $class</td></tr>
<tr><td><div align="right"><a name="249"></a><a href="#249">249</a></div></td><td class="codeLine"> * @param string $directory</td></tr>
<tr><td><div align="right"><a name="250"></a><a href="#250">250</a></div></td><td class="codeLine"> * @return string</td></tr>
<tr><td><div align="right"><a name="251"></a><a href="#251">251</a></div></td><td class="codeLine"> */</td></tr>
<tr><td><div align="right"><a name="252"></a><a href="#252">252</a></div></td><td class="codeLine"> protected function transformClassNameToFilename($class, $directory)</td></tr>
<tr><td><div align="right"><a name="253"></a><a href="#253">253</a></div></td><td class="codeLine"> {</td></tr>
<tr><td><div align="right"><a name="254"></a><a href="#254">254</a></div></td><td class="codeLine"> // $class may contain a namespace portion, in which case we need</td></tr>
<tr><td><div align="right"><a name="255"></a><a href="#255">255</a></div></td><td class="codeLine"> // to preserve any underscores in that portion.</td></tr>
<tr class="success popin" data-title="2 tests cover line 256" data-content="<ul><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable</li><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="256"></a><a href="#256">256</a></div></td><td class="codeLine"> $matches = array();</td></tr>
<tr class="success popin" data-title="2 tests cover line 257" data-content="<ul><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable</li><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="257"></a><a href="#257">257</a></div></td><td class="codeLine"> preg_match('/(?P<namespace>.+\\\)?(?P<class>[^\\\]+$)/', $class, $matches);</td></tr>
<tr><td><div align="right"><a name="258"></a><a href="#258">258</a></div></td><td class="codeLine"></td></tr>
<tr class="success popin" data-title="2 tests cover line 259" data-content="<ul><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable</li><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="259"></a><a href="#259">259</a></div></td><td class="codeLine"> $class = (isset($matches['class'])) ? $matches['class'] : '';</td></tr>
<tr class="success popin" data-title="2 tests cover line 260" data-content="<ul><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable</li><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="260"></a><a href="#260">260</a></div></td><td class="codeLine"> $namespace = (isset($matches['namespace'])) ? $matches['namespace'] : '';</td></tr>
<tr><td><div align="right"><a name="261"></a><a href="#261">261</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="262"></a><a href="#262">262</a></div></td><td class="codeLine"> return $directory</td></tr>
<tr class="success popin" data-title="2 tests cover line 263" data-content="<ul><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable</li><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="263"></a><a href="#263">263</a></div></td><td class="codeLine"> . str_replace(self::NS_SEPARATOR, '/', $namespace)</td></tr>
<tr class="success popin" data-title="2 tests cover line 264" data-content="<ul><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable</li><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="264"></a><a href="#264">264</a></div></td><td class="codeLine"> . str_replace(self::PREFIX_SEPARATOR, '/', $class)</td></tr>
<tr class="success popin" data-title="2 tests cover line 265" data-content="<ul><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable</li><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="265"></a><a href="#265">265</a></div></td><td class="codeLine"> . '.php';</td></tr>
<tr><td><div align="right"><a name="266"></a><a href="#266">266</a></div></td><td class="codeLine"> }</td></tr>
<tr><td><div align="right"><a name="267"></a><a href="#267">267</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="268"></a><a href="#268">268</a></div></td><td class="codeLine"> /**</td></tr>
<tr><td><div align="right"><a name="269"></a><a href="#269">269</a></div></td><td class="codeLine"> * Load a class, based on its type (namespaced or prefixed)</td></tr>
<tr><td><div align="right"><a name="270"></a><a href="#270">270</a></div></td><td class="codeLine"> *</td></tr>
<tr><td><div align="right"><a name="271"></a><a href="#271">271</a></div></td><td class="codeLine"> * @param string $class</td></tr>
<tr><td><div align="right"><a name="272"></a><a href="#272">272</a></div></td><td class="codeLine"> * @param string $type</td></tr>
<tr><td><div align="right"><a name="273"></a><a href="#273">273</a></div></td><td class="codeLine"> * @return bool|string</td></tr>
<tr><td><div align="right"><a name="274"></a><a href="#274">274</a></div></td><td class="codeLine"> * @throws Exception\InvalidArgumentException</td></tr>
<tr><td><div align="right"><a name="275"></a><a href="#275">275</a></div></td><td class="codeLine"> */</td></tr>
<tr><td><div align="right"><a name="276"></a><a href="#276">276</a></div></td><td class="codeLine"> protected function loadClass($class, $type)</td></tr>
<tr><td><div align="right"><a name="277"></a><a href="#277">277</a></div></td><td class="codeLine"> {</td></tr>
<tr class="success popin" data-title="2 tests cover line 278" data-content="<ul><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable</li><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="278"></a><a href="#278">278</a></div></td><td class="codeLine"> if (!in_array($type, array(self::LOAD_NS, self::LOAD_PREFIX, self::ACT_AS_FALLBACK))) {</td></tr>
<tr class="danger"><td><div align="right"><a name="279"></a><a href="#279">279</a></div></td><td class="codeLine"> require_once __DIR__ . '/Exception/InvalidArgumentException.php';</td></tr>
<tr class="danger"><td><div align="right"><a name="280"></a><a href="#280">280</a></div></td><td class="codeLine"> throw new Exception\InvalidArgumentException();</td></tr>
<tr><td><div align="right"><a name="281"></a><a href="#281">281</a></div></td><td class="codeLine"> }</td></tr>
<tr><td><div align="right"><a name="282"></a><a href="#282">282</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="283"></a><a href="#283">283</a></div></td><td class="codeLine"> // Fallback autoloading</td></tr>
<tr class="success popin" data-title="2 tests cover line 284" data-content="<ul><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable</li><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="284"></a><a href="#284">284</a></div></td><td class="codeLine"> if ($type === self::ACT_AS_FALLBACK) {</td></tr>
<tr><td><div align="right"><a name="285"></a><a href="#285">285</a></div></td><td class="codeLine"> // create filename</td></tr>
<tr class="danger"><td><div align="right"><a name="286"></a><a href="#286">286</a></div></td><td class="codeLine"> $filename = $this->transformClassNameToFilename($class, '');</td></tr>
<tr class="danger"><td><div align="right"><a name="287"></a><a href="#287">287</a></div></td><td class="codeLine"> $resolvedName = stream_resolve_include_path($filename);</td></tr>
<tr class="danger"><td><div align="right"><a name="288"></a><a href="#288">288</a></div></td><td class="codeLine"> if ($resolvedName !== false) {</td></tr>
<tr class="danger"><td><div align="right"><a name="289"></a><a href="#289">289</a></div></td><td class="codeLine"> return include $resolvedName;</td></tr>
<tr><td><div align="right"><a name="290"></a><a href="#290">290</a></div></td><td class="codeLine"> }</td></tr>
<tr class="danger"><td><div align="right"><a name="291"></a><a href="#291">291</a></div></td><td class="codeLine"> return false;</td></tr>
<tr><td><div align="right"><a name="292"></a><a href="#292">292</a></div></td><td class="codeLine"> }</td></tr>
<tr><td><div align="right"><a name="293"></a><a href="#293">293</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="294"></a><a href="#294">294</a></div></td><td class="codeLine"> // Namespace and/or prefix autoloading</td></tr>
<tr class="success popin" data-title="2 tests cover line 295" data-content="<ul><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable</li><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="295"></a><a href="#295">295</a></div></td><td class="codeLine"> foreach ($this->$type as $leader => $path) {</td></tr>
<tr class="success popin" data-title="2 tests cover line 296" data-content="<ul><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable</li><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="296"></a><a href="#296">296</a></div></td><td class="codeLine"> if (0 === strpos($class, $leader)) {</td></tr>
<tr><td><div align="right"><a name="297"></a><a href="#297">297</a></div></td><td class="codeLine"> // Trim off leader (namespace or prefix)</td></tr>
<tr class="success popin" data-title="2 tests cover line 298" data-content="<ul><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable</li><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="298"></a><a href="#298">298</a></div></td><td class="codeLine"> $trimmedClass = substr($class, strlen($leader));</td></tr>
<tr><td><div align="right"><a name="299"></a><a href="#299">299</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="300"></a><a href="#300">300</a></div></td><td class="codeLine"> // create filename</td></tr>
<tr class="success popin" data-title="2 tests cover line 301" data-content="<ul><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable</li><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="301"></a><a href="#301">301</a></div></td><td class="codeLine"> $filename = $this->transformClassNameToFilename($trimmedClass, $path);</td></tr>
<tr class="success popin" data-title="2 tests cover line 302" data-content="<ul><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable</li><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="302"></a><a href="#302">302</a></div></td><td class="codeLine"> if (file_exists($filename)) {</td></tr>
<tr class="success popin" data-title="2 tests cover line 303" data-content="<ul><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable</li><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="303"></a><a href="#303">303</a></div></td><td class="codeLine"> return include $filename;</td></tr>
<tr><td><div align="right"><a name="304"></a><a href="#304">304</a></div></td><td class="codeLine"> }</td></tr>
<tr class="danger"><td><div align="right"><a name="305"></a><a href="#305">305</a></div></td><td class="codeLine"> return false;</td></tr>
<tr><td><div align="right"><a name="306"></a><a href="#306">306</a></div></td><td class="codeLine"> }</td></tr>
<tr class="success popin" data-title="2 tests cover line 307" data-content="<ul><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable</li><li class="success">AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="307"></a><a href="#307">307</a></div></td><td class="codeLine"> }</td></tr>
<tr class="danger"><td><div align="right"><a name="308"></a><a href="#308">308</a></div></td><td class="codeLine"> return false;</td></tr>
<tr><td><div align="right"><a name="309"></a><a href="#309">309</a></div></td><td class="codeLine"> }</td></tr>
<tr><td><div align="right"><a name="310"></a><a href="#310">310</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="311"></a><a href="#311">311</a></div></td><td class="codeLine"> /**</td></tr>
<tr><td><div align="right"><a name="312"></a><a href="#312">312</a></div></td><td class="codeLine"> * Normalize the directory to include a trailing directory separator</td></tr>
<tr><td><div align="right"><a name="313"></a><a href="#313">313</a></div></td><td class="codeLine"> *</td></tr>
<tr><td><div align="right"><a name="314"></a><a href="#314">314</a></div></td><td class="codeLine"> * @param string $directory</td></tr>
<tr><td><div align="right"><a name="315"></a><a href="#315">315</a></div></td><td class="codeLine"> * @return string</td></tr>
<tr><td><div align="right"><a name="316"></a><a href="#316">316</a></div></td><td class="codeLine"> */</td></tr>
<tr><td><div align="right"><a name="317"></a><a href="#317">317</a></div></td><td class="codeLine"> protected function normalizeDirectory($directory)</td></tr>
<tr><td><div align="right"><a name="318"></a><a href="#318">318</a></div></td><td class="codeLine"> {</td></tr>
<tr class="danger"><td><div align="right"><a name="319"></a><a href="#319">319</a></div></td><td class="codeLine"> $last = $directory[strlen($directory) - 1];</td></tr>
<tr class="danger"><td><div align="right"><a name="320"></a><a href="#320">320</a></div></td><td class="codeLine"> if (in_array($last, array('/', '\\'))) {</td></tr>
<tr class="danger"><td><div align="right"><a name="321"></a><a href="#321">321</a></div></td><td class="codeLine"> $directory[strlen($directory) - 1] = DIRECTORY_SEPARATOR;</td></tr>
<tr class="danger"><td><div align="right"><a name="322"></a><a href="#322">322</a></div></td><td class="codeLine"> return $directory;</td></tr>
<tr><td><div align="right"><a name="323"></a><a href="#323">323</a></div></td><td class="codeLine"> }</td></tr>
<tr class="danger"><td><div align="right"><a name="324"></a><a href="#324">324</a></div></td><td class="codeLine"> $directory .= DIRECTORY_SEPARATOR;</td></tr>
<tr class="danger"><td><div align="right"><a name="325"></a><a href="#325">325</a></div></td><td class="codeLine"> return $directory;</td></tr>
<tr><td><div align="right"><a name="326"></a><a href="#326">326</a></div></td><td class="codeLine"> }</td></tr>
<tr><td><div align="right"><a name="327"></a><a href="#327">327</a></div></td><td class="codeLine">}</td></tr>
</tbody>
</table>
<footer>
<h4>Legend</h4>
<p>
<span class="success"><strong>Executed</strong></span>
<span class="danger"><strong>Not Executed</strong></span>
<span class="warning"><strong>Dead Code</strong></span>
</p>
<p>
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 1.2.13</a> using <a href="http://www.php.net/" target="_top">PHP 5.6.0-1+deb.sury.org~trusty+1</a> and <a href="http://phpunit.de/">PHPUnit 3.7.28</a> at Wed Oct 8 12:51:47 AMT 2014.</small>
</p>
</footer>
</div>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script type="text/javascript">$('.popin').popover({trigger: 'hover'});</script>
</body>
</html>
|
Java
|
<@row>
<@columns>
<@box color='success'>
<@boxHeader title='#i18n{portal.users.create_attribute.pageTitleAttributeImage}' />
<@boxBody>
<@tform action='jsp/admin/user/attribute/DoCreateAttribute.jsp' method='post'>
<@input type='hidden' name='token' value='${token}' />
<@input type='hidden' name='attribute_type_class_name' value='${attribute_type.className}' />
<@formGroup labelKey='#i18n{portal.users.create_attribute.labelTitle} *' labelFor='attr_title' helpKey='#i18n{portal.users.create_attribute.labelTitleComment}' mandatory=true>
<@input type='text' name='title' id='attr_title' maxlength=255 />
</@formGroup>
<@formGroup labelKey='#i18n{portal.users.create_attribute.labelHelpMessage}' labelFor='help_message' helpKey='#i18n{portal.users.create_attribute.labelHelpMessageComment}'>
<@input type='textarea' name='help_message' id='help_message' cols=80 rows=5 />
</@formGroup>
<@formGroup>
<@checkBox name='is_shown_in_result_list' id='is_shown_in_result_list' labelKey='#i18n{portal.users.create_attribute.labelIsShownInResultList}' value='1' />
</@formGroup>
<@formGroup>
<@checkBox name='mandatory' id='mandatory' labelKey='#i18n{portal.users.create_attribute.labelMandatory}' value='1' />
</@formGroup>
<@formGroup labelKey='#i18n{portal.users.create_attribute.labelWidth}' labelFor='width'>
<@input type='text' name='width' id='width' value='50' />
</@formGroup>
<@formGroup labelKey='#i18n{portal.users.create_attribute.labelHeight}' labelFor='height'>
<@input type='text' name='height' id='height' value='50' />
</@formGroup>
<@formGroup>
<@button type='submit' name='save' value='save' buttonIcon='check' title='#i18n{portal.users.create_attribute.buttonValidate}' size='' />
<@button type='submit' name='apply' value='apply' buttonIcon='check' title='#i18n{portal.users.create_attribute.buttonApply}' size='' />
<@button type='submit' name='cancel' value='cancel' buttonIcon='times' title='#i18n{portal.admin.message.buttonCancel}' cancel=true size='' />
</@formGroup>
</@tform>
</@boxBody>
</@box>
</@columns>
</@row>
|
Java
|
// Copyright (c) 2012 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_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_
#define CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_
#include <memory>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "build/chromeos_buildflags.h"
#include "chrome/common/renderer_configuration.mojom.h"
#include "components/content_settings/common/content_settings_manager.mojom.h"
#include "components/content_settings/core/common/content_settings.h"
#include "content/public/renderer/render_thread_observer.h"
#include "mojo/public/cpp/bindings/associated_receiver_set.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/renderer/chromeos_delayed_callback_group.h"
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
namespace blink {
class WebResourceRequestSenderDelegate;
} // namespace blink
namespace visitedlink {
class VisitedLinkReader;
}
// This class filters the incoming control messages (i.e. ones not destined for
// a RenderView) for Chrome specific messages that the content layer doesn't
// happen. If a few messages are related, they should probably have their own
// observer.
class ChromeRenderThreadObserver : public content::RenderThreadObserver,
public chrome::mojom::RendererConfiguration {
public:
#if BUILDFLAG(IS_CHROMEOS_ASH)
// A helper class to handle Mojo calls that need to be dispatched to the IO
// thread instead of the main thread as is the norm.
// This class is thread-safe.
class ChromeOSListener : public chrome::mojom::ChromeOSListener,
public base::RefCountedThreadSafe<ChromeOSListener> {
public:
static scoped_refptr<ChromeOSListener> Create(
mojo::PendingReceiver<chrome::mojom::ChromeOSListener>
chromeos_listener_receiver);
ChromeOSListener(const ChromeOSListener&) = delete;
ChromeOSListener& operator=(const ChromeOSListener&) = delete;
// Is the merge session still running?
bool IsMergeSessionRunning() const;
// Run |callback| on the calling sequence when the merge session has
// finished (or timed out).
void RunWhenMergeSessionFinished(DelayedCallbackGroup::Callback callback);
protected:
// chrome::mojom::ChromeOSListener:
void MergeSessionComplete() override;
private:
friend class base::RefCountedThreadSafe<ChromeOSListener>;
ChromeOSListener();
~ChromeOSListener() override;
void BindOnIOThread(mojo::PendingReceiver<chrome::mojom::ChromeOSListener>
chromeos_listener_receiver);
scoped_refptr<DelayedCallbackGroup> session_merged_callbacks_;
bool merge_session_running_ GUARDED_BY(lock_);
mutable base::Lock lock_;
mojo::Receiver<chrome::mojom::ChromeOSListener> receiver_{this};
};
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
ChromeRenderThreadObserver();
ChromeRenderThreadObserver(const ChromeRenderThreadObserver&) = delete;
ChromeRenderThreadObserver& operator=(const ChromeRenderThreadObserver&) =
delete;
~ChromeRenderThreadObserver() override;
static bool is_incognito_process() { return is_incognito_process_; }
// Return the dynamic parameters - those that may change while the
// render process is running.
static const chrome::mojom::DynamicParams& GetDynamicParams();
// Returns a pointer to the content setting rules owned by
// |ChromeRenderThreadObserver|.
const RendererContentSettingRules* content_setting_rules() const;
visitedlink::VisitedLinkReader* visited_link_reader() {
return visited_link_reader_.get();
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
scoped_refptr<ChromeOSListener> chromeos_listener() const {
return chromeos_listener_;
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
content_settings::mojom::ContentSettingsManager* content_settings_manager() {
if (content_settings_manager_)
return content_settings_manager_.get();
return nullptr;
}
private:
// content::RenderThreadObserver:
void RegisterMojoInterfaces(
blink::AssociatedInterfaceRegistry* associated_interfaces) override;
void UnregisterMojoInterfaces(
blink::AssociatedInterfaceRegistry* associated_interfaces) override;
// chrome::mojom::RendererConfiguration:
void SetInitialConfiguration(
bool is_incognito_process,
mojo::PendingReceiver<chrome::mojom::ChromeOSListener>
chromeos_listener_receiver,
mojo::PendingRemote<content_settings::mojom::ContentSettingsManager>
content_settings_manager) override;
void SetConfiguration(chrome::mojom::DynamicParamsPtr params) override;
void SetContentSettingRules(
const RendererContentSettingRules& rules) override;
void OnRendererConfigurationAssociatedRequest(
mojo::PendingAssociatedReceiver<chrome::mojom::RendererConfiguration>
receiver);
static bool is_incognito_process_;
std::unique_ptr<blink::WebResourceRequestSenderDelegate>
resource_request_sender_delegate_;
RendererContentSettingRules content_setting_rules_;
mojo::Remote<content_settings::mojom::ContentSettingsManager>
content_settings_manager_;
std::unique_ptr<visitedlink::VisitedLinkReader> visited_link_reader_;
mojo::AssociatedReceiverSet<chrome::mojom::RendererConfiguration>
renderer_configuration_receivers_;
#if BUILDFLAG(IS_CHROMEOS_ASH)
// Only set if the Chrome OS merge session was running when the renderer
// was started.
scoped_refptr<ChromeOSListener> chromeos_listener_;
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
};
#endif // CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_
|
Java
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_alloca_memcpy_82_bad.cpp
Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE805.label.xml
Template File: sources-sink-82_bad.tmpl.cpp
*/
/*
* @description
* CWE: 121 Stack Based Buffer Overflow
* BadSource: Set data pointer to the bad buffer
* GoodSource: Set data pointer to the good buffer
* Sinks: memcpy
* BadSink : Copy twoIntsStruct array to data using memcpy
* Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer
*
* */
#ifndef OMITBAD
#include "std_testcase.h"
#include "CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_alloca_memcpy_82.h"
namespace CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_alloca_memcpy_82
{
void CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_alloca_memcpy_82_bad::action(twoIntsStruct * data)
{
{
twoIntsStruct source[100];
{
size_t i;
/* Initialize array */
for (i = 0; i < 100; i++)
{
source[i].intOne = 0;
source[i].intTwo = 0;
}
}
/* POTENTIAL FLAW: Possible buffer overflow if data < 100 */
memcpy(data, source, 100*sizeof(twoIntsStruct));
printStructLine(&data[0]);
}
}
}
#endif /* OMITBAD */
|
Java
|
# -*- coding: utf-8 -*-
"""
Display a fortune-telling, swimming fish.
Wanda has no use what-so-ever. It only takes up disk space and compilation time,
and if loaded, it also takes up precious bar space, memory, and cpu cycles.
Anybody found using it should be promptly sent for a psychiatric evaluation.
Configuration parameters:
cache_timeout: refresh interval for this module (default 0)
format: display format for this module
(default '{nomotion}[{fortune} ]{wanda}{motion}')
fortune_timeout: refresh interval for fortune (default 60)
Format placeholders:
{fortune} one of many aphorisms or vague prophecies
{wanda} name of one of the most commonly kept freshwater aquarium fish
{motion} biologically propelled motion through a liquid medium
{nomotion} opposite behavior of motion to prevent modules from shifting
Optional:
fortune-mod: the fortune cookie program from bsd games
Examples:
```
# disable motions when not in use
wanda_the_fish {
format = '[\?if=fortune {nomotion}][{fortune} ]'
format += '{wanda}[\?if=fortune {motion}]'
}
# no updates, no motions, yes fortunes, you click
wanda_the_fish {
format = '[{fortune} ]{wanda}'
cache_timeout = -1
}
# wanda moves, fortunes stays
wanda_the_fish {
format = '[{fortune} ]{nomotion}{wanda}{motion}'
}
# wanda is swimming too fast, slow down wanda
wanda_the_fish {
cache_timeout = 2
}
```
@author lasers
SAMPLE OUTPUT
[
{'full_text': 'innovate, v.: To annoy people.'},
{'full_text': ' <', 'color': '#ffa500'},
{'full_text': '\xba', 'color': '#add8e6'},
{'full_text': ',', 'color': '#ff8c00'},
{'full_text': '))', 'color': '#ffa500'},
{'full_text': '))>< ', 'color': '#ff8c00'},
]
idle
[
{'full_text': ' <', 'color': '#ffa500'},
{'full_text': '\xba', 'color': '#add8e6'},
{'full_text': ',', 'color': '#ff8c00'},
{'full_text': '))', 'color': '#ffa500'},
{'full_text': '))>3', 'color': '#ff8c00'},
]
py3status
[
{'full_text': 'py3status is so cool!'},
{'full_text': ' <', 'color': '#ffa500'},
{'full_text': '\xba', 'color': '#add8e6'},
{'full_text': ',', 'color': '#ff8c00'},
{'full_text': '))', 'color': '#ffa500'},
{'full_text': '))>< ', 'color': '#ff8c00'},
]
"""
from time import time
class Py3status:
"""
"""
# available configuration parameters
cache_timeout = 0
format = "{nomotion}[{fortune} ]{wanda}{motion}"
fortune_timeout = 60
def post_config_hook(self):
body = (
"[\?color=orange&show <"
"[\?color=lightblue&show º]"
"[\?color=darkorange&show ,]))"
"[\?color=darkorange&show ))>%s]]"
)
wanda = [body % fin for fin in ("<", ">", "<", "3")]
self.wanda = [self.py3.safe_format(x) for x in wanda]
self.wanda_length = len(self.wanda)
self.index = 0
self.fortune_command = ["fortune", "-as"]
self.fortune = self.py3.storage_get("fortune") or None
self.toggled = self.py3.storage_get("toggled") or False
self.motions = {"motion": " ", "nomotion": ""}
# deal with {new,old} timeout between storage
fortune_timeout = self.py3.storage_get("fortune_timeout")
timeout = None
if self.fortune_timeout != fortune_timeout:
timeout = time() + self.fortune_timeout
self.time = (
timeout or self.py3.storage_get("time") or (time() + self.fortune_timeout)
)
def _set_fortune(self, state=None, new=False):
if not self.fortune_command:
return
if new:
try:
fortune_data = self.py3.command_output(self.fortune_command)
except self.py3.CommandError:
self.fortune = ""
self.fortune_command = None
else:
self.fortune = " ".join(fortune_data.split())
self.time = time() + self.fortune_timeout
elif state is None:
if self.toggled and time() >= self.time:
self._set_fortune(new=True)
else:
self.toggled = state
if state:
self._set_fortune(new=True)
else:
self.fortune = None
def _set_motion(self):
for k in self.motions:
self.motions[k] = "" if self.motions[k] else " "
def _set_wanda(self):
self.index += 1
if self.index >= self.wanda_length:
self.index = 0
def wanda_the_fish(self):
self._set_fortune()
self._set_motion()
self._set_wanda()
return {
"cached_until": self.py3.time_in(self.cache_timeout),
"full_text": self.py3.safe_format(
self.format,
{
"fortune": self.fortune,
"motion": self.motions["motion"],
"nomotion": self.motions["nomotion"],
"wanda": self.wanda[self.index],
},
),
}
def kill(self):
self.py3.storage_set("toggled", self.toggled)
self.py3.storage_set("fortune", self.fortune)
self.py3.storage_set("fortune_timeout", self.fortune_timeout)
self.py3.storage_set("time", self.time)
def on_click(self, event):
if not self.fortune_command:
return
self._set_fortune(not self.toggled)
if __name__ == "__main__":
"""
Run module in test mode.
"""
from py3status.module_test import module_test
module_test(Py3status)
|
Java
|
[简体中文](README_ZH.md)
# rawbuf - Scalable & Efficient Serialization Library #

`rawbuf` is a powerful tool kit used in object serialization and deserialization with **full automation** feature, all new design based on [YAS](https://github.com/jobs-github/yas).
The design of rawbuf:

## What is rawbuf ? ##
`rawbuf` is inspired by [flatbuffers](https://github.com/google/flatbuffers) and [slothjson](https://github.com/jobs-github/slothjson). `flatbuffers` is efficient enough but not so stupid & succinct, while `slothjson` is stupid & succinct enough but not so efficient. That is what `rawbuf` needs to do.
`rawbuf` uses flatbuffers-like protocol to describe data, and uses [YAS](https://github.com/jobs-github/yas) for automation. So it is faster than `slothjson` and easier than `flatbuffers`.
Please refer to [slothjson](https://github.com/jobs-github/slothjson) for more details.
## Features ##
* Efficient (4x faster than `slothjson`)
* Succinct interface for people (everything can be done with just a single line of code)
* Simple, powerful code generator with full automation (not need to implement serialize/deserialize interfaces manually)
* Support optional field (easy to serialize/deserialize field optionally)
* Flexible schema (support array, dict, nested object and **nested array & dict**)
* Succinct design (no tricky C++ template technology, easy to understand), reusable, extensible (easy to support new types)
* Cross-Platform (Windows & Linux & OS X)
## Usage ##
Take C++ implement of rawbuf as an example. In the beginning, you need to add the following items to your project:
* `rawbuf`: refer to `cpp/include/rawbuf.h` and `cpp/include/rawbuf.cpp`, the library of rawbuf
**That's all the dependency**.
Then, write a schema named `fxxx_gfw.json`:
{
"structs":
[
{
"type": "fxxx_gfw_t",
"members":
[
["bool", "bool_val", "100"],
["int8_t", "int8_val"],
["int32_t", "int32_val"],
["uint64_t", "uint64_val"],
["double", "double_val", "101"],
["string", "str_val"],
["[int32_t]", "vec_val", "110"],
["{string}", "dict_val"]
]
}
]
}
Run command line:
python cpp/generator/rawbuf.py -f cpp/src/fxxx_gfw.json
It will generate `fxxx_gfw.h` and `fxxx_gfw.cpp`, which you need to add to your project.
Then you can code like this:
rawbuf::fxxx_gfw_t obj_val;
// set the value of "obj_val"
......
// output as instance of "rb_buf_t"
rawbuf::rb_buf_t rb_val = rawbuf::rb_create_buf(rawbuf::rb_sizeof(obj_val));
bool rc = rawbuf::rb_encode(obj_val, rb_val);
// use value of "rb_val"
......
rawbuf::rb_dispose_buf(rb_val); // do not forget!
// output as file
std::string path = "fxxx_gfw_t.bin";
bool rc = rawbuf::rb_dump(obj_val, path);
If you don't want to serialize all fields, code like this:
obj_val.skip_dict_val(); // call "skip_xxx"
The same as deserialize:
rawbuf::rb_buf_t rb_val = rawbuf::rb_create_buf(rawbuf::rb_sizeof(obj_val));
// set the value of "rb_val"
......
// load from "rb_val"
rawbuf::fxxx_gfw_t obj_val;
bool rc = rawbuf::rb_decode(rb_val, 0, obj_val);
......
rawbuf::rb_dispose_buf(rb_val); // do not forget!
// load from file
std::string path = "fxxx_gfw_t.bin";
rawbuf::fxxx_gfw_t obj_val;
bool rc = rawbuf::rb_load(path, obj_val);
After deserialized, if you need to know **whether a field is in binary buffer or not**, code like this:
if (obj_val.rb_has_dict_val()) // call "rb_has_xxx()"
{
......
}
That's all about the usage, simple & stupid, isn't it ?
## Supported Programming Languages ##
* C++
* C
* Go
I implement rawbuf using php & python, but not merge to master branch as the performance does not come up to expectation. Welcome contribution on other programming languages' implementation.
* [php-alpha](https://github.com/jobs-github/rawbuf/tree/php-alpha)
* [python-alpha](https://github.com/jobs-github/rawbuf/tree/python-alpha)
* [php-beta](https://github.com/jobs-github/rawbuf/tree/php-beta)
* [python-beta](https://github.com/jobs-github/rawbuf/tree/python-beta)
Note: the performance of `beta` is better than `alpha`.
## Implement on YAS Extension ##
Language | Implement YAS Extension
--------------|-------------------------
C++ | Yes
C | No
go | No
php-alpha | Yes
python-alpha | Yes
php-beta | No
python-beta | No
## Platforms ##
Platform | Description
---------|----------------------------------------------------------
Linux | CentOS 6.x & Ubuntu 10.04 (kernel 2.6.32) GCC 4.4.7
Win32 | Windows 7, MSVC 10.0
OS X | Mac OS X EI Capitan, GCC 4.2.1, Apple LLVM version 7.3.0
## Performance ##
## Details ##
`rawbuf` and `slothjson` share the **same design, same schema**. The difference between them is the protocol (`text` vs `binary`) and performance.
You can get all details from [here](https://github.com/jobs-github/slothjson) and [here](https://github.com/jobs-github/yas)
## Protocol ##
### scalar ###

### string ###

### object ###

### array ###

### dict ###

## License ##
`rawbuf` is licensed under [New BSD License](https://opensource.org/licenses/BSD-3-Clause), a very flexible license to use.
## Author ##
* chengzhuo (jobs, yao050421103@163.com)
## More ##
- Yet Another Schema - [YAS](https://github.com/jobs-github/yas)
- Object Serialization Artifact For Lazy Man - [slothjson](https://github.com/jobs-github/slothjson)
- High-performance Distributed Storage - [huststore](https://github.com/Qihoo360/huststore)
|
Java
|
/****************************************************************************/
/* */
/* Module: LegTrnaslationFuncs.h */
/* */
/* Description: This module provides compatibility support to allow */
/* QST 2.x applications run on QST 1.x firmware. */
/* */
/****************************************************************************/
/****************************************************************************/
/* */
/* Copyright (c) 2005-2009, Intel Corporation. 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 Intel Corporation nor the names of its */
/* contributors may be used to endorse or promote products derived */
/* from this software without specific prior written permission. */
/* */
/* DISCLAIMER: 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 */
/* INTEL CORPORATION OR THE 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 _LEG_TRANSLATION_FUNCS_H
#define _LEG_TRANSLATION_FUNCS_H
// Error platform independent error codes for using this module
typedef enum
{
TRANSLATE_CMD_SUCCESS = 0,
TRANSLATE_CMD_INVALID_PARAMETER,
TRANSLATE_CMD_BAD_COMMAND,
TRANSLATE_CMD_NOT_ENOUGH_MEMORY,
TRANSLATE_CMD_FAILED_WITH_ERROR_SET
} CMD_TRANSLATION_STATUS;
// Function prototypes
BOOL GetSubsystemInformation( void );
BOOL TranslationToLegacyRequired( void );
BOOL TranslationToNewRequired( void );
CMD_TRANSLATION_STATUS TranslateToLegacyCommand(
IN void *pvCmdBuf, // Address of buffer contaiing command packet
IN size_t tCmdSize, // Size of command packet
OUT void *pvRspBuf, // Address of buffer for response packet
IN size_t tRspSize // Expected size of response packet
);
CMD_TRANSLATION_STATUS TranslateToNewCommand(
IN void *pvCmdBuf, // Address of buffer contaiing command packet
IN size_t tCmdSize, // Size of command packet
OUT void *pvRspBuf, // Address of buffer for response packet
IN size_t tRspSize // Expected size of response packet
);
BOOL CommonCmdHandler(
IN void *pvCmdBuf, // Address of buffer contaiing command packet
IN size_t tCmdSize, // Size of command packet
OUT void *pvRspBuf, // Address of buffer for response packet
IN size_t tRspSize // Expected size of response packet
);
#endif // ndef _LEG_TRANSLATION_FUNCS_H
|
Java
|
#ifndef APPS_SFDL_HW_V_INP_GEN_HW_H_
#define APPS_SFDL_HW_V_INP_GEN_HW_H_
#include <libv/libv.h>
#include <common/utility.h>
#include <apps_sfdl_gen/fannkuch_v_inp_gen.h>
/*
* Provides the ability for user-defined input creation
*/
class fannkuchVerifierInpGenHw : public InputCreator {
public:
fannkuchVerifierInpGenHw(Venezia* v);
void create_input(mpq_t* input_q, int num_inputs);
private:
Venezia* v;
fannkuchVerifierInpGen compiler_implementation;
};
#endif // APPS_SFDL_HW_V_INP_GEN_HW_H_
|
Java
|
#!/bin/bash
#
# Run a shell command on all slave hosts.
#
# Environment Variables
#
# HADOOP_SLAVES File naming remote hosts.
# Default is ${HADOOP_CONF_DIR}/slaves.
# HADOOP_CONF_DIR Alternate conf dir. Default is ${HADOOP_HOME}/conf.
# HADOOP_SLAVE_SLEEP Seconds to sleep between spawning remote commands.
# HADOOP_SSH_OPTS Options passed to ssh when running remote commands.
##
usage="Usage: slaves.sh [--config confdir] command..."
# if no args specified, show usage
if [ $# -le 0 ]; then
echo $usage
exit 1
fi
bin=`dirname "$0"`
bin=`cd "$bin"; pwd`
. "$bin"/hadoop-config.sh
# If the slaves file is specified in the command line,
# then it takes precedence over the definition in
# hadoop-env.sh. Save it here.
HOSTLIST=$HADOOP_SLAVES
if [ -f "${HADOOP_CONF_DIR}/hadoop-env.sh" ]; then
. "${HADOOP_CONF_DIR}/hadoop-env.sh"
fi
if [ "$HOSTLIST" = "" ]; then
if [ "$HADOOP_SLAVES" = "" ]; then
export HOSTLIST="${HADOOP_CONF_DIR}/slaves"
else
export HOSTLIST="${HADOOP_SLAVES}"
fi
fi
for slave in `cat "$HOSTLIST"`; do
ssh $HADOOP_SSH_OPTS $slave $"${@// /\\ }" \
2>&1 | sed "s/^/$slave: /" &
if [ "$HADOOP_SLAVE_SLEEP" != "" ]; then
sleep $HADOOP_SLAVE_SLEEP
fi
done
wait
|
Java
|
/**
* (c) 2017 TIBCO Software Inc. All rights reserved.
*
* Except as specified below, this software is licensed pursuant to the Eclipse Public License v. 1.0.
* The details can be found in the file LICENSE.
*
* The following proprietary files are included as a convenience, and may not be used except pursuant
* to valid license to Composite Information Server or TIBCO(R) Data Virtualization Server:
* csadmin-XXXX.jar, csarchive-XXXX.jar, csbase-XXXX.jar, csclient-XXXX.jar, cscommon-XXXX.jar,
* csext-XXXX.jar, csjdbc-XXXX.jar, csserverutil-XXXX.jar, csserver-XXXX.jar, cswebapi-XXXX.jar,
* and customproc-XXXX.jar (where -XXXX is an optional version number). Any included third party files
* are licensed under the terms contained in their own accompanying LICENSE files, generally named .LICENSE.txt.
*
* This software is licensed AS-IS. Support for this software is not covered by standard maintenance agreements with TIBCO.
* If you would like to obtain assistance with this software, such assistance may be obtained through a separate paid consulting
* agreement with TIBCO.
*
*/
package com.tibco.ps.deploytool.services;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContextException;
import com.tibco.ps.common.CommonConstants;
import com.tibco.ps.common.exception.CompositeException;
import com.tibco.ps.common.util.CommonUtils;
import com.tibco.ps.deploytool.dao.ServerDAO;
import com.tibco.ps.deploytool.dao.wsapi.ServerWSDAOImpl;
public class ServerManagerImpl implements ServerManager {
private ServerDAO serverDAO = null;
// Get the configuration property file set in the environment with a default of deploy.properties
String propertyFile = CommonUtils.getFileOrSystemPropertyValue(CommonConstants.propertyFile, "CONFIG_PROPERTY_FILE");
private static Log logger = LogFactory.getLog(ServerManagerImpl.class);
// @Override
public void startServer(String serverId, String pathToServersXML) throws CompositeException {
String prefix = "startServer";
// Extract variables for the serverId
serverId = CommonUtils.extractVariable(prefix, serverId, propertyFile, true);
if(logger.isDebugEnabled()){
logger.debug(" Entering ServerManagerImpl.start() with following params - serverId: " + serverId + ", pathToServersXML: " + pathToServersXML);
}
try {
serverManagerAction(ServerDAO.action.START.name(), serverId, pathToServersXML);
} catch (CompositeException e) {
logger.error("Error while starting server: " , e);
throw new ApplicationContextException(e.getMessage(), e);
}
}
// @Override
public void stopServer(String serverId, String pathToServersXML) throws CompositeException {
String prefix = "stopServer";
// Extract variables for the serverId
serverId = CommonUtils.extractVariable(prefix, serverId, propertyFile, true);
if(logger.isDebugEnabled()){
logger.debug(" Entering ServerManagerImpl.start() with following params - serverId: " + serverId + ", pathToServersXML: " + pathToServersXML);
}
try {
serverManagerAction(ServerDAO.action.STOP.name(), serverId, pathToServersXML);
} catch (CompositeException e) {
logger.error("Error while stopping server: " , e);
throw new ApplicationContextException(e.getMessage(), e);
}
}
// @Override
public void restartServer(String serverId, String pathToServersXML) throws CompositeException {
String prefix = "restartServer";
// Extract variables for the serverId
serverId = CommonUtils.extractVariable(prefix, serverId, propertyFile, true);
if(logger.isDebugEnabled()){
logger.debug(" Entering ServerManagerImpl.start() with following params - serverId: " + serverId + ", pathToServersXML: " + pathToServersXML);
}
try {
serverManagerAction(ServerDAO.action.RESTART.name(), serverId, pathToServersXML);
} catch (CompositeException e) {
logger.error("Error while restarting server: " , e);
throw new ApplicationContextException(e.getMessage(), e);
}
}
private void serverManagerAction(String actionName, String serverId, String pathToServersXML) throws CompositeException {
String prefix = "serverManagerAction";
String processedIds = null;
// Extract variables for the serverId
serverId = CommonUtils.extractVariable(prefix, serverId, propertyFile, true);
// Set the Module Action Objective
String s1 = (serverId == null) ? "no_serverId" : "Ids="+serverId;
System.setProperty("MODULE_ACTION_OBJECTIVE", actionName+" : "+s1);
// Validate whether the files exist or not
if (!CommonUtils.fileExists(pathToServersXML)) {
throw new CompositeException("File ["+pathToServersXML+"] does not exist.");
}
try {
if(logger.isInfoEnabled()){
logger.info("processing action "+ actionName + " on server "+ serverId);
}
getServerDAO().takeServerManagerAction(actionName, serverId, pathToServersXML);
} catch (CompositeException e) {
logger.error("Error on server action (" + actionName + "): ", e);
throw new ApplicationContextException(e.getMessage(), e);
}
}
/**
* @return serverDAO
*/
public ServerDAO getServerDAO() {
if(this.serverDAO == null){
this.serverDAO = new ServerWSDAOImpl();
}
return serverDAO;
}
/**
* @param set serverDAO
*/
public void setServerDAO(ServerDAO serverDAO) {
this.serverDAO = serverDAO;
}
}
|
Java
|
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
* 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 THE AUTHOR ``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 AUTHOR 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 <sys/cdefs.h>
__FBSDID("$FreeBSD: releng/9.3/sys/net80211/ieee80211_ioctl.c 234753 2012-04-28 09:15:01Z dim $");
/*
* IEEE 802.11 ioctl support (FreeBSD-specific)
*/
#include "opt_inet.h"
#include "opt_ipx.h"
#include "opt_wlan.h"
#include <sys/endian.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/priv.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <sys/systm.h>
#include <net/if.h>
#include <net/if_dl.h>
#include <net/if_media.h>
#include <net/ethernet.h>
#ifdef INET
#include <netinet/in.h>
#include <netinet/if_ether.h>
#endif
#ifdef IPX
#include <netipx/ipx.h>
#include <netipx/ipx_if.h>
#endif
#include <net80211/ieee80211_var.h>
#include <net80211/ieee80211_ioctl.h>
#include <net80211/ieee80211_regdomain.h>
#include <net80211/ieee80211_input.h>
#define IS_UP_AUTO(_vap) \
(IFNET_IS_UP_RUNNING((_vap)->iv_ifp) && \
(_vap)->iv_roaming == IEEE80211_ROAMING_AUTO)
static const uint8_t zerobssid[IEEE80211_ADDR_LEN];
static struct ieee80211_channel *findchannel(struct ieee80211com *,
int ieee, int mode);
static int ieee80211_scanreq(struct ieee80211vap *,
struct ieee80211_scan_req *);
static __noinline int
ieee80211_ioctl_getkey(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_node *ni;
struct ieee80211req_key ik;
struct ieee80211_key *wk;
const struct ieee80211_cipher *cip;
u_int kid;
int error;
if (ireq->i_len != sizeof(ik))
return EINVAL;
error = copyin(ireq->i_data, &ik, sizeof(ik));
if (error)
return error;
kid = ik.ik_keyix;
if (kid == IEEE80211_KEYIX_NONE) {
ni = ieee80211_find_vap_node(&ic->ic_sta, vap, ik.ik_macaddr);
if (ni == NULL)
return ENOENT;
wk = &ni->ni_ucastkey;
} else {
if (kid >= IEEE80211_WEP_NKID)
return EINVAL;
wk = &vap->iv_nw_keys[kid];
IEEE80211_ADDR_COPY(&ik.ik_macaddr, vap->iv_bss->ni_macaddr);
ni = NULL;
}
cip = wk->wk_cipher;
ik.ik_type = cip->ic_cipher;
ik.ik_keylen = wk->wk_keylen;
ik.ik_flags = wk->wk_flags & (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV);
if (wk->wk_keyix == vap->iv_def_txkey)
ik.ik_flags |= IEEE80211_KEY_DEFAULT;
if (priv_check(curthread, PRIV_NET80211_GETKEY) == 0) {
/* NB: only root can read key data */
ik.ik_keyrsc = wk->wk_keyrsc[IEEE80211_NONQOS_TID];
ik.ik_keytsc = wk->wk_keytsc;
memcpy(ik.ik_keydata, wk->wk_key, wk->wk_keylen);
if (cip->ic_cipher == IEEE80211_CIPHER_TKIP) {
memcpy(ik.ik_keydata+wk->wk_keylen,
wk->wk_key + IEEE80211_KEYBUF_SIZE,
IEEE80211_MICBUF_SIZE);
ik.ik_keylen += IEEE80211_MICBUF_SIZE;
}
} else {
ik.ik_keyrsc = 0;
ik.ik_keytsc = 0;
memset(ik.ik_keydata, 0, sizeof(ik.ik_keydata));
}
if (ni != NULL)
ieee80211_free_node(ni);
return copyout(&ik, ireq->i_data, sizeof(ik));
}
static __noinline int
ieee80211_ioctl_getchanlist(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
struct ieee80211com *ic = vap->iv_ic;
if (sizeof(ic->ic_chan_active) < ireq->i_len)
ireq->i_len = sizeof(ic->ic_chan_active);
return copyout(&ic->ic_chan_active, ireq->i_data, ireq->i_len);
}
static __noinline int
ieee80211_ioctl_getchaninfo(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
struct ieee80211com *ic = vap->iv_ic;
uint32_t space;
space = __offsetof(struct ieee80211req_chaninfo,
ic_chans[ic->ic_nchans]);
if (space > ireq->i_len)
space = ireq->i_len;
/* XXX assumes compatible layout */
return copyout(&ic->ic_nchans, ireq->i_data, space);
}
static __noinline int
ieee80211_ioctl_getwpaie(struct ieee80211vap *vap,
struct ieee80211req *ireq, int req)
{
struct ieee80211_node *ni;
struct ieee80211req_wpaie2 wpaie;
int error;
if (ireq->i_len < IEEE80211_ADDR_LEN)
return EINVAL;
error = copyin(ireq->i_data, wpaie.wpa_macaddr, IEEE80211_ADDR_LEN);
if (error != 0)
return error;
ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap, wpaie.wpa_macaddr);
if (ni == NULL)
return ENOENT;
memset(wpaie.wpa_ie, 0, sizeof(wpaie.wpa_ie));
if (ni->ni_ies.wpa_ie != NULL) {
int ielen = ni->ni_ies.wpa_ie[1] + 2;
if (ielen > sizeof(wpaie.wpa_ie))
ielen = sizeof(wpaie.wpa_ie);
memcpy(wpaie.wpa_ie, ni->ni_ies.wpa_ie, ielen);
}
if (req == IEEE80211_IOC_WPAIE2) {
memset(wpaie.rsn_ie, 0, sizeof(wpaie.rsn_ie));
if (ni->ni_ies.rsn_ie != NULL) {
int ielen = ni->ni_ies.rsn_ie[1] + 2;
if (ielen > sizeof(wpaie.rsn_ie))
ielen = sizeof(wpaie.rsn_ie);
memcpy(wpaie.rsn_ie, ni->ni_ies.rsn_ie, ielen);
}
if (ireq->i_len > sizeof(struct ieee80211req_wpaie2))
ireq->i_len = sizeof(struct ieee80211req_wpaie2);
} else {
/* compatibility op, may overwrite wpa ie */
/* XXX check ic_flags? */
if (ni->ni_ies.rsn_ie != NULL) {
int ielen = ni->ni_ies.rsn_ie[1] + 2;
if (ielen > sizeof(wpaie.wpa_ie))
ielen = sizeof(wpaie.wpa_ie);
memcpy(wpaie.wpa_ie, ni->ni_ies.rsn_ie, ielen);
}
if (ireq->i_len > sizeof(struct ieee80211req_wpaie))
ireq->i_len = sizeof(struct ieee80211req_wpaie);
}
ieee80211_free_node(ni);
return copyout(&wpaie, ireq->i_data, ireq->i_len);
}
static __noinline int
ieee80211_ioctl_getstastats(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
struct ieee80211_node *ni;
uint8_t macaddr[IEEE80211_ADDR_LEN];
const size_t off = __offsetof(struct ieee80211req_sta_stats, is_stats);
int error;
if (ireq->i_len < off)
return EINVAL;
error = copyin(ireq->i_data, macaddr, IEEE80211_ADDR_LEN);
if (error != 0)
return error;
ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap, macaddr);
if (ni == NULL)
return ENOENT;
if (ireq->i_len > sizeof(struct ieee80211req_sta_stats))
ireq->i_len = sizeof(struct ieee80211req_sta_stats);
/* NB: copy out only the statistics */
error = copyout(&ni->ni_stats, (uint8_t *) ireq->i_data + off,
ireq->i_len - off);
ieee80211_free_node(ni);
return error;
}
struct scanreq {
struct ieee80211req_scan_result *sr;
size_t space;
};
static size_t
scan_space(const struct ieee80211_scan_entry *se, int *ielen)
{
size_t len;
*ielen = se->se_ies.len;
/*
* NB: ie's can be no more than 255 bytes and the max 802.11
* packet is <3Kbytes so we are sure this doesn't overflow
* 16-bits; if this is a concern we can drop the ie's.
*/
len = sizeof(struct ieee80211req_scan_result) + se->se_ssid[1] +
se->se_meshid[1] + *ielen;
return roundup(len, sizeof(uint32_t));
}
static void
get_scan_space(void *arg, const struct ieee80211_scan_entry *se)
{
struct scanreq *req = arg;
int ielen;
req->space += scan_space(se, &ielen);
}
static __noinline void
get_scan_result(void *arg, const struct ieee80211_scan_entry *se)
{
struct scanreq *req = arg;
struct ieee80211req_scan_result *sr;
int ielen, len, nr, nxr;
uint8_t *cp;
len = scan_space(se, &ielen);
if (len > req->space)
return;
sr = req->sr;
KASSERT(len <= 65535 && ielen <= 65535,
("len %u ssid %u ie %u", len, se->se_ssid[1], ielen));
sr->isr_len = len;
sr->isr_ie_off = sizeof(struct ieee80211req_scan_result);
sr->isr_ie_len = ielen;
sr->isr_freq = se->se_chan->ic_freq;
sr->isr_flags = se->se_chan->ic_flags;
sr->isr_rssi = se->se_rssi;
sr->isr_noise = se->se_noise;
sr->isr_intval = se->se_intval;
sr->isr_capinfo = se->se_capinfo;
sr->isr_erp = se->se_erp;
IEEE80211_ADDR_COPY(sr->isr_bssid, se->se_bssid);
nr = min(se->se_rates[1], IEEE80211_RATE_MAXSIZE);
memcpy(sr->isr_rates, se->se_rates+2, nr);
nxr = min(se->se_xrates[1], IEEE80211_RATE_MAXSIZE - nr);
memcpy(sr->isr_rates+nr, se->se_xrates+2, nxr);
sr->isr_nrates = nr + nxr;
/* copy SSID */
sr->isr_ssid_len = se->se_ssid[1];
cp = ((uint8_t *)sr) + sr->isr_ie_off;
memcpy(cp, se->se_ssid+2, sr->isr_ssid_len);
/* copy mesh id */
cp += sr->isr_ssid_len;
sr->isr_meshid_len = se->se_meshid[1];
memcpy(cp, se->se_meshid+2, sr->isr_meshid_len);
cp += sr->isr_meshid_len;
if (ielen)
memcpy(cp, se->se_ies.data, ielen);
req->space -= len;
req->sr = (struct ieee80211req_scan_result *)(((uint8_t *)sr) + len);
}
static __noinline int
ieee80211_ioctl_getscanresults(struct ieee80211vap *vap,
struct ieee80211req *ireq)
{
struct scanreq req;
int error;
if (ireq->i_len < sizeof(struct scanreq))
return EFAULT;
error = 0;
req.space = 0;
ieee80211_scan_iterate(vap, get_scan_space, &req);
if (req.space > ireq->i_len)
req.space = ireq->i_len;
if (req.space > 0) {
uint32_t space;
void *p;
space = req.space;
/* XXX M_WAITOK after driver lock released */
p = malloc(space, M_TEMP, M_NOWAIT | M_ZERO);
if (p == NULL)
return ENOMEM;
req.sr = p;
ieee80211_scan_iterate(vap, get_scan_result, &req);
ireq->i_len = space - req.space;
error = copyout(p, ireq->i_data, ireq->i_len);
free(p, M_TEMP);
} else
ireq->i_len = 0;
return error;
}
struct stainforeq {
struct ieee80211vap *vap;
struct ieee80211req_sta_info *si;
size_t space;
};
static size_t
sta_space(const struct ieee80211_node *ni, size_t *ielen)
{
*ielen = ni->ni_ies.len;
return roundup(sizeof(struct ieee80211req_sta_info) + *ielen,
sizeof(uint32_t));
}
static void
get_sta_space(void *arg, struct ieee80211_node *ni)
{
struct stainforeq *req = arg;
size_t ielen;
if (req->vap != ni->ni_vap)
return;
if (ni->ni_vap->iv_opmode == IEEE80211_M_HOSTAP &&
ni->ni_associd == 0) /* only associated stations */
return;
req->space += sta_space(ni, &ielen);
}
static __noinline void
get_sta_info(void *arg, struct ieee80211_node *ni)
{
struct stainforeq *req = arg;
struct ieee80211vap *vap = ni->ni_vap;
struct ieee80211req_sta_info *si;
size_t ielen, len;
uint8_t *cp;
if (req->vap != ni->ni_vap)
return;
if (vap->iv_opmode == IEEE80211_M_HOSTAP &&
ni->ni_associd == 0) /* only associated stations */
return;
if (ni->ni_chan == IEEE80211_CHAN_ANYC) /* XXX bogus entry */
return;
len = sta_space(ni, &ielen);
if (len > req->space)
return;
si = req->si;
si->isi_len = len;
si->isi_ie_off = sizeof(struct ieee80211req_sta_info);
si->isi_ie_len = ielen;
si->isi_freq = ni->ni_chan->ic_freq;
si->isi_flags = ni->ni_chan->ic_flags;
si->isi_state = ni->ni_flags;
si->isi_authmode = ni->ni_authmode;
vap->iv_ic->ic_node_getsignal(ni, &si->isi_rssi, &si->isi_noise);
vap->iv_ic->ic_node_getmimoinfo(ni, &si->isi_mimo);
si->isi_capinfo = ni->ni_capinfo;
si->isi_erp = ni->ni_erp;
IEEE80211_ADDR_COPY(si->isi_macaddr, ni->ni_macaddr);
si->isi_nrates = ni->ni_rates.rs_nrates;
if (si->isi_nrates > 15)
si->isi_nrates = 15;
memcpy(si->isi_rates, ni->ni_rates.rs_rates, si->isi_nrates);
si->isi_txrate = ni->ni_txrate;
if (si->isi_txrate & IEEE80211_RATE_MCS) {
const struct ieee80211_mcs_rates *mcs =
&ieee80211_htrates[ni->ni_txrate &~ IEEE80211_RATE_MCS];
if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) {
if (ni->ni_flags & IEEE80211_NODE_SGI40)
si->isi_txmbps = mcs->ht40_rate_800ns;
else
si->isi_txmbps = mcs->ht40_rate_400ns;
} else {
if (ni->ni_flags & IEEE80211_NODE_SGI20)
si->isi_txmbps = mcs->ht20_rate_800ns;
else
si->isi_txmbps = mcs->ht20_rate_400ns;
}
} else
si->isi_txmbps = si->isi_txrate;
si->isi_associd = ni->ni_associd;
si->isi_txpower = ni->ni_txpower;
si->isi_vlan = ni->ni_vlan;
if (ni->ni_flags & IEEE80211_NODE_QOS) {
memcpy(si->isi_txseqs, ni->ni_txseqs, sizeof(ni->ni_txseqs));
memcpy(si->isi_rxseqs, ni->ni_rxseqs, sizeof(ni->ni_rxseqs));
} else {
si->isi_txseqs[0] = ni->ni_txseqs[IEEE80211_NONQOS_TID];
si->isi_rxseqs[0] = ni->ni_rxseqs[IEEE80211_NONQOS_TID];
}
/* NB: leave all cases in case we relax ni_associd == 0 check */
if (ieee80211_node_is_authorized(ni))
si->isi_inact = vap->iv_inact_run;
else if (ni->ni_associd != 0 ||
(vap->iv_opmode == IEEE80211_M_WDS &&
(vap->iv_flags_ext & IEEE80211_FEXT_WDSLEGACY)))
si->isi_inact = vap->iv_inact_auth;
else
si->isi_inact = vap->iv_inact_init;
si->isi_inact = (si->isi_inact - ni->ni_inact) * IEEE80211_INACT_WAIT;
si->isi_localid = ni->ni_mllid;
si->isi_peerid = ni->ni_mlpid;
si->isi_peerstate = ni->ni_mlstate;
if (ielen) {
cp = ((uint8_t *)si) + si->isi_ie_off;
memcpy(cp, ni->ni_ies.data, ielen);
}
req->si = (struct ieee80211req_sta_info *)(((uint8_t *)si) + len);
req->space -= len;
}
static __noinline int
getstainfo_common(struct ieee80211vap *vap, struct ieee80211req *ireq,
struct ieee80211_node *ni, size_t off)
{
struct ieee80211com *ic = vap->iv_ic;
struct stainforeq req;
size_t space;
void *p;
int error;
error = 0;
req.space = 0;
req.vap = vap;
if (ni == NULL)
ieee80211_iterate_nodes(&ic->ic_sta, get_sta_space, &req);
else
get_sta_space(&req, ni);
if (req.space > ireq->i_len)
req.space = ireq->i_len;
if (req.space > 0) {
space = req.space;
/* XXX M_WAITOK after driver lock released */
p = malloc(space, M_TEMP, M_NOWAIT | M_ZERO);
if (p == NULL) {
error = ENOMEM;
goto bad;
}
req.si = p;
if (ni == NULL)
ieee80211_iterate_nodes(&ic->ic_sta, get_sta_info, &req);
else
get_sta_info(&req, ni);
ireq->i_len = space - req.space;
error = copyout(p, (uint8_t *) ireq->i_data+off, ireq->i_len);
free(p, M_TEMP);
} else
ireq->i_len = 0;
bad:
if (ni != NULL)
ieee80211_free_node(ni);
return error;
}
static __noinline int
ieee80211_ioctl_getstainfo(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
uint8_t macaddr[IEEE80211_ADDR_LEN];
const size_t off = __offsetof(struct ieee80211req_sta_req, info);
struct ieee80211_node *ni;
int error;
if (ireq->i_len < sizeof(struct ieee80211req_sta_req))
return EFAULT;
error = copyin(ireq->i_data, macaddr, IEEE80211_ADDR_LEN);
if (error != 0)
return error;
if (IEEE80211_ADDR_EQ(macaddr, vap->iv_ifp->if_broadcastaddr)) {
ni = NULL;
} else {
ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap, macaddr);
if (ni == NULL)
return ENOENT;
}
return getstainfo_common(vap, ireq, ni, off);
}
static __noinline int
ieee80211_ioctl_getstatxpow(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
struct ieee80211_node *ni;
struct ieee80211req_sta_txpow txpow;
int error;
if (ireq->i_len != sizeof(txpow))
return EINVAL;
error = copyin(ireq->i_data, &txpow, sizeof(txpow));
if (error != 0)
return error;
ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap, txpow.it_macaddr);
if (ni == NULL)
return ENOENT;
txpow.it_txpow = ni->ni_txpower;
error = copyout(&txpow, ireq->i_data, sizeof(txpow));
ieee80211_free_node(ni);
return error;
}
static __noinline int
ieee80211_ioctl_getwmeparam(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_wme_state *wme = &ic->ic_wme;
struct wmeParams *wmep;
int ac;
if ((ic->ic_caps & IEEE80211_C_WME) == 0)
return EINVAL;
ac = (ireq->i_len & IEEE80211_WMEPARAM_VAL);
if (ac >= WME_NUM_AC)
ac = WME_AC_BE;
if (ireq->i_len & IEEE80211_WMEPARAM_BSS)
wmep = &wme->wme_wmeBssChanParams.cap_wmeParams[ac];
else
wmep = &wme->wme_wmeChanParams.cap_wmeParams[ac];
switch (ireq->i_type) {
case IEEE80211_IOC_WME_CWMIN: /* WME: CWmin */
ireq->i_val = wmep->wmep_logcwmin;
break;
case IEEE80211_IOC_WME_CWMAX: /* WME: CWmax */
ireq->i_val = wmep->wmep_logcwmax;
break;
case IEEE80211_IOC_WME_AIFS: /* WME: AIFS */
ireq->i_val = wmep->wmep_aifsn;
break;
case IEEE80211_IOC_WME_TXOPLIMIT: /* WME: txops limit */
ireq->i_val = wmep->wmep_txopLimit;
break;
case IEEE80211_IOC_WME_ACM: /* WME: ACM (bss only) */
wmep = &wme->wme_wmeBssChanParams.cap_wmeParams[ac];
ireq->i_val = wmep->wmep_acm;
break;
case IEEE80211_IOC_WME_ACKPOLICY: /* WME: ACK policy (!bss only)*/
wmep = &wme->wme_wmeChanParams.cap_wmeParams[ac];
ireq->i_val = !wmep->wmep_noackPolicy;
break;
}
return 0;
}
static __noinline int
ieee80211_ioctl_getmaccmd(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
const struct ieee80211_aclator *acl = vap->iv_acl;
return (acl == NULL ? EINVAL : acl->iac_getioctl(vap, ireq));
}
static __noinline int
ieee80211_ioctl_getcurchan(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_channel *c;
if (ireq->i_len != sizeof(struct ieee80211_channel))
return EINVAL;
/*
* vap's may have different operating channels when HT is
* in use. When in RUN state report the vap-specific channel.
* Otherwise return curchan.
*/
if (vap->iv_state == IEEE80211_S_RUN)
c = vap->iv_bss->ni_chan;
else
c = ic->ic_curchan;
return copyout(c, ireq->i_data, sizeof(*c));
}
static int
getappie(const struct ieee80211_appie *aie, struct ieee80211req *ireq)
{
if (aie == NULL)
return EINVAL;
/* NB: truncate, caller can check length */
if (ireq->i_len > aie->ie_len)
ireq->i_len = aie->ie_len;
return copyout(aie->ie_data, ireq->i_data, ireq->i_len);
}
static int
ieee80211_ioctl_getappie(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
uint8_t fc0;
fc0 = ireq->i_val & 0xff;
if ((fc0 & IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_MGT)
return EINVAL;
/* NB: could check iv_opmode and reject but hardly worth the effort */
switch (fc0 & IEEE80211_FC0_SUBTYPE_MASK) {
case IEEE80211_FC0_SUBTYPE_BEACON:
return getappie(vap->iv_appie_beacon, ireq);
case IEEE80211_FC0_SUBTYPE_PROBE_RESP:
return getappie(vap->iv_appie_proberesp, ireq);
case IEEE80211_FC0_SUBTYPE_ASSOC_RESP:
return getappie(vap->iv_appie_assocresp, ireq);
case IEEE80211_FC0_SUBTYPE_PROBE_REQ:
return getappie(vap->iv_appie_probereq, ireq);
case IEEE80211_FC0_SUBTYPE_ASSOC_REQ:
return getappie(vap->iv_appie_assocreq, ireq);
case IEEE80211_FC0_SUBTYPE_BEACON|IEEE80211_FC0_SUBTYPE_PROBE_RESP:
return getappie(vap->iv_appie_wpa, ireq);
}
return EINVAL;
}
static __noinline int
ieee80211_ioctl_getregdomain(struct ieee80211vap *vap,
const struct ieee80211req *ireq)
{
struct ieee80211com *ic = vap->iv_ic;
if (ireq->i_len != sizeof(ic->ic_regdomain))
return EINVAL;
return copyout(&ic->ic_regdomain, ireq->i_data,
sizeof(ic->ic_regdomain));
}
static __noinline int
ieee80211_ioctl_getroam(struct ieee80211vap *vap,
const struct ieee80211req *ireq)
{
size_t len = ireq->i_len;
/* NB: accept short requests for backwards compat */
if (len > sizeof(vap->iv_roamparms))
len = sizeof(vap->iv_roamparms);
return copyout(vap->iv_roamparms, ireq->i_data, len);
}
static __noinline int
ieee80211_ioctl_gettxparams(struct ieee80211vap *vap,
const struct ieee80211req *ireq)
{
size_t len = ireq->i_len;
/* NB: accept short requests for backwards compat */
if (len > sizeof(vap->iv_txparms))
len = sizeof(vap->iv_txparms);
return copyout(vap->iv_txparms, ireq->i_data, len);
}
static __noinline int
ieee80211_ioctl_getdevcaps(struct ieee80211com *ic,
const struct ieee80211req *ireq)
{
struct ieee80211_devcaps_req *dc;
struct ieee80211req_chaninfo *ci;
int maxchans, error;
maxchans = 1 + ((ireq->i_len - sizeof(struct ieee80211_devcaps_req)) /
sizeof(struct ieee80211_channel));
/* NB: require 1 so we know ic_nchans is accessible */
if (maxchans < 1)
return EINVAL;
/* constrain max request size, 2K channels is ~24Kbytes */
if (maxchans > 2048)
maxchans = 2048;
dc = (struct ieee80211_devcaps_req *)
malloc(IEEE80211_DEVCAPS_SIZE(maxchans), M_TEMP, M_NOWAIT | M_ZERO);
if (dc == NULL)
return ENOMEM;
dc->dc_drivercaps = ic->ic_caps;
dc->dc_cryptocaps = ic->ic_cryptocaps;
dc->dc_htcaps = ic->ic_htcaps;
ci = &dc->dc_chaninfo;
ic->ic_getradiocaps(ic, maxchans, &ci->ic_nchans, ci->ic_chans);
KASSERT(ci->ic_nchans <= maxchans,
("nchans %d maxchans %d", ci->ic_nchans, maxchans));
ieee80211_sort_channels(ci->ic_chans, ci->ic_nchans);
error = copyout(dc, ireq->i_data, IEEE80211_DEVCAPS_SPACE(dc));
free(dc, M_TEMP);
return error;
}
static __noinline int
ieee80211_ioctl_getstavlan(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
struct ieee80211_node *ni;
struct ieee80211req_sta_vlan vlan;
int error;
if (ireq->i_len != sizeof(vlan))
return EINVAL;
error = copyin(ireq->i_data, &vlan, sizeof(vlan));
if (error != 0)
return error;
if (!IEEE80211_ADDR_EQ(vlan.sv_macaddr, zerobssid)) {
ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap,
vlan.sv_macaddr);
if (ni == NULL)
return ENOENT;
} else
ni = ieee80211_ref_node(vap->iv_bss);
vlan.sv_vlan = ni->ni_vlan;
error = copyout(&vlan, ireq->i_data, sizeof(vlan));
ieee80211_free_node(ni);
return error;
}
/*
* Dummy ioctl get handler so the linker set is defined.
*/
static int
dummy_ioctl_get(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
return ENOSYS;
}
IEEE80211_IOCTL_GET(dummy, dummy_ioctl_get);
static int
ieee80211_ioctl_getdefault(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
ieee80211_ioctl_getfunc * const *get;
int error;
SET_FOREACH(get, ieee80211_ioctl_getset) {
error = (*get)(vap, ireq);
if (error != ENOSYS)
return error;
}
return EINVAL;
}
/*
* When building the kernel with -O2 on the i386 architecture, gcc
* seems to want to inline this function into ieee80211_ioctl()
* (which is the only routine that calls it). When this happens,
* ieee80211_ioctl() ends up consuming an additional 2K of stack
* space. (Exactly why it needs so much is unclear.) The problem
* is that it's possible for ieee80211_ioctl() to invoke other
* routines (including driver init functions) which could then find
* themselves perilously close to exhausting the stack.
*
* To avoid this, we deliberately prevent gcc from inlining this
* routine. Another way to avoid this is to use less agressive
* optimization when compiling this file (i.e. -O instead of -O2)
* but special-casing the compilation of this one module in the
* build system would be awkward.
*/
static __noinline int
ieee80211_ioctl_get80211(struct ieee80211vap *vap, u_long cmd,
struct ieee80211req *ireq)
{
#define MS(_v, _f) (((_v) & _f) >> _f##_S)
struct ieee80211com *ic = vap->iv_ic;
u_int kid, len;
uint8_t tmpkey[IEEE80211_KEYBUF_SIZE];
char tmpssid[IEEE80211_NWID_LEN];
int error = 0;
switch (ireq->i_type) {
case IEEE80211_IOC_SSID:
switch (vap->iv_state) {
case IEEE80211_S_INIT:
case IEEE80211_S_SCAN:
ireq->i_len = vap->iv_des_ssid[0].len;
memcpy(tmpssid, vap->iv_des_ssid[0].ssid, ireq->i_len);
break;
default:
ireq->i_len = vap->iv_bss->ni_esslen;
memcpy(tmpssid, vap->iv_bss->ni_essid, ireq->i_len);
break;
}
error = copyout(tmpssid, ireq->i_data, ireq->i_len);
break;
case IEEE80211_IOC_NUMSSIDS:
ireq->i_val = 1;
break;
case IEEE80211_IOC_WEP:
if ((vap->iv_flags & IEEE80211_F_PRIVACY) == 0)
ireq->i_val = IEEE80211_WEP_OFF;
else if (vap->iv_flags & IEEE80211_F_DROPUNENC)
ireq->i_val = IEEE80211_WEP_ON;
else
ireq->i_val = IEEE80211_WEP_MIXED;
break;
case IEEE80211_IOC_WEPKEY:
kid = (u_int) ireq->i_val;
if (kid >= IEEE80211_WEP_NKID)
return EINVAL;
len = (u_int) vap->iv_nw_keys[kid].wk_keylen;
/* NB: only root can read WEP keys */
if (priv_check(curthread, PRIV_NET80211_GETKEY) == 0) {
bcopy(vap->iv_nw_keys[kid].wk_key, tmpkey, len);
} else {
bzero(tmpkey, len);
}
ireq->i_len = len;
error = copyout(tmpkey, ireq->i_data, len);
break;
case IEEE80211_IOC_NUMWEPKEYS:
ireq->i_val = IEEE80211_WEP_NKID;
break;
case IEEE80211_IOC_WEPTXKEY:
ireq->i_val = vap->iv_def_txkey;
break;
case IEEE80211_IOC_AUTHMODE:
if (vap->iv_flags & IEEE80211_F_WPA)
ireq->i_val = IEEE80211_AUTH_WPA;
else
ireq->i_val = vap->iv_bss->ni_authmode;
break;
case IEEE80211_IOC_CHANNEL:
ireq->i_val = ieee80211_chan2ieee(ic, ic->ic_curchan);
break;
case IEEE80211_IOC_POWERSAVE:
if (vap->iv_flags & IEEE80211_F_PMGTON)
ireq->i_val = IEEE80211_POWERSAVE_ON;
else
ireq->i_val = IEEE80211_POWERSAVE_OFF;
break;
case IEEE80211_IOC_POWERSAVESLEEP:
ireq->i_val = ic->ic_lintval;
break;
case IEEE80211_IOC_RTSTHRESHOLD:
ireq->i_val = vap->iv_rtsthreshold;
break;
case IEEE80211_IOC_PROTMODE:
ireq->i_val = ic->ic_protmode;
break;
case IEEE80211_IOC_TXPOWER:
/*
* Tx power limit is the min of max regulatory
* power, any user-set limit, and the max the
* radio can do.
*/
ireq->i_val = 2*ic->ic_curchan->ic_maxregpower;
if (ireq->i_val > ic->ic_txpowlimit)
ireq->i_val = ic->ic_txpowlimit;
if (ireq->i_val > ic->ic_curchan->ic_maxpower)
ireq->i_val = ic->ic_curchan->ic_maxpower;
break;
case IEEE80211_IOC_WPA:
switch (vap->iv_flags & IEEE80211_F_WPA) {
case IEEE80211_F_WPA1:
ireq->i_val = 1;
break;
case IEEE80211_F_WPA2:
ireq->i_val = 2;
break;
case IEEE80211_F_WPA1 | IEEE80211_F_WPA2:
ireq->i_val = 3;
break;
default:
ireq->i_val = 0;
break;
}
break;
case IEEE80211_IOC_CHANLIST:
error = ieee80211_ioctl_getchanlist(vap, ireq);
break;
case IEEE80211_IOC_ROAMING:
ireq->i_val = vap->iv_roaming;
break;
case IEEE80211_IOC_PRIVACY:
ireq->i_val = (vap->iv_flags & IEEE80211_F_PRIVACY) != 0;
break;
case IEEE80211_IOC_DROPUNENCRYPTED:
ireq->i_val = (vap->iv_flags & IEEE80211_F_DROPUNENC) != 0;
break;
case IEEE80211_IOC_COUNTERMEASURES:
ireq->i_val = (vap->iv_flags & IEEE80211_F_COUNTERM) != 0;
break;
case IEEE80211_IOC_WME:
ireq->i_val = (vap->iv_flags & IEEE80211_F_WME) != 0;
break;
case IEEE80211_IOC_HIDESSID:
ireq->i_val = (vap->iv_flags & IEEE80211_F_HIDESSID) != 0;
break;
case IEEE80211_IOC_APBRIDGE:
ireq->i_val = (vap->iv_flags & IEEE80211_F_NOBRIDGE) == 0;
break;
case IEEE80211_IOC_WPAKEY:
error = ieee80211_ioctl_getkey(vap, ireq);
break;
case IEEE80211_IOC_CHANINFO:
error = ieee80211_ioctl_getchaninfo(vap, ireq);
break;
case IEEE80211_IOC_BSSID:
if (ireq->i_len != IEEE80211_ADDR_LEN)
return EINVAL;
if (vap->iv_state == IEEE80211_S_RUN) {
error = copyout(vap->iv_opmode == IEEE80211_M_WDS ?
vap->iv_bss->ni_macaddr : vap->iv_bss->ni_bssid,
ireq->i_data, ireq->i_len);
} else
error = copyout(vap->iv_des_bssid, ireq->i_data,
ireq->i_len);
break;
case IEEE80211_IOC_WPAIE:
error = ieee80211_ioctl_getwpaie(vap, ireq, ireq->i_type);
break;
case IEEE80211_IOC_WPAIE2:
error = ieee80211_ioctl_getwpaie(vap, ireq, ireq->i_type);
break;
case IEEE80211_IOC_SCAN_RESULTS:
error = ieee80211_ioctl_getscanresults(vap, ireq);
break;
case IEEE80211_IOC_STA_STATS:
error = ieee80211_ioctl_getstastats(vap, ireq);
break;
case IEEE80211_IOC_TXPOWMAX:
ireq->i_val = vap->iv_bss->ni_txpower;
break;
case IEEE80211_IOC_STA_TXPOW:
error = ieee80211_ioctl_getstatxpow(vap, ireq);
break;
case IEEE80211_IOC_STA_INFO:
error = ieee80211_ioctl_getstainfo(vap, ireq);
break;
case IEEE80211_IOC_WME_CWMIN: /* WME: CWmin */
case IEEE80211_IOC_WME_CWMAX: /* WME: CWmax */
case IEEE80211_IOC_WME_AIFS: /* WME: AIFS */
case IEEE80211_IOC_WME_TXOPLIMIT: /* WME: txops limit */
case IEEE80211_IOC_WME_ACM: /* WME: ACM (bss only) */
case IEEE80211_IOC_WME_ACKPOLICY: /* WME: ACK policy (bss only) */
error = ieee80211_ioctl_getwmeparam(vap, ireq);
break;
case IEEE80211_IOC_DTIM_PERIOD:
ireq->i_val = vap->iv_dtim_period;
break;
case IEEE80211_IOC_BEACON_INTERVAL:
/* NB: get from ic_bss for station mode */
ireq->i_val = vap->iv_bss->ni_intval;
break;
case IEEE80211_IOC_PUREG:
ireq->i_val = (vap->iv_flags & IEEE80211_F_PUREG) != 0;
break;
case IEEE80211_IOC_BGSCAN:
ireq->i_val = (vap->iv_flags & IEEE80211_F_BGSCAN) != 0;
break;
case IEEE80211_IOC_BGSCAN_IDLE:
ireq->i_val = vap->iv_bgscanidle*hz/1000; /* ms */
break;
case IEEE80211_IOC_BGSCAN_INTERVAL:
ireq->i_val = vap->iv_bgscanintvl/hz; /* seconds */
break;
case IEEE80211_IOC_SCANVALID:
ireq->i_val = vap->iv_scanvalid/hz; /* seconds */
break;
case IEEE80211_IOC_FRAGTHRESHOLD:
ireq->i_val = vap->iv_fragthreshold;
break;
case IEEE80211_IOC_MACCMD:
error = ieee80211_ioctl_getmaccmd(vap, ireq);
break;
case IEEE80211_IOC_BURST:
ireq->i_val = (vap->iv_flags & IEEE80211_F_BURST) != 0;
break;
case IEEE80211_IOC_BMISSTHRESHOLD:
ireq->i_val = vap->iv_bmissthreshold;
break;
case IEEE80211_IOC_CURCHAN:
error = ieee80211_ioctl_getcurchan(vap, ireq);
break;
case IEEE80211_IOC_SHORTGI:
ireq->i_val = 0;
if (vap->iv_flags_ht & IEEE80211_FHT_SHORTGI20)
ireq->i_val |= IEEE80211_HTCAP_SHORTGI20;
if (vap->iv_flags_ht & IEEE80211_FHT_SHORTGI40)
ireq->i_val |= IEEE80211_HTCAP_SHORTGI40;
break;
case IEEE80211_IOC_AMPDU:
ireq->i_val = 0;
if (vap->iv_flags_ht & IEEE80211_FHT_AMPDU_TX)
ireq->i_val |= 1;
if (vap->iv_flags_ht & IEEE80211_FHT_AMPDU_RX)
ireq->i_val |= 2;
break;
case IEEE80211_IOC_AMPDU_LIMIT:
if (vap->iv_opmode == IEEE80211_M_HOSTAP)
ireq->i_val = vap->iv_ampdu_rxmax;
else if (vap->iv_state == IEEE80211_S_RUN)
ireq->i_val = MS(vap->iv_bss->ni_htparam,
IEEE80211_HTCAP_MAXRXAMPDU);
else
ireq->i_val = vap->iv_ampdu_limit;
break;
case IEEE80211_IOC_AMPDU_DENSITY:
if (vap->iv_opmode == IEEE80211_M_STA &&
vap->iv_state == IEEE80211_S_RUN)
ireq->i_val = MS(vap->iv_bss->ni_htparam,
IEEE80211_HTCAP_MPDUDENSITY);
else
ireq->i_val = vap->iv_ampdu_density;
break;
case IEEE80211_IOC_AMSDU:
ireq->i_val = 0;
if (vap->iv_flags_ht & IEEE80211_FHT_AMSDU_TX)
ireq->i_val |= 1;
if (vap->iv_flags_ht & IEEE80211_FHT_AMSDU_RX)
ireq->i_val |= 2;
break;
case IEEE80211_IOC_AMSDU_LIMIT:
ireq->i_val = vap->iv_amsdu_limit; /* XXX truncation? */
break;
case IEEE80211_IOC_PUREN:
ireq->i_val = (vap->iv_flags_ht & IEEE80211_FHT_PUREN) != 0;
break;
case IEEE80211_IOC_DOTH:
ireq->i_val = (vap->iv_flags & IEEE80211_F_DOTH) != 0;
break;
case IEEE80211_IOC_REGDOMAIN:
error = ieee80211_ioctl_getregdomain(vap, ireq);
break;
case IEEE80211_IOC_ROAM:
error = ieee80211_ioctl_getroam(vap, ireq);
break;
case IEEE80211_IOC_TXPARAMS:
error = ieee80211_ioctl_gettxparams(vap, ireq);
break;
case IEEE80211_IOC_HTCOMPAT:
ireq->i_val = (vap->iv_flags_ht & IEEE80211_FHT_HTCOMPAT) != 0;
break;
case IEEE80211_IOC_DWDS:
ireq->i_val = (vap->iv_flags & IEEE80211_F_DWDS) != 0;
break;
case IEEE80211_IOC_INACTIVITY:
ireq->i_val = (vap->iv_flags_ext & IEEE80211_FEXT_INACT) != 0;
break;
case IEEE80211_IOC_APPIE:
error = ieee80211_ioctl_getappie(vap, ireq);
break;
case IEEE80211_IOC_WPS:
ireq->i_val = (vap->iv_flags_ext & IEEE80211_FEXT_WPS) != 0;
break;
case IEEE80211_IOC_TSN:
ireq->i_val = (vap->iv_flags_ext & IEEE80211_FEXT_TSN) != 0;
break;
case IEEE80211_IOC_DFS:
ireq->i_val = (vap->iv_flags_ext & IEEE80211_FEXT_DFS) != 0;
break;
case IEEE80211_IOC_DOTD:
ireq->i_val = (vap->iv_flags_ext & IEEE80211_FEXT_DOTD) != 0;
break;
case IEEE80211_IOC_DEVCAPS:
error = ieee80211_ioctl_getdevcaps(ic, ireq);
break;
case IEEE80211_IOC_HTPROTMODE:
ireq->i_val = ic->ic_htprotmode;
break;
case IEEE80211_IOC_HTCONF:
if (vap->iv_flags_ht & IEEE80211_FHT_HT) {
ireq->i_val = 1;
if (vap->iv_flags_ht & IEEE80211_FHT_USEHT40)
ireq->i_val |= 2;
} else
ireq->i_val = 0;
break;
case IEEE80211_IOC_STA_VLAN:
error = ieee80211_ioctl_getstavlan(vap, ireq);
break;
case IEEE80211_IOC_SMPS:
if (vap->iv_opmode == IEEE80211_M_STA &&
vap->iv_state == IEEE80211_S_RUN) {
if (vap->iv_bss->ni_flags & IEEE80211_NODE_MIMO_RTS)
ireq->i_val = IEEE80211_HTCAP_SMPS_DYNAMIC;
else if (vap->iv_bss->ni_flags & IEEE80211_NODE_MIMO_PS)
ireq->i_val = IEEE80211_HTCAP_SMPS_ENA;
else
ireq->i_val = IEEE80211_HTCAP_SMPS_OFF;
} else
ireq->i_val = vap->iv_htcaps & IEEE80211_HTCAP_SMPS;
break;
case IEEE80211_IOC_RIFS:
if (vap->iv_opmode == IEEE80211_M_STA &&
vap->iv_state == IEEE80211_S_RUN)
ireq->i_val =
(vap->iv_bss->ni_flags & IEEE80211_NODE_RIFS) != 0;
else
ireq->i_val =
(vap->iv_flags_ht & IEEE80211_FHT_RIFS) != 0;
break;
default:
error = ieee80211_ioctl_getdefault(vap, ireq);
break;
}
return error;
#undef MS
}
static __noinline int
ieee80211_ioctl_setkey(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
struct ieee80211req_key ik;
struct ieee80211_node *ni;
struct ieee80211_key *wk;
uint16_t kid;
int error, i;
if (ireq->i_len != sizeof(ik))
return EINVAL;
error = copyin(ireq->i_data, &ik, sizeof(ik));
if (error)
return error;
/* NB: cipher support is verified by ieee80211_crypt_newkey */
/* NB: this also checks ik->ik_keylen > sizeof(wk->wk_key) */
if (ik.ik_keylen > sizeof(ik.ik_keydata))
return E2BIG;
kid = ik.ik_keyix;
if (kid == IEEE80211_KEYIX_NONE) {
/* XXX unicast keys currently must be tx/rx */
if (ik.ik_flags != (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV))
return EINVAL;
if (vap->iv_opmode == IEEE80211_M_STA) {
ni = ieee80211_ref_node(vap->iv_bss);
if (!IEEE80211_ADDR_EQ(ik.ik_macaddr, ni->ni_bssid)) {
ieee80211_free_node(ni);
return EADDRNOTAVAIL;
}
} else {
ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap,
ik.ik_macaddr);
if (ni == NULL)
return ENOENT;
}
wk = &ni->ni_ucastkey;
} else {
if (kid >= IEEE80211_WEP_NKID)
return EINVAL;
wk = &vap->iv_nw_keys[kid];
/*
* Global slots start off w/o any assigned key index.
* Force one here for consistency with IEEE80211_IOC_WEPKEY.
*/
if (wk->wk_keyix == IEEE80211_KEYIX_NONE)
wk->wk_keyix = kid;
ni = NULL;
}
error = 0;
ieee80211_key_update_begin(vap);
if (ieee80211_crypto_newkey(vap, ik.ik_type, ik.ik_flags, wk)) {
wk->wk_keylen = ik.ik_keylen;
/* NB: MIC presence is implied by cipher type */
if (wk->wk_keylen > IEEE80211_KEYBUF_SIZE)
wk->wk_keylen = IEEE80211_KEYBUF_SIZE;
for (i = 0; i < IEEE80211_TID_SIZE; i++)
wk->wk_keyrsc[i] = ik.ik_keyrsc;
wk->wk_keytsc = 0; /* new key, reset */
memset(wk->wk_key, 0, sizeof(wk->wk_key));
memcpy(wk->wk_key, ik.ik_keydata, ik.ik_keylen);
IEEE80211_ADDR_COPY(wk->wk_macaddr,
ni != NULL ? ni->ni_macaddr : ik.ik_macaddr);
if (!ieee80211_crypto_setkey(vap, wk))
error = EIO;
else if ((ik.ik_flags & IEEE80211_KEY_DEFAULT))
vap->iv_def_txkey = kid;
} else
error = ENXIO;
ieee80211_key_update_end(vap);
if (ni != NULL)
ieee80211_free_node(ni);
return error;
}
static __noinline int
ieee80211_ioctl_delkey(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
struct ieee80211req_del_key dk;
int kid, error;
if (ireq->i_len != sizeof(dk))
return EINVAL;
error = copyin(ireq->i_data, &dk, sizeof(dk));
if (error)
return error;
kid = dk.idk_keyix;
/* XXX uint8_t -> uint16_t */
if (dk.idk_keyix == (uint8_t) IEEE80211_KEYIX_NONE) {
struct ieee80211_node *ni;
if (vap->iv_opmode == IEEE80211_M_STA) {
ni = ieee80211_ref_node(vap->iv_bss);
if (!IEEE80211_ADDR_EQ(dk.idk_macaddr, ni->ni_bssid)) {
ieee80211_free_node(ni);
return EADDRNOTAVAIL;
}
} else {
ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap,
dk.idk_macaddr);
if (ni == NULL)
return ENOENT;
}
/* XXX error return */
ieee80211_node_delucastkey(ni);
ieee80211_free_node(ni);
} else {
if (kid >= IEEE80211_WEP_NKID)
return EINVAL;
/* XXX error return */
ieee80211_crypto_delkey(vap, &vap->iv_nw_keys[kid]);
}
return 0;
}
struct mlmeop {
struct ieee80211vap *vap;
int op;
int reason;
};
static void
mlmedebug(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN],
int op, int reason)
{
#ifdef IEEE80211_DEBUG
static const struct {
int mask;
const char *opstr;
} ops[] = {
{ 0, "op#0" },
{ IEEE80211_MSG_IOCTL | IEEE80211_MSG_STATE |
IEEE80211_MSG_ASSOC, "assoc" },
{ IEEE80211_MSG_IOCTL | IEEE80211_MSG_STATE |
IEEE80211_MSG_ASSOC, "disassoc" },
{ IEEE80211_MSG_IOCTL | IEEE80211_MSG_STATE |
IEEE80211_MSG_AUTH, "deauth" },
{ IEEE80211_MSG_IOCTL | IEEE80211_MSG_STATE |
IEEE80211_MSG_AUTH, "authorize" },
{ IEEE80211_MSG_IOCTL | IEEE80211_MSG_STATE |
IEEE80211_MSG_AUTH, "unauthorize" },
};
if (op == IEEE80211_MLME_AUTH) {
IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_IOCTL |
IEEE80211_MSG_STATE | IEEE80211_MSG_AUTH, mac,
"station authenticate %s via MLME (reason %d)",
reason == IEEE80211_STATUS_SUCCESS ? "ACCEPT" : "REJECT",
reason);
} else if (!(IEEE80211_MLME_ASSOC <= op && op <= IEEE80211_MLME_AUTH)) {
IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_ANY, mac,
"unknown MLME request %d (reason %d)", op, reason);
} else if (reason == IEEE80211_STATUS_SUCCESS) {
IEEE80211_NOTE_MAC(vap, ops[op].mask, mac,
"station %s via MLME", ops[op].opstr);
} else {
IEEE80211_NOTE_MAC(vap, ops[op].mask, mac,
"station %s via MLME (reason %d)", ops[op].opstr, reason);
}
#endif /* IEEE80211_DEBUG */
}
static void
domlme(void *arg, struct ieee80211_node *ni)
{
struct mlmeop *mop = arg;
struct ieee80211vap *vap = ni->ni_vap;
if (vap != mop->vap)
return;
/*
* NB: if ni_associd is zero then the node is already cleaned
* up and we don't need to do this (we're safely holding a
* reference but should otherwise not modify it's state).
*/
if (ni->ni_associd == 0)
return;
mlmedebug(vap, ni->ni_macaddr, mop->op, mop->reason);
if (mop->op == IEEE80211_MLME_DEAUTH) {
IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_DEAUTH,
mop->reason);
} else {
IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_DISASSOC,
mop->reason);
}
ieee80211_node_leave(ni);
}
static int
setmlme_dropsta(struct ieee80211vap *vap,
const uint8_t mac[IEEE80211_ADDR_LEN], struct mlmeop *mlmeop)
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_node_table *nt = &ic->ic_sta;
struct ieee80211_node *ni;
int error = 0;
/* NB: the broadcast address means do 'em all */
if (!IEEE80211_ADDR_EQ(mac, ic->ic_ifp->if_broadcastaddr)) {
IEEE80211_NODE_LOCK(nt);
ni = ieee80211_find_node_locked(nt, mac);
if (ni != NULL) {
domlme(mlmeop, ni);
ieee80211_free_node(ni);
} else
error = ENOENT;
IEEE80211_NODE_UNLOCK(nt);
} else {
ieee80211_iterate_nodes(nt, domlme, mlmeop);
}
return error;
}
static __noinline int
setmlme_common(struct ieee80211vap *vap, int op,
const uint8_t mac[IEEE80211_ADDR_LEN], int reason)
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_node_table *nt = &ic->ic_sta;
struct ieee80211_node *ni;
struct mlmeop mlmeop;
int error;
error = 0;
switch (op) {
case IEEE80211_MLME_DISASSOC:
case IEEE80211_MLME_DEAUTH:
switch (vap->iv_opmode) {
case IEEE80211_M_STA:
mlmedebug(vap, vap->iv_bss->ni_macaddr, op, reason);
/* XXX not quite right */
ieee80211_new_state(vap, IEEE80211_S_INIT, reason);
break;
case IEEE80211_M_HOSTAP:
mlmeop.vap = vap;
mlmeop.op = op;
mlmeop.reason = reason;
error = setmlme_dropsta(vap, mac, &mlmeop);
break;
case IEEE80211_M_WDS:
/* XXX user app should send raw frame? */
if (op != IEEE80211_MLME_DEAUTH) {
error = EINVAL;
break;
}
#if 0
/* XXX accept any address, simplifies user code */
if (!IEEE80211_ADDR_EQ(mac, vap->iv_bss->ni_macaddr)) {
error = EINVAL;
break;
}
#endif
mlmedebug(vap, vap->iv_bss->ni_macaddr, op, reason);
ni = ieee80211_ref_node(vap->iv_bss);
IEEE80211_SEND_MGMT(ni,
IEEE80211_FC0_SUBTYPE_DEAUTH, reason);
ieee80211_free_node(ni);
break;
default:
error = EINVAL;
break;
}
break;
case IEEE80211_MLME_AUTHORIZE:
case IEEE80211_MLME_UNAUTHORIZE:
if (vap->iv_opmode != IEEE80211_M_HOSTAP &&
vap->iv_opmode != IEEE80211_M_WDS) {
error = EINVAL;
break;
}
IEEE80211_NODE_LOCK(nt);
ni = ieee80211_find_vap_node_locked(nt, vap, mac);
if (ni != NULL) {
mlmedebug(vap, mac, op, reason);
if (op == IEEE80211_MLME_AUTHORIZE)
ieee80211_node_authorize(ni);
else
ieee80211_node_unauthorize(ni);
ieee80211_free_node(ni);
} else
error = ENOENT;
IEEE80211_NODE_UNLOCK(nt);
break;
case IEEE80211_MLME_AUTH:
if (vap->iv_opmode != IEEE80211_M_HOSTAP) {
error = EINVAL;
break;
}
IEEE80211_NODE_LOCK(nt);
ni = ieee80211_find_vap_node_locked(nt, vap, mac);
if (ni != NULL) {
mlmedebug(vap, mac, op, reason);
if (reason == IEEE80211_STATUS_SUCCESS) {
IEEE80211_SEND_MGMT(ni,
IEEE80211_FC0_SUBTYPE_AUTH, 2);
/*
* For shared key auth, just continue the
* exchange. Otherwise when 802.1x is not in
* use mark the port authorized at this point
* so traffic can flow.
*/
if (ni->ni_authmode != IEEE80211_AUTH_8021X &&
ni->ni_challenge == NULL)
ieee80211_node_authorize(ni);
} else {
vap->iv_stats.is_rx_acl++;
ieee80211_send_error(ni, ni->ni_macaddr,
IEEE80211_FC0_SUBTYPE_AUTH, 2|(reason<<16));
ieee80211_node_leave(ni);
}
ieee80211_free_node(ni);
} else
error = ENOENT;
IEEE80211_NODE_UNLOCK(nt);
break;
default:
error = EINVAL;
break;
}
return error;
}
struct scanlookup {
const uint8_t *mac;
int esslen;
const uint8_t *essid;
const struct ieee80211_scan_entry *se;
};
/*
* Match mac address and any ssid.
*/
static void
mlmelookup(void *arg, const struct ieee80211_scan_entry *se)
{
struct scanlookup *look = arg;
if (!IEEE80211_ADDR_EQ(look->mac, se->se_macaddr))
return;
if (look->esslen != 0) {
if (se->se_ssid[1] != look->esslen)
return;
if (memcmp(look->essid, se->se_ssid+2, look->esslen))
return;
}
look->se = se;
}
static __noinline int
setmlme_assoc_sta(struct ieee80211vap *vap,
const uint8_t mac[IEEE80211_ADDR_LEN], int ssid_len,
const uint8_t ssid[IEEE80211_NWID_LEN])
{
struct scanlookup lookup;
KASSERT(vap->iv_opmode == IEEE80211_M_STA,
("expected opmode STA not %s",
ieee80211_opmode_name[vap->iv_opmode]));
/* NB: this is racey if roaming is !manual */
lookup.se = NULL;
lookup.mac = mac;
lookup.esslen = ssid_len;
lookup.essid = ssid;
ieee80211_scan_iterate(vap, mlmelookup, &lookup);
if (lookup.se == NULL)
return ENOENT;
mlmedebug(vap, mac, IEEE80211_MLME_ASSOC, 0);
if (!ieee80211_sta_join(vap, lookup.se->se_chan, lookup.se))
return EIO; /* XXX unique but could be better */
return 0;
}
static __noinline int
setmlme_assoc_adhoc(struct ieee80211vap *vap,
const uint8_t mac[IEEE80211_ADDR_LEN], int ssid_len,
const uint8_t ssid[IEEE80211_NWID_LEN])
{
struct ieee80211_scan_req sr;
KASSERT(vap->iv_opmode == IEEE80211_M_IBSS ||
vap->iv_opmode == IEEE80211_M_AHDEMO,
("expected opmode IBSS or AHDEMO not %s",
ieee80211_opmode_name[vap->iv_opmode]));
if (ssid_len == 0)
return EINVAL;
/* NB: IEEE80211_IOC_SSID call missing for ap_scan=2. */
memset(vap->iv_des_ssid[0].ssid, 0, IEEE80211_NWID_LEN);
vap->iv_des_ssid[0].len = ssid_len;
memcpy(vap->iv_des_ssid[0].ssid, ssid, ssid_len);
vap->iv_des_nssid = 1;
memset(&sr, 0, sizeof(sr));
sr.sr_flags = IEEE80211_IOC_SCAN_ACTIVE | IEEE80211_IOC_SCAN_ONCE;
sr.sr_duration = IEEE80211_IOC_SCAN_FOREVER;
memcpy(sr.sr_ssid[0].ssid, ssid, ssid_len);
sr.sr_ssid[0].len = ssid_len;
sr.sr_nssid = 1;
return ieee80211_scanreq(vap, &sr);
}
static __noinline int
ieee80211_ioctl_setmlme(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
struct ieee80211req_mlme mlme;
int error;
if (ireq->i_len != sizeof(mlme))
return EINVAL;
error = copyin(ireq->i_data, &mlme, sizeof(mlme));
if (error)
return error;
if (vap->iv_opmode == IEEE80211_M_STA &&
mlme.im_op == IEEE80211_MLME_ASSOC)
return setmlme_assoc_sta(vap, mlme.im_macaddr,
vap->iv_des_ssid[0].len, vap->iv_des_ssid[0].ssid);
else if (mlme.im_op == IEEE80211_MLME_ASSOC)
return setmlme_assoc_adhoc(vap, mlme.im_macaddr,
mlme.im_ssid_len, mlme.im_ssid);
else
return setmlme_common(vap, mlme.im_op,
mlme.im_macaddr, mlme.im_reason);
}
static __noinline int
ieee80211_ioctl_macmac(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
uint8_t mac[IEEE80211_ADDR_LEN];
const struct ieee80211_aclator *acl = vap->iv_acl;
int error;
if (ireq->i_len != sizeof(mac))
return EINVAL;
error = copyin(ireq->i_data, mac, ireq->i_len);
if (error)
return error;
if (acl == NULL) {
acl = ieee80211_aclator_get("mac");
if (acl == NULL || !acl->iac_attach(vap))
return EINVAL;
vap->iv_acl = acl;
}
if (ireq->i_type == IEEE80211_IOC_ADDMAC)
acl->iac_add(vap, mac);
else
acl->iac_remove(vap, mac);
return 0;
}
static __noinline int
ieee80211_ioctl_setmaccmd(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
const struct ieee80211_aclator *acl = vap->iv_acl;
switch (ireq->i_val) {
case IEEE80211_MACCMD_POLICY_OPEN:
case IEEE80211_MACCMD_POLICY_ALLOW:
case IEEE80211_MACCMD_POLICY_DENY:
case IEEE80211_MACCMD_POLICY_RADIUS:
if (acl == NULL) {
acl = ieee80211_aclator_get("mac");
if (acl == NULL || !acl->iac_attach(vap))
return EINVAL;
vap->iv_acl = acl;
}
acl->iac_setpolicy(vap, ireq->i_val);
break;
case IEEE80211_MACCMD_FLUSH:
if (acl != NULL)
acl->iac_flush(vap);
/* NB: silently ignore when not in use */
break;
case IEEE80211_MACCMD_DETACH:
if (acl != NULL) {
vap->iv_acl = NULL;
acl->iac_detach(vap);
}
break;
default:
if (acl == NULL)
return EINVAL;
else
return acl->iac_setioctl(vap, ireq);
}
return 0;
}
static __noinline int
ieee80211_ioctl_setchanlist(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
struct ieee80211com *ic = vap->iv_ic;
uint8_t *chanlist, *list;
int i, nchan, maxchan, error;
if (ireq->i_len > sizeof(ic->ic_chan_active))
ireq->i_len = sizeof(ic->ic_chan_active);
list = malloc(ireq->i_len + IEEE80211_CHAN_BYTES, M_TEMP,
M_NOWAIT | M_ZERO);
if (list == NULL)
return ENOMEM;
error = copyin(ireq->i_data, list, ireq->i_len);
if (error) {
free(list, M_TEMP);
return error;
}
nchan = 0;
chanlist = list + ireq->i_len; /* NB: zero'd already */
maxchan = ireq->i_len * NBBY;
for (i = 0; i < ic->ic_nchans; i++) {
const struct ieee80211_channel *c = &ic->ic_channels[i];
/*
* Calculate the intersection of the user list and the
* available channels so users can do things like specify
* 1-255 to get all available channels.
*/
if (c->ic_ieee < maxchan && isset(list, c->ic_ieee)) {
setbit(chanlist, c->ic_ieee);
nchan++;
}
}
if (nchan == 0) {
free(list, M_TEMP);
return EINVAL;
}
if (ic->ic_bsschan != IEEE80211_CHAN_ANYC && /* XXX */
isclr(chanlist, ic->ic_bsschan->ic_ieee))
ic->ic_bsschan = IEEE80211_CHAN_ANYC;
memcpy(ic->ic_chan_active, chanlist, IEEE80211_CHAN_BYTES);
ieee80211_scan_flush(vap);
free(list, M_TEMP);
return ENETRESET;
}
static __noinline int
ieee80211_ioctl_setstastats(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
struct ieee80211_node *ni;
uint8_t macaddr[IEEE80211_ADDR_LEN];
int error;
/*
* NB: we could copyin ieee80211req_sta_stats so apps
* could make selective changes but that's overkill;
* just clear all stats for now.
*/
if (ireq->i_len < IEEE80211_ADDR_LEN)
return EINVAL;
error = copyin(ireq->i_data, macaddr, IEEE80211_ADDR_LEN);
if (error != 0)
return error;
ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap, macaddr);
if (ni == NULL)
return ENOENT;
/* XXX require ni_vap == vap? */
memset(&ni->ni_stats, 0, sizeof(ni->ni_stats));
ieee80211_free_node(ni);
return 0;
}
static __noinline int
ieee80211_ioctl_setstatxpow(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
struct ieee80211_node *ni;
struct ieee80211req_sta_txpow txpow;
int error;
if (ireq->i_len != sizeof(txpow))
return EINVAL;
error = copyin(ireq->i_data, &txpow, sizeof(txpow));
if (error != 0)
return error;
ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap, txpow.it_macaddr);
if (ni == NULL)
return ENOENT;
ni->ni_txpower = txpow.it_txpow;
ieee80211_free_node(ni);
return error;
}
static __noinline int
ieee80211_ioctl_setwmeparam(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_wme_state *wme = &ic->ic_wme;
struct wmeParams *wmep, *chanp;
int isbss, ac;
if ((ic->ic_caps & IEEE80211_C_WME) == 0)
return EOPNOTSUPP;
isbss = (ireq->i_len & IEEE80211_WMEPARAM_BSS);
ac = (ireq->i_len & IEEE80211_WMEPARAM_VAL);
if (ac >= WME_NUM_AC)
ac = WME_AC_BE;
if (isbss) {
chanp = &wme->wme_bssChanParams.cap_wmeParams[ac];
wmep = &wme->wme_wmeBssChanParams.cap_wmeParams[ac];
} else {
chanp = &wme->wme_chanParams.cap_wmeParams[ac];
wmep = &wme->wme_wmeChanParams.cap_wmeParams[ac];
}
switch (ireq->i_type) {
case IEEE80211_IOC_WME_CWMIN: /* WME: CWmin */
if (isbss) {
wmep->wmep_logcwmin = ireq->i_val;
if ((wme->wme_flags & WME_F_AGGRMODE) == 0)
chanp->wmep_logcwmin = ireq->i_val;
} else {
wmep->wmep_logcwmin = chanp->wmep_logcwmin =
ireq->i_val;
}
break;
case IEEE80211_IOC_WME_CWMAX: /* WME: CWmax */
if (isbss) {
wmep->wmep_logcwmax = ireq->i_val;
if ((wme->wme_flags & WME_F_AGGRMODE) == 0)
chanp->wmep_logcwmax = ireq->i_val;
} else {
wmep->wmep_logcwmax = chanp->wmep_logcwmax =
ireq->i_val;
}
break;
case IEEE80211_IOC_WME_AIFS: /* WME: AIFS */
if (isbss) {
wmep->wmep_aifsn = ireq->i_val;
if ((wme->wme_flags & WME_F_AGGRMODE) == 0)
chanp->wmep_aifsn = ireq->i_val;
} else {
wmep->wmep_aifsn = chanp->wmep_aifsn = ireq->i_val;
}
break;
case IEEE80211_IOC_WME_TXOPLIMIT: /* WME: txops limit */
if (isbss) {
wmep->wmep_txopLimit = ireq->i_val;
if ((wme->wme_flags & WME_F_AGGRMODE) == 0)
chanp->wmep_txopLimit = ireq->i_val;
} else {
wmep->wmep_txopLimit = chanp->wmep_txopLimit =
ireq->i_val;
}
break;
case IEEE80211_IOC_WME_ACM: /* WME: ACM (bss only) */
wmep->wmep_acm = ireq->i_val;
if ((wme->wme_flags & WME_F_AGGRMODE) == 0)
chanp->wmep_acm = ireq->i_val;
break;
case IEEE80211_IOC_WME_ACKPOLICY: /* WME: ACK policy (!bss only)*/
wmep->wmep_noackPolicy = chanp->wmep_noackPolicy =
(ireq->i_val) == 0;
break;
}
ieee80211_wme_updateparams(vap);
return 0;
}
static int
find11gchannel(struct ieee80211com *ic, int start, int freq)
{
const struct ieee80211_channel *c;
int i;
for (i = start+1; i < ic->ic_nchans; i++) {
c = &ic->ic_channels[i];
if (c->ic_freq == freq && IEEE80211_IS_CHAN_ANYG(c))
return 1;
}
/* NB: should not be needed but in case things are mis-sorted */
for (i = 0; i < start; i++) {
c = &ic->ic_channels[i];
if (c->ic_freq == freq && IEEE80211_IS_CHAN_ANYG(c))
return 1;
}
return 0;
}
static struct ieee80211_channel *
findchannel(struct ieee80211com *ic, int ieee, int mode)
{
static const u_int chanflags[IEEE80211_MODE_MAX] = {
[IEEE80211_MODE_AUTO] = 0,
[IEEE80211_MODE_11A] = IEEE80211_CHAN_A,
[IEEE80211_MODE_11B] = IEEE80211_CHAN_B,
[IEEE80211_MODE_11G] = IEEE80211_CHAN_G,
[IEEE80211_MODE_FH] = IEEE80211_CHAN_FHSS,
[IEEE80211_MODE_TURBO_A] = IEEE80211_CHAN_108A,
[IEEE80211_MODE_TURBO_G] = IEEE80211_CHAN_108G,
[IEEE80211_MODE_STURBO_A] = IEEE80211_CHAN_STURBO,
[IEEE80211_MODE_HALF] = IEEE80211_CHAN_HALF,
[IEEE80211_MODE_QUARTER] = IEEE80211_CHAN_QUARTER,
/* NB: handled specially below */
[IEEE80211_MODE_11NA] = IEEE80211_CHAN_A,
[IEEE80211_MODE_11NG] = IEEE80211_CHAN_G,
};
u_int modeflags;
int i;
modeflags = chanflags[mode];
for (i = 0; i < ic->ic_nchans; i++) {
struct ieee80211_channel *c = &ic->ic_channels[i];
if (c->ic_ieee != ieee)
continue;
if (mode == IEEE80211_MODE_AUTO) {
/* ignore turbo channels for autoselect */
if (IEEE80211_IS_CHAN_TURBO(c))
continue;
/*
* XXX special-case 11b/g channels so we
* always select the g channel if both
* are present.
* XXX prefer HT to non-HT?
*/
if (!IEEE80211_IS_CHAN_B(c) ||
!find11gchannel(ic, i, c->ic_freq))
return c;
} else {
/* must check HT specially */
if ((mode == IEEE80211_MODE_11NA ||
mode == IEEE80211_MODE_11NG) &&
!IEEE80211_IS_CHAN_HT(c))
continue;
if ((c->ic_flags & modeflags) == modeflags)
return c;
}
}
return NULL;
}
/*
* Check the specified against any desired mode (aka netband).
* This is only used (presently) when operating in hostap mode
* to enforce consistency.
*/
static int
check_mode_consistency(const struct ieee80211_channel *c, int mode)
{
KASSERT(c != IEEE80211_CHAN_ANYC, ("oops, no channel"));
switch (mode) {
case IEEE80211_MODE_11B:
return (IEEE80211_IS_CHAN_B(c));
case IEEE80211_MODE_11G:
return (IEEE80211_IS_CHAN_ANYG(c) && !IEEE80211_IS_CHAN_HT(c));
case IEEE80211_MODE_11A:
return (IEEE80211_IS_CHAN_A(c) && !IEEE80211_IS_CHAN_HT(c));
case IEEE80211_MODE_STURBO_A:
return (IEEE80211_IS_CHAN_STURBO(c));
case IEEE80211_MODE_11NA:
return (IEEE80211_IS_CHAN_HTA(c));
case IEEE80211_MODE_11NG:
return (IEEE80211_IS_CHAN_HTG(c));
}
return 1;
}
/*
* Common code to set the current channel. If the device
* is up and running this may result in an immediate channel
* change or a kick of the state machine.
*/
static int
setcurchan(struct ieee80211vap *vap, struct ieee80211_channel *c)
{
struct ieee80211com *ic = vap->iv_ic;
int error;
if (c != IEEE80211_CHAN_ANYC) {
if (IEEE80211_IS_CHAN_RADAR(c))
return EBUSY; /* XXX better code? */
if (vap->iv_opmode == IEEE80211_M_HOSTAP) {
if (IEEE80211_IS_CHAN_NOHOSTAP(c))
return EINVAL;
if (!check_mode_consistency(c, vap->iv_des_mode))
return EINVAL;
} else if (vap->iv_opmode == IEEE80211_M_IBSS) {
if (IEEE80211_IS_CHAN_NOADHOC(c))
return EINVAL;
}
if (vap->iv_state == IEEE80211_S_RUN &&
vap->iv_bss->ni_chan == c)
return 0; /* NB: nothing to do */
}
vap->iv_des_chan = c;
error = 0;
if (vap->iv_opmode == IEEE80211_M_MONITOR &&
vap->iv_des_chan != IEEE80211_CHAN_ANYC) {
/*
* Monitor mode can switch directly.
*/
if (IFNET_IS_UP_RUNNING(vap->iv_ifp)) {
/* XXX need state machine for other vap's to follow */
ieee80211_setcurchan(ic, vap->iv_des_chan);
vap->iv_bss->ni_chan = ic->ic_curchan;
} else
ic->ic_curchan = vap->iv_des_chan;
ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan);
} else {
/*
* Need to go through the state machine in case we
* need to reassociate or the like. The state machine
* will pickup the desired channel and avoid scanning.
*/
if (IS_UP_AUTO(vap))
ieee80211_new_state(vap, IEEE80211_S_SCAN, 0);
else if (vap->iv_des_chan != IEEE80211_CHAN_ANYC) {
/*
* When not up+running and a real channel has
* been specified fix the current channel so
* there is immediate feedback; e.g. via ifconfig.
*/
ic->ic_curchan = vap->iv_des_chan;
ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan);
}
}
return error;
}
/*
* Old api for setting the current channel; this is
* deprecated because channel numbers are ambiguous.
*/
static __noinline int
ieee80211_ioctl_setchannel(struct ieee80211vap *vap,
const struct ieee80211req *ireq)
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_channel *c;
/* XXX 0xffff overflows 16-bit signed */
if (ireq->i_val == 0 ||
ireq->i_val == (int16_t) IEEE80211_CHAN_ANY) {
c = IEEE80211_CHAN_ANYC;
} else {
struct ieee80211_channel *c2;
c = findchannel(ic, ireq->i_val, vap->iv_des_mode);
if (c == NULL) {
c = findchannel(ic, ireq->i_val,
IEEE80211_MODE_AUTO);
if (c == NULL)
return EINVAL;
}
/*
* Fine tune channel selection based on desired mode:
* if 11b is requested, find the 11b version of any
* 11g channel returned,
* if static turbo, find the turbo version of any
* 11a channel return,
* if 11na is requested, find the ht version of any
* 11a channel returned,
* if 11ng is requested, find the ht version of any
* 11g channel returned,
* otherwise we should be ok with what we've got.
*/
switch (vap->iv_des_mode) {
case IEEE80211_MODE_11B:
if (IEEE80211_IS_CHAN_ANYG(c)) {
c2 = findchannel(ic, ireq->i_val,
IEEE80211_MODE_11B);
/* NB: should not happen, =>'s 11g w/o 11b */
if (c2 != NULL)
c = c2;
}
break;
case IEEE80211_MODE_TURBO_A:
if (IEEE80211_IS_CHAN_A(c)) {
c2 = findchannel(ic, ireq->i_val,
IEEE80211_MODE_TURBO_A);
if (c2 != NULL)
c = c2;
}
break;
case IEEE80211_MODE_11NA:
if (IEEE80211_IS_CHAN_A(c)) {
c2 = findchannel(ic, ireq->i_val,
IEEE80211_MODE_11NA);
if (c2 != NULL)
c = c2;
}
break;
case IEEE80211_MODE_11NG:
if (IEEE80211_IS_CHAN_ANYG(c)) {
c2 = findchannel(ic, ireq->i_val,
IEEE80211_MODE_11NG);
if (c2 != NULL)
c = c2;
}
break;
default: /* NB: no static turboG */
break;
}
}
return setcurchan(vap, c);
}
/*
* New/current api for setting the current channel; a complete
* channel description is provide so there is no ambiguity in
* identifying the channel.
*/
static __noinline int
ieee80211_ioctl_setcurchan(struct ieee80211vap *vap,
const struct ieee80211req *ireq)
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_channel chan, *c;
int error;
if (ireq->i_len != sizeof(chan))
return EINVAL;
error = copyin(ireq->i_data, &chan, sizeof(chan));
if (error != 0)
return error;
/* XXX 0xffff overflows 16-bit signed */
if (chan.ic_freq == 0 || chan.ic_freq == IEEE80211_CHAN_ANY) {
c = IEEE80211_CHAN_ANYC;
} else {
c = ieee80211_find_channel(ic, chan.ic_freq, chan.ic_flags);
if (c == NULL)
return EINVAL;
}
return setcurchan(vap, c);
}
static __noinline int
ieee80211_ioctl_setregdomain(struct ieee80211vap *vap,
const struct ieee80211req *ireq)
{
struct ieee80211_regdomain_req *reg;
int nchans, error;
nchans = 1 + ((ireq->i_len - sizeof(struct ieee80211_regdomain_req)) /
sizeof(struct ieee80211_channel));
if (!(1 <= nchans && nchans <= IEEE80211_CHAN_MAX)) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_IOCTL,
"%s: bad # chans, i_len %d nchans %d\n", __func__,
ireq->i_len, nchans);
return EINVAL;
}
reg = (struct ieee80211_regdomain_req *)
malloc(IEEE80211_REGDOMAIN_SIZE(nchans), M_TEMP, M_NOWAIT);
if (reg == NULL) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_IOCTL,
"%s: no memory, nchans %d\n", __func__, nchans);
return ENOMEM;
}
error = copyin(ireq->i_data, reg, IEEE80211_REGDOMAIN_SIZE(nchans));
if (error == 0) {
/* NB: validate inline channel count against storage size */
if (reg->chaninfo.ic_nchans != nchans) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_IOCTL,
"%s: chan cnt mismatch, %d != %d\n", __func__,
reg->chaninfo.ic_nchans, nchans);
error = EINVAL;
} else
error = ieee80211_setregdomain(vap, reg);
}
free(reg, M_TEMP);
return (error == 0 ? ENETRESET : error);
}
static int
ieee80211_ioctl_setroam(struct ieee80211vap *vap,
const struct ieee80211req *ireq)
{
if (ireq->i_len != sizeof(vap->iv_roamparms))
return EINVAL;
/* XXX validate params */
/* XXX? ENETRESET to push to device? */
return copyin(ireq->i_data, vap->iv_roamparms,
sizeof(vap->iv_roamparms));
}
static int
checkrate(const struct ieee80211_rateset *rs, int rate)
{
int i;
if (rate == IEEE80211_FIXED_RATE_NONE)
return 1;
for (i = 0; i < rs->rs_nrates; i++)
if ((rs->rs_rates[i] & IEEE80211_RATE_VAL) == rate)
return 1;
return 0;
}
static int
checkmcs(int mcs)
{
if (mcs == IEEE80211_FIXED_RATE_NONE)
return 1;
if ((mcs & IEEE80211_RATE_MCS) == 0) /* MCS always have 0x80 set */
return 0;
return (mcs & 0x7f) <= 15; /* XXX could search ht rate set */
}
static __noinline int
ieee80211_ioctl_settxparams(struct ieee80211vap *vap,
const struct ieee80211req *ireq)
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_txparams_req parms; /* XXX stack use? */
struct ieee80211_txparam *src, *dst;
const struct ieee80211_rateset *rs;
int error, mode, changed, is11n, nmodes;
/* NB: accept short requests for backwards compat */
if (ireq->i_len > sizeof(parms))
return EINVAL;
error = copyin(ireq->i_data, &parms, ireq->i_len);
if (error != 0)
return error;
nmodes = ireq->i_len / sizeof(struct ieee80211_txparam);
changed = 0;
/* validate parameters and check if anything changed */
for (mode = IEEE80211_MODE_11A; mode < nmodes; mode++) {
if (isclr(ic->ic_modecaps, mode))
continue;
src = &parms.params[mode];
dst = &vap->iv_txparms[mode];
rs = &ic->ic_sup_rates[mode]; /* NB: 11n maps to legacy */
is11n = (mode == IEEE80211_MODE_11NA ||
mode == IEEE80211_MODE_11NG);
if (src->ucastrate != dst->ucastrate) {
if (!checkrate(rs, src->ucastrate) &&
(!is11n || !checkmcs(src->ucastrate)))
return EINVAL;
changed++;
}
if (src->mcastrate != dst->mcastrate) {
if (!checkrate(rs, src->mcastrate) &&
(!is11n || !checkmcs(src->mcastrate)))
return EINVAL;
changed++;
}
if (src->mgmtrate != dst->mgmtrate) {
if (!checkrate(rs, src->mgmtrate) &&
(!is11n || !checkmcs(src->mgmtrate)))
return EINVAL;
changed++;
}
if (src->maxretry != dst->maxretry) /* NB: no bounds */
changed++;
}
if (changed) {
/*
* Copy new parameters in place and notify the
* driver so it can push state to the device.
*/
for (mode = IEEE80211_MODE_11A; mode < nmodes; mode++) {
if (isset(ic->ic_modecaps, mode))
vap->iv_txparms[mode] = parms.params[mode];
}
/* XXX could be more intelligent,
e.g. don't reset if setting not being used */
return ENETRESET;
}
return 0;
}
/*
* Application Information Element support.
*/
static int
setappie(struct ieee80211_appie **aie, const struct ieee80211req *ireq)
{
struct ieee80211_appie *app = *aie;
struct ieee80211_appie *napp;
int error;
if (ireq->i_len == 0) { /* delete any existing ie */
if (app != NULL) {
*aie = NULL; /* XXX racey */
free(app, M_80211_NODE_IE);
}
return 0;
}
if (!(2 <= ireq->i_len && ireq->i_len <= IEEE80211_MAX_APPIE))
return EINVAL;
/*
* Allocate a new appie structure and copy in the user data.
* When done swap in the new structure. Note that we do not
* guard against users holding a ref to the old structure;
* this must be handled outside this code.
*
* XXX bad bad bad
*/
napp = (struct ieee80211_appie *) malloc(
sizeof(struct ieee80211_appie) + ireq->i_len, M_80211_NODE_IE, M_NOWAIT);
if (napp == NULL)
return ENOMEM;
/* XXX holding ic lock */
error = copyin(ireq->i_data, napp->ie_data, ireq->i_len);
if (error) {
free(napp, M_80211_NODE_IE);
return error;
}
napp->ie_len = ireq->i_len;
*aie = napp;
if (app != NULL)
free(app, M_80211_NODE_IE);
return 0;
}
static void
setwparsnie(struct ieee80211vap *vap, uint8_t *ie, int space)
{
/* validate data is present as best we can */
if (space == 0 || 2+ie[1] > space)
return;
if (ie[0] == IEEE80211_ELEMID_VENDOR)
vap->iv_wpa_ie = ie;
else if (ie[0] == IEEE80211_ELEMID_RSN)
vap->iv_rsn_ie = ie;
}
static __noinline int
ieee80211_ioctl_setappie_locked(struct ieee80211vap *vap,
const struct ieee80211req *ireq, int fc0)
{
int error;
IEEE80211_LOCK_ASSERT(vap->iv_ic);
switch (fc0 & IEEE80211_FC0_SUBTYPE_MASK) {
case IEEE80211_FC0_SUBTYPE_BEACON:
if (vap->iv_opmode != IEEE80211_M_HOSTAP &&
vap->iv_opmode != IEEE80211_M_IBSS) {
error = EINVAL;
break;
}
error = setappie(&vap->iv_appie_beacon, ireq);
if (error == 0)
ieee80211_beacon_notify(vap, IEEE80211_BEACON_APPIE);
break;
case IEEE80211_FC0_SUBTYPE_PROBE_RESP:
error = setappie(&vap->iv_appie_proberesp, ireq);
break;
case IEEE80211_FC0_SUBTYPE_ASSOC_RESP:
if (vap->iv_opmode == IEEE80211_M_HOSTAP)
error = setappie(&vap->iv_appie_assocresp, ireq);
else
error = EINVAL;
break;
case IEEE80211_FC0_SUBTYPE_PROBE_REQ:
error = setappie(&vap->iv_appie_probereq, ireq);
break;
case IEEE80211_FC0_SUBTYPE_ASSOC_REQ:
if (vap->iv_opmode == IEEE80211_M_STA)
error = setappie(&vap->iv_appie_assocreq, ireq);
else
error = EINVAL;
break;
case (IEEE80211_APPIE_WPA & IEEE80211_FC0_SUBTYPE_MASK):
error = setappie(&vap->iv_appie_wpa, ireq);
if (error == 0) {
/*
* Must split single blob of data into separate
* WPA and RSN ie's because they go in different
* locations in the mgt frames.
* XXX use IEEE80211_IOC_WPA2 so user code does split
*/
vap->iv_wpa_ie = NULL;
vap->iv_rsn_ie = NULL;
if (vap->iv_appie_wpa != NULL) {
struct ieee80211_appie *appie =
vap->iv_appie_wpa;
uint8_t *data = appie->ie_data;
/* XXX ie length validate is painful, cheat */
setwparsnie(vap, data, appie->ie_len);
setwparsnie(vap, data + 2 + data[1],
appie->ie_len - (2 + data[1]));
}
if (vap->iv_opmode == IEEE80211_M_HOSTAP ||
vap->iv_opmode == IEEE80211_M_IBSS) {
/*
* Must rebuild beacon frame as the update
* mechanism doesn't handle WPA/RSN ie's.
* Could extend it but it doesn't normally
* change; this is just to deal with hostapd
* plumbing the ie after the interface is up.
*/
error = ENETRESET;
}
}
break;
default:
error = EINVAL;
break;
}
return error;
}
static __noinline int
ieee80211_ioctl_setappie(struct ieee80211vap *vap,
const struct ieee80211req *ireq)
{
struct ieee80211com *ic = vap->iv_ic;
int error;
uint8_t fc0;
fc0 = ireq->i_val & 0xff;
if ((fc0 & IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_MGT)
return EINVAL;
/* NB: could check iv_opmode and reject but hardly worth the effort */
IEEE80211_LOCK(ic);
error = ieee80211_ioctl_setappie_locked(vap, ireq, fc0);
IEEE80211_UNLOCK(ic);
return error;
}
static __noinline int
ieee80211_ioctl_chanswitch(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_chanswitch_req csr;
struct ieee80211_channel *c;
int error;
if (ireq->i_len != sizeof(csr))
return EINVAL;
error = copyin(ireq->i_data, &csr, sizeof(csr));
if (error != 0)
return error;
/* XXX adhoc mode not supported */
if (vap->iv_opmode != IEEE80211_M_HOSTAP ||
(vap->iv_flags & IEEE80211_F_DOTH) == 0)
return EOPNOTSUPP;
c = ieee80211_find_channel(ic,
csr.csa_chan.ic_freq, csr.csa_chan.ic_flags);
if (c == NULL)
return ENOENT;
IEEE80211_LOCK(ic);
if ((ic->ic_flags & IEEE80211_F_CSAPENDING) == 0)
ieee80211_csa_startswitch(ic, c, csr.csa_mode, csr.csa_count);
else if (csr.csa_count == 0)
ieee80211_csa_cancelswitch(ic);
else
error = EBUSY;
IEEE80211_UNLOCK(ic);
return error;
}
static int
ieee80211_scanreq(struct ieee80211vap *vap, struct ieee80211_scan_req *sr)
{
#define IEEE80211_IOC_SCAN_FLAGS \
(IEEE80211_IOC_SCAN_NOPICK | IEEE80211_IOC_SCAN_ACTIVE | \
IEEE80211_IOC_SCAN_PICK1ST | IEEE80211_IOC_SCAN_BGSCAN | \
IEEE80211_IOC_SCAN_ONCE | IEEE80211_IOC_SCAN_NOBCAST | \
IEEE80211_IOC_SCAN_NOJOIN | IEEE80211_IOC_SCAN_FLUSH | \
IEEE80211_IOC_SCAN_CHECK)
struct ieee80211com *ic = vap->iv_ic;
int error, i;
/* convert duration */
if (sr->sr_duration == IEEE80211_IOC_SCAN_FOREVER)
sr->sr_duration = IEEE80211_SCAN_FOREVER;
else {
if (sr->sr_duration < IEEE80211_IOC_SCAN_DURATION_MIN ||
sr->sr_duration > IEEE80211_IOC_SCAN_DURATION_MAX)
return EINVAL;
sr->sr_duration = msecs_to_ticks(sr->sr_duration);
if (sr->sr_duration < 1)
sr->sr_duration = 1;
}
/* convert min/max channel dwell */
if (sr->sr_mindwell != 0) {
sr->sr_mindwell = msecs_to_ticks(sr->sr_mindwell);
if (sr->sr_mindwell < 1)
sr->sr_mindwell = 1;
}
if (sr->sr_maxdwell != 0) {
sr->sr_maxdwell = msecs_to_ticks(sr->sr_maxdwell);
if (sr->sr_maxdwell < 1)
sr->sr_maxdwell = 1;
}
/* NB: silently reduce ssid count to what is supported */
if (sr->sr_nssid > IEEE80211_SCAN_MAX_SSID)
sr->sr_nssid = IEEE80211_SCAN_MAX_SSID;
for (i = 0; i < sr->sr_nssid; i++)
if (sr->sr_ssid[i].len > IEEE80211_NWID_LEN)
return EINVAL;
/* cleanse flags just in case, could reject if invalid flags */
sr->sr_flags &= IEEE80211_IOC_SCAN_FLAGS;
/*
* Add an implicit NOPICK if the vap is not marked UP. This
* allows applications to scan without joining a bss (or picking
* a channel and setting up a bss) and without forcing manual
* roaming mode--you just need to mark the parent device UP.
*/
if ((vap->iv_ifp->if_flags & IFF_UP) == 0)
sr->sr_flags |= IEEE80211_IOC_SCAN_NOPICK;
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: flags 0x%x%s duration 0x%x mindwell %u maxdwell %u nssid %d\n",
__func__, sr->sr_flags,
(vap->iv_ifp->if_flags & IFF_UP) == 0 ? " (!IFF_UP)" : "",
sr->sr_duration, sr->sr_mindwell, sr->sr_maxdwell, sr->sr_nssid);
/*
* If we are in INIT state then the driver has never had a chance
* to setup hardware state to do a scan; we must use the state
* machine to get us up to the SCAN state but once we reach SCAN
* state we then want to use the supplied params. Stash the
* parameters in the vap and mark IEEE80211_FEXT_SCANREQ; the
* state machines will recognize this and use the stashed params
* to issue the scan request.
*
* Otherwise just invoke the scan machinery directly.
*/
IEEE80211_LOCK(ic);
if (vap->iv_state == IEEE80211_S_INIT) {
/* NB: clobbers previous settings */
vap->iv_scanreq_flags = sr->sr_flags;
vap->iv_scanreq_duration = sr->sr_duration;
vap->iv_scanreq_nssid = sr->sr_nssid;
for (i = 0; i < sr->sr_nssid; i++) {
vap->iv_scanreq_ssid[i].len = sr->sr_ssid[i].len;
memcpy(vap->iv_scanreq_ssid[i].ssid,
sr->sr_ssid[i].ssid, sr->sr_ssid[i].len);
}
vap->iv_flags_ext |= IEEE80211_FEXT_SCANREQ;
IEEE80211_UNLOCK(ic);
ieee80211_new_state(vap, IEEE80211_S_SCAN, 0);
} else {
vap->iv_flags_ext &= ~IEEE80211_FEXT_SCANREQ;
IEEE80211_UNLOCK(ic);
if (sr->sr_flags & IEEE80211_IOC_SCAN_CHECK) {
error = ieee80211_check_scan(vap, sr->sr_flags,
sr->sr_duration, sr->sr_mindwell, sr->sr_maxdwell,
sr->sr_nssid,
/* NB: cheat, we assume structures are compatible */
(const struct ieee80211_scan_ssid *) &sr->sr_ssid[0]);
} else {
error = ieee80211_start_scan(vap, sr->sr_flags,
sr->sr_duration, sr->sr_mindwell, sr->sr_maxdwell,
sr->sr_nssid,
/* NB: cheat, we assume structures are compatible */
(const struct ieee80211_scan_ssid *) &sr->sr_ssid[0]);
}
if (error == 0)
return EINPROGRESS;
}
return 0;
#undef IEEE80211_IOC_SCAN_FLAGS
}
static __noinline int
ieee80211_ioctl_scanreq(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_scan_req sr; /* XXX off stack? */
int error;
/* NB: parent must be running */
if ((ic->ic_ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
return ENXIO;
if (ireq->i_len != sizeof(sr))
return EINVAL;
error = copyin(ireq->i_data, &sr, sizeof(sr));
if (error != 0)
return error;
return ieee80211_scanreq(vap, &sr);
}
static __noinline int
ieee80211_ioctl_setstavlan(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
struct ieee80211_node *ni;
struct ieee80211req_sta_vlan vlan;
int error;
if (ireq->i_len != sizeof(vlan))
return EINVAL;
error = copyin(ireq->i_data, &vlan, sizeof(vlan));
if (error != 0)
return error;
if (!IEEE80211_ADDR_EQ(vlan.sv_macaddr, zerobssid)) {
ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap,
vlan.sv_macaddr);
if (ni == NULL)
return ENOENT;
} else
ni = ieee80211_ref_node(vap->iv_bss);
ni->ni_vlan = vlan.sv_vlan;
ieee80211_free_node(ni);
return error;
}
static int
isvap11g(const struct ieee80211vap *vap)
{
const struct ieee80211_node *bss = vap->iv_bss;
return bss->ni_chan != IEEE80211_CHAN_ANYC &&
IEEE80211_IS_CHAN_ANYG(bss->ni_chan);
}
static int
isvapht(const struct ieee80211vap *vap)
{
const struct ieee80211_node *bss = vap->iv_bss;
return bss->ni_chan != IEEE80211_CHAN_ANYC &&
IEEE80211_IS_CHAN_HT(bss->ni_chan);
}
/*
* Dummy ioctl set handler so the linker set is defined.
*/
static int
dummy_ioctl_set(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
return ENOSYS;
}
IEEE80211_IOCTL_SET(dummy, dummy_ioctl_set);
static int
ieee80211_ioctl_setdefault(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
ieee80211_ioctl_setfunc * const *set;
int error;
SET_FOREACH(set, ieee80211_ioctl_setset) {
error = (*set)(vap, ireq);
if (error != ENOSYS)
return error;
}
return EINVAL;
}
static __noinline int
ieee80211_ioctl_set80211(struct ieee80211vap *vap, u_long cmd, struct ieee80211req *ireq)
{
struct ieee80211com *ic = vap->iv_ic;
int error;
const struct ieee80211_authenticator *auth;
uint8_t tmpkey[IEEE80211_KEYBUF_SIZE];
char tmpssid[IEEE80211_NWID_LEN];
uint8_t tmpbssid[IEEE80211_ADDR_LEN];
struct ieee80211_key *k;
u_int kid;
uint32_t flags;
error = 0;
switch (ireq->i_type) {
case IEEE80211_IOC_SSID:
if (ireq->i_val != 0 ||
ireq->i_len > IEEE80211_NWID_LEN)
return EINVAL;
error = copyin(ireq->i_data, tmpssid, ireq->i_len);
if (error)
break;
memset(vap->iv_des_ssid[0].ssid, 0, IEEE80211_NWID_LEN);
vap->iv_des_ssid[0].len = ireq->i_len;
memcpy(vap->iv_des_ssid[0].ssid, tmpssid, ireq->i_len);
vap->iv_des_nssid = (ireq->i_len > 0);
error = ENETRESET;
break;
case IEEE80211_IOC_WEP:
switch (ireq->i_val) {
case IEEE80211_WEP_OFF:
vap->iv_flags &= ~IEEE80211_F_PRIVACY;
vap->iv_flags &= ~IEEE80211_F_DROPUNENC;
break;
case IEEE80211_WEP_ON:
vap->iv_flags |= IEEE80211_F_PRIVACY;
vap->iv_flags |= IEEE80211_F_DROPUNENC;
break;
case IEEE80211_WEP_MIXED:
vap->iv_flags |= IEEE80211_F_PRIVACY;
vap->iv_flags &= ~IEEE80211_F_DROPUNENC;
break;
}
error = ENETRESET;
break;
case IEEE80211_IOC_WEPKEY:
kid = (u_int) ireq->i_val;
if (kid >= IEEE80211_WEP_NKID)
return EINVAL;
k = &vap->iv_nw_keys[kid];
if (ireq->i_len == 0) {
/* zero-len =>'s delete any existing key */
(void) ieee80211_crypto_delkey(vap, k);
break;
}
if (ireq->i_len > sizeof(tmpkey))
return EINVAL;
memset(tmpkey, 0, sizeof(tmpkey));
error = copyin(ireq->i_data, tmpkey, ireq->i_len);
if (error)
break;
ieee80211_key_update_begin(vap);
k->wk_keyix = kid; /* NB: force fixed key id */
if (ieee80211_crypto_newkey(vap, IEEE80211_CIPHER_WEP,
IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV, k)) {
k->wk_keylen = ireq->i_len;
memcpy(k->wk_key, tmpkey, sizeof(tmpkey));
IEEE80211_ADDR_COPY(k->wk_macaddr, vap->iv_myaddr);
if (!ieee80211_crypto_setkey(vap, k))
error = EINVAL;
} else
error = EINVAL;
ieee80211_key_update_end(vap);
break;
case IEEE80211_IOC_WEPTXKEY:
kid = (u_int) ireq->i_val;
if (kid >= IEEE80211_WEP_NKID &&
(uint16_t) kid != IEEE80211_KEYIX_NONE)
return EINVAL;
vap->iv_def_txkey = kid;
break;
case IEEE80211_IOC_AUTHMODE:
switch (ireq->i_val) {
case IEEE80211_AUTH_WPA:
case IEEE80211_AUTH_8021X: /* 802.1x */
case IEEE80211_AUTH_OPEN: /* open */
case IEEE80211_AUTH_SHARED: /* shared-key */
case IEEE80211_AUTH_AUTO: /* auto */
auth = ieee80211_authenticator_get(ireq->i_val);
if (auth == NULL)
return EINVAL;
break;
default:
return EINVAL;
}
switch (ireq->i_val) {
case IEEE80211_AUTH_WPA: /* WPA w/ 802.1x */
vap->iv_flags |= IEEE80211_F_PRIVACY;
ireq->i_val = IEEE80211_AUTH_8021X;
break;
case IEEE80211_AUTH_OPEN: /* open */
vap->iv_flags &= ~(IEEE80211_F_WPA|IEEE80211_F_PRIVACY);
break;
case IEEE80211_AUTH_SHARED: /* shared-key */
case IEEE80211_AUTH_8021X: /* 802.1x */
vap->iv_flags &= ~IEEE80211_F_WPA;
/* both require a key so mark the PRIVACY capability */
vap->iv_flags |= IEEE80211_F_PRIVACY;
break;
case IEEE80211_AUTH_AUTO: /* auto */
vap->iv_flags &= ~IEEE80211_F_WPA;
/* XXX PRIVACY handling? */
/* XXX what's the right way to do this? */
break;
}
/* NB: authenticator attach/detach happens on state change */
vap->iv_bss->ni_authmode = ireq->i_val;
/* XXX mixed/mode/usage? */
vap->iv_auth = auth;
error = ENETRESET;
break;
case IEEE80211_IOC_CHANNEL:
error = ieee80211_ioctl_setchannel(vap, ireq);
break;
case IEEE80211_IOC_POWERSAVE:
switch (ireq->i_val) {
case IEEE80211_POWERSAVE_OFF:
if (vap->iv_flags & IEEE80211_F_PMGTON) {
ieee80211_syncflag(vap, -IEEE80211_F_PMGTON);
error = ERESTART;
}
break;
case IEEE80211_POWERSAVE_ON:
if ((vap->iv_caps & IEEE80211_C_PMGT) == 0)
error = EOPNOTSUPP;
else if ((vap->iv_flags & IEEE80211_F_PMGTON) == 0) {
ieee80211_syncflag(vap, IEEE80211_F_PMGTON);
error = ERESTART;
}
break;
default:
error = EINVAL;
break;
}
break;
case IEEE80211_IOC_POWERSAVESLEEP:
if (ireq->i_val < 0)
return EINVAL;
ic->ic_lintval = ireq->i_val;
error = ERESTART;
break;
case IEEE80211_IOC_RTSTHRESHOLD:
if (!(IEEE80211_RTS_MIN <= ireq->i_val &&
ireq->i_val <= IEEE80211_RTS_MAX))
return EINVAL;
vap->iv_rtsthreshold = ireq->i_val;
error = ERESTART;
break;
case IEEE80211_IOC_PROTMODE:
if (ireq->i_val > IEEE80211_PROT_RTSCTS)
return EINVAL;
ic->ic_protmode = (enum ieee80211_protmode)ireq->i_val;
/* NB: if not operating in 11g this can wait */
if (ic->ic_bsschan != IEEE80211_CHAN_ANYC &&
IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan))
error = ERESTART;
break;
case IEEE80211_IOC_TXPOWER:
if ((ic->ic_caps & IEEE80211_C_TXPMGT) == 0)
return EOPNOTSUPP;
if (!(IEEE80211_TXPOWER_MIN <= ireq->i_val &&
ireq->i_val <= IEEE80211_TXPOWER_MAX))
return EINVAL;
ic->ic_txpowlimit = ireq->i_val;
error = ERESTART;
break;
case IEEE80211_IOC_ROAMING:
if (!(IEEE80211_ROAMING_DEVICE <= ireq->i_val &&
ireq->i_val <= IEEE80211_ROAMING_MANUAL))
return EINVAL;
vap->iv_roaming = (enum ieee80211_roamingmode)ireq->i_val;
/* XXXX reset? */
break;
case IEEE80211_IOC_PRIVACY:
if (ireq->i_val) {
/* XXX check for key state? */
vap->iv_flags |= IEEE80211_F_PRIVACY;
} else
vap->iv_flags &= ~IEEE80211_F_PRIVACY;
/* XXX ERESTART? */
break;
case IEEE80211_IOC_DROPUNENCRYPTED:
if (ireq->i_val)
vap->iv_flags |= IEEE80211_F_DROPUNENC;
else
vap->iv_flags &= ~IEEE80211_F_DROPUNENC;
/* XXX ERESTART? */
break;
case IEEE80211_IOC_WPAKEY:
error = ieee80211_ioctl_setkey(vap, ireq);
break;
case IEEE80211_IOC_DELKEY:
error = ieee80211_ioctl_delkey(vap, ireq);
break;
case IEEE80211_IOC_MLME:
error = ieee80211_ioctl_setmlme(vap, ireq);
break;
case IEEE80211_IOC_COUNTERMEASURES:
if (ireq->i_val) {
if ((vap->iv_flags & IEEE80211_F_WPA) == 0)
return EOPNOTSUPP;
vap->iv_flags |= IEEE80211_F_COUNTERM;
} else
vap->iv_flags &= ~IEEE80211_F_COUNTERM;
/* XXX ERESTART? */
break;
case IEEE80211_IOC_WPA:
if (ireq->i_val > 3)
return EINVAL;
/* XXX verify ciphers available */
flags = vap->iv_flags & ~IEEE80211_F_WPA;
switch (ireq->i_val) {
case 1:
if (!(vap->iv_caps & IEEE80211_C_WPA1))
return EOPNOTSUPP;
flags |= IEEE80211_F_WPA1;
break;
case 2:
if (!(vap->iv_caps & IEEE80211_C_WPA2))
return EOPNOTSUPP;
flags |= IEEE80211_F_WPA2;
break;
case 3:
if ((vap->iv_caps & IEEE80211_C_WPA) != IEEE80211_C_WPA)
return EOPNOTSUPP;
flags |= IEEE80211_F_WPA1 | IEEE80211_F_WPA2;
break;
default: /* Can't set any -> error */
return EOPNOTSUPP;
}
vap->iv_flags = flags;
error = ERESTART; /* NB: can change beacon frame */
break;
case IEEE80211_IOC_WME:
if (ireq->i_val) {
if ((vap->iv_caps & IEEE80211_C_WME) == 0)
return EOPNOTSUPP;
ieee80211_syncflag(vap, IEEE80211_F_WME);
} else
ieee80211_syncflag(vap, -IEEE80211_F_WME);
error = ERESTART; /* NB: can change beacon frame */
break;
case IEEE80211_IOC_HIDESSID:
if (ireq->i_val)
vap->iv_flags |= IEEE80211_F_HIDESSID;
else
vap->iv_flags &= ~IEEE80211_F_HIDESSID;
error = ERESTART; /* XXX ENETRESET? */
break;
case IEEE80211_IOC_APBRIDGE:
if (ireq->i_val == 0)
vap->iv_flags |= IEEE80211_F_NOBRIDGE;
else
vap->iv_flags &= ~IEEE80211_F_NOBRIDGE;
break;
case IEEE80211_IOC_BSSID:
if (ireq->i_len != sizeof(tmpbssid))
return EINVAL;
error = copyin(ireq->i_data, tmpbssid, ireq->i_len);
if (error)
break;
IEEE80211_ADDR_COPY(vap->iv_des_bssid, tmpbssid);
if (IEEE80211_ADDR_EQ(vap->iv_des_bssid, zerobssid))
vap->iv_flags &= ~IEEE80211_F_DESBSSID;
else
vap->iv_flags |= IEEE80211_F_DESBSSID;
error = ENETRESET;
break;
case IEEE80211_IOC_CHANLIST:
error = ieee80211_ioctl_setchanlist(vap, ireq);
break;
#define OLD_IEEE80211_IOC_SCAN_REQ 23
#ifdef OLD_IEEE80211_IOC_SCAN_REQ
case OLD_IEEE80211_IOC_SCAN_REQ:
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: active scan request\n", __func__);
/*
* If we are in INIT state then the driver has never
* had a chance to setup hardware state to do a scan;
* use the state machine to get us up the SCAN state.
* Otherwise just invoke the scan machinery to start
* a one-time scan.
*/
if (vap->iv_state == IEEE80211_S_INIT)
ieee80211_new_state(vap, IEEE80211_S_SCAN, 0);
else
(void) ieee80211_start_scan(vap,
IEEE80211_SCAN_ACTIVE |
IEEE80211_SCAN_NOPICK |
IEEE80211_SCAN_ONCE,
IEEE80211_SCAN_FOREVER, 0, 0,
/* XXX use ioctl params */
vap->iv_des_nssid, vap->iv_des_ssid);
break;
#endif /* OLD_IEEE80211_IOC_SCAN_REQ */
case IEEE80211_IOC_SCAN_REQ:
error = ieee80211_ioctl_scanreq(vap, ireq);
break;
case IEEE80211_IOC_SCAN_CANCEL:
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: cancel scan\n", __func__);
ieee80211_cancel_scan(vap);
break;
case IEEE80211_IOC_HTCONF:
if (ireq->i_val & 1)
ieee80211_syncflag_ht(vap, IEEE80211_FHT_HT);
else
ieee80211_syncflag_ht(vap, -IEEE80211_FHT_HT);
if (ireq->i_val & 2)
ieee80211_syncflag_ht(vap, IEEE80211_FHT_USEHT40);
else
ieee80211_syncflag_ht(vap, -IEEE80211_FHT_USEHT40);
error = ENETRESET;
break;
case IEEE80211_IOC_ADDMAC:
case IEEE80211_IOC_DELMAC:
error = ieee80211_ioctl_macmac(vap, ireq);
break;
case IEEE80211_IOC_MACCMD:
error = ieee80211_ioctl_setmaccmd(vap, ireq);
break;
case IEEE80211_IOC_STA_STATS:
error = ieee80211_ioctl_setstastats(vap, ireq);
break;
case IEEE80211_IOC_STA_TXPOW:
error = ieee80211_ioctl_setstatxpow(vap, ireq);
break;
case IEEE80211_IOC_WME_CWMIN: /* WME: CWmin */
case IEEE80211_IOC_WME_CWMAX: /* WME: CWmax */
case IEEE80211_IOC_WME_AIFS: /* WME: AIFS */
case IEEE80211_IOC_WME_TXOPLIMIT: /* WME: txops limit */
case IEEE80211_IOC_WME_ACM: /* WME: ACM (bss only) */
case IEEE80211_IOC_WME_ACKPOLICY: /* WME: ACK policy (bss only) */
error = ieee80211_ioctl_setwmeparam(vap, ireq);
break;
case IEEE80211_IOC_DTIM_PERIOD:
if (vap->iv_opmode != IEEE80211_M_HOSTAP &&
vap->iv_opmode != IEEE80211_M_MBSS &&
vap->iv_opmode != IEEE80211_M_IBSS)
return EINVAL;
if (IEEE80211_DTIM_MIN <= ireq->i_val &&
ireq->i_val <= IEEE80211_DTIM_MAX) {
vap->iv_dtim_period = ireq->i_val;
error = ENETRESET; /* requires restart */
} else
error = EINVAL;
break;
case IEEE80211_IOC_BEACON_INTERVAL:
if (vap->iv_opmode != IEEE80211_M_HOSTAP &&
vap->iv_opmode != IEEE80211_M_MBSS &&
vap->iv_opmode != IEEE80211_M_IBSS)
return EINVAL;
if (IEEE80211_BINTVAL_MIN <= ireq->i_val &&
ireq->i_val <= IEEE80211_BINTVAL_MAX) {
ic->ic_bintval = ireq->i_val;
error = ENETRESET; /* requires restart */
} else
error = EINVAL;
break;
case IEEE80211_IOC_PUREG:
if (ireq->i_val)
vap->iv_flags |= IEEE80211_F_PUREG;
else
vap->iv_flags &= ~IEEE80211_F_PUREG;
/* NB: reset only if we're operating on an 11g channel */
if (isvap11g(vap))
error = ENETRESET;
break;
case IEEE80211_IOC_BGSCAN:
if (ireq->i_val) {
if ((vap->iv_caps & IEEE80211_C_BGSCAN) == 0)
return EOPNOTSUPP;
vap->iv_flags |= IEEE80211_F_BGSCAN;
} else
vap->iv_flags &= ~IEEE80211_F_BGSCAN;
break;
case IEEE80211_IOC_BGSCAN_IDLE:
if (ireq->i_val >= IEEE80211_BGSCAN_IDLE_MIN)
vap->iv_bgscanidle = ireq->i_val*hz/1000;
else
error = EINVAL;
break;
case IEEE80211_IOC_BGSCAN_INTERVAL:
if (ireq->i_val >= IEEE80211_BGSCAN_INTVAL_MIN)
vap->iv_bgscanintvl = ireq->i_val*hz;
else
error = EINVAL;
break;
case IEEE80211_IOC_SCANVALID:
if (ireq->i_val >= IEEE80211_SCAN_VALID_MIN)
vap->iv_scanvalid = ireq->i_val*hz;
else
error = EINVAL;
break;
case IEEE80211_IOC_FRAGTHRESHOLD:
if ((vap->iv_caps & IEEE80211_C_TXFRAG) == 0 &&
ireq->i_val != IEEE80211_FRAG_MAX)
return EOPNOTSUPP;
if (!(IEEE80211_FRAG_MIN <= ireq->i_val &&
ireq->i_val <= IEEE80211_FRAG_MAX))
return EINVAL;
vap->iv_fragthreshold = ireq->i_val;
error = ERESTART;
break;
case IEEE80211_IOC_BURST:
if (ireq->i_val) {
if ((vap->iv_caps & IEEE80211_C_BURST) == 0)
return EOPNOTSUPP;
ieee80211_syncflag(vap, IEEE80211_F_BURST);
} else
ieee80211_syncflag(vap, -IEEE80211_F_BURST);
error = ERESTART;
break;
case IEEE80211_IOC_BMISSTHRESHOLD:
if (!(IEEE80211_HWBMISS_MIN <= ireq->i_val &&
ireq->i_val <= IEEE80211_HWBMISS_MAX))
return EINVAL;
vap->iv_bmissthreshold = ireq->i_val;
error = ERESTART;
break;
case IEEE80211_IOC_CURCHAN:
error = ieee80211_ioctl_setcurchan(vap, ireq);
break;
case IEEE80211_IOC_SHORTGI:
if (ireq->i_val) {
#define IEEE80211_HTCAP_SHORTGI \
(IEEE80211_HTCAP_SHORTGI20 | IEEE80211_HTCAP_SHORTGI40)
if (((ireq->i_val ^ vap->iv_htcaps) & IEEE80211_HTCAP_SHORTGI) != 0)
return EINVAL;
if (ireq->i_val & IEEE80211_HTCAP_SHORTGI20)
vap->iv_flags_ht |= IEEE80211_FHT_SHORTGI20;
if (ireq->i_val & IEEE80211_HTCAP_SHORTGI40)
vap->iv_flags_ht |= IEEE80211_FHT_SHORTGI40;
#undef IEEE80211_HTCAP_SHORTGI
} else
vap->iv_flags_ht &=
~(IEEE80211_FHT_SHORTGI20 | IEEE80211_FHT_SHORTGI40);
error = ERESTART;
break;
case IEEE80211_IOC_AMPDU:
if (ireq->i_val && (vap->iv_htcaps & IEEE80211_HTC_AMPDU) == 0)
return EINVAL;
if (ireq->i_val & 1)
vap->iv_flags_ht |= IEEE80211_FHT_AMPDU_TX;
else
vap->iv_flags_ht &= ~IEEE80211_FHT_AMPDU_TX;
if (ireq->i_val & 2)
vap->iv_flags_ht |= IEEE80211_FHT_AMPDU_RX;
else
vap->iv_flags_ht &= ~IEEE80211_FHT_AMPDU_RX;
/* NB: reset only if we're operating on an 11n channel */
if (isvapht(vap))
error = ERESTART;
break;
case IEEE80211_IOC_AMPDU_LIMIT:
if (!(IEEE80211_HTCAP_MAXRXAMPDU_8K <= ireq->i_val &&
ireq->i_val <= IEEE80211_HTCAP_MAXRXAMPDU_64K))
return EINVAL;
if (vap->iv_opmode == IEEE80211_M_HOSTAP)
vap->iv_ampdu_rxmax = ireq->i_val;
else
vap->iv_ampdu_limit = ireq->i_val;
error = ERESTART;
break;
case IEEE80211_IOC_AMPDU_DENSITY:
if (!(IEEE80211_HTCAP_MPDUDENSITY_NA <= ireq->i_val &&
ireq->i_val <= IEEE80211_HTCAP_MPDUDENSITY_16))
return EINVAL;
vap->iv_ampdu_density = ireq->i_val;
error = ERESTART;
break;
case IEEE80211_IOC_AMSDU:
if (ireq->i_val && (vap->iv_htcaps & IEEE80211_HTC_AMSDU) == 0)
return EINVAL;
if (ireq->i_val & 1)
vap->iv_flags_ht |= IEEE80211_FHT_AMSDU_TX;
else
vap->iv_flags_ht &= ~IEEE80211_FHT_AMSDU_TX;
if (ireq->i_val & 2)
vap->iv_flags_ht |= IEEE80211_FHT_AMSDU_RX;
else
vap->iv_flags_ht &= ~IEEE80211_FHT_AMSDU_RX;
/* NB: reset only if we're operating on an 11n channel */
if (isvapht(vap))
error = ERESTART;
break;
case IEEE80211_IOC_AMSDU_LIMIT:
/* XXX validate */
vap->iv_amsdu_limit = ireq->i_val; /* XXX truncation? */
break;
case IEEE80211_IOC_PUREN:
if (ireq->i_val) {
if ((vap->iv_flags_ht & IEEE80211_FHT_HT) == 0)
return EINVAL;
vap->iv_flags_ht |= IEEE80211_FHT_PUREN;
} else
vap->iv_flags_ht &= ~IEEE80211_FHT_PUREN;
/* NB: reset only if we're operating on an 11n channel */
if (isvapht(vap))
error = ERESTART;
break;
case IEEE80211_IOC_DOTH:
if (ireq->i_val) {
#if 0
/* XXX no capability */
if ((vap->iv_caps & IEEE80211_C_DOTH) == 0)
return EOPNOTSUPP;
#endif
vap->iv_flags |= IEEE80211_F_DOTH;
} else
vap->iv_flags &= ~IEEE80211_F_DOTH;
error = ENETRESET;
break;
case IEEE80211_IOC_REGDOMAIN:
error = ieee80211_ioctl_setregdomain(vap, ireq);
break;
case IEEE80211_IOC_ROAM:
error = ieee80211_ioctl_setroam(vap, ireq);
break;
case IEEE80211_IOC_TXPARAMS:
error = ieee80211_ioctl_settxparams(vap, ireq);
break;
case IEEE80211_IOC_HTCOMPAT:
if (ireq->i_val) {
if ((vap->iv_flags_ht & IEEE80211_FHT_HT) == 0)
return EOPNOTSUPP;
vap->iv_flags_ht |= IEEE80211_FHT_HTCOMPAT;
} else
vap->iv_flags_ht &= ~IEEE80211_FHT_HTCOMPAT;
/* NB: reset only if we're operating on an 11n channel */
if (isvapht(vap))
error = ERESTART;
break;
case IEEE80211_IOC_DWDS:
if (ireq->i_val) {
/* NB: DWDS only makes sense for WDS-capable devices */
if ((ic->ic_caps & IEEE80211_C_WDS) == 0)
return EOPNOTSUPP;
/* NB: DWDS is used only with ap+sta vaps */
if (vap->iv_opmode != IEEE80211_M_HOSTAP &&
vap->iv_opmode != IEEE80211_M_STA)
return EINVAL;
vap->iv_flags |= IEEE80211_F_DWDS;
if (vap->iv_opmode == IEEE80211_M_STA)
vap->iv_flags_ext |= IEEE80211_FEXT_4ADDR;
} else {
vap->iv_flags &= ~IEEE80211_F_DWDS;
if (vap->iv_opmode == IEEE80211_M_STA)
vap->iv_flags_ext &= ~IEEE80211_FEXT_4ADDR;
}
break;
case IEEE80211_IOC_INACTIVITY:
if (ireq->i_val)
vap->iv_flags_ext |= IEEE80211_FEXT_INACT;
else
vap->iv_flags_ext &= ~IEEE80211_FEXT_INACT;
break;
case IEEE80211_IOC_APPIE:
error = ieee80211_ioctl_setappie(vap, ireq);
break;
case IEEE80211_IOC_WPS:
if (ireq->i_val) {
if ((vap->iv_caps & IEEE80211_C_WPA) == 0)
return EOPNOTSUPP;
vap->iv_flags_ext |= IEEE80211_FEXT_WPS;
} else
vap->iv_flags_ext &= ~IEEE80211_FEXT_WPS;
break;
case IEEE80211_IOC_TSN:
if (ireq->i_val) {
if ((vap->iv_caps & IEEE80211_C_WPA) == 0)
return EOPNOTSUPP;
vap->iv_flags_ext |= IEEE80211_FEXT_TSN;
} else
vap->iv_flags_ext &= ~IEEE80211_FEXT_TSN;
break;
case IEEE80211_IOC_CHANSWITCH:
error = ieee80211_ioctl_chanswitch(vap, ireq);
break;
case IEEE80211_IOC_DFS:
if (ireq->i_val) {
if ((vap->iv_caps & IEEE80211_C_DFS) == 0)
return EOPNOTSUPP;
/* NB: DFS requires 11h support */
if ((vap->iv_flags & IEEE80211_F_DOTH) == 0)
return EINVAL;
vap->iv_flags_ext |= IEEE80211_FEXT_DFS;
} else
vap->iv_flags_ext &= ~IEEE80211_FEXT_DFS;
break;
case IEEE80211_IOC_DOTD:
if (ireq->i_val)
vap->iv_flags_ext |= IEEE80211_FEXT_DOTD;
else
vap->iv_flags_ext &= ~IEEE80211_FEXT_DOTD;
if (vap->iv_opmode == IEEE80211_M_STA)
error = ENETRESET;
break;
case IEEE80211_IOC_HTPROTMODE:
if (ireq->i_val > IEEE80211_PROT_RTSCTS)
return EINVAL;
ic->ic_htprotmode = ireq->i_val ?
IEEE80211_PROT_RTSCTS : IEEE80211_PROT_NONE;
/* NB: if not operating in 11n this can wait */
if (isvapht(vap))
error = ERESTART;
break;
case IEEE80211_IOC_STA_VLAN:
error = ieee80211_ioctl_setstavlan(vap, ireq);
break;
case IEEE80211_IOC_SMPS:
if ((ireq->i_val &~ IEEE80211_HTCAP_SMPS) != 0 ||
ireq->i_val == 0x0008) /* value of 2 is reserved */
return EINVAL;
if (ireq->i_val != IEEE80211_HTCAP_SMPS_OFF &&
(vap->iv_htcaps & IEEE80211_HTC_SMPS) == 0)
return EOPNOTSUPP;
vap->iv_htcaps = (vap->iv_htcaps &~ IEEE80211_HTCAP_SMPS) |
ireq->i_val;
/* NB: if not operating in 11n this can wait */
if (isvapht(vap))
error = ERESTART;
break;
case IEEE80211_IOC_RIFS:
if (ireq->i_val != 0) {
if ((vap->iv_htcaps & IEEE80211_HTC_RIFS) == 0)
return EOPNOTSUPP;
vap->iv_flags_ht |= IEEE80211_FHT_RIFS;
} else
vap->iv_flags_ht &= ~IEEE80211_FHT_RIFS;
/* NB: if not operating in 11n this can wait */
if (isvapht(vap))
error = ERESTART;
break;
default:
error = ieee80211_ioctl_setdefault(vap, ireq);
break;
}
/*
* The convention is that ENETRESET means an operation
* requires a complete re-initialization of the device (e.g.
* changing something that affects the association state).
* ERESTART means the request may be handled with only a
* reload of the hardware state. We hand ERESTART requests
* to the iv_reset callback so the driver can decide. If
* a device does not fillin iv_reset then it defaults to one
* that returns ENETRESET. Otherwise a driver may return
* ENETRESET (in which case a full reset will be done) or
* 0 to mean there's no need to do anything (e.g. when the
* change has no effect on the driver/device).
*/
if (error == ERESTART)
error = IFNET_IS_UP_RUNNING(vap->iv_ifp) ?
vap->iv_reset(vap, ireq->i_type) : 0;
if (error == ENETRESET) {
/* XXX need to re-think AUTO handling */
if (IS_UP_AUTO(vap))
ieee80211_init(vap);
error = 0;
}
return error;
}
/*
* Rebuild the parent's multicast address list after an add/del
* of a multicast address for a vap. We have no way to tell
* what happened above to optimize the work so we purge the entire
* list and rebuild from scratch. This is way expensive.
* Note also the half-baked workaround for if_addmulti calling
* back to the parent device; there's no way to insert mcast
* entries quietly and/or cheaply.
*/
static void
ieee80211_ioctl_updatemulti(struct ieee80211com *ic)
{
struct ifnet *parent = ic->ic_ifp;
struct ieee80211vap *vap;
void *ioctl;
IEEE80211_LOCK(ic);
if_delallmulti(parent);
ioctl = parent->if_ioctl; /* XXX WAR if_allmulti */
parent->if_ioctl = NULL;
TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
struct ifnet *ifp = vap->iv_ifp;
struct ifmultiaddr *ifma;
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
(void) if_addmulti(parent, ifma->ifma_addr, NULL);
}
}
parent->if_ioctl = ioctl;
ieee80211_runtask(ic, &ic->ic_mcast_task);
IEEE80211_UNLOCK(ic);
}
int
ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
struct ieee80211vap *vap = ifp->if_softc;
struct ieee80211com *ic = vap->iv_ic;
int error = 0;
struct ifreq *ifr;
struct ifaddr *ifa; /* XXX */
switch (cmd) {
case SIOCSIFFLAGS:
IEEE80211_LOCK(ic);
ieee80211_syncifflag_locked(ic, IFF_PROMISC);
ieee80211_syncifflag_locked(ic, IFF_ALLMULTI);
if (ifp->if_flags & IFF_UP) {
/*
* Bring ourself up unless we're already operational.
* If we're the first vap and the parent is not up
* then it will automatically be brought up as a
* side-effect of bringing ourself up.
*/
if (vap->iv_state == IEEE80211_S_INIT)
ieee80211_start_locked(vap);
} else if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
/*
* Stop ourself. If we are the last vap to be
* marked down the parent will also be taken down.
*/
ieee80211_stop_locked(vap);
}
IEEE80211_UNLOCK(ic);
/* Wait for parent ioctl handler if it was queued */
ieee80211_waitfor_parent(ic);
break;
case SIOCADDMULTI:
case SIOCDELMULTI:
ieee80211_ioctl_updatemulti(ic);
break;
case SIOCSIFMEDIA:
case SIOCGIFMEDIA:
ifr = (struct ifreq *)data;
error = ifmedia_ioctl(ifp, ifr, &vap->iv_media, cmd);
break;
case SIOCG80211:
error = ieee80211_ioctl_get80211(vap, cmd,
(struct ieee80211req *) data);
break;
case SIOCS80211:
error = priv_check(curthread, PRIV_NET80211_MANAGE);
if (error == 0)
error = ieee80211_ioctl_set80211(vap, cmd,
(struct ieee80211req *) data);
break;
case SIOCG80211STATS:
ifr = (struct ifreq *)data;
copyout(&vap->iv_stats, ifr->ifr_data, sizeof (vap->iv_stats));
break;
case SIOCSIFMTU:
ifr = (struct ifreq *)data;
if (!(IEEE80211_MTU_MIN <= ifr->ifr_mtu &&
ifr->ifr_mtu <= IEEE80211_MTU_MAX))
error = EINVAL;
else
ifp->if_mtu = ifr->ifr_mtu;
break;
case SIOCSIFADDR:
/*
* XXX Handle this directly so we can supress if_init calls.
* XXX This should be done in ether_ioctl but for the moment
* XXX there are too many other parts of the system that
* XXX set IFF_UP and so supress if_init being called when
* XXX it should be.
*/
ifa = (struct ifaddr *) data;
switch (ifa->ifa_addr->sa_family) {
#ifdef INET
case AF_INET:
if ((ifp->if_flags & IFF_UP) == 0) {
ifp->if_flags |= IFF_UP;
ifp->if_init(ifp->if_softc);
}
arp_ifinit(ifp, ifa);
break;
#endif
#ifdef IPX
/*
* XXX - This code is probably wrong,
* but has been copied many times.
*/
case AF_IPX: {
struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr);
if (ipx_nullhost(*ina))
ina->x_host = *(union ipx_host *)
IF_LLADDR(ifp);
else
bcopy((caddr_t) ina->x_host.c_host,
(caddr_t) IF_LLADDR(ifp),
ETHER_ADDR_LEN);
/* fall thru... */
}
#endif
default:
if ((ifp->if_flags & IFF_UP) == 0) {
ifp->if_flags |= IFF_UP;
ifp->if_init(ifp->if_softc);
}
break;
}
break;
/* Pass NDIS ioctls up to the driver */
case SIOCGDRVSPEC:
case SIOCSDRVSPEC:
case SIOCGPRIVATE_0: {
struct ifnet *parent = vap->iv_ic->ic_ifp;
error = parent->if_ioctl(parent, cmd, data);
break;
}
default:
error = ether_ioctl(ifp, cmd, data);
break;
}
return error;
}
|
Java
|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-10-05 14:25
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("elections", "0049_move_status")]
operations = [
migrations.RemoveField(model_name="election", name="rejection_reason"),
migrations.RemoveField(model_name="election", name="suggested_status"),
migrations.RemoveField(model_name="election", name="suggestion_reason"),
]
|
Java
|
from __future__ import print_function
import re
import logging
logging.basicConfig(level=logging.INFO)
class Executor(object):
def __init__(self, op_map):
processed = {}
for pattern, f in op_map.iteritems():
s = self._build_pattern_groups(pattern.lower())
processed[re.compile(s)] = f
self.operations = processed
def execute(self, context, op):
s = "%04x" % op
for pattern, f in self.operations.iteritems():
m = pattern.match(s)
if m:
return f(context, *[int(v, base=16) for v in m.groups()])
assert False, s
def _build_pattern_groups(self, pattern):
s = pattern.replace('?', '.')
for id in ['x', 'y', 'z']:
m = re.search('%s+' % id, s)
if m:
s = s[:m.start()] + ('(.{%s})' % (m.end() - m.start())) + s[m.end():]
return '^' + s + '$'
def set_mem_v0_vx(context, x):
for i in range(x):
context.memory.write_byte(context.index_reg + i, context.v[i])
context.pc += 2
def fill_v0_vx(context, x):
for i in range(x+1):
context.v[i] = context.memory.get_byte(context.index_reg + i)
context.pc += 2
def set_bcd_vx(context, x):
val = int(context.v[x])
context.memory.write_byte(context.index_reg, val / 100)
context.memory.write_byte(context.index_reg + 1, val % 100 / 10)
context.memory.write_byte(context.index_reg + 2, val % 100 % 10)
context.pc += 2
def set_i_font(context, x):
context.index_reg = context.memory.get_font_address(context.v[x])
context.pc += 2
def add_reg_ind(context, x):
context.index_reg += context.v[x]
context.pc += 2
def set_delay_timer(context, x):
context.delay_timer = context.v[x]
context.pc += 2
def set_sound_timer(context, x):
context.sound_timer = context.v[x]
context.pc += 2
def set_vx_key_pressed(context, x):
context.v[x] = context.keypad.wait_for_keypress()
context.pc += 2
def set_vx_delay_timer(context, x):
context.v[x] = context.delay_timer
context.pc += 2
def skip_key_vx(context, x, result=True):
if context.keypad.is_keypressed(context.v[x]) == result:
context.pc += 2
context.pc += 2
def draw_sprite(context, x, y, n):
sprite = []
for cb in range(n):
sprite.append(context.memory.get_byte(context.index_reg + cb))
collision = context.screen.draw(context.v[x], context.v[y], sprite)
context.v[15] = collision
context.pc += 2
def jump_nnn_v0(context, nnn):
context.pc = context.v[0] + nnn
def set_vx_rand(context, x, nn):
import random
context.v[x] = random.randint(0, 0xFF) & nn
context.pc += 2
def jump_noteq(context, x, y):
if context.v[x] != context.v[y]:
context.pc += 2
context.pc += 2
def shift_vy_left(context, x, y):
context.v[15] = context.v[15] >> 7 # First value
context.v[x] = (context.v[y] << 1) % 255
context.pc += 2
def shift_right(context, x, y):
context.v[15] = context.v[y] & 0x1
context.v[x] = context.v[y] >> 1
context.pc += 2
def sub_vx_vy_vf(context, x, y):
logging.info('Setting V[X] = V[X] - V[Y], V[F] = 1 if V[Y] > V[X]')
context.v[15] = 1 if context.v[y] > context.v[x] else 0
context.v[x] = context.v[x] - context.v[y]
context.pc += 2
def add_vx_vy(context, x, y):
logging.info('Setting V[X] = V[X] + V[Y]')
val = context.v[x] + context.v[y]
context.v[15] = 1 if val > 255 else 0
context.v[x] = val % 256
context.pc += 2
def sub_vx_vy(context, x, y):
logging.info('Setting V[X] = V[X] - V[Y]')
val = context.v[x] - context.v[y]
context.v[15] = 1 if val < 0 else 0
context.v[x] = val % 256
context.pc += 2
def set_vx_or_vy(context, x, y):
logging.info('Setting V[X] = V[X] | V[Y]')
context.v[x] = context.v[x] | context.v[y]
context.pc += 2
def set_vx_xor_vy(context, x, y):
logging.info('Setting V[X] = V[X] ^ V[Y]')
context.v[x] = context.v[x] ^ context.v[y]
context.pc += 2
def set_vx_and_vy(context, x, y):
logging.info('Setting V[X] = V[X] & V[Y]')
context.v[x] = context.v[x] & context.v[y]
context.pc += 2
def set_vx_vy(context, x, y):
logging.info('Setting V[X] = V[Y]')
context.v[x] = context.v[y]
context.pc += 2
def add_reg(context, x, nnn):
logging.info('Adding NNN to V[X]')
context.v[x] = (context.v[x] + nnn) % 256
context.pc += 2
def set_i(context, nnn):
logging.info('Setting NNN to index_reg')
context.index_reg = nnn
context.pc += 2
def pop_stack(context):
logging.info('Returning from a subroutine')
context.pc = context.stack.pop()
def call_rca1082(context, address): #TODO
print("operation not implemented yet:", address)
context.pc += 1
def clear(context):
logging.info('Clearing screen')
context.screen.clear()
context.pc += 2
def jump(context, address):
logging.info('Jump at 0x%2x address' % address)
context.pc = address
def call(context, address):
logging.info('Calling subroutine at 0x%2x address' % address)
context.pc += 2
context.stack.append(context.pc)
context.pc = address
def skip_equal(context, x, nnn, ifeq=True):
logging.info('Skip if V[X] === NNN is %s' % ifeq)
if (context.v[x] == nnn) == ifeq:
context.pc += 2
context.pc += 2
def skip_eq_reg(context, x, y):
logging.info('Skip if V[X] === V[Y]')
if context.v[x] == context.v[y]:
context.pc += 2
context.pc += 2
def set_reg(context, x, nnn):
logging.info('Set NNN to cpu reg V[x]')
context.v[x] = nnn
context.pc += 2
op_map = {
'0?E0': clear,
'0?EE': pop_stack,
'0XXX': call_rca1082,
'1XXX': jump,
'2XXX': call,
'3XYY': skip_equal,
'4XYY': lambda context, x, nn: skip_equal(context, x, nn, ifeq = False),
'5XY0': skip_eq_reg,
'6XYY': set_reg,
'7XYY': add_reg,
'8XY0': set_vx_vy,
'8XY1': set_vx_or_vy,
'8XY2': set_vx_and_vy,
'8XY3': set_vx_xor_vy,
'8XY4': add_vx_vy,
'8XY5': sub_vx_vy,
'8XY6': shift_right,
'8XY7': sub_vx_vy_vf,
'8XYE': shift_vy_left,
'9XY0': jump_noteq,
'AXXX': set_i,
'BXXX': jump_nnn_v0,
'CXYY': set_vx_rand,
'DXYZ': draw_sprite,
'EX9E': lambda context, x: skip_key_vx(x, result=False),
'EXA1': skip_key_vx,
'FX07': set_vx_delay_timer,
'FX0A': set_vx_key_pressed,
'FX15': set_delay_timer,
'FX18': set_sound_timer,
'FX1E': add_reg_ind,
'FX29': set_i_font,
'FX33': set_bcd_vx,
'FX55': set_mem_v0_vx,
'FX65': fill_v0_vx
}
|
Java
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="lang:clipboard.copy" content="Copy to clipboard">
<meta name="lang:clipboard.copied" content="Copied to clipboard">
<meta name="lang:search.language" content="en">
<meta name="lang:search.pipeline.stopwords" content="True">
<meta name="lang:search.pipeline.trimmer" content="True">
<meta name="lang:search.result.none" content="No matching documents">
<meta name="lang:search.result.one" content="1 matching document">
<meta name="lang:search.result.other" content="# matching documents">
<meta name="lang:search.tokenizer" content="[\s\-]+">
<link href="https://fonts.gstatic.com/" rel="preconnect" crossorigin>
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:300,400,400i,700&display=fallback" rel="stylesheet">
<style>
body,
input {
font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif
}
code,
kbd,
pre {
font-family: "Roboto Mono", "Courier New", Courier, monospace
}
</style>
<link rel="stylesheet" href="../_static/stylesheets/application.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-palette.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-fixes.css"/>
<link rel="stylesheet" href="../_static/fonts/material-icons.css"/>
<meta name="theme-color" content="#3f51b5">
<script src="../_static/javascripts/modernizr.js"></script>
<title>statsmodels.tsa.vector_ar.svar_model.SVARResults.irf — statsmodels</title>
<link rel="icon" type="image/png" sizes="32x32" href="../_static/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="../_static/icons/favicon-16x16.png">
<link rel="manifest" href="../_static/icons/site.webmanifest">
<link rel="mask-icon" href="../_static/icons/safari-pinned-tab.svg" color="#919191">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="../_static/icons/browserconfig.xml">
<link rel="stylesheet" href="../_static/stylesheets/examples.css">
<link rel="stylesheet" href="../_static/stylesheets/deprecation.css">
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../_static/material.css" />
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
<link rel="stylesheet" type="text/css" href="../_static/plot_directive.css" />
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="statsmodels.tsa.vector_ar.svar_model.SVARResults.irf_errband_mc" href="statsmodels.tsa.vector_ar.svar_model.SVARResults.irf_errband_mc.html" />
<link rel="prev" title="statsmodels.tsa.vector_ar.svar_model.SVARResults.intercept_longrun" href="statsmodels.tsa.vector_ar.svar_model.SVARResults.intercept_longrun.html" />
</head>
<body dir=ltr
data-md-color-primary=indigo data-md-color-accent=blue>
<svg class="md-svg">
<defs data-children-count="0">
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg>
</defs>
</svg>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search">
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
<a href="#generated/statsmodels.tsa.vector_ar.svar_model.SVARResults.irf" tabindex="1" class="md-skip"> Skip to content </a>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid">
<div class="md-flex navheader">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="../index.html" title="statsmodels"
class="md-header-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" height="26"
alt="statsmodels logo">
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
<span class="md-header-nav__topic">statsmodels v0.13.0</span>
<span class="md-header-nav__topic"> statsmodels.tsa.vector_ar.svar_model.SVARResults.irf </span>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" action="../search.html" method="get" name="search">
<input type="text" class="md-search__input" name="q" placeholder="Search"
autocapitalize="off" autocomplete="off" spellcheck="false"
data-md-component="query" data-md-state="active">
<label class="md-icon md-search__icon" for="__search"></label>
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">

</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="result">
<div class="md-search-result__meta">
Type to start searching
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
</div>
<script src="../_static/javascripts/version_dropdown.js"></script>
<script>
var json_loc = "../../versions-v2.json",
target_loc = "../../",
text = "Versions";
$( document ).ready( add_version_dropdown(json_loc, target_loc, text));
</script>
</div>
</nav>
</header>
<div class="md-container">
<nav class="md-tabs" data-md-component="tabs">
<div class="md-tabs__inner md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item"><a href="../user-guide.html" class="md-tabs__link">User Guide</a></li>
<li class="md-tabs__item"><a href="../vector_ar.html" class="md-tabs__link">Vector Autoregressions <code class="xref py py-mod docutils literal notranslate"><span class="pre">tsa.vector_ar</span></code></a></li>
<li class="md-tabs__item"><a href="statsmodels.tsa.vector_ar.svar_model.SVARResults.html" class="md-tabs__link">statsmodels.tsa.vector_ar.svar_model.SVARResults</a></li>
</ul>
</div>
</nav>
<main class="md-main">
<div class="md-main__inner md-grid" data-md-component="container">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="__drawer">
<a href="../index.html" title="statsmodels" class="md-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" alt=" logo" width="48" height="48">
</a>
<a href="../index.html"
title="statsmodels">statsmodels v0.13.0</a>
</label>
<div class="md-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../install.html" class="md-nav__link">Installing statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../gettingstarted.html" class="md-nav__link">Getting started</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html" class="md-nav__link">User Guide</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../user-guide.html#background" class="md-nav__link">Background</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#regression-and-linear-models" class="md-nav__link">Regression and Linear Models</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#time-series-analysis" class="md-nav__link">Time Series Analysis</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../tsa.html" class="md-nav__link">Time Series analysis <code class="xref py py-mod docutils literal notranslate"><span class="pre">tsa</span></code></a>
</li>
<li class="md-nav__item">
<a href="../statespace.html" class="md-nav__link">Time Series Analysis by State Space Methods <code class="xref py py-mod docutils literal notranslate"><span class="pre">statespace</span></code></a>
</li>
<li class="md-nav__item">
<a href="../vector_ar.html" class="md-nav__link">Vector Autoregressions <code class="xref py py-mod docutils literal notranslate"><span class="pre">tsa.vector_ar</span></code></a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#other-models" class="md-nav__link">Other Models</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#statistics-and-tools" class="md-nav__link">Statistics and Tools</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#data-sets" class="md-nav__link">Data Sets</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#sandbox" class="md-nav__link">Sandbox</a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../examples/index.html" class="md-nav__link">Examples</a>
</li>
<li class="md-nav__item">
<a href="../api.html" class="md-nav__link">API Reference</a>
</li>
<li class="md-nav__item">
<a href="../about.html" class="md-nav__link">About statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../dev/index.html" class="md-nav__link">Developer Page</a>
</li>
<li class="md-nav__item">
<a href="../release/index.html" class="md-nav__link">Release Notes</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary">
<ul class="md-nav__list" data-md-scrollfix="">
<li class="md-nav__item"><a class="md-nav__extra_link" href="../_sources/generated/statsmodels.tsa.vector_ar.svar_model.SVARResults.irf.rst.txt">Show Source</a> </li>
<li id="searchbox" class="md-nav__item"></li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset" role="main">
<h1 id="generated-statsmodels-tsa-vector-ar-svar-model-svarresults-irf--page-root">statsmodels.tsa.vector_ar.svar_model.SVARResults.irf<a class="headerlink" href="#generated-statsmodels-tsa-vector-ar-svar-model-svarresults-irf--page-root" title="Permalink to this headline">¶</a></h1>
<dl class="py method">
<dt class="sig sig-object py" id="statsmodels.tsa.vector_ar.svar_model.SVARResults.irf">
<span class="sig-prename descclassname"><span class="pre">SVARResults.</span></span><span class="sig-name descname"><span class="pre">irf</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">periods</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">10</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">var_order</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/statsmodels/tsa/vector_ar/svar_model.html#SVARResults.irf"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#statsmodels.tsa.vector_ar.svar_model.SVARResults.irf" title="Permalink to this definition">¶</a></dt>
<dd><p>Analyze structural impulse responses to shocks in system</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl>
<dt><strong>periods</strong><span class="classifier"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="docutils literal notranslate"><span class="pre">int</span></code></a></span></dt><dd></dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl>
<dt><strong>irf</strong><span class="classifier"><code class="xref py py-obj docutils literal notranslate"><span class="pre">IRAnalysis</span></code></span></dt><dd></dd>
</dl>
</dd>
</dl>
</dd></dl>
</article>
</div>
</div>
</main>
</div>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a href="statsmodels.tsa.vector_ar.svar_model.SVARResults.intercept_longrun.html" title="statsmodels.tsa.vector_ar.svar_model.SVARResults.intercept_longrun"
class="md-flex md-footer-nav__link md-footer-nav__link--prev"
rel="prev">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span
class="md-footer-nav__direction"> Previous </span> statsmodels.tsa.vector_ar.svar_model.SVARResults.intercept_longrun </span>
</div>
</a>
<a href="statsmodels.tsa.vector_ar.svar_model.SVARResults.irf_errband_mc.html" title="statsmodels.tsa.vector_ar.svar_model.SVARResults.irf_errband_mc"
class="md-flex md-footer-nav__link md-footer-nav__link--next"
rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"><span
class="md-flex__ellipsis"> <span
class="md-footer-nav__direction"> Next </span> statsmodels.tsa.vector_ar.svar_model.SVARResults.irf_errband_mc </span>
</div>
<div class="md-flex__cell md-flex__cell--shrink"><i
class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
© Copyright 2009-2019, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
</div>
Last updated on
Oct 06, 2021.
<br/>
Created using
<a href="http://www.sphinx-doc.org/">Sphinx</a> 4.0.3.
and
<a href="https://github.com/bashtage/sphinx-material/">Material for
Sphinx</a>
</div>
</div>
</div>
</footer>
<script src="../_static/javascripts/application.js"></script>
<script>app.initialize({version: "1.0.4", url: {base: ".."}})</script>
</body>
</html>
|
Java
|
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>statsmodels.tsa.vector_ar.var_model.VARProcess.acorr — statsmodels v0.10.0 documentation</title>
<link rel="stylesheet" href="../_static/nature.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/language_data.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="shortcut icon" href="../_static/statsmodels_hybi_favico.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="statsmodels.tsa.vector_ar.var_model.VARProcess.forecast" href="statsmodels.tsa.vector_ar.var_model.VARProcess.forecast.html" />
<link rel="prev" title="statsmodels.tsa.vector_ar.var_model.VARProcess.acf" href="statsmodels.tsa.vector_ar.var_model.VARProcess.acf.html" />
<link rel="stylesheet" href="../_static/examples.css" type="text/css" />
<link rel="stylesheet" href="../_static/facebox.css" type="text/css" />
<script type="text/javascript" src="../_static/scripts.js">
</script>
<script type="text/javascript" src="../_static/facebox.js">
</script>
<script type="text/javascript">
$.facebox.settings.closeImage = "../_static/closelabel.png"
$.facebox.settings.loadingImage = "../_static/loading.gif"
</script>
<script>
$(document).ready(function() {
$.getJSON("../../versions.json", function(versions) {
var dropdown = document.createElement("div");
dropdown.className = "dropdown";
var button = document.createElement("button");
button.className = "dropbtn";
button.innerHTML = "Other Versions";
var content = document.createElement("div");
content.className = "dropdown-content";
dropdown.appendChild(button);
dropdown.appendChild(content);
$(".header").prepend(dropdown);
for (var i = 0; i < versions.length; i++) {
if (versions[i].substring(0, 1) == "v") {
versions[i] = [versions[i], versions[i].substring(1)];
} else {
versions[i] = [versions[i], versions[i]];
};
};
for (var i = 0; i < versions.length; i++) {
var a = document.createElement("a");
a.innerHTML = versions[i][1];
a.href = "../../" + versions[i][0] + "/index.html";
a.title = versions[i][1];
$(".dropdown-content").append(a);
};
});
});
</script>
</head><body>
<div class="headerwrap">
<div class = "header">
<a href = "../index.html">
<img src="../_static/statsmodels_hybi_banner.png" alt="Logo"
style="padding-left: 15px"/></a>
</div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="statsmodels.tsa.vector_ar.var_model.VARProcess.forecast.html" title="statsmodels.tsa.vector_ar.var_model.VARProcess.forecast"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="statsmodels.tsa.vector_ar.var_model.VARProcess.acf.html" title="statsmodels.tsa.vector_ar.var_model.VARProcess.acf"
accesskey="P">previous</a> |</li>
<li><a href ="../install.html">Install</a></li> |
<li><a href="https://groups.google.com/forum/?hl=en#!forum/pystatsmodels">Support</a></li> |
<li><a href="https://github.com/statsmodels/statsmodels/issues">Bugs</a></li> |
<li><a href="../dev/index.html">Develop</a></li> |
<li><a href="../examples/index.html">Examples</a></li> |
<li><a href="../faq.html">FAQ</a></li> |
<li class="nav-item nav-item-1"><a href="../vector_ar.html" >Vector Autoregressions <code class="xref py py-mod docutils literal notranslate"><span class="pre">tsa.vector_ar</span></code></a> |</li>
<li class="nav-item nav-item-2"><a href="statsmodels.tsa.vector_ar.var_model.VARProcess.html" accesskey="U">statsmodels.tsa.vector_ar.var_model.VARProcess</a> |</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="statsmodels-tsa-vector-ar-var-model-varprocess-acorr">
<h1>statsmodels.tsa.vector_ar.var_model.VARProcess.acorr<a class="headerlink" href="#statsmodels-tsa-vector-ar-var-model-varprocess-acorr" title="Permalink to this headline">¶</a></h1>
<p>method</p>
<dl class="method">
<dt id="statsmodels.tsa.vector_ar.var_model.VARProcess.acorr">
<code class="sig-prename descclassname">VARProcess.</code><code class="sig-name descname">acorr</code><span class="sig-paren">(</span><em class="sig-param">nlags=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/statsmodels/tsa/vector_ar/var_model.html#VARProcess.acorr"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#statsmodels.tsa.vector_ar.var_model.VARProcess.acorr" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute theoretical autocorrelation function</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>acorr</strong><span class="classifier">ndarray (p x k x k)</span></dt><dd></dd>
</dl>
</dd>
</dl>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="statsmodels.tsa.vector_ar.var_model.VARProcess.acf.html"
title="previous chapter">statsmodels.tsa.vector_ar.var_model.VARProcess.acf</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="statsmodels.tsa.vector_ar.var_model.VARProcess.forecast.html"
title="next chapter">statsmodels.tsa.vector_ar.var_model.VARProcess.forecast</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/generated/statsmodels.tsa.vector_ar.var_model.VARProcess.acorr.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer" role="contentinfo">
© Copyright 2009-2018, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.1.2.
</div>
</body>
</html>
|
Java
|
/*
* Created on Oct 18, 2004
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package org.tolweb.tapestry;
import java.util.Collection;
import org.apache.tapestry.BaseComponent;
import org.apache.tapestry.IRequestCycle;
import org.tolweb.hibernate.TitleIllustration;
import org.tolweb.tapestry.injections.BaseInjectable;
import org.tolweb.tapestry.injections.ImageInjectable;
import org.tolweb.treegrow.main.Contributor;
import org.tolweb.treegrow.main.ImageVersion;
import org.tolweb.treegrow.main.NodeImage;
import org.tolweb.treegrow.main.StringUtils;
/**
* @author dmandel
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public abstract class TitleIllustrations extends BaseComponent implements
ImageInjectable, BaseInjectable {
@SuppressWarnings("unchecked")
public abstract Collection getIllustrations();
public abstract TitleIllustration getCurrentIllustration();
public abstract void setCurrentIllustration(TitleIllustration value);
public abstract void setIsSingleIllustration(boolean value);
public abstract boolean getIsSingleIllustration();
public abstract int getIndex();
public abstract void setContributor(Contributor contributor);
public String getAltText() {
if (getCurrentIllustration().getImage() != null) {
NodeImage img = getCurrentIllustration().getImage();
if (StringUtils.notEmpty(img.getAltText())) {
return img.getAltText();
} else {
return " ";
}
} else {
return " ";
}
}
public void prepareForRender(IRequestCycle cycle) {
super.prepareForRender(cycle);
if (getIllustrations() != null && getIllustrations().size() == 1) {
setIsSingleIllustration(true);
} else {
setIsSingleIllustration(false);
}
}
public String getCurrentImageLocation() {
TitleIllustration currentIllustration = getCurrentIllustration();
ImageVersion version = currentIllustration.getVersion();
String url;
if (StringUtils.isEmpty(version.getFileName())) {
url = getImageDAO().generateAndSaveVersion(version);
} else {
url = getImageUtils().getVersionUrl(currentIllustration.getVersion());
}
return url;
}
public String getCurrentImageClass() {
if (getIsSingleIllustration()) {
return "singletillus";
} else {
return null;
}
}
}
|
Java
|
//---------------------------------------------------------------------------//
//!
//! \file MonteCarlo_ParticleState.cpp
//! \author Alex Robinson
//! \brief Basic particle state class definition.
//!
//---------------------------------------------------------------------------//
// FRENSIE Includes
#include "MonteCarlo_ParticleState.hpp"
#include "Utility_PhysicalConstants.hpp"
#include "Utility_DirectionHelpers.hpp"
namespace MonteCarlo{
// Default constructor
/*! \details The default constructor should only be called before loading the
* particle state from an archive.
*/
ParticleState::ParticleState()
: d_history_number( 0 ),
d_particle_type(),
d_position(),
d_direction{0.0,0.0,1.0},
d_energy( 0.0 ),
d_time( 0.0 ),
d_collision_number( 0 ),
d_generation_number( 0 ),
d_weight( 1.0 ),
d_cell( Geometry::ModuleTraits::invalid_internal_cell_handle ),
d_lost( false ),
d_gone( false ),
d_ray( d_position, d_direction, false )
{ /* ... */ }
// Constructor
ParticleState::ParticleState(
const ParticleState::historyNumberType history_number,
const ParticleType type )
: d_history_number( history_number ),
d_particle_type( type ),
d_position(),
d_direction(),
d_energy( 0.0 ),
d_time( 0.0 ),
d_collision_number( 0 ),
d_generation_number( 0 ),
d_weight( 1.0 ),
d_cell( Geometry::ModuleTraits::invalid_internal_cell_handle ),
d_lost( false ),
d_gone( false ),
d_ray( d_position, d_direction, false )
{ /* ... */ }
// Copy constructor
/*! \details When copied, the new particle is assumed to not be lost and
* not be gone.
*/
ParticleState::ParticleState( const ParticleState& existing_base_state,
const ParticleType new_type,
const bool increment_generation_number,
const bool reset_collision_number )
: d_history_number( existing_base_state.d_history_number ),
d_particle_type( new_type ),
d_position{existing_base_state.d_position[0],
existing_base_state.d_position[1],
existing_base_state.d_position[2]},
d_direction{existing_base_state.d_direction[0],
existing_base_state.d_direction[1],
existing_base_state.d_direction[2]},
d_energy( existing_base_state.d_energy ),
d_time( existing_base_state.d_time ),
d_collision_number( existing_base_state.d_collision_number ),
d_generation_number( existing_base_state.d_generation_number ),
d_weight( existing_base_state.d_weight ),
d_cell( existing_base_state.d_cell ),
d_lost( false ),
d_gone( false ),
d_ray( d_position, d_direction, false )
{
// Increment the generation number if requested
if( increment_generation_number )
++d_generation_number;
// Reset the collision number if requested
if( reset_collision_number )
d_collision_number = 0u;
}
// Clone the particle state but change the history number
/*! \details This method returns a heap-allocated pointer. It is only safe
* to call this method inside of a smart pointer constructor or reset method.
* The clone will only need a new history number in very rare circumstances
* (e.g. state source).
*/
ParticleState* ParticleState::clone(
const ParticleState::historyNumberType new_history_number ) const
{
ParticleState* clone_state = this->clone();
clone_state->d_history_number = new_history_number;
return clone_state;
}
// Return the history number
ParticleState::historyNumberType ParticleState::getHistoryNumber() const
{
return d_history_number;
}
// Return the particle type
ParticleType ParticleState::getParticleType() const
{
return d_particle_type;
}
// Return the cell handle for the cell containing the particle
Geometry::ModuleTraits::InternalCellHandle ParticleState::getCell() const
{
return d_cell;
}
// Set the cell containing the particle
void ParticleState::setCell(
const Geometry::ModuleTraits::InternalCellHandle cell )
{
// Make sure the cell handle is valid
testPrecondition( cell !=
Geometry::ModuleTraits::invalid_internal_cell_handle);
d_cell = cell;
}
// Return the x position of the particle
double ParticleState::getXPosition() const
{
return d_position[0];
}
// Return the y position of the particle
double ParticleState::getYPosition() const
{
return d_position[1];
}
// Return the z position of the particle
double ParticleState::getZPosition() const
{
return d_position[2];
}
// Return the position of the particle
const double* ParticleState::getPosition() const
{
return d_position;
}
// Set the position of the particle
void ParticleState::setPosition( const double x_position,
const double y_position,
const double z_position )
{
// Make sure the coordinates are valid
testPrecondition( !ST::isnaninf( x_position ) );
testPrecondition( !ST::isnaninf( y_position ) );
testPrecondition( !ST::isnaninf( z_position ) );
d_position[0] = x_position;
d_position[1] = y_position;
d_position[2] = z_position;
}
// Return the x direction of the particle
double ParticleState::getXDirection() const
{
return d_direction[0];
}
// Return the y direction of the particle
double ParticleState::getYDirection() const
{
return d_direction[1];
}
// Return the z direction of the particle
double ParticleState::getZDirection() const
{
return d_direction[2];
}
// Return the direction of the particle
const double* ParticleState::getDirection() const
{
return d_direction;
}
// Set the direction of the particle
void ParticleState::setDirection( const double x_direction,
const double y_direction,
const double z_direction )
{
// Make sure the direction coordinates are valid
testPrecondition( !ST::isnaninf( x_direction ) );
testPrecondition( !ST::isnaninf( y_direction ) );
testPrecondition( !ST::isnaninf( z_direction ) );
// Make sure the direction is a unit vector
testPrecondition( Utility::validDirection( x_direction,
y_direction,
z_direction ) );
d_direction[0] = x_direction;
d_direction[1] = y_direction;
d_direction[2] = z_direction;
}
// Rotate the direction of the particle using polar a. cosine and azimuthal a.
/*! \details The polar angle cosine and azimuthal angle are w.r.t. the
* current particle direction and not the global coordinate system. These
* are the variables the commonly occur when sampling a new direction
* for the particle from a scattering distribution. This function is therefore
* meant to avoid duplicate code that would otherwise arise when determining
* the new particle direction
*/
void ParticleState::rotateDirection( const double polar_angle_cosine,
const double azimuthal_angle )
{
// Make sure the current particle direction is valid (initialized)
testPrecondition( Utility::validDirection( this->getDirection() ) );
// Make sure the polar angle cosine is valid
testPrecondition( polar_angle_cosine >= -1.0 );
testPrecondition( polar_angle_cosine <= 1.0 );
// Make sure the azimuthal angle is valid
testPrecondition( azimuthal_angle >= 0.0 );
testPrecondition( azimuthal_angle <= 2*Utility::PhysicalConstants::pi );
double outgoing_direction[3];
Utility::rotateDirectionThroughPolarAndAzimuthalAngle( polar_angle_cosine,
azimuthal_angle,
this->getDirection(),
outgoing_direction );
this->setDirection( outgoing_direction );
}
// Advance the particle along its direction by the requested distance
void ParticleState::advance( const double distance )
{
// Make sure the distance is valid
testPrecondition( !ST::isnaninf( distance ) );
d_position[0] += d_direction[0]*distance;
d_position[1] += d_direction[1]*distance;
d_position[2] += d_direction[2]*distance;
// Compute the time to traverse the distance
d_time += calculateTraversalTime( distance );
}
// Set the energy of the particle
/*! The default implementation is only valid for massless particles (It is
* assumed that the speed of the particle does not change with the energy).
*/
void ParticleState::setEnergy( const ParticleState::energyType energy )
{
// Make sure the energy is valid
testPrecondition( !ST::isnaninf( energy ) );
testPrecondition( energy > 0.0 );
d_energy = energy;
}
// Return the time state of the particle
ParticleState::timeType ParticleState::getTime() const
{
return d_time;
}
// Set the time state of the particle
void ParticleState::setTime( const ParticleState::timeType time )
{
d_time = time;
}
// Return the collision number of the particle
ParticleState::collisionNumberType ParticleState::getCollisionNumber() const
{
return d_collision_number;
}
// Increment the collision number
void ParticleState::incrementCollisionNumber()
{
++d_collision_number;
}
// Reset the collision number
/*! \details This should rarely be used - try to rely on the contructor to
* reset the collision number.
*/
void ParticleState::resetCollisionNumber()
{
d_collision_number = 0u;
}
// Return the generation number of the particle
ParticleState::generationNumberType ParticleState::getGenerationNumber() const
{
return d_generation_number;
}
// Increment the generation number
void ParticleState::incrementGenerationNumber()
{
++d_generation_number;
}
// Return the weight of the particle
double ParticleState::getWeight() const
{
return d_weight;
}
// Set the weight of the particle
void ParticleState::setWeight( const double weight )
{
d_weight = weight;
}
// Multiply the weight of the particle by a factor
void ParticleState::multiplyWeight( const double weight_factor )
{
// Make sure that the current weight is valid
testPrecondition( d_weight > 0.0 );
d_weight *= weight_factor;
}
// Return if the particle is lost
bool ParticleState::isLost() const
{
return d_lost;
}
// Set the particle as lost
void ParticleState::setAsLost()
{
d_lost = true;
}
// Return if the particle is gone
bool ParticleState::isGone() const
{
return d_gone;
}
// Set the particle as gone
void ParticleState::setAsGone()
{
d_gone = true;
}
} // end MonteCarlo
//---------------------------------------------------------------------------//
// end MonteCarlo_ParticleState.cpp
//---------------------------------------------------------------------------//
|
Java
|
<?php
/*
* This file is part of Respect/Validation.
*
* (c) Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
*
* For the full copyright and license information, please view the "LICENSE.md"
* file that was distributed with this source code.
*/
namespace Respect\Validation\Rules;
/**
* @group rule
* @covers Respect\Validation\Rules\PrimeNumber
* @covers Respect\Validation\Exceptions\PrimeNumberException
*/
class PrimeNumberTest extends \PHPUnit_Framework_TestCase
{
protected $object;
protected function setUp()
{
$this->object = new PrimeNumber();
}
/**
* @dataProvider providerForPrimeNumber
*/
public function testPrimeNumber($input)
{
$this->assertTrue($this->object->__invoke($input));
$this->assertTrue($this->object->check($input));
$this->assertTrue($this->object->assert($input));
}
/**
* @dataProvider providerForNotPrimeNumber
* @expectedException Respect\Validation\Exceptions\PrimeNumberException
*/
public function testNotPrimeNumber($input)
{
$this->assertFalse($this->object->__invoke($input));
$this->assertFalse($this->object->assert($input));
}
public function providerForPrimeNumber()
{
return array(
array(3),
array(5),
array(7),
array('3'),
array('5'),
array('+7'),
);
}
public function providerForNotPrimeNumber()
{
return array(
array(''),
array(null),
array(0),
array(10),
array(25),
array(36),
array(-1),
array('-1'),
array('25'),
array('0'),
array('a'),
array(' '),
array('Foo'),
);
}
}
|
Java
|
// Copyright 2014 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.
#include "chrome/browser/chromeos/set_time_dialog.h"
#include "base/metrics/user_metrics.h"
#include "base/strings/string16.h"
#include "chrome/common/url_constants.h"
#include "chromeos/login/login_state/login_state.h"
#include "ui/gfx/geometry/size.h"
namespace chromeos {
namespace {
// Dialog width and height in DIPs.
const int kDefaultWidth = 530;
const int kDefaultHeightWithTimezone = 286;
const int kDefaultHeightWithoutTimezone = 228;
} // namespace
// static
void SetTimeDialog::ShowDialog(gfx::NativeWindow parent) {
base::RecordAction(base::UserMetricsAction("Options_SetTimeDialog_Show"));
auto* dialog = new SetTimeDialog();
dialog->ShowSystemDialog(parent);
}
// static
bool SetTimeDialog::ShouldShowTimezone() {
// After login the user should set the timezone via Settings, which applies
// additional restrictions.
return !LoginState::Get()->IsUserLoggedIn();
}
SetTimeDialog::SetTimeDialog()
: SystemWebDialogDelegate(GURL(chrome::kChromeUISetTimeURL),
base::string16() /* title */) {}
SetTimeDialog::~SetTimeDialog() = default;
void SetTimeDialog::GetDialogSize(gfx::Size* size) const {
size->SetSize(kDefaultWidth, ShouldShowTimezone()
? kDefaultHeightWithTimezone
: kDefaultHeightWithoutTimezone);
}
} // namespace chromeos
|
Java
|
/*
* GaussianKernel.java
*
* Created on September 25, 2004, 4:52 PM
*/
package jpview.graphics;
/**
* This class creates a kernel for use by an AffineTransformOp
*
* @author clyon
*/
public class GaussianKernel {
private int radius = 5;
private float sigma = 1;
private float[] kernel;
/** Creates a new instance of GaussianKernel */
public GaussianKernel() {
kernel = makeKernel();
}
/**
* Creates a gaussian kernel with the provided radius
*
* @param r
* the radius for the gaussian kernel
*/
public GaussianKernel(int r) {
radius = r;
kernel = makeKernel();
}
/**
* Creates a gaussian kernel with the provided radius and sigma value
*
* @param r
* the radius of the blur
* @param s
* the sigma value for the kernel
*/
public GaussianKernel(int r, float s) {
radius = r;
sigma = s;
kernel = makeKernel();
}
private float[] makeKernel() {
kernel = new float[radius * radius];
float sum = 0;
for (int y = 0; y < radius; y++) {
for (int x = 0; x < radius; x++) {
int off = y * radius + x;
int xx = x - radius / 2;
int yy = y - radius / 2;
kernel[off] = (float) Math.pow(Math.E, -(xx * xx + yy * yy)
/ (2 * (sigma * sigma)));
sum += kernel[off];
}
}
for (int i = 0; i < kernel.length; i++)
kernel[i] /= sum;
return kernel;
}
/**
* Dumps a string representation of the kernel to standard out
*/
public void dump() {
for (int x = 0; x < radius; x++) {
for (int y = 0; y < radius; y++) {
System.out.print(kernel[y * radius + x] + "\t");
}
System.out.println();
}
}
/**
* returns the kernel as a float [] suitable for use with an affine
* transform
*
* @return the kernel values
*/
public float[] getKernel() {
return kernel;
}
public static void main(String args[]) {
GaussianKernel gk = new GaussianKernel(5, 100f);
gk.dump();
}
}
|
Java
|
<?php
/**
* This file is part of the proophsoftware/event-machine.
* (c) 2017-2019 prooph software GmbH <contact@prooph.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace ProophExample\FunctionalFlavour;
use Prooph\EventMachine\Messaging\Message;
use Prooph\EventMachine\Messaging\MessageBag;
use Prooph\EventMachine\Runtime\Functional\Port;
use ProophExample\FunctionalFlavour\Api\Command;
use ProophExample\FunctionalFlavour\Api\Event;
use ProophExample\FunctionalFlavour\Api\Query;
final class ExampleFunctionalPort implements Port
{
/**
* {@inheritdoc}
*/
public function deserialize(Message $message)
{
//Note: we use a very simple mapping strategy here
//You could also use a deserializer or other techniques
switch ($message->messageType()) {
case Message::TYPE_COMMAND:
return Command::createFromNameAndPayload($message->messageName(), $message->payload());
case Message::TYPE_EVENT:
return Event::createFromNameAndPayload($message->messageName(), $message->payload());
case Message::TYPE_QUERY:
return Query::createFromNameAndPayload($message->messageName(), $message->payload());
}
}
/**
* {@inheritdoc}
*/
public function serializePayload($customMessage): array
{
//Since, we use objects with public properties as custom messages, casting to array is enough
//In a production setting, you should use your own immutable messages and a serializer
return (array) $customMessage;
}
/**
* {@inheritdoc}
*/
public function decorateEvent($customEvent): MessageBag
{
return new MessageBag(
Event::nameOf($customEvent),
MessageBag::TYPE_EVENT,
$customEvent
);
}
/**
* {@inheritdoc}
*/
public function getAggregateIdFromCommand(string $aggregateIdPayloadKey, $command): string
{
//Duck typing, do not do this in production but rather use your own interfaces
return $command->{$aggregateIdPayloadKey};
}
/**
* {@inheritdoc}
*/
public function callCommandPreProcessor($customCommand, $preProcessor)
{
//Duck typing, do not do this in production but rather use your own interfaces
return $preProcessor->preProcess($customCommand);
}
/**
* {@inheritdoc}
*/
public function callContextProvider($customCommand, $contextProvider)
{
//Duck typing, do not do this in production but rather use your own interfaces
return $contextProvider->provide($customCommand);
}
}
|
Java
|
// Copyright 2016 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 ASH_COMMON_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_
#define ASH_COMMON_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_
#include "ash/ash_export.h"
#include "base/macros.h"
namespace ash {
namespace test {
class MaterialDesignControllerTestAPI;
} // namespace test
// Central controller to handle material design modes.
class ASH_EXPORT MaterialDesignController {
public:
// The different material design modes for Chrome OS system UI.
enum Mode {
// Not initialized.
UNINITIALIZED = -1,
// Classic, non-material design.
NON_MATERIAL = 0,
// Basic material design.
MATERIAL_NORMAL = 1,
// Material design with experimental features.
MATERIAL_EXPERIMENTAL = 2
};
// Initializes |mode_|. Must be called before calling IsMaterial(),
// IsMaterialExperimental(), IsMaterialNormal(), or GetMode().
static void Initialize();
// Returns the currently initialized MaterialDesignController::Mode type for
// Chrome OS system UI.
static Mode GetMode();
// Returns true if overview mode is using Material Design.
static bool IsOverviewMaterial();
// Returns true if Material Design features are enabled for Chrome OS shelf.
static bool IsShelfMaterial();
// Returns true if Material Design features are enabled for Chrome OS system
// tray menu.
static bool IsSystemTrayMenuMaterial();
// Returns true if material design versions of icons should be used in the
// status tray and system menu.
static bool UseMaterialDesignSystemIcons();
private:
friend class test::MaterialDesignControllerTestAPI;
// Declarations only. Do not allow construction of an object.
MaterialDesignController();
~MaterialDesignController();
// Material Design |Mode| for Chrome OS system UI. Used only by tests.
static Mode mode();
// Returns true if Material Design is enabled in Chrome OS system UI.
// Maps to "ash-md" flag "enabled" or "experimental" values.
static bool IsMaterial();
// Returns true if Material Design normal features are enabled in Chrome OS
// system UI. Maps to "--ash-md=enabled" command line switch value.
static bool IsMaterialNormal();
// Returns true if Material Design experimental features are enabled in
// Chrome OS system UI. Maps to "--ash-md=experimental" command line switch
// value.
static bool IsMaterialExperimental();
// Returns the per-platform default material design variant.
static Mode DefaultMode();
// Sets |mode_| to |mode|. Can be used by tests to directly set the mode.
static void SetMode(Mode mode);
// Resets the initialization state to uninitialized. To be used by tests to
// allow calling Initialize() more than once.
static void Uninitialize();
DISALLOW_COPY_AND_ASSIGN(MaterialDesignController);
};
} // namespace ash
#endif // ASH_COMMON_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_
|
Java
|
// Copyright 2014 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_BROWSER_CHROMEOS_LOGIN_USERS_AVATAR_USER_IMAGE_LOADER_H_
#define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AVATAR_USER_IMAGE_LOADER_H_
#include <string>
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "chrome/browser/image_decoder.h"
class SkBitmap;
namespace base {
class SequencedTaskRunner;
}
namespace user_manager {
class UserImage;
}
namespace chromeos {
// Helper that reads, decodes and optionally resizes an image on a background
// thread. Returns the image in the form of an SkBitmap.
class UserImageLoader : public base::RefCountedThreadSafe<UserImageLoader> {
public:
// Callback used to return the result of an image load operation.
typedef base::Callback<void(const user_manager::UserImage& user_image)>
LoadedCallback;
// All file I/O, decoding and resizing are done via |background_task_runner|.
UserImageLoader(
ImageDecoder::ImageCodec image_codec,
scoped_refptr<base::SequencedTaskRunner> background_task_runner);
// Load an image in the background and call |loaded_cb| with the resulting
// UserImage (which may be empty in case of error). If |pixels_per_side| is
// positive, the image is cropped to a square and shrunk so that it does not
// exceed |pixels_per_side|x|pixels_per_side|. The first variant of this
// method reads the image from |filepath| on disk, the second processes |data|
// read into memory already.
void Start(const std::string& filepath,
int pixels_per_side,
const LoadedCallback& loaded_cb);
void Start(scoped_ptr<std::string> data,
int pixels_per_side,
const LoadedCallback& loaded_cb);
private:
friend class base::RefCountedThreadSafe<UserImageLoader>;
// Contains attributes we need to know about each image we decode.
struct ImageInfo {
ImageInfo(const std::string& file_path,
int pixels_per_side,
const LoadedCallback& loaded_cb);
~ImageInfo();
const std::string file_path;
const int pixels_per_side;
const LoadedCallback loaded_cb;
};
class UserImageRequest : public ImageDecoder::ImageRequest {
public:
UserImageRequest(const ImageInfo& image_info,
const std::string& image_data,
UserImageLoader* user_image_loader);
// ImageDecoder::ImageRequest implementation. These callbacks will only be
// invoked via user_image_loader_'s background_task_runner_.
void OnImageDecoded(const SkBitmap& decoded_image) override;
void OnDecodeImageFailed() override;
private:
~UserImageRequest() override;
const ImageInfo image_info_;
std::vector<unsigned char> image_data_;
UserImageLoader* user_image_loader_;
};
~UserImageLoader();
// Reads the image from |image_info.file_path| and starts the decoding
// process. This method may only be invoked via the |background_task_runner_|.
void ReadAndDecodeImage(const ImageInfo& image_info);
// Decodes the image |data|. This method may only be invoked via the
// |background_task_runner_|.
void DecodeImage(const scoped_ptr<std::string> data,
const ImageInfo& image_info);
// The foreground task runner on which |this| is instantiated, Start() is
// called and LoadedCallbacks are invoked.
scoped_refptr<base::SequencedTaskRunner> foreground_task_runner_;
// The background task runner on which file I/O, image decoding and resizing
// are done.
scoped_refptr<base::SequencedTaskRunner> background_task_runner_;
// Specify how the file should be decoded in the utility process.
const ImageDecoder::ImageCodec image_codec_;
DISALLOW_COPY_AND_ASSIGN(UserImageLoader);
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AVATAR_USER_IMAGE_LOADER_H_
|
Java
|
//===-- MainLoopBase.h ------------------------------------------*- 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 LLDB_HOST_MAINLOOPBASE_H
#define LLDB_HOST_MAINLOOPBASE_H
#include "lldb/Utility/IOObject.h"
#include "lldb/Utility/Status.h"
#include "llvm/Support/ErrorHandling.h"
#include <functional>
namespace lldb_private {
// The purpose of this class is to enable multiplexed processing of data from
// different sources without resorting to multi-threading. Clients can register
// IOObjects, which will be monitored for readability, and when they become
// ready, the specified callback will be invoked. Monitoring for writability is
// not supported, but can be easily added if needed.
//
// The RegisterReadObject function return a handle, which controls the duration
// of the monitoring. When this handle is destroyed, the callback is
// deregistered.
//
// This class simply defines the interface common for all platforms, actual
// implementations are platform-specific.
class MainLoopBase {
private:
class ReadHandle;
public:
MainLoopBase() {}
virtual ~MainLoopBase() {}
typedef std::unique_ptr<ReadHandle> ReadHandleUP;
typedef std::function<void(MainLoopBase &)> Callback;
virtual ReadHandleUP RegisterReadObject(const lldb::IOObjectSP &object_sp,
const Callback &callback,
Status &error) {
llvm_unreachable("Not implemented");
}
// Waits for registered events and invoke the proper callbacks. Returns when
// all callbacks deregister themselves or when someone requests termination.
virtual Status Run() { llvm_unreachable("Not implemented"); }
// Requests the exit of the Run() function.
virtual void RequestTermination() { llvm_unreachable("Not implemented"); }
protected:
ReadHandleUP CreateReadHandle(const lldb::IOObjectSP &object_sp) {
return ReadHandleUP(new ReadHandle(*this, object_sp->GetWaitableHandle()));
}
virtual void UnregisterReadObject(IOObject::WaitableHandle handle) {
llvm_unreachable("Not implemented");
}
private:
class ReadHandle {
public:
~ReadHandle() { m_mainloop.UnregisterReadObject(m_handle); }
private:
ReadHandle(MainLoopBase &mainloop, IOObject::WaitableHandle handle)
: m_mainloop(mainloop), m_handle(handle) {}
MainLoopBase &m_mainloop;
IOObject::WaitableHandle m_handle;
friend class MainLoopBase;
DISALLOW_COPY_AND_ASSIGN(ReadHandle);
};
private:
DISALLOW_COPY_AND_ASSIGN(MainLoopBase);
};
} // namespace lldb_private
#endif // LLDB_HOST_MAINLOOPBASE_H
|
Java
|
\hypertarget{ChassisTurnRate_8cpp}{\section{framework/\-Chassis\-Turn\-Rate.cpp File Reference}
\label{ChassisTurnRate_8cpp}\index{framework/\-Chassis\-Turn\-Rate.\-cpp@{framework/\-Chassis\-Turn\-Rate.\-cpp}}
}
\hyperlink{classChassisTurnRate}{Chassis\-Turn\-Rate} is a strictly defined type for specifying the turn rate of a moving chassis.
{\ttfamily \#include \char`\"{}Chassis\-Turn\-Rate.\-hpp\char`\"{}}\\*
\subsection{Detailed Description}
\hyperlink{classChassisTurnRate}{Chassis\-Turn\-Rate} is a strictly defined type for specifying the turn rate of a moving chassis. \begin{DoxyCopyright}{Copyright}
(c) 2017 Mark R. Jenkins. All rights reserved.
\end{DoxyCopyright}
\begin{DoxyAuthor}{Author}
M\-Jenkins, E\-N\-P\-M 808\-X Spring 2017
\end{DoxyAuthor}
\begin{DoxyDate}{Date}
Mar 13, 2017 -\/ Creation
\end{DoxyDate}
\hyperlink{classChassis}{Chassis} turn rates may be specified in a variety of ways; the one implemented here is as a degree of turn per foot of movement. This class creates a strict type for chassis turn rates, and can provide a variety of accessor functiont so allow setting/getting the turn rate in different units. The class stores the turn rate internaly as \char`\"{}\-Degrees per Foot of movement\char`\"{}. Note that a zero turn rate indicates movement straight ahead, a negative turn rate indicates a deviation (turn) to the left, and a positive turn rate indicates a deviation (turn) to the right.
|
Java
|
Гость создан
|
Java
|
// Copyright 2014 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.
package org.chromium.net.impl;
import android.content.Context;
import android.os.Build;
import android.os.ConditionVariable;
import android.os.Handler;
import android.os.Looper;
import android.os.Process;
import android.util.Log;
import org.chromium.base.ObserverList;
import org.chromium.base.VisibleForTesting;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.base.annotations.NativeClassQualifiedName;
import org.chromium.base.annotations.UsedByReflection;
import org.chromium.net.BidirectionalStream;
import org.chromium.net.CronetEngine;
import org.chromium.net.NetworkQualityRttListener;
import org.chromium.net.NetworkQualityThroughputListener;
import org.chromium.net.RequestFinishedInfo;
import org.chromium.net.UrlRequest;
import org.chromium.net.urlconnection.CronetHttpURLConnection;
import org.chromium.net.urlconnection.CronetURLStreamHandlerFactory;
import java.net.Proxy;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandlerFactory;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.concurrent.GuardedBy;
/**
* CronetEngine using Chromium HTTP stack implementation.
*/
@JNINamespace("cronet")
@UsedByReflection("CronetEngine.java")
@VisibleForTesting
public class CronetUrlRequestContext extends CronetEngine {
private static final int LOG_NONE = 3; // LOG(FATAL), no VLOG.
private static final int LOG_DEBUG = -1; // LOG(FATAL...INFO), VLOG(1)
private static final int LOG_VERBOSE = -2; // LOG(FATAL...INFO), VLOG(2)
static final String LOG_TAG = "ChromiumNetwork";
/**
* Synchronize access to mUrlRequestContextAdapter and shutdown routine.
*/
private final Object mLock = new Object();
private final ConditionVariable mInitCompleted = new ConditionVariable(false);
private final AtomicInteger mActiveRequestCount = new AtomicInteger(0);
private long mUrlRequestContextAdapter = 0;
private Thread mNetworkThread;
private boolean mNetworkQualityEstimatorEnabled;
/**
* Locks operations on network quality listeners, because listener
* addition and removal may occur on a different thread from notification.
*/
private final Object mNetworkQualityLock = new Object();
/**
* Locks operations on the list of RequestFinishedInfo.Listeners, because operations can happen
* on any thread.
*/
private final Object mFinishedListenerLock = new Object();
@GuardedBy("mNetworkQualityLock")
private final ObserverList<NetworkQualityRttListener> mRttListenerList =
new ObserverList<NetworkQualityRttListener>();
@GuardedBy("mNetworkQualityLock")
private final ObserverList<NetworkQualityThroughputListener> mThroughputListenerList =
new ObserverList<NetworkQualityThroughputListener>();
@GuardedBy("mFinishedListenerLock")
private final List<RequestFinishedInfo.Listener> mFinishedListenerList =
new ArrayList<RequestFinishedInfo.Listener>();
/**
* Synchronize access to mCertVerifierData.
*/
private ConditionVariable mWaitGetCertVerifierDataComplete = new ConditionVariable();
/** Holds CertVerifier data. */
private String mCertVerifierData;
@UsedByReflection("CronetEngine.java")
public CronetUrlRequestContext(final CronetEngine.Builder builder) {
CronetLibraryLoader.ensureInitialized(builder.getContext(), builder);
nativeSetMinLogLevel(getLoggingLevel());
synchronized (mLock) {
mUrlRequestContextAdapter = nativeCreateRequestContextAdapter(
createNativeUrlRequestContextConfig(builder.getContext(), builder));
if (mUrlRequestContextAdapter == 0) {
throw new NullPointerException("Context Adapter creation failed.");
}
mNetworkQualityEstimatorEnabled = builder.networkQualityEstimatorEnabled();
}
// Init native Chromium URLRequestContext on main UI thread.
Runnable task = new Runnable() {
@Override
public void run() {
CronetLibraryLoader.ensureInitializedOnMainThread(builder.getContext());
synchronized (mLock) {
// mUrlRequestContextAdapter is guaranteed to exist until
// initialization on main and network threads completes and
// initNetworkThread is called back on network thread.
nativeInitRequestContextOnMainThread(mUrlRequestContextAdapter);
}
}
};
// Run task immediately or post it to the UI thread.
if (Looper.getMainLooper() == Looper.myLooper()) {
task.run();
} else {
new Handler(Looper.getMainLooper()).post(task);
}
}
@VisibleForTesting
public static long createNativeUrlRequestContextConfig(
final Context context, CronetEngine.Builder builder) {
final long urlRequestContextConfig = nativeCreateRequestContextConfig(
builder.getUserAgent(), builder.storagePath(), builder.quicEnabled(),
builder.getDefaultQuicUserAgentId(context), builder.http2Enabled(),
builder.sdchEnabled(), builder.dataReductionProxyKey(),
builder.dataReductionProxyPrimaryProxy(), builder.dataReductionProxyFallbackProxy(),
builder.dataReductionProxySecureProxyCheckUrl(), builder.cacheDisabled(),
builder.httpCacheMode(), builder.httpCacheMaxSize(), builder.experimentalOptions(),
builder.mockCertVerifier(), builder.networkQualityEstimatorEnabled(),
builder.publicKeyPinningBypassForLocalTrustAnchorsEnabled(),
builder.certVerifierData());
for (Builder.QuicHint quicHint : builder.quicHints()) {
nativeAddQuicHint(urlRequestContextConfig, quicHint.mHost, quicHint.mPort,
quicHint.mAlternatePort);
}
for (Builder.Pkp pkp : builder.publicKeyPins()) {
nativeAddPkp(urlRequestContextConfig, pkp.mHost, pkp.mHashes, pkp.mIncludeSubdomains,
pkp.mExpirationDate.getTime());
}
return urlRequestContextConfig;
}
@Override
public UrlRequest createRequest(String url, UrlRequest.Callback callback, Executor executor,
int priority, Collection<Object> requestAnnotations, boolean disableCache,
boolean disableConnectionMigration) {
synchronized (mLock) {
checkHaveAdapter();
boolean metricsCollectionEnabled = false;
synchronized (mFinishedListenerLock) {
metricsCollectionEnabled = !mFinishedListenerList.isEmpty();
}
return new CronetUrlRequest(this, url, priority, callback, executor, requestAnnotations,
metricsCollectionEnabled, disableCache, disableConnectionMigration);
}
}
@Override
public BidirectionalStream createBidirectionalStream(String url,
BidirectionalStream.Callback callback, Executor executor, String httpMethod,
List<Map.Entry<String, String>> requestHeaders,
@BidirectionalStream.Builder.StreamPriority int priority, boolean disableAutoFlush,
boolean delayRequestHeadersUntilFirstFlush) {
synchronized (mLock) {
checkHaveAdapter();
return new CronetBidirectionalStream(this, url, priority, callback, executor,
httpMethod, requestHeaders, disableAutoFlush,
delayRequestHeadersUntilFirstFlush);
}
}
@Override
public boolean isEnabled() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
}
@Override
public String getVersionString() {
return "Cronet/" + ImplVersion.getVersion();
}
@Override
public void shutdown() {
synchronized (mLock) {
checkHaveAdapter();
if (mActiveRequestCount.get() != 0) {
throw new IllegalStateException("Cannot shutdown with active requests.");
}
// Destroying adapter stops the network thread, so it cannot be
// called on network thread.
if (Thread.currentThread() == mNetworkThread) {
throw new IllegalThreadStateException("Cannot shutdown from network thread.");
}
}
// Wait for init to complete on main and network thread (without lock,
// so other thread could access it).
mInitCompleted.block();
synchronized (mLock) {
// It is possible that adapter is already destroyed on another thread.
if (!haveRequestContextAdapter()) {
return;
}
nativeDestroy(mUrlRequestContextAdapter);
mUrlRequestContextAdapter = 0;
}
}
@Override
public void startNetLogToFile(String fileName, boolean logAll) {
synchronized (mLock) {
checkHaveAdapter();
nativeStartNetLogToFile(mUrlRequestContextAdapter, fileName, logAll);
}
}
@Override
public void stopNetLog() {
synchronized (mLock) {
checkHaveAdapter();
nativeStopNetLog(mUrlRequestContextAdapter);
}
}
@Override
public String getCertVerifierData(long timeout) {
if (timeout < 0) {
throw new IllegalArgumentException("timeout must be a positive value");
} else if (timeout == 0) {
timeout = 100;
}
mWaitGetCertVerifierDataComplete.close();
synchronized (mLock) {
checkHaveAdapter();
nativeGetCertVerifierData(mUrlRequestContextAdapter);
}
mWaitGetCertVerifierDataComplete.block(timeout);
return mCertVerifierData;
}
// This method is intentionally non-static to ensure Cronet native library
// is loaded by class constructor.
@Override
public byte[] getGlobalMetricsDeltas() {
return nativeGetHistogramDeltas();
}
@VisibleForTesting
@Override
public void configureNetworkQualityEstimatorForTesting(
boolean useLocalHostRequests, boolean useSmallerResponses) {
if (!mNetworkQualityEstimatorEnabled) {
throw new IllegalStateException("Network quality estimator must be enabled");
}
synchronized (mLock) {
checkHaveAdapter();
nativeConfigureNetworkQualityEstimatorForTesting(
mUrlRequestContextAdapter, useLocalHostRequests, useSmallerResponses);
}
}
@Override
public void addRttListener(NetworkQualityRttListener listener) {
if (!mNetworkQualityEstimatorEnabled) {
throw new IllegalStateException("Network quality estimator must be enabled");
}
synchronized (mNetworkQualityLock) {
if (mRttListenerList.isEmpty()) {
synchronized (mLock) {
checkHaveAdapter();
nativeProvideRTTObservations(mUrlRequestContextAdapter, true);
}
}
mRttListenerList.addObserver(listener);
}
}
@Override
public void removeRttListener(NetworkQualityRttListener listener) {
if (!mNetworkQualityEstimatorEnabled) {
throw new IllegalStateException("Network quality estimator must be enabled");
}
synchronized (mNetworkQualityLock) {
mRttListenerList.removeObserver(listener);
if (mRttListenerList.isEmpty()) {
synchronized (mLock) {
checkHaveAdapter();
nativeProvideRTTObservations(mUrlRequestContextAdapter, false);
}
}
}
}
@Override
public void addThroughputListener(NetworkQualityThroughputListener listener) {
if (!mNetworkQualityEstimatorEnabled) {
throw new IllegalStateException("Network quality estimator must be enabled");
}
synchronized (mNetworkQualityLock) {
if (mThroughputListenerList.isEmpty()) {
synchronized (mLock) {
checkHaveAdapter();
nativeProvideThroughputObservations(mUrlRequestContextAdapter, true);
}
}
mThroughputListenerList.addObserver(listener);
}
}
@Override
public void removeThroughputListener(NetworkQualityThroughputListener listener) {
if (!mNetworkQualityEstimatorEnabled) {
throw new IllegalStateException("Network quality estimator must be enabled");
}
synchronized (mNetworkQualityLock) {
mThroughputListenerList.removeObserver(listener);
if (mThroughputListenerList.isEmpty()) {
synchronized (mLock) {
checkHaveAdapter();
nativeProvideThroughputObservations(mUrlRequestContextAdapter, false);
}
}
}
}
@Override
public void addRequestFinishedListener(RequestFinishedInfo.Listener listener) {
synchronized (mFinishedListenerLock) {
mFinishedListenerList.add(listener);
}
}
@Override
public void removeRequestFinishedListener(RequestFinishedInfo.Listener listener) {
synchronized (mFinishedListenerLock) {
mFinishedListenerList.remove(listener);
}
}
@Override
public URLConnection openConnection(URL url) {
return openConnection(url, Proxy.NO_PROXY);
}
@Override
public URLConnection openConnection(URL url, Proxy proxy) {
if (proxy.type() != Proxy.Type.DIRECT) {
throw new UnsupportedOperationException();
}
String protocol = url.getProtocol();
if ("http".equals(protocol) || "https".equals(protocol)) {
return new CronetHttpURLConnection(url, this);
}
throw new UnsupportedOperationException("Unexpected protocol:" + protocol);
}
@Override
public URLStreamHandlerFactory createURLStreamHandlerFactory() {
return new CronetURLStreamHandlerFactory(this);
}
/**
* Mark request as started to prevent shutdown when there are active
* requests.
*/
void onRequestStarted() {
mActiveRequestCount.incrementAndGet();
}
/**
* Mark request as finished to allow shutdown when there are no active
* requests.
*/
void onRequestDestroyed() {
mActiveRequestCount.decrementAndGet();
}
@VisibleForTesting
public long getUrlRequestContextAdapter() {
synchronized (mLock) {
checkHaveAdapter();
return mUrlRequestContextAdapter;
}
}
private void checkHaveAdapter() throws IllegalStateException {
if (!haveRequestContextAdapter()) {
throw new IllegalStateException("Engine is shut down.");
}
}
private boolean haveRequestContextAdapter() {
return mUrlRequestContextAdapter != 0;
}
/**
* @return loggingLevel see {@link #LOG_NONE}, {@link #LOG_DEBUG} and
* {@link #LOG_VERBOSE}.
*/
private int getLoggingLevel() {
int loggingLevel;
if (Log.isLoggable(LOG_TAG, Log.VERBOSE)) {
loggingLevel = LOG_VERBOSE;
} else if (Log.isLoggable(LOG_TAG, Log.DEBUG)) {
loggingLevel = LOG_DEBUG;
} else {
loggingLevel = LOG_NONE;
}
return loggingLevel;
}
@SuppressWarnings("unused")
@CalledByNative
private void initNetworkThread() {
synchronized (mLock) {
mNetworkThread = Thread.currentThread();
mInitCompleted.open();
}
Thread.currentThread().setName("ChromiumNet");
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
}
@SuppressWarnings("unused")
@CalledByNative
private void onRttObservation(final int rttMs, final long whenMs, final int source) {
synchronized (mNetworkQualityLock) {
for (final NetworkQualityRttListener listener : mRttListenerList) {
Runnable task = new Runnable() {
@Override
public void run() {
listener.onRttObservation(rttMs, whenMs, source);
}
};
postObservationTaskToExecutor(listener.getExecutor(), task);
}
}
}
@SuppressWarnings("unused")
@CalledByNative
private void onThroughputObservation(
final int throughputKbps, final long whenMs, final int source) {
synchronized (mNetworkQualityLock) {
for (final NetworkQualityThroughputListener listener : mThroughputListenerList) {
Runnable task = new Runnable() {
@Override
public void run() {
listener.onThroughputObservation(throughputKbps, whenMs, source);
}
};
postObservationTaskToExecutor(listener.getExecutor(), task);
}
}
}
@SuppressWarnings("unused")
@CalledByNative
private void onGetCertVerifierData(String certVerifierData) {
mCertVerifierData = certVerifierData;
mWaitGetCertVerifierDataComplete.open();
}
void reportFinished(final CronetUrlRequest request) {
final RequestFinishedInfo requestInfo = request.getRequestFinishedInfo();
ArrayList<RequestFinishedInfo.Listener> currentListeners;
synchronized (mFinishedListenerLock) {
currentListeners = new ArrayList<RequestFinishedInfo.Listener>(mFinishedListenerList);
}
for (final RequestFinishedInfo.Listener listener : currentListeners) {
Runnable task = new Runnable() {
@Override
public void run() {
listener.onRequestFinished(requestInfo);
}
};
postObservationTaskToExecutor(listener.getExecutor(), task);
}
}
private static void postObservationTaskToExecutor(Executor executor, Runnable task) {
try {
executor.execute(task);
} catch (RejectedExecutionException failException) {
Log.e(CronetUrlRequestContext.LOG_TAG, "Exception posting task to executor",
failException);
}
}
// Native methods are implemented in cronet_url_request_context_adapter.cc.
private static native long nativeCreateRequestContextConfig(String userAgent,
String storagePath, boolean quicEnabled, String quicUserAgentId, boolean http2Enabled,
boolean sdchEnabled, String dataReductionProxyKey,
String dataReductionProxyPrimaryProxy, String dataReductionProxyFallbackProxy,
String dataReductionProxySecureProxyCheckUrl, boolean disableCache, int httpCacheMode,
long httpCacheMaxSize, String experimentalOptions, long mockCertVerifier,
boolean enableNetworkQualityEstimator,
boolean bypassPublicKeyPinningForLocalTrustAnchors, String certVerifierData);
private static native void nativeAddQuicHint(
long urlRequestContextConfig, String host, int port, int alternatePort);
private static native void nativeAddPkp(long urlRequestContextConfig, String host,
byte[][] hashes, boolean includeSubdomains, long expirationTime);
private static native long nativeCreateRequestContextAdapter(long urlRequestContextConfig);
private static native int nativeSetMinLogLevel(int loggingLevel);
private static native byte[] nativeGetHistogramDeltas();
@NativeClassQualifiedName("CronetURLRequestContextAdapter")
private native void nativeDestroy(long nativePtr);
@NativeClassQualifiedName("CronetURLRequestContextAdapter")
private native void nativeStartNetLogToFile(long nativePtr, String fileName, boolean logAll);
@NativeClassQualifiedName("CronetURLRequestContextAdapter")
private native void nativeStopNetLog(long nativePtr);
@NativeClassQualifiedName("CronetURLRequestContextAdapter")
private native void nativeGetCertVerifierData(long nativePtr);
@NativeClassQualifiedName("CronetURLRequestContextAdapter")
private native void nativeInitRequestContextOnMainThread(long nativePtr);
@NativeClassQualifiedName("CronetURLRequestContextAdapter")
private native void nativeConfigureNetworkQualityEstimatorForTesting(
long nativePtr, boolean useLocalHostRequests, boolean useSmallerResponses);
@NativeClassQualifiedName("CronetURLRequestContextAdapter")
private native void nativeProvideRTTObservations(long nativePtr, boolean should);
@NativeClassQualifiedName("CronetURLRequestContextAdapter")
private native void nativeProvideThroughputObservations(long nativePtr, boolean should);
}
|
Java
|
/*
* Copyright (C) 2007-2015 Frank Mertens.
*
* Use of this source is governed by a BSD-style license that can be
* found in the LICENSE file.
*
*/
#ifndef FLUXMETA_METAPROTOCOL_H
#define FLUXMETA_METAPROTOCOL_H
#include <flux/meta/MetaObject>
namespace flux {
namespace meta {
/** \brief Duck-typed object protocol
*/
class MetaProtocol: public Object
{
public:
inline static Ref<MetaProtocol> create() {
return new MetaProtocol;
}
template<class Prototype>
Prototype *define(const String &className) {
Ref<Prototype> prototype = Prototype::create(className);
define(prototype);
return prototype;
}
template<class Prototype>
Prototype *define() {
Ref<Prototype> prototype = Prototype::create();
define(prototype);
return prototype;
}
MetaObject *define(MetaObject *prototype) {
prototype->define();
prototypes()->insert(prototype->className(), prototype);
return prototype;
}
template<class Prototype>
static Ref<MetaObject> createPrototype() {
Ref<MetaObject> prototype = Prototype::create();
prototype->define();
return prototype;
}
virtual MetaObject *lookup(String className) const {
MetaObject *prototype = 0;
if (prototypes_) prototypes_->lookup(className, &prototype);
return prototype;
}
int minCount() const { return minCount_; }
int maxCount() const { return maxCount_; }
void minCount(int newCount) { minCount_ = newCount; }
void maxCount(int newCount) { maxCount_ = newCount; }
inline bool lookup(const String &className, MetaObject **prototype) const {
*prototype = lookup(className);
return *prototype;
}
protected:
friend class YasonSyntax;
MetaProtocol():
minCount_(0),
maxCount_(flux::intMax)
{}
virtual Ref<MetaObject> produce(MetaObject *prototype) const {
return prototype->produce();
}
private:
typedef Map<String, Ref<MetaObject> > Prototypes;
Prototypes *prototypes() {
if (!prototypes_) prototypes_ = Prototypes::create();
return prototypes_;
}
Ref<Prototypes> prototypes_;
int minCount_;
int maxCount_;
};
}} // namespace flux::meta
#endif // FLUXMETA_METAPROTOCOL_H
|
Java
|
module Carto
module Configuration
def db_config
@@db_config ||= YAML.load(File.read(db_config_file)).freeze
end
def app_config
@@app_config ||= YAML.load_file(app_config_file).freeze
end
def frontend_version
@@frontend_version ||= JSON::parse(File.read(Rails.root.join("package.json")))["version"]
end
def env_app_config
app_config[ENV['RAILS_ENV'] || 'development']
end
def log_file_path(filename)
"#{log_dir_path}/#{filename}"
end
def log_dir_path
"#{log_files_root}/log"
end
def public_uploaded_assets_path
public_uploads_path('uploads')
end
def public_uploads_path(subfolder = '')
path_with_alternative('RAILS_PUBLIC_UPLOADS_PATH', subfolder) do
if env_app_config && env_app_config[:importer] && env_app_config[:importer]["uploads_path"]
env_app_config[:importer]["uploads_path"]
else
Rails.root.join('public', subfolder).to_s
end
end
end
def uploaded_file_path(path)
pathname = Pathname.new(path)
return path if pathname.exist? && pathname.absolute?
upload_path = Cartodb.get_config(:importer, 'uploads_path')
if upload_path
# Ugly patch needed for backwards compatibility
"#{upload_path}#{path}".gsub('/uploads/uploads/', '/uploads/')
else
Rails.root.join("public#{path}").to_s
end
end
def custom_app_views_paths
config = env_app_config
(config && config['custom_paths'] && config['custom_paths']['views']) || Array.new
end
def saas?
Cartodb.config[:cartodb_com_hosted] == false
end
def mapzen_api_key
Cartodb.get_config(:geocoder, 'mapzen', 'search_bar_api_key')
end
def mapbox_api_key
Cartodb.get_config(:geocoder, 'mapbox', 'search_bar_api_key')
end
# Make some methods available. Remember that this sets methods as private.
# More information: https://idiosyncratic-ruby.com/8-self-improvement.html
# This is the chosen approach to avoid including `Configuration` all over the place. Check #12757
module_function :saas?
private
def config_files_root
rails_path('RAILS_CONFIG_BASE_PATH')
end
def log_files_root
rails_path('RAILS_LOG_BASE_PATH')
end
def rails_path(environment_variable)
path_with_alternative(environment_variable) { Rails.root }
end
# Returns an string, block should as well
def path_with_alternative(environment_variable, subfolder_at_environment = '')
if ENV[environment_variable]
Pathname.new(ENV[environment_variable]).join(subfolder_at_environment).to_s
else
alternative = yield
alternative || ''
end
end
def db_config_file
if ENV['RAILS_DATABASE_FILE']
File.join(config_files_root, 'config/' + ENV['RAILS_DATABASE_FILE'])
else
File.join(config_files_root, 'config/database.yml')
end
end
def app_config_file
"#{config_files_root}/config/app_config.yml"
end
end
class Conf
include Carto::Configuration
end
end
|
Java
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_33) on Fri Jul 13 11:10:51 CEST 2012 -->
<TITLE>
Sample
</TITLE>
<META NAME="date" CONTENT="2012-07-13">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Sample";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Sample.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../converter/FrameNetConverterTest.html" title="class in converter"><B>PREV CLASS</B></A>
<A HREF="../converter/TigerXmlConverter.html" title="class in converter"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../index.html?converter/Sample.html" target="_top"><B>FRAMES</B></A>
<A HREF="Sample.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
converter</FONT>
<BR>
Class Sample</H2>
<PRE>
java.lang.Object
<IMG SRC="../resources/inherit.gif" ALT="extended by "><B>converter.Sample</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>Sample</B><DT>extends java.lang.Object</DL>
</PRE>
<P>
<HR>
<P>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../converter/Sample.html#Sample()">Sample</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../converter/Sample.html#convertFromTigerXmlToFramenet()">convertFromTigerXmlToFramenet</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="Sample()"><!-- --></A><H3>
Sample</H3>
<PRE>
public <B>Sample</B>()</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="convertFromTigerXmlToFramenet()"><!-- --></A><H3>
convertFromTigerXmlToFramenet</H3>
<PRE>
public void <B>convertFromTigerXmlToFramenet</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Sample.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../converter/FrameNetConverterTest.html" title="class in converter"><B>PREV CLASS</B></A>
<A HREF="../converter/TigerXmlConverter.html" title="class in converter"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../index.html?converter/Sample.html" target="_top"><B>FRAMES</B></A>
<A HREF="Sample.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
|
Java
|
/* Copyright (C) 2002 Jean-Marc Valin */
/**
@file speex_bits.h
@brief Handles bit packing/unpacking
*/
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation 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 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.
*/
#ifndef BITS_H
#define BITS_H
/** @defgroup SpeexBits SpeexBits: Bit-stream manipulations
* This is the structure that holds the bit-stream when encoding or decoding
* with Speex. It allows some manipulations as well.
* @{
*/
#include "speex_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/** Bit-packing data structure representing (part of) a bit-stream. */
typedef struct SpeexBits {
char *chars; /**< "raw" data */
int nbBits; /**< Total number of bits stored in the stream*/
int charPtr; /**< Position of the byte "cursor" */
int bitPtr; /**< Position of the bit "cursor" within the current char */
int owner; /**< Does the struct "own" the "raw" buffer (member "chars") */
int overflow;/**< Set to one if we try to read past the valid data */
int buf_size;/**< Allocated size for buffer */
int reserved1; /**< Reserved for future use */
void *reserved2; /**< Reserved for future use */
} SpeexBits;
/** Initializes and allocates resources for a SpeexBits struct */
PUBLIC_API void speex_bits_init(SpeexBits *bits);
/** Initializes SpeexBits struct using a pre-allocated buffer*/
PUBLIC_API void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size);
/** Sets the bits in a SpeexBits struct to use data from an existing buffer (for decoding without copying data) */
PUBLIC_API void speex_bits_set_bit_buffer(SpeexBits *bits, void *buff, int buf_size);
/** Frees all resources associated to a SpeexBits struct. Right now this does nothing since no resources are allocated, but this could change in the future.*/
PUBLIC_API void speex_bits_destroy(SpeexBits *bits);
/** Resets bits to initial value (just after initialization, erasing content)*/
PUBLIC_API void speex_bits_reset(SpeexBits *bits);
/** Rewind the bit-stream to the beginning (ready for read) without erasing the content */
PUBLIC_API void speex_bits_rewind(SpeexBits *bits);
/** Initializes the bit-stream from the data in an area of memory */
PUBLIC_API void speex_bits_read_from(SpeexBits *bits, const char *bytes, int len);
/** Append bytes to the bit-stream
*
* @param bits Bit-stream to operate on
* @param bytes pointer to the bytes what will be appended
* @param len Number of bytes of append
*/
PUBLIC_API void speex_bits_read_whole_bytes(SpeexBits *bits, const char *bytes, int len);
/** Write the content of a bit-stream to an area of memory
*
* @param bits Bit-stream to operate on
* @param bytes Memory location where to write the bits
* @param max_len Maximum number of bytes to write (i.e. size of the "bytes" buffer)
* @return Number of bytes written to the "bytes" buffer
*/
PUBLIC_API int speex_bits_write(SpeexBits *bits, char *bytes, int max_len);
/** Like speex_bits_write, but writes only the complete bytes in the stream. Also removes the written bytes from the stream */
PUBLIC_API int speex_bits_write_whole_bytes(SpeexBits *bits, char *bytes, int max_len);
/** Append bits to the bit-stream
* @param bits Bit-stream to operate on
* @param data Value to append as integer
* @param nbBits number of bits to consider in "data"
*/
PUBLIC_API void speex_bits_pack(SpeexBits *bits, int data, int nbBits);
/** Interpret the next bits in the bit-stream as a signed integer
*
* @param bits Bit-stream to operate on
* @param nbBits Number of bits to interpret
* @return A signed integer represented by the bits read
*/
PUBLIC_API int speex_bits_unpack_signed(SpeexBits *bits, int nbBits);
/** Interpret the next bits in the bit-stream as an unsigned integer
*
* @param bits Bit-stream to operate on
* @param nbBits Number of bits to interpret
* @return An unsigned integer represented by the bits read
*/
PUBLIC_API unsigned int speex_bits_unpack_unsigned(SpeexBits *bits, int nbBits);
/** Returns the number of bytes in the bit-stream, including the last one even if it is not "full"
*
* @param bits Bit-stream to operate on
* @return Number of bytes in the stream
*/
PUBLIC_API int speex_bits_nbytes(SpeexBits *bits);
/** Same as speex_bits_unpack_unsigned, but without modifying the cursor position
*
* @param bits Bit-stream to operate on
* @param nbBits Number of bits to look for
* @return Value of the bits peeked, interpreted as unsigned
*/
PUBLIC_API unsigned int speex_bits_peek_unsigned(SpeexBits *bits, int nbBits);
/** Get the value of the next bit in the stream, without modifying the
* "cursor" position
*
* @param bits Bit-stream to operate on
* @return Value of the bit peeked (one bit only)
*/
PUBLIC_API int speex_bits_peek(SpeexBits *bits);
/** Advances the position of the "bit cursor" in the stream
*
* @param bits Bit-stream to operate on
* @param n Number of bits to advance
*/
PUBLIC_API void speex_bits_advance(SpeexBits *bits, int n);
/** Returns the number of bits remaining to be read in a stream
*
* @param bits Bit-stream to operate on
* @return Number of bits that can still be read from the stream
*/
PUBLIC_API int speex_bits_remaining(SpeexBits *bits);
/** Insert a terminator so that the data can be sent as a packet while auto-detecting
* the number of frames in each packet
*
* @param bits Bit-stream to operate on
*/
PUBLIC_API void speex_bits_insert_terminator(SpeexBits *bits);
#ifdef __cplusplus
}
#endif
/* @} */
#endif
|
Java
|
/*L
* Copyright Oracle Inc
*
* Distributed under the OSI-approved BSD 3-Clause License.
* See http://ncip.github.com/cadsr-cgmdr-nci-uk/LICENSE.txt for details.
*/
/*
* eXist Open Source Native XML Database
* Copyright (C) 2001-04 The eXist Project
* http://exist-db.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id$
*/
package org.exist.storage.index;
import java.nio.ByteBuffer;
import org.exist.storage.DBBroker;
import org.exist.storage.journal.LogException;
import org.exist.storage.txn.Txn;
/**
* @author wolf
*
*/
public class RemoveValueLoggable extends AbstractBFileLoggable {
protected long page;
protected short tid;
protected byte[] oldData;
protected int offset = 0;
protected int len;
/**
*
*
* @param page
* @param tid
* @param oldData
* @param offset
* @param len
* @param fileId
* @param transaction
*/
public RemoveValueLoggable(Txn transaction, byte fileId, long page, short tid, byte[] oldData, int offset, int len) {
super(BFile.LOG_REMOVE_VALUE, fileId, transaction);
this.page = page;
this.tid = tid;
this.oldData = oldData;
this.offset = offset;
this.len = len;
}
/**
* @param broker
* @param transactionId
*/
public RemoveValueLoggable(DBBroker broker, long transactionId) {
super(broker, transactionId);
}
public void write(ByteBuffer out) {
super.write(out);
out.putInt((int) page);
out.putShort(tid);
out.putShort((short) len);
out.put(oldData, offset, len);
}
public void read(ByteBuffer in) {
super.read(in);
page = in.getInt();
tid = in.getShort();
len = in.getShort();
oldData = new byte[len];
in.get(oldData);
}
public int getLogSize() {
return super.getLogSize() + len + 8;
}
public void redo() throws LogException {
getIndexFile().redoRemoveValue(this);
}
public void undo() throws LogException {
getIndexFile().undoRemoveValue(this);
}
public String dump() {
return super.dump() + " - remove value with tid " + tid + " from page " + page;
}
}
|
Java
|
/*
-- MAGMA (version 2.1.0) --
Univ. of Tennessee, Knoxville
Univ. of California, Berkeley
Univ. of Colorado, Denver
@date August 2016
@generated from sparse-iter/control/magma_zutil_sparse.cpp, normal z -> s, Tue Aug 30 09:38:47 2016
@author Hartwig Anzt
Utilities for testing MAGMA-sparse.
*/
#include <cuda_runtime_api.h>
#include "magmasparse_internal.h"
#define PRECISION_s
// --------------------
static const char *usage_sparse_short =
"%% Usage: %s [options] [-h|--help] matrices\n\n";
static const char *usage_sparse =
"Options are:\n"
" --solver Possibility to choose a solver:\n"
" CG, PCG, BICGSTAB, PBICGSTAB, GMRES, PGMRES, LOBPCG, JACOBI,\n"
" BAITER, IDR, PIDR, CGS, PCGS, TFQMR, PTFQMR, QMR, PQMR, BICG,\n"
" PBICG, BOMBARDMENT, ITERREF.\n"
" --basic Use non-optimized version\n"
" --ev x For eigensolvers, set number of eigenvalues/eigenvectors to compute.\n"
" --restart For GMRES: possibility to choose the restart.\n"
" For IDR: Number of distinct subspaces (1,2,4,8).\n"
" --atol x Set an absolute residual stopping criterion.\n"
" --verbose x Possibility to print intermediate residuals every x iteration.\n"
" --maxiter x Set an upper limit for the iteration count.\n"
" --rtol x Set a relative residual stopping criterion.\n"
" --format Possibility to choose a format for the sparse matrix:\n"
" CSR, ELL, SELLP, CUSPARSECSR\n"
" --blocksize x Set a specific blocksize for SELL-P format.\n"
" --alignment x Set a specific alignment for SELL-P format.\n"
" --mscale Possibility to scale the original matrix:\n"
" NOSCALE no scaling\n"
" UNITDIAG symmetric scaling to unit diagonal\n"
" --precond x Possibility to choose a preconditioner:\n"
" CG, BICGSTAB, GMRES, LOBPCG, JACOBI,\n"
" BAITER, IDR, CGS, TFQMR, QMR, BICG\n"
" BOMBARDMENT, ITERREF, ILU, PARILU, PARILUT, NONE.\n"
" --patol atol Absolute residual stopping criterion for preconditioner.\n"
" --prtol rtol Relative residual stopping criterion for preconditioner.\n"
" --piters k Iteration count for iterative preconditioner.\n"
" --plevels k Number of ILU levels.\n"
" --triolver k Solver for triangular ILU factors: e.g. CUSOLVE, JACOBI, ISAI.\n"
" --ppattern k Pattern used for ISAI preconditioner.\n"
" --psweeps x Number of iterative ParILU sweeps.\n"
" --trisolver Possibility to choose a triangular solver for ILU preconditioning: e.g. JACOBI, ISAI.\n"
" --ppattern k Possibility to choose a pattern for the trisolver: ISAI(k) or Block Jacobi.\n"
" --piters k Number of preconditioner relaxation steps, e.g. for ISAI or (Block) Jacobi trisolver.\n"
" --patol x Set an absolute residual stopping criterion for the preconditioner.\n"
" Corresponds to the relative fill-in in PARILUT.\n"
" --prtol x Set a relative residual stopping criterion for the preconditioner.\n"
" Corresponds to the replacement ratio in PARILUT.\n";
/**
Purpose
-------
Parses input options for a solver
Arguments
---------
@param[in]
argc int
command line input
@param[in]
argv char**
command line input
@param[in,out]
opts magma_sopts *
magma solver options
@param[out]
matrices int
counter how many linear systems to process
@param[in]
queue magma_queue_t
Queue to execute in.
@ingroup magmasparse_saux
********************************************************************/
extern "C"
magma_int_t
magma_sparse_opts(
int argc,
char** argv,
magma_sopts *opts,
int *matrices,
magma_queue_t queue )
{
magma_int_t info = MAGMA_SUCCESS;
// fill in default values
opts->input_format = Magma_CSR;
opts->blocksize = 32;
opts->alignment = 1;
opts->output_format = Magma_CSR;
opts->input_location = Magma_CPU;
opts->output_location = Magma_CPU;
opts->scaling = Magma_NOSCALE;
#if defined(PRECISION_z) | defined(PRECISION_d)
opts->solver_par.atol = 1e-16;
opts->solver_par.rtol = 1e-10;
#else
opts->solver_par.atol = 1e-8;
opts->solver_par.rtol = 1e-5;
#endif
opts->solver_par.maxiter = 1000;
opts->solver_par.verbose = 0;
opts->solver_par.version = 0;
opts->solver_par.restart = 50;
opts->solver_par.num_eigenvalues = 0;
opts->precond_par.solver = Magma_NONE;
opts->precond_par.trisolver = Magma_CUSOLVE;
#if defined(PRECISION_z) | defined(PRECISION_d)
opts->precond_par.atol = 1e-16;
opts->precond_par.rtol = 1e-10;
#else
opts->precond_par.atol = 0;
opts->precond_par.rtol = 1e-5;
#endif
opts->precond_par.maxiter = 100;
opts->precond_par.restart = 10;
opts->precond_par.levels = 0;
opts->precond_par.sweeps = 5;
opts->precond_par.maxiter = 1;
opts->precond_par.pattern = 1;
opts->solver_par.solver = Magma_CGMERGE;
printf( usage_sparse_short, argv[0] );
int ndevices;
cudaGetDeviceCount( &ndevices );
int basic = 0;
for( int i = 1; i < argc; ++i ) {
if ( strcmp("--format", argv[i]) == 0 && i+1 < argc ) {
i++;
if ( strcmp("CSR", argv[i]) == 0 ) {
opts->output_format = Magma_CSR;
} else if ( strcmp("ELL", argv[i]) == 0 ) {
opts->output_format = Magma_ELL;
} else if ( strcmp("SELLP", argv[i]) == 0 ) {
opts->output_format = Magma_SELLP;
} else if ( strcmp("CUSPARSECSR", argv[i]) == 0 ) {
opts->output_format = Magma_CUCSR;
} else {
printf( "%%error: invalid format, use default (CSR).\n" );
}
} else if ( strcmp("--mscale", argv[i]) == 0 && i+1 < argc ) {
i++;
if ( strcmp("NOSCALE", argv[i]) == 0 ) {
opts->scaling = Magma_NOSCALE;
}
else if ( strcmp("UNITDIAG", argv[i]) == 0 ) {
opts->scaling = Magma_UNITDIAG;
}
else if ( strcmp("UNITROW", argv[i]) == 0 ) {
opts->scaling = Magma_UNITROW;
}
else {
printf( "%%error: invalid scaling, use default.\n" );
}
} else if ( strcmp("--solver", argv[i]) == 0 && i+1 < argc ) {
i++;
if ( strcmp("CG", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_CGMERGE;
}
else if ( strcmp("PCG", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_PCGMERGE;
}
else if ( strcmp("BICG", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_BICG;
}
else if ( strcmp("PBICG", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_PBICG;
}
else if ( strcmp("BICGSTAB", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_BICGSTABMERGE;
}
else if ( strcmp("PBICGSTAB", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_PBICGSTABMERGE;
}
else if ( strcmp("QMR", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_QMRMERGE;
}
else if ( strcmp("PQMR", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_PQMRMERGE;
}
else if ( strcmp("TFQMR", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_TFQMRMERGE;
}
else if ( strcmp("PTFQMR", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_PTFQMRMERGE;
}
else if ( strcmp("GMRES", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_GMRES;
}
else if ( strcmp("PGMRES", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_PGMRES;
}
else if ( strcmp("LOBPCG", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_LOBPCG;
}
else if ( strcmp("LSQR", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_LSQR;
}
else if ( strcmp("JACOBI", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_JACOBI;
}
else if ( strcmp("BA", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_BAITER;
}
else if ( strcmp("BAO", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_BAITERO;
}
else if ( strcmp("IDR", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_IDRMERGE;
}
else if ( strcmp("PIDR", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_PIDRMERGE;
}
else if ( strcmp("CGS", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_CGSMERGE;
}
else if ( strcmp("PCGS", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_PCGSMERGE;
}
else if ( strcmp("BOMBARDMENT", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_BOMBARDMERGE;
}
else if ( strcmp("ITERREF", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_ITERREF;
}
else {
printf( "%%error: invalid solver.\n" );
}
} else if ( strcmp("--restart", argv[i]) == 0 && i+1 < argc ) {
opts->solver_par.restart = atoi( argv[++i] );
} else if ( strcmp("--precond", argv[i]) == 0 && i+1 < argc ) {
i++;
if ( strcmp("CG", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_CGMERGE;
}
else if ( strcmp("PCG", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_PCG;
}
else if ( strcmp("BICGSTAB", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_BICGSTABMERGE;
}
else if ( strcmp("QMR", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_QMRMERGE;
}
else if ( strcmp("TFQMR", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_TFQMRMERGE;
}
else if ( strcmp("PTFQMR", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_PTFQMRMERGE;
}
else if ( strcmp("GMRES", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_GMRES;
}
else if ( strcmp("PGMRES", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_PGMRES;
}
else if ( strcmp("LOBPCG", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_LOBPCG;
}
else if ( strcmp("JACOBI", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_JACOBI;
}
else if ( strcmp("BA", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_BAITER;
}
else if ( strcmp("BAO", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_BAITERO;
}
else if ( strcmp("IDR", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_IDRMERGE;
}
else if ( strcmp("PIDR", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_PIDRMERGE;
}
else if ( strcmp("CGS", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_CGSMERGE;
}
else if ( strcmp("PCGS", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_PCGSMERGE;
}
else if ( strcmp("BOMBARDMENT", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_BOMBARD;
}
else if ( strcmp("ITERREF", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_ITERREF;
}
else if ( strcmp("ILU", argv[i]) == 0 || strcmp("IC", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_ILU;
}
else if ( strcmp("PARILU", argv[i]) == 0 || strcmp("AIC", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_PARILU;
}
else if ( strcmp("PARICT", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_PARICT;
}
else if ( strcmp("PARILUT", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_PARILUT;
}
else if ( strcmp("CUSTOMIC", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_CUSTOMIC;
}
else if ( strcmp("CUSTOMILU", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_CUSTOMILU;
}
else if ( strcmp("ISAI", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_ISAI;
}
else if ( strcmp("NONE", argv[i]) == 0 ) {
opts->precond_par.solver = Magma_NONE;
}
else {
printf( "%%error: invalid preconditioner.\n" );
}
} else if ( strcmp("--trisolver", argv[i]) == 0 && i+1 < argc ) {
i++;
if ( strcmp("CG", argv[i]) == 0 ) {
opts->precond_par.trisolver = Magma_CGMERGE;
}
else if ( strcmp("BICGSTAB", argv[i]) == 0 ) {
opts->precond_par.trisolver = Magma_BICGSTABMERGE;
}
else if ( strcmp("QMR", argv[i]) == 0 ) {
opts->precond_par.trisolver = Magma_QMRMERGE;
}
else if ( strcmp("TFQMR", argv[i]) == 0 ) {
opts->precond_par.trisolver = Magma_TFQMRMERGE;
}
else if ( strcmp("GMRES", argv[i]) == 0 ) {
opts->precond_par.trisolver = Magma_GMRES;
}
else if ( strcmp("JACOBI", argv[i]) == 0 ) {
opts->precond_par.trisolver = Magma_JACOBI;
}
else if ( strcmp("BA", argv[i]) == 0 ) {
opts->precond_par.trisolver = Magma_BAITER;
}
else if ( strcmp("BAO", argv[i]) == 0 ) {
opts->precond_par.trisolver = Magma_BAITERO;
}
else if ( strcmp("IDR", argv[i]) == 0 ) {
opts->precond_par.trisolver = Magma_IDRMERGE;
}
else if ( strcmp("CGS", argv[i]) == 0 ) {
opts->precond_par.trisolver = Magma_CGSMERGE;
}
else if ( strcmp("CUSOLVE", argv[i]) == 0 ) {
opts->precond_par.trisolver = Magma_CUSOLVE;
}
else if ( strcmp("ISAI", argv[i]) == 0 ) {
opts->precond_par.trisolver = Magma_ISAI;
}
else if ( strcmp("NONE", argv[i]) == 0 ) {
opts->precond_par.trisolver = Magma_NONE;
}
else {
printf( "%%error: invalid trisolver.\n" );
}
} else if ( strcmp("--basic", argv[i]) == 0 && i+1 < argc ) {
basic = 1;
} else if ( strcmp("--prestart", argv[i]) == 0 && i+1 < argc ) {
opts->precond_par.restart = atoi( argv[++i] );
} else if ( strcmp("--patol", argv[i]) == 0 && i+1 < argc ) {
sscanf( argv[++i], "%f", &opts->precond_par.atol );
}else if ( strcmp("--prtol", argv[i]) == 0 && i+1 < argc ) {
sscanf( argv[++i], "%f", &opts->precond_par.rtol );
} else if ( strcmp("--piters", argv[i]) == 0 && i+1 < argc ) {
opts->precond_par.maxiter = atoi( argv[++i] );
} else if ( strcmp("--ppattern", argv[i]) == 0 && i+1 < argc ) {
opts->precond_par.pattern = atoi( argv[++i] );
} else if ( strcmp("--psweeps", argv[i]) == 0 && i+1 < argc ) {
opts->precond_par.sweeps = atoi( argv[++i] );
} else if ( strcmp("--plevels", argv[i]) == 0 && i+1 < argc ) {
opts->precond_par.levels = atoi( argv[++i] );
} else if ( strcmp("--blocksize", argv[i]) == 0 && i+1 < argc ) {
opts->blocksize = atoi( argv[++i] );
} else if ( strcmp("--alignment", argv[i]) == 0 && i+1 < argc ) {
opts->alignment = atoi( argv[++i] );
} else if ( strcmp("--verbose", argv[i]) == 0 && i+1 < argc ) {
opts->solver_par.verbose = atoi( argv[++i] );
} else if ( strcmp("--maxiter", argv[i]) == 0 && i+1 < argc ) {
opts->solver_par.maxiter = atoi( argv[++i] );
} else if ( strcmp("--atol", argv[i]) == 0 && i+1 < argc ) {
sscanf( argv[++i], "%f", &opts->solver_par.atol );
} else if ( strcmp("--rtol", argv[i]) == 0 && i+1 < argc ) {
sscanf( argv[++i], "%f", &opts->solver_par.rtol );
} else if ( strcmp("--ev", argv[i]) == 0 && i+1 < argc ) {
opts->solver_par.num_eigenvalues = atoi( argv[++i] );
} else if ( strcmp("--version", argv[i]) == 0 && i+1 < argc ) {
opts->solver_par.version = atoi( argv[++i] );
}
// ----- usage
else if ( strcmp("-h", argv[i]) == 0 ||
strcmp("--help", argv[i]) == 0 ) {
fprintf( stderr, usage_sparse, argv[0] );
} else {
*matrices = i;
break;
}
}
if( basic == 1 ){
if ( opts->solver_par.solver == Magma_CGMERGE ) {
opts->solver_par.solver = Magma_CG;
}
else if ( opts->solver_par.solver == Magma_PCGMERGE) {
opts->solver_par.solver = Magma_PCG;
}
else if ( opts->solver_par.solver == Magma_BICGSTABMERGE ) {
opts->solver_par.solver = Magma_BICGSTAB;
}
else if ( opts->solver_par.solver == Magma_PBICGSTAB ) {
opts->solver_par.solver = Magma_PBICGSTAB;
}
else if ( opts->solver_par.solver == Magma_TFQMRMERGE ) {
opts->solver_par.solver = Magma_TFQMR;
}
else if ( opts->solver_par.solver == Magma_PTFQMRMERGE) {
opts->solver_par.solver = Magma_PTFQMR;
}
else if ( opts->solver_par.solver == Magma_CGSMERGE ) {
opts->solver_par.solver = Magma_CGS;
}
else if ( opts->solver_par.solver == Magma_PCGSMERGE) {
opts->solver_par.solver = Magma_PCGS;
}
else if ( opts->solver_par.solver == Magma_QMRMERGE ) {
opts->solver_par.solver = Magma_QMR;
}
else if ( opts->solver_par.solver == Magma_PQMRMERGE) {
opts->solver_par.solver = Magma_PQMR;
}
else if ( opts->solver_par.solver == Magma_QMRMERGE ) {
opts->solver_par.solver = Magma_QMR;
}
else if ( opts->solver_par.solver == Magma_PCGMERGE) {
opts->solver_par.solver = Magma_PCG;
}
else if ( opts->solver_par.solver == Magma_IDRMERGE) {
opts->solver_par.solver = Magma_IDR;
}
else if ( opts->solver_par.solver == Magma_PIDRMERGE) {
opts->solver_par.solver = Magma_PIDR;
}
else if ( opts->solver_par.solver == Magma_BOMBARDMERGE) {
opts->solver_par.solver = Magma_BOMBARD;
}
}
// make sure preconditioner is NONE for unpreconditioned systems
if ( opts->solver_par.solver != Magma_PCG &&
opts->solver_par.solver != Magma_PCGMERGE &&
opts->solver_par.solver != Magma_PGMRES &&
opts->solver_par.solver != Magma_PBICGSTAB &&
opts->solver_par.solver != Magma_PBICGSTABMERGE &&
opts->solver_par.solver != Magma_ITERREF &&
opts->solver_par.solver != Magma_PIDR &&
opts->solver_par.solver != Magma_PIDRMERGE &&
opts->solver_par.solver != Magma_PCGS &&
opts->solver_par.solver != Magma_PCGSMERGE &&
opts->solver_par.solver != Magma_PTFQMR &&
opts->solver_par.solver != Magma_PQMRMERGE &&
opts->solver_par.solver != Magma_PTFQMRMERGE &&
opts->solver_par.solver != Magma_PQMR &&
opts->solver_par.solver != Magma_PBICG &&
opts->solver_par.solver != Magma_LSQR &&
opts->solver_par.solver != Magma_LOBPCG ){
opts->precond_par.solver = Magma_NONE;
}
// ensure to take a symmetric preconditioner for the PCG
if ( ( opts->solver_par.solver == Magma_PCG || opts->solver_par.solver == Magma_PCGMERGE )
&& opts->precond_par.solver == Magma_ILU )
opts->precond_par.solver = Magma_ICC;
if ( ( opts->solver_par.solver == Magma_PCG || opts->solver_par.solver == Magma_PCGMERGE )
&& opts->precond_par.solver == Magma_PARILU )
opts->precond_par.solver = Magma_PARIC;
return info;
}
|
Java
|
#!/usr/bin/env perl
use strict;
use warnings;
use LWP::UserAgent;
use JSON::PP;
my $base = "http://gameai.skullspace.ca/api/";
sub failure {
print("!! " . shift(@_) . "\n");
exit(1);
}
sub info {
print("** " . shift(@_) . "\n");
}
sub parse_card {
my $abbr = shift(@_);
my %card = ("abbr" => $abbr);
my $suit = substr($abbr, 0, 1);
if ($suit eq "C") {
$card{"suit"} = "CLUBS";
}
elsif ($suit eq "D") {
$card{"suit"} = "DIAMONDS";
}
elsif ($suit eq "H") {
$card{"suit"} = "HEARTS";
}
else {
$card{"suit"} = "SPADES";
}
$card{"value"} = int(substr($abbr, 1, 2));
return %card;
}
sub rawapi {
my $method = shift(@_);
my (%params) = @_;
# Collect parameters into a JSON object.
my $json = JSON::PP->new;
my $json_params = $json->encode(\%params);
# Create the URL of the endpoint.
my $url = $base . $method . "/";
# Create a new HTTP request to the endpoint.
my $req = HTTP::Request->new(POST => $url);
# Set up the HTTP request's properties.
$req->header("Content-type" => "application/json");
# Set the HTTP request's body.
$req->content($json_params);
# Send the HTTP request.
my $con = LWP::UserAgent->new;
my $res = $con->request($req);
# Check for errors.
if (!$res->is_success) {
failure("An unknown error occurred during the API call.");
}
# Read the HTTP response code.
if ($res->code != 200) {
failure("The server responded with a status code other than 200.");
}
# Read the HTTP response body.
return $json->decode($res->decoded_content);
}
sub api {
my $method = shift(@_);
my (%params) = @_;
my $json = rawapi($method, %params);
if ($json->{"result"} eq "failure") {
failure($json->{"reason"});
}
return $json;
}
sub main {
my (@argv) = @_;
# Ensure we've been given a name and a password.
my $name;
my $pass;
if (@argv != 2) {
print("Enter your bot's name: ");
$name = <STDIN>;
chomp($name);
print("Enter your bot's password: ");
$pass = <STDIN>;
chomp($pass);
}
else {
$name = $argv[0];
$pass = $argv[1];
}
# Register the name, which will have no effect if you've already done it.
rawapi("register", ("name" => $name, "password" => $pass));
# Login with the name and password.
info("Logging in to the server...");
my $json = api("login", ("name" => $name, "password" => $pass));
info("Logged in.");
# Store the session from the login for future use.
my $session = $json->{"session"};
info("Received session '$session'.");
while (1) {
# Ask to be given an opponent to play against.
info("Attempting to start a new game...");
$json = api("new-game", ("session" => $session));
# If there's nobody to play against, start the loop from the top after
# waiting 5 seconds.
if ($json->{"result"} eq "retry") {
print("?? " . $json->{"reason"} . "\n");
sleep(5);
next;
}
# Create an object to represent the cards we have been dealt.
my @cards = @{$json->{"cards"}};
info("We have started a new game, and have been dealt: " . join(", ", @cards) . ".");
# Run the game AI.
new_game($session, @cards);
# Cleanup from our game.
info("Our role in this game is over, but we need to be sure the server has ended the game before we start a new one.");
info("If we try to start a new game without the old one being done, the server will reject our request.");
while (1) {
info("Waiting for our game to be over...");
$json = api("status", ("session" => $session));
if (!defined $json->{"game"}) {
last;
}
sleep(1);
}
info("The server has ended our game.");
}
}
sub new_game {
my $session = shift(@_);
my @hand = @_;
# Make a bid, which we'll do randomly, by choosing a number between 1 and
# 13.
my $bid = int(1 + rand(13));
# Register our bid with the server.
info("Attempting to bid " . $bid . ".");
api("bid", ("session" => $session, "bid" => $bid));
info("Our bid has been accepted.");
# Check the status repeatedly, and if it's our turn play a card, until all
# cards have been played and the game ends.
while (@hand) {
# Always wait 1 second, it may not seem like much but it helps avoid
# pinning the client's CPU and flooding the server.
sleep(1);
# Request the game's status from the server.
info("Requesting the status of our game...");
my $json = api("status", ("session" => $session));
info("Status received.");
# If the game has ended prematurely, due to a forfeit from your opponent
# or some other reason, rejoice and find a new opponent.
if (!defined $json->{"game"}) {
info("Our game appears to have ended.");
return;
}
# If we're still in the bidding process, it's nobody's turn.
if (!defined $json->{"your-turn"}) {
info("Our game is still in the bidding phase, we need to wait for our opponent.");
next;
}
# If not it's not our turn yet, jump back to the top of the loop to
# check the status again.
if (not $json->{"your-turn"}) {
info("It is currently our opponent's turn, we need to wait for our opponent.");
next;
}
# Finally, it's our turn. First, we have to determine if another card
# was played first in this round. If so, it restricts our choices.
my @allowed_cards;
if (!defined $json->{"opponent-current-card"}) {
# We can play any card we want, since we're going first in this
# round. So all the cards in our hand are allowed.
@allowed_cards = @hand;
info("We have the lead this round, so we may choose any card.");
}
else {
# We can only play cards that match the suit of the lead card, since
# we're going second in this round. Gather together all the cards in
# our hand that have the appropriate suit.
@allowed_cards = ();
my %lead_card = parse_card($json->{"opponent-current-card"});
info("Our opponent has lead this round, so we must try to play a card that matches the lead card's suit: " . $lead_card{"suit"} . ".");
foreach my $card (@hand) {
my %card = parse_card($card);
if ($card{"suit"} eq $lead_card{"suit"}) {
push(@allowed_cards, $card{"abbr"});
}
}
# Check if we actually found any cards in our hand with the
# appropriate suit. If we don't have any, there are no restrictions
# on the card we can then play.
if (!@allowed_cards) {
info("We have no " . $lead_card{"suit"} . " in our hand, so we can play any suit we choose.");
@allowed_cards = @hand;
}
}
# Among the cards that we have determined are valid, according to the
# rules, choose one to play at random.
my $idx = int(rand(@allowed_cards));
my $card = $allowed_cards[$idx];
info("We have randomly chosen " . $card . ".");
# Now that the card has been chosen, play it.
info("Attempting to play " . $card . "...");
api("play", ("session" => $session, "card" => $card));
info("Card has been played.");
# Remove the card from our hand.
my @new_hand = ();
foreach my $card_in_hand (@hand) {
if ($card_in_hand ne $card) {
push(@new_hand, $card_in_hand);
}
}
@hand = @new_hand;
}
}
main(@ARGV);
|
Java
|
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>statsmodels.robust.robust_linear_model.RLMResults.pvalues — statsmodels v0.10.2 documentation</title>
<link rel="stylesheet" href="../_static/nature.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/language_data.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="shortcut icon" href="../_static/statsmodels_hybi_favico.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="statsmodels.robust.robust_linear_model.RLMResults.remove_data" href="statsmodels.robust.robust_linear_model.RLMResults.remove_data.html" />
<link rel="prev" title="statsmodels.robust.robust_linear_model.RLMResults.predict" href="statsmodels.robust.robust_linear_model.RLMResults.predict.html" />
<link rel="stylesheet" href="../_static/examples.css" type="text/css" />
<link rel="stylesheet" href="../_static/facebox.css" type="text/css" />
<script type="text/javascript" src="../_static/scripts.js">
</script>
<script type="text/javascript" src="../_static/facebox.js">
</script>
<script type="text/javascript">
$.facebox.settings.closeImage = "../_static/closelabel.png"
$.facebox.settings.loadingImage = "../_static/loading.gif"
</script>
<script>
$(document).ready(function() {
$.getJSON("../../versions.json", function(versions) {
var dropdown = document.createElement("div");
dropdown.className = "dropdown";
var button = document.createElement("button");
button.className = "dropbtn";
button.innerHTML = "Other Versions";
var content = document.createElement("div");
content.className = "dropdown-content";
dropdown.appendChild(button);
dropdown.appendChild(content);
$(".header").prepend(dropdown);
for (var i = 0; i < versions.length; i++) {
if (versions[i].substring(0, 1) == "v") {
versions[i] = [versions[i], versions[i].substring(1)];
} else {
versions[i] = [versions[i], versions[i]];
};
};
for (var i = 0; i < versions.length; i++) {
var a = document.createElement("a");
a.innerHTML = versions[i][1];
a.href = "../../" + versions[i][0] + "/index.html";
a.title = versions[i][1];
$(".dropdown-content").append(a);
};
});
});
</script>
</head><body>
<div class="headerwrap">
<div class = "header">
<a href = "../index.html">
<img src="../_static/statsmodels_hybi_banner.png" alt="Logo"
style="padding-left: 15px"/></a>
</div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="statsmodels.robust.robust_linear_model.RLMResults.remove_data.html" title="statsmodels.robust.robust_linear_model.RLMResults.remove_data"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="statsmodels.robust.robust_linear_model.RLMResults.predict.html" title="statsmodels.robust.robust_linear_model.RLMResults.predict"
accesskey="P">previous</a> |</li>
<li><a href ="../install.html">Install</a></li> |
<li><a href="https://groups.google.com/forum/?hl=en#!forum/pystatsmodels">Support</a></li> |
<li><a href="https://github.com/statsmodels/statsmodels/issues">Bugs</a></li> |
<li><a href="../dev/index.html">Develop</a></li> |
<li><a href="../examples/index.html">Examples</a></li> |
<li><a href="../faq.html">FAQ</a></li> |
<li class="nav-item nav-item-1"><a href="../rlm.html" >Robust Linear Models</a> |</li>
<li class="nav-item nav-item-2"><a href="statsmodels.robust.robust_linear_model.RLMResults.html" accesskey="U">statsmodels.robust.robust_linear_model.RLMResults</a> |</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="statsmodels-robust-robust-linear-model-rlmresults-pvalues">
<h1>statsmodels.robust.robust_linear_model.RLMResults.pvalues<a class="headerlink" href="#statsmodels-robust-robust-linear-model-rlmresults-pvalues" title="Permalink to this headline">¶</a></h1>
<p>method</p>
<dl class="method">
<dt id="statsmodels.robust.robust_linear_model.RLMResults.pvalues">
<code class="sig-prename descclassname">RLMResults.</code><code class="sig-name descname">pvalues</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/statsmodels/robust/robust_linear_model.html#RLMResults.pvalues"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#statsmodels.robust.robust_linear_model.RLMResults.pvalues" title="Permalink to this definition">¶</a></dt>
<dd><p>The two-tailed p values for the t-stats of the params.</p>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="statsmodels.robust.robust_linear_model.RLMResults.predict.html"
title="previous chapter">statsmodels.robust.robust_linear_model.RLMResults.predict</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="statsmodels.robust.robust_linear_model.RLMResults.remove_data.html"
title="next chapter">statsmodels.robust.robust_linear_model.RLMResults.remove_data</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/generated/statsmodels.robust.robust_linear_model.RLMResults.pvalues.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer" role="contentinfo">
© Copyright 2009-2018, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.1.
</div>
</body>
</html>
|
Java
|
// $Id$
//
// Copyright (C) 2007-2013 Greg Landrum
//
// @@ All Rights Reserved @@
// This file is part of the RDKit.
// The contents are covered by the terms of the BSD license
// which is included in the file license.txt, found at the root
// of the RDKit source tree.
//
#include <GraphMol/RDKitBase.h>
#include <GraphMol/Fingerprints/AtomPairs.h>
#include <GraphMol/Subgraphs/Subgraphs.h>
#include <DataStructs/SparseIntVect.h>
#include <RDGeneral/hash/hash.hpp>
#include <boost/cstdint.hpp>
#include <boost/dynamic_bitset.hpp>
#include <boost/foreach.hpp>
namespace RDKit {
namespace AtomPairs {
unsigned int numPiElectrons(const Atom *atom) {
PRECONDITION(atom, "no atom");
unsigned int res = 0;
if (atom->getIsAromatic()) {
res = 1;
} else if (atom->getHybridization() != Atom::SP3) {
unsigned int val = static_cast<unsigned int>(atom->getExplicitValence());
val -= atom->getNumExplicitHs();
CHECK_INVARIANT(val >= atom->getDegree(),
"explicit valence exceeds atom degree");
res = val - atom->getDegree();
}
return res;
}
boost::uint32_t getAtomCode(const Atom *atom, unsigned int branchSubtract,
bool includeChirality) {
PRECONDITION(atom, "no atom");
boost::uint32_t code;
unsigned int numBranches = 0;
if (atom->getDegree() > branchSubtract) {
numBranches = atom->getDegree() - branchSubtract;
}
code = numBranches % maxNumBranches;
unsigned int nPi = numPiElectrons(atom) % maxNumPi;
code |= nPi << numBranchBits;
unsigned int typeIdx = 0;
unsigned int nTypes = 1 << numTypeBits;
while (typeIdx < nTypes) {
if (atomNumberTypes[typeIdx] ==
static_cast<unsigned int>(atom->getAtomicNum())) {
break;
} else if (atomNumberTypes[typeIdx] >
static_cast<unsigned int>(atom->getAtomicNum())) {
typeIdx = nTypes;
break;
}
++typeIdx;
}
if (typeIdx == nTypes) --typeIdx;
code |= typeIdx << (numBranchBits + numPiBits);
if (includeChirality) {
std::string cipCode;
if (atom->getPropIfPresent(common_properties::_CIPCode, cipCode)) {
boost::uint32_t offset = numBranchBits + numPiBits + numTypeBits;
if (cipCode == "R") {
code |= 1 << offset;
} else if (cipCode == "S") {
code |= 2 << offset;
}
}
}
POSTCONDITION(code < (1 << (codeSize + (includeChirality ? 2 : 0))),
"code exceeds number of bits");
return code;
};
boost::uint32_t getAtomPairCode(boost::uint32_t codeI, boost::uint32_t codeJ,
unsigned int dist, bool includeChirality) {
PRECONDITION(dist < maxPathLen, "dist too long");
boost::uint32_t res = dist;
res |= std::min(codeI, codeJ) << numPathBits;
res |= std::max(codeI, codeJ)
<< (numPathBits + codeSize + (includeChirality ? numChiralBits : 0));
return res;
}
template <typename T1, typename T2>
void updateElement(SparseIntVect<T1> &v, T2 elem) {
v.setVal(elem, v.getVal(elem) + 1);
}
template <typename T1>
void updateElement(ExplicitBitVect &v, T1 elem) {
v.setBit(elem % v.getNumBits());
}
template <typename T>
void setAtomPairBit(boost::uint32_t i, boost::uint32_t j,
boost::uint32_t nAtoms,
const std::vector<boost::uint32_t> &atomCodes,
const double *dm, T *bv, unsigned int minLength,
unsigned int maxLength, bool includeChirality) {
unsigned int dist = static_cast<unsigned int>(floor(dm[i * nAtoms + j]));
if (dist >= minLength && dist <= maxLength) {
boost::uint32_t bitId =
getAtomPairCode(atomCodes[i], atomCodes[j], dist, includeChirality);
updateElement(*bv, static_cast<boost::uint32_t>(bitId));
}
}
SparseIntVect<boost::int32_t> *getAtomPairFingerprint(
const ROMol &mol, const std::vector<boost::uint32_t> *fromAtoms,
const std::vector<boost::uint32_t> *ignoreAtoms,
const std::vector<boost::uint32_t> *atomInvariants, bool includeChirality,
bool use2D, int confId) {
return getAtomPairFingerprint(mol, 1, maxPathLen - 1, fromAtoms, ignoreAtoms,
atomInvariants, includeChirality, use2D,
confId);
};
SparseIntVect<boost::int32_t> *getAtomPairFingerprint(
const ROMol &mol, unsigned int minLength, unsigned int maxLength,
const std::vector<boost::uint32_t> *fromAtoms,
const std::vector<boost::uint32_t> *ignoreAtoms,
const std::vector<boost::uint32_t> *atomInvariants, bool includeChirality,
bool use2D, int confId) {
PRECONDITION(minLength <= maxLength, "bad lengths provided");
PRECONDITION(!atomInvariants || atomInvariants->size() >= mol.getNumAtoms(),
"bad atomInvariants size");
SparseIntVect<boost::int32_t> *res = new SparseIntVect<boost::int32_t>(
1 << (numAtomPairFingerprintBits + 2 * (includeChirality ? 2 : 0)));
const double *dm;
if (use2D) {
dm = MolOps::getDistanceMat(mol);
} else {
dm = MolOps::get3DDistanceMat(mol, confId);
}
const unsigned int nAtoms = mol.getNumAtoms();
std::vector<boost::uint32_t> atomCodes;
for (ROMol::ConstAtomIterator atomItI = mol.beginAtoms();
atomItI != mol.endAtoms(); ++atomItI) {
if (!atomInvariants) {
atomCodes.push_back(getAtomCode(*atomItI, 0, includeChirality));
} else {
atomCodes.push_back((*atomInvariants)[(*atomItI)->getIdx()] %
((1 << codeSize) - 1));
}
}
for (ROMol::ConstAtomIterator atomItI = mol.beginAtoms();
atomItI != mol.endAtoms(); ++atomItI) {
unsigned int i = (*atomItI)->getIdx();
if (ignoreAtoms &&
std::find(ignoreAtoms->begin(), ignoreAtoms->end(), i) !=
ignoreAtoms->end()) {
continue;
}
if (!fromAtoms) {
for (ROMol::ConstAtomIterator atomItJ = atomItI + 1;
atomItJ != mol.endAtoms(); ++atomItJ) {
unsigned int j = (*atomItJ)->getIdx();
if (ignoreAtoms &&
std::find(ignoreAtoms->begin(), ignoreAtoms->end(), j) !=
ignoreAtoms->end()) {
continue;
}
setAtomPairBit(i, j, nAtoms, atomCodes, dm, res, minLength, maxLength,
includeChirality);
}
} else {
BOOST_FOREACH (boost::uint32_t j, *fromAtoms) {
if (j != i) {
if (ignoreAtoms &&
std::find(ignoreAtoms->begin(), ignoreAtoms->end(), j) !=
ignoreAtoms->end()) {
continue;
}
setAtomPairBit(i, j, nAtoms, atomCodes, dm, res, minLength, maxLength,
includeChirality);
}
}
}
}
return res;
}
SparseIntVect<boost::int32_t> *getHashedAtomPairFingerprint(
const ROMol &mol, unsigned int nBits, unsigned int minLength,
unsigned int maxLength, const std::vector<boost::uint32_t> *fromAtoms,
const std::vector<boost::uint32_t> *ignoreAtoms,
const std::vector<boost::uint32_t> *atomInvariants, bool includeChirality,
bool use2D, int confId) {
PRECONDITION(minLength <= maxLength, "bad lengths provided");
PRECONDITION(!atomInvariants || atomInvariants->size() >= mol.getNumAtoms(),
"bad atomInvariants size");
SparseIntVect<boost::int32_t> *res = new SparseIntVect<boost::int32_t>(nBits);
const double *dm;
if (use2D) {
dm = MolOps::getDistanceMat(mol);
} else {
dm = MolOps::get3DDistanceMat(mol, confId);
}
const unsigned int nAtoms = mol.getNumAtoms();
std::vector<boost::uint32_t> atomCodes;
atomCodes.reserve(nAtoms);
for (ROMol::ConstAtomIterator atomItI = mol.beginAtoms();
atomItI != mol.endAtoms(); ++atomItI) {
if (!atomInvariants) {
atomCodes.push_back(getAtomCode(*atomItI, 0, includeChirality));
} else {
atomCodes.push_back((*atomInvariants)[(*atomItI)->getIdx()]);
}
}
for (ROMol::ConstAtomIterator atomItI = mol.beginAtoms();
atomItI != mol.endAtoms(); ++atomItI) {
unsigned int i = (*atomItI)->getIdx();
if (ignoreAtoms &&
std::find(ignoreAtoms->begin(), ignoreAtoms->end(), i) !=
ignoreAtoms->end()) {
continue;
}
if (!fromAtoms) {
for (ROMol::ConstAtomIterator atomItJ = atomItI + 1;
atomItJ != mol.endAtoms(); ++atomItJ) {
unsigned int j = (*atomItJ)->getIdx();
if (ignoreAtoms &&
std::find(ignoreAtoms->begin(), ignoreAtoms->end(), j) !=
ignoreAtoms->end()) {
continue;
}
unsigned int dist =
static_cast<unsigned int>(floor(dm[i * nAtoms + j]));
if (dist >= minLength && dist <= maxLength) {
boost::uint32_t bit = 0;
gboost::hash_combine(bit, std::min(atomCodes[i], atomCodes[j]));
gboost::hash_combine(bit, dist);
gboost::hash_combine(bit, std::max(atomCodes[i], atomCodes[j]));
updateElement(*res, static_cast<boost::int32_t>(bit % nBits));
}
}
} else {
BOOST_FOREACH (boost::uint32_t j, *fromAtoms) {
if (j != i) {
if (ignoreAtoms &&
std::find(ignoreAtoms->begin(), ignoreAtoms->end(), j) !=
ignoreAtoms->end()) {
continue;
}
unsigned int dist =
static_cast<unsigned int>(floor(dm[i * nAtoms + j]));
if (dist >= minLength && dist <= maxLength) {
boost::uint32_t bit = 0;
gboost::hash_combine(bit, std::min(atomCodes[i], atomCodes[j]));
gboost::hash_combine(bit, dist);
gboost::hash_combine(bit, std::max(atomCodes[i], atomCodes[j]));
updateElement(*res, static_cast<boost::int32_t>(bit % nBits));
}
}
}
}
}
return res;
}
ExplicitBitVect *getHashedAtomPairFingerprintAsBitVect(
const ROMol &mol, unsigned int nBits, unsigned int minLength,
unsigned int maxLength, const std::vector<boost::uint32_t> *fromAtoms,
const std::vector<boost::uint32_t> *ignoreAtoms,
const std::vector<boost::uint32_t> *atomInvariants,
unsigned int nBitsPerEntry, bool includeChirality, bool use2D, int confId) {
PRECONDITION(minLength <= maxLength, "bad lengths provided");
PRECONDITION(!atomInvariants || atomInvariants->size() >= mol.getNumAtoms(),
"bad atomInvariants size");
static int bounds[4] = {1, 2, 4, 8};
unsigned int blockLength = nBits / nBitsPerEntry;
SparseIntVect<boost::int32_t> *sres = getHashedAtomPairFingerprint(
mol, blockLength, minLength, maxLength, fromAtoms, ignoreAtoms,
atomInvariants, includeChirality, use2D, confId);
ExplicitBitVect *res = new ExplicitBitVect(nBits);
if (nBitsPerEntry != 4) {
BOOST_FOREACH (SparseIntVect<boost::int64_t>::StorageType::value_type val,
sres->getNonzeroElements()) {
for (unsigned int i = 0; i < nBitsPerEntry; ++i) {
if (val.second > static_cast<int>(i))
res->setBit(val.first * nBitsPerEntry + i);
}
}
} else {
BOOST_FOREACH (SparseIntVect<boost::int64_t>::StorageType::value_type val,
sres->getNonzeroElements()) {
for (unsigned int i = 0; i < nBitsPerEntry; ++i) {
if (val.second >= bounds[i]) {
res->setBit(val.first * nBitsPerEntry + i);
}
}
}
}
delete sres;
return res;
}
boost::uint64_t getTopologicalTorsionCode(
const std::vector<boost::uint32_t> &pathCodes, bool includeChirality) {
bool reverseIt = false;
unsigned int i = 0;
unsigned int j = pathCodes.size() - 1;
while (i < j) {
if (pathCodes[i] > pathCodes[j]) {
reverseIt = true;
break;
} else if (pathCodes[i] < pathCodes[j]) {
break;
}
++i;
--j;
}
int shiftSize = codeSize + (includeChirality ? numChiralBits : 0);
boost::uint64_t res = 0;
if (reverseIt) {
for (unsigned int i = 0; i < pathCodes.size(); ++i) {
res |= static_cast<boost::uint64_t>(pathCodes[pathCodes.size() - i - 1])
<< (shiftSize * i);
}
} else {
for (unsigned int i = 0; i < pathCodes.size(); ++i) {
res |= static_cast<boost::uint64_t>(pathCodes[i]) << (shiftSize * i);
}
}
return res;
}
size_t getTopologicalTorsionHash(
const std::vector<boost::uint32_t> &pathCodes) {
bool reverseIt = false;
unsigned int i = 0;
unsigned int j = pathCodes.size() - 1;
while (i < j) {
if (pathCodes[i] > pathCodes[j]) {
reverseIt = true;
break;
} else if (pathCodes[i] < pathCodes[j]) {
break;
}
++i;
--j;
}
boost::uint32_t res = 0;
if (reverseIt) {
for (unsigned int i = 0; i < pathCodes.size(); ++i) {
gboost::hash_combine(res, pathCodes[pathCodes.size() - i - 1]);
}
} else {
for (unsigned int i = 0; i < pathCodes.size(); ++i) {
gboost::hash_combine(res, pathCodes[i]);
}
}
return res;
}
SparseIntVect<boost::int64_t> *getTopologicalTorsionFingerprint(
const ROMol &mol, unsigned int targetSize,
const std::vector<boost::uint32_t> *fromAtoms,
const std::vector<boost::uint32_t> *ignoreAtoms,
const std::vector<boost::uint32_t> *atomInvariants, bool includeChirality) {
PRECONDITION(!atomInvariants || atomInvariants->size() >= mol.getNumAtoms(),
"bad atomInvariants size");
boost::uint64_t sz = 1;
sz = (sz << (targetSize *
(codeSize + (includeChirality ? numChiralBits : 0))));
// NOTE: this -1 is incorrect but it's needed for backwards compatibility.
// hopefully we'll never have a case with a torsion that hits this.
//
// mmm, bug compatible.
sz -= 1;
SparseIntVect<boost::int64_t> *res = new SparseIntVect<boost::int64_t>(sz);
std::vector<boost::uint32_t> atomCodes;
atomCodes.reserve(mol.getNumAtoms());
for (ROMol::ConstAtomIterator atomItI = mol.beginAtoms();
atomItI != mol.endAtoms(); ++atomItI) {
if (!atomInvariants) {
atomCodes.push_back(getAtomCode(*atomItI, 0, includeChirality));
} else {
// need to add to the atomCode here because we subtract off up to 2 below
// as part of the branch correction
atomCodes.push_back(
(*atomInvariants)[(*atomItI)->getIdx()] % ((1 << codeSize) - 1) + 2);
}
}
boost::dynamic_bitset<> *fromAtomsBV = 0;
if (fromAtoms) {
fromAtomsBV = new boost::dynamic_bitset<>(mol.getNumAtoms());
BOOST_FOREACH (boost::uint32_t fAt, *fromAtoms) { fromAtomsBV->set(fAt); }
}
boost::dynamic_bitset<> *ignoreAtomsBV = 0;
if (ignoreAtoms) {
ignoreAtomsBV = new boost::dynamic_bitset<>(mol.getNumAtoms());
BOOST_FOREACH (boost::uint32_t fAt, *ignoreAtoms) {
ignoreAtomsBV->set(fAt);
}
}
boost::dynamic_bitset<> pAtoms(mol.getNumAtoms());
PATH_LIST paths = findAllPathsOfLengthN(mol, targetSize, false);
for (PATH_LIST::const_iterator pathIt = paths.begin(); pathIt != paths.end();
++pathIt) {
bool keepIt = true;
if (fromAtomsBV) {
keepIt = false;
}
std::vector<boost::uint32_t> pathCodes;
const PATH_TYPE &path = *pathIt;
if (fromAtomsBV) {
if (fromAtomsBV->test(static_cast<boost::uint32_t>(path.front())) ||
fromAtomsBV->test(static_cast<boost::uint32_t>(path.back()))) {
keepIt = true;
}
}
if (keepIt && ignoreAtomsBV) {
BOOST_FOREACH (int pElem, path) {
if (ignoreAtomsBV->test(pElem)) {
keepIt = false;
break;
}
}
}
if (keepIt) {
pAtoms.reset();
for (PATH_TYPE::const_iterator pIt = path.begin(); pIt < path.end();
++pIt) {
// look for a cycle that doesn't start at the first atom
// we can't effectively canonicalize these at the moment
// (was github #811)
if (pIt != path.begin() && *pIt != *(path.begin()) && pAtoms[*pIt]) {
pathCodes.clear();
break;
}
pAtoms.set(*pIt);
unsigned int code = atomCodes[*pIt] - 1;
// subtract off the branching number:
if (pIt != path.begin() && pIt + 1 != path.end()) {
--code;
}
pathCodes.push_back(code);
}
if (pathCodes.size()) {
boost::int64_t code =
getTopologicalTorsionCode(pathCodes, includeChirality);
updateElement(*res, code);
}
}
}
delete fromAtomsBV;
delete ignoreAtomsBV;
return res;
}
namespace {
template <typename T>
void TorsionFpCalc(T *res, const ROMol &mol, unsigned int nBits,
unsigned int targetSize,
const std::vector<boost::uint32_t> *fromAtoms,
const std::vector<boost::uint32_t> *ignoreAtoms,
const std::vector<boost::uint32_t> *atomInvariants,
bool includeChirality) {
PRECONDITION(!atomInvariants || atomInvariants->size() >= mol.getNumAtoms(),
"bad atomInvariants size");
std::vector<boost::uint32_t> atomCodes;
atomCodes.reserve(mol.getNumAtoms());
for (ROMol::ConstAtomIterator atomItI = mol.beginAtoms();
atomItI != mol.endAtoms(); ++atomItI) {
if (!atomInvariants) {
atomCodes.push_back(getAtomCode(*atomItI, 0, includeChirality));
} else {
// need to add to the atomCode here because we subtract off up to 2 below
// as part of the branch correction
atomCodes.push_back(((*atomInvariants)[(*atomItI)->getIdx()] << 1) + 1);
}
}
boost::dynamic_bitset<> *fromAtomsBV = 0;
if (fromAtoms) {
fromAtomsBV = new boost::dynamic_bitset<>(mol.getNumAtoms());
BOOST_FOREACH (boost::uint32_t fAt, *fromAtoms) { fromAtomsBV->set(fAt); }
}
boost::dynamic_bitset<> *ignoreAtomsBV = 0;
if (ignoreAtoms) {
ignoreAtomsBV = new boost::dynamic_bitset<>(mol.getNumAtoms());
BOOST_FOREACH (boost::uint32_t fAt, *ignoreAtoms) {
ignoreAtomsBV->set(fAt);
}
}
PATH_LIST paths = findAllPathsOfLengthN(mol, targetSize, false);
for (PATH_LIST::const_iterator pathIt = paths.begin(); pathIt != paths.end();
++pathIt) {
bool keepIt = true;
if (fromAtomsBV) {
keepIt = false;
}
const PATH_TYPE &path = *pathIt;
if (fromAtomsBV) {
if (fromAtomsBV->test(static_cast<boost::uint32_t>(path.front())) ||
fromAtomsBV->test(static_cast<boost::uint32_t>(path.back()))) {
keepIt = true;
}
}
if (keepIt && ignoreAtomsBV) {
BOOST_FOREACH (int pElem, path) {
if (ignoreAtomsBV->test(pElem)) {
keepIt = false;
break;
}
}
}
if (keepIt) {
std::vector<boost::uint32_t> pathCodes(targetSize);
for (unsigned int i = 0; i < targetSize; ++i) {
unsigned int code = atomCodes[path[i]] - 1;
// subtract off the branching number:
if (i > 0 && i < targetSize - 1) {
--code;
}
pathCodes[i] = code;
}
size_t bit = getTopologicalTorsionHash(pathCodes);
updateElement(*res, bit % nBits);
}
}
delete fromAtomsBV;
delete ignoreAtomsBV;
}
} // end of local namespace
SparseIntVect<boost::int64_t> *getHashedTopologicalTorsionFingerprint(
const ROMol &mol, unsigned int nBits, unsigned int targetSize,
const std::vector<boost::uint32_t> *fromAtoms,
const std::vector<boost::uint32_t> *ignoreAtoms,
const std::vector<boost::uint32_t> *atomInvariants, bool includeChirality) {
PRECONDITION(!atomInvariants || atomInvariants->size() >= mol.getNumAtoms(),
"bad atomInvariants size");
SparseIntVect<boost::int64_t> *res = new SparseIntVect<boost::int64_t>(nBits);
TorsionFpCalc(res, mol, nBits, targetSize, fromAtoms, ignoreAtoms,
atomInvariants, includeChirality);
return res;
}
ExplicitBitVect *getHashedTopologicalTorsionFingerprintAsBitVect(
const ROMol &mol, unsigned int nBits, unsigned int targetSize,
const std::vector<boost::uint32_t> *fromAtoms,
const std::vector<boost::uint32_t> *ignoreAtoms,
const std::vector<boost::uint32_t> *atomInvariants,
unsigned int nBitsPerEntry, bool includeChirality) {
PRECONDITION(!atomInvariants || atomInvariants->size() >= mol.getNumAtoms(),
"bad atomInvariants size");
static int bounds[4] = {1, 2, 4, 8};
unsigned int blockLength = nBits / nBitsPerEntry;
SparseIntVect<boost::int64_t> *sres =
new SparseIntVect<boost::int64_t>(blockLength);
TorsionFpCalc(sres, mol, blockLength, targetSize, fromAtoms, ignoreAtoms,
atomInvariants, includeChirality);
ExplicitBitVect *res = new ExplicitBitVect(nBits);
if (nBitsPerEntry != 4) {
BOOST_FOREACH (SparseIntVect<boost::int64_t>::StorageType::value_type val,
sres->getNonzeroElements()) {
for (unsigned int i = 0; i < nBitsPerEntry; ++i) {
if (val.second > static_cast<int>(i))
res->setBit(val.first * nBitsPerEntry + i);
}
}
} else {
BOOST_FOREACH (SparseIntVect<boost::int64_t>::StorageType::value_type val,
sres->getNonzeroElements()) {
for (unsigned int i = 0; i < nBitsPerEntry; ++i) {
if (val.second >= bounds[i]) {
res->setBit(val.first * nBitsPerEntry + i);
}
}
}
}
delete sres;
return res;
}
} // end of namespace AtomPairs
} // end of namespace RDKit
|
Java
|
---
id: 5900f3bc1000cf542c50fecf
title: 'Problema 80: Expansão de algarismos da raiz quadrada'
challengeType: 5
forumTopicId: 302194
dashedName: problem-80-square-root-digital-expansion
---
# --description--
É do conhecimento geral que se a raiz quadrada de um número natural não é um número inteiro, então é irracional. A expansão decimal de tais raízes quadradas é infinita sem qualquer tipo de padrão de repetição.
A raiz quadrada de dois é `1.41421356237309504880...`. A soma dos algarismos das primeiras cem casas decimais é `475`.
Para os primeiros `n` números naturais, encontre o total das somas dos algarismos das primeiras cem casas decimais para todas as raízes quadradas irracionais.
# --hints--
`sqrtDigitalExpansion(2)` deve retornar um número.
```js
assert(typeof sqrtDigitalExpansion(2) === 'number');
```
`sqrtDigitalExpansion(2)` deve retornar `475`.
```js
assert.strictEqual(sqrtDigitalExpansion(2), 475);
```
`sqrtDigitalExpansion(50)` deve retornar `19543`.
```js
assert.strictEqual(sqrtDigitalExpansion(50), 19543);
```
`sqrtDigitalExpansion(100)` deve retornar `40886`.
```js
assert.strictEqual(sqrtDigitalExpansion(100), 40886);
```
# --seed--
## --seed-contents--
```js
function sqrtDigitalExpansion(n) {
return true;
}
sqrtDigitalExpansion(2);
```
# --solutions--
```js
function sqrtDigitalExpansion(n) {
function sumDigits(number) {
let sum = 0;
while (number > 0n) {
let digit = number % 10n;
sum += parseInt(digit, 10);
number = number / 10n;
}
return sum;
}
function power(numberA, numberB) {
let result = 1n;
for (let b = 0; b < numberB; b++) {
result = result * BigInt(numberA);
}
return result;
}
// Based on http://www.afjarvis.staff.shef.ac.uk/maths/jarvisspec02.pdf
function expandSquareRoot(number, numDigits) {
let a = 5n * BigInt(number);
let b = 5n;
const boundaryWithNeededDigits = power(10, numDigits + 1);
while (b < boundaryWithNeededDigits) {
if (a >= b) {
a = a - b;
b = b + 10n;
} else {
a = a * 100n;
b = (b / 10n) * 100n + 5n;
}
}
return b / 100n;
}
let result = 0;
let nextPerfectRoot = 1;
const requiredDigits = 100;
for (let i = 1; i <= n; i++) {
if (nextPerfectRoot ** 2 === i) {
nextPerfectRoot++;
continue;
}
result += sumDigits(expandSquareRoot(i, requiredDigits));
}
return result;
}
```
|
Java
|
/*
----------------------
BeDC License
----------------------
Copyright 2002, The BeDC team.
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 BeDC team 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 TITLE, NON-INFRINGEMENT, 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 _DC_STRINGS_H_
#define _DC_STRINGS_H_
#include <String.h>
// String constants
enum
{
// Hub window
STR_HUB_WINDOW_TITLE = 0,
// Hub window -> Buttons
STR_HUB_CONNECT,
STR_HUB_REFRESH,
STR_HUB_NEXT50,
STR_HUB_PREV50,
// Hub window -> List view
STR_SERVER_NAME,
STR_SERVER_ADDR,
STR_SERVER_DESC,
STR_SERVER_USERS,
// Hub window -> Status
STR_STATUS_IDLE,
STR_STATUS_CONNECTING,
STR_STATUS_CONNECTED,
STR_STATUS_CONNECT_ERROR,
STR_STATUS_SEND_ERROR,
STR_STATUS_RECV_ERROR,
STR_STATUS_NUM_SERVERS,
// Main window -> Menus
STR_MENU_FILE,
STR_MENU_FILE_ABOUT,
STR_MENU_FILE_CLOSE,
STR_MENU_EDIT,
STR_MENU_EDIT_PREFS,
STR_MENU_WINDOWS,
STR_MENU_WINDOWS_HUB,
// Prefernces window
STR_PREFS_TITLE,
STR_PREFS_GENERAL,
STR_PREFS_GENERAL_PERSONAL,
STR_PREFS_GENERAL_CONNECTION_SETTINGS,
STR_PREFS_GENERAL_NICK,
STR_PREFS_GENERAL_EMAIL,
STR_PREFS_GENERAL_DESC,
STR_PREFS_GENERAL_CONNECTION,
STR_PREFS_GENERAL_ACTIVE,
STR_PREFS_GENERAL_PASSIVE,
STR_PREFS_GENERAL_IP,
STR_PREFS_GENERAL_PORT,
STR_PREFS_COLORS,
STR_PREFS_COLORS_SYSTEM,
STR_PREFS_COLORS_TEXT,
STR_PREFS_COLORS_ERROR,
STR_PREFS_COLORS_REMOTE_NICK,
STR_PREFS_COLORS_LOCAL_NICK,
STR_PREFS_COLORS_PRIVATE_TEXT,
// For the user list view
STR_VIEW_NAME = STR_SERVER_NAME, // Reuse ;)
STR_VIEW_SPEED = STR_PREFS_COLORS_PRIVATE_TEXT + 1,
STR_VIEW_DESC,
STR_VIEW_EMAIL,
STR_VIEW_SHARED,
STR_VIEW_CHAT,
STR_VIEW_CLOSE,
STR_OK,
STR_CANCEL,
STR_ERROR,
STR_USERS,
STR_LANGUAGE,
STR_REVERT,
STR_ALERT_BAD_NICK,
// Messages
STR_MSG_SYSTEM,
STR_MSG_ERROR,
STR_MSG_CONNECTING_TO,
STR_MSG_CONNECTED,
STR_MSG_CONNECT_ERROR,
STR_MSG_RECONNECTING,
STR_MSG_DISCONNECTED_FROM_SERVER,
STR_MSG_INVALID_NICK,
STR_MSG_USER_LOGGED_IN,
STR_MSG_USER_LOGGED_OUT,
STR_MSG_REDIRECTING,
STR_MSG_HUB_IS_FULL,
STR_MSG_USER_NOT_FOUND,
STR_MSG_UNKNOWN_COMMAND,
// This is a LONG string that contains the WHOLE /help text
STR_MSG_HELP,
STR_NUM // Place holder
};
// Key shortcuts for menu items
enum
{
KEY_FILE_ABOUT = 0,
KEY_FILE_CLOSE,
KEY_EDIT_PREFS,
KEY_WINDOWS_HUB,
KEY_NUM
};
enum
{
DC_LANG_ENGLISH = 0,
DC_LANG_SWEDISH,
DC_LANG_FINNISH,
DC_LANG_GERMAN,
DC_LANG_NORWEGIAN,
DC_LANG_POLISH,
DC_LANG_RUSSIAN,
DC_LANG_NUM // Place holder
};
extern const char * DC_LANGUAGES[DC_LANG_NUM];
const char * DCStr(int);
char DCKey(int);
void DCSetLanguage(int);
int DCGetLanguage();
BString DCUTF8(const char * str);
BString DCMS(const char * str);
#endif // _DC_STRINGS_H_
|
Java
|
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Ldap
*/
namespace Zend\Ldap\Collection;
use Zend\Ldap;
use Zend\Ldap\Exception;
use Zend\Stdlib\ErrorHandler;
/**
* Zend\Ldap\Collection\DefaultIterator is the default collection iterator implementation
* using ext/ldap
*
* @category Zend
* @package Zend_Ldap
*/
class DefaultIterator implements \Iterator, \Countable
{
const ATTRIBUTE_TO_LOWER = 1;
const ATTRIBUTE_TO_UPPER = 2;
const ATTRIBUTE_NATIVE = 3;
/**
* LDAP Connection
*
* @var \Zend\Ldap\Ldap
*/
protected $ldap = null;
/**
* Result identifier resource
*
* @var resource
*/
protected $resultId = null;
/**
* Current result entry identifier
*
* @var resource
*/
protected $current = null;
/**
* Number of items in query result
*
* @var integer
*/
protected $itemCount = -1;
/**
* The method that will be applied to the attribute's names.
*
* @var integer|callable
*/
protected $attributeNameTreatment = self::ATTRIBUTE_TO_LOWER;
/**
* Constructor.
*
* @param \Zend\Ldap\Ldap $ldap
* @param resource $resultId
* @throws \Zend\Ldap\Exception\LdapException if no entries was found.
* @return DefaultIterator
*/
public function __construct(Ldap\Ldap $ldap, $resultId)
{
$this->ldap = $ldap;
$this->resultId = $resultId;
$resource = $ldap->getResource();
ErrorHandler::start();
$this->itemCount = ldap_count_entries($resource, $resultId);
ErrorHandler::stop();
if ($this->itemCount === false) {
throw new Exception\LdapException($this->ldap, 'counting entries');
}
}
public function __destruct()
{
$this->close();
}
/**
* Closes the current result set
*
* @return bool
*/
public function close()
{
$isClosed = false;
if (is_resource($this->resultId)) {
ErrorHandler::start();
$isClosed = ldap_free_result($this->resultId);
ErrorHandler::stop();
$this->resultId = null;
$this->current = null;
}
return $isClosed;
}
/**
* Gets the current LDAP connection.
*
* @return \Zend\Ldap\Ldap
*/
public function getLDAP()
{
return $this->ldap;
}
/**
* Sets the attribute name treatment.
*
* Can either be one of the following constants
* - Zend\Ldap\Collection\DefaultIterator::ATTRIBUTE_TO_LOWER
* - Zend\Ldap\Collection\DefaultIterator::ATTRIBUTE_TO_UPPER
* - Zend\Ldap\Collection\DefaultIterator::ATTRIBUTE_NATIVE
* or a valid callback accepting the attribute's name as it's only
* argument and returning the new attribute's name.
*
* @param integer|callable $attributeNameTreatment
* @return DefaultIterator Provides a fluent interface
*/
public function setAttributeNameTreatment($attributeNameTreatment)
{
if (is_callable($attributeNameTreatment)) {
if (is_string($attributeNameTreatment) && !function_exists($attributeNameTreatment)) {
$this->attributeNameTreatment = self::ATTRIBUTE_TO_LOWER;
} elseif (is_array($attributeNameTreatment)
&& !method_exists($attributeNameTreatment[0], $attributeNameTreatment[1])
) {
$this->attributeNameTreatment = self::ATTRIBUTE_TO_LOWER;
} else {
$this->attributeNameTreatment = $attributeNameTreatment;
}
} else {
$attributeNameTreatment = (int)$attributeNameTreatment;
switch ($attributeNameTreatment) {
case self::ATTRIBUTE_TO_LOWER:
case self::ATTRIBUTE_TO_UPPER:
case self::ATTRIBUTE_NATIVE:
$this->attributeNameTreatment = $attributeNameTreatment;
break;
default:
$this->attributeNameTreatment = self::ATTRIBUTE_TO_LOWER;
break;
}
}
return $this;
}
/**
* Returns the currently set attribute name treatment
*
* @return integer|callable
*/
public function getAttributeNameTreatment()
{
return $this->attributeNameTreatment;
}
/**
* Returns the number of items in current result
* Implements Countable
*
* @return int
*/
public function count()
{
return $this->itemCount;
}
/**
* Return the current result item
* Implements Iterator
*
* @return array|null
* @throws \Zend\Ldap\Exception\LdapException
*/
public function current()
{
if (!is_resource($this->current)) {
$this->rewind();
}
if (!is_resource($this->current)) {
return null;
}
$entry = array('dn' => $this->key());
$ber_identifier = null;
$resource = $this->ldap->getResource();
ErrorHandler::start();
$name = ldap_first_attribute(
$resource, $this->current,
$ber_identifier
);
ErrorHandler::stop();
while ($name) {
ErrorHandler::start();
$data = ldap_get_values_len($resource, $this->current, $name);
ErrorHandler::stop();
if (!$data) {
$data = array();
}
if (isset($data['count'])) {
unset($data['count']);
}
switch ($this->attributeNameTreatment) {
case self::ATTRIBUTE_TO_LOWER:
$attrName = strtolower($name);
break;
case self::ATTRIBUTE_TO_UPPER:
$attrName = strtoupper($name);
break;
case self::ATTRIBUTE_NATIVE:
$attrName = $name;
break;
default:
$attrName = call_user_func($this->attributeNameTreatment, $name);
break;
}
$entry[$attrName] = $data;
ErrorHandler::start();
$name = ldap_next_attribute(
$resource, $this->current,
$ber_identifier
);
ErrorHandler::stop();
}
ksort($entry, SORT_LOCALE_STRING);
return $entry;
}
/**
* Return the result item key
* Implements Iterator
*
* @throws \Zend\Ldap\Exception\LdapException
* @return string|null
*/
public function key()
{
if (!is_resource($this->current)) {
$this->rewind();
}
if (is_resource($this->current)) {
$resource = $this->ldap->getResource();
ErrorHandler::start();
$currentDn = ldap_get_dn($resource, $this->current);
ErrorHandler::stop();
if ($currentDn === false) {
throw new Exception\LdapException($this->ldap, 'getting dn');
}
return $currentDn;
} else {
return null;
}
}
/**
* Move forward to next result item
* Implements Iterator
*
* @throws \Zend\Ldap\Exception\LdapException
*/
public function next()
{
$code = 0;
if (is_resource($this->current) && $this->itemCount > 0) {
$resource = $this->ldap->getResource();
ErrorHandler::start();
$this->current = ldap_next_entry($resource, $this->current);
ErrorHandler::stop();
if ($this->current === false) {
$msg = $this->ldap->getLastError($code);
if ($code === Exception\LdapException::LDAP_SIZELIMIT_EXCEEDED) {
// we have reached the size limit enforced by the server
return;
} elseif ($code > Exception\LdapException::LDAP_SUCCESS) {
throw new Exception\LdapException($this->ldap, 'getting next entry (' . $msg . ')');
}
}
} else {
$this->current = false;
}
}
/**
* Rewind the Iterator to the first result item
* Implements Iterator
*
*
* @throws \Zend\Ldap\Exception\LdapException
*/
public function rewind()
{
if (is_resource($this->resultId)) {
$resource = $this->ldap->getResource();
ErrorHandler::start();
$this->current = ldap_first_entry($resource, $this->resultId);
ErrorHandler::stop();
if ($this->current === false
&& $this->ldap->getLastErrorCode() > Exception\LdapException::LDAP_SUCCESS
) {
throw new Exception\LdapException($this->ldap, 'getting first entry');
}
}
}
/**
* Check if there is a current result item
* after calls to rewind() or next()
* Implements Iterator
*
* @return boolean
*/
public function valid()
{
return (is_resource($this->current));
}
}
|
Java
|
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\HalfproductSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="halfproduct-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id_product') ?>
<?= $form->field($model, 'kode') ?>
<?= $form->field($model, 'nama') ?>
<?= $form->field($model, 'package') ?>
<?= $form->field($model, 'panjang') ?>
<?php // echo $form->field($model, 'lebar') ?>
<?php // echo $form->field($model, 'berat') ?>
<?php // echo $form->field($model, 'flag') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
|
Java
|
WakaTime#

[](https://ci.appveyor.com/project/salaros/wakatime-sharp/branch/master)

==========


[](https://social.msdn.microsoft.com/Forums/vstudio/en-US/7035edc6-97fc-49ee-8eee-2fa4d040a63b/)
[](https://social.msdn.microsoft.com/Forums/vstudio/en-US/7035edc6-97fc-49ee-8eee-2fa4d040a63b/)
A core implementation of all WakaTime C#-driven plugins for IDE such as Xamarin Studio, Monodevelop, Visual Studio, Visual Studio for Mac, Notepad++, Unity etc
These plugins will help to collect metrics, insights and time tracking automatically generated directly from your programming activity.
https://wakatime.com
|
Java
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AudioHurtHandler : MonoBehaviour {
// Static reference to singleton object
public static AudioHurtHandler instance;
public AudioClip[] myClip;
// Use this for initialization
void Start ()
{
instance = gameObject.GetComponent<AudioHurtHandler>();
}
public void playSound ()
{
audio.PlayOneShot(myClip[Random.Range(0,myClip.Length)]);
//wait ();
}
IEnumerator wait()
{
yield return new WaitForSeconds(1);
}
}
|
Java
|
<?php namespace estvoyage\risingsun\comparison\unary\container\payload;
use estvoyage\risingsun\{ container, comparison, ointeger, block };
class disjunction
implements
comparison\unary\container\payload
{
private
$operand,
$recipient
;
function __construct($operand, comparison\recipient $recipient)
{
$this->operand = $operand;
$this->recipient = $recipient;
}
function containerIteratorEngineControllerForUnaryComparisonAtPositionIs(comparison\unary $comparison, ointeger $position, container\iterator\engine\controller $controller)
{
$comparison
->recipientOfComparisonWithOperandIs(
$this->operand,
new comparison\recipient\block(
new block\functor(
function($nboolean) use ($controller)
{
$this->recipient->nbooleanIs($nboolean);
(new comparison\unary\with\true\boolean)
->recipientOfComparisonWithOperandIs(
$nboolean,
new comparison\recipient\functor\ok(
function() use ($controller)
{
$controller->remainingIterationsInContainerIteratorEngineAreUseless();
}
)
)
;
}
)
)
)
;
}
}
|
Java
|
<?php
namespace UForm\Form\Element;
use UForm\Filtering\FilterChain;
use UForm\Form\Element;
/**
* Element that intends to contain other elements.
* It only aims to be a common parent for Group and Collection
*
* In some ways it is opposed to the Primary element that cant contain other elements
*
* @see UForm\Form\Element\Container\Group
* @see UForm\Form\Element\Container\Collection
* @see UForm\Form\Element\Container\Primary
* @semanticType container
*/
abstract class Container extends Element
{
public function __construct($name = null)
{
parent::__construct($name);
$this->addSemanticType('container');
}
/**
* Get an element by its name
* @param $name
* @return Element
*/
abstract public function getElement($name);
/**
* Get the elements contained in this container.
* Values are required because a collection requires values to be generated
* @param mixed $values used for the "collection" element that is rendered according to a value set
* @return Element[] the elements contained in this container
*/
abstract public function getElements($values = null);
/**
* Get an element located directly in this element. There is an exception for unnamed elements :
* we will search inside directElements of unnamed elements
* @param string $name name of the element to get
* @param mixed $values used for the "collection" element that is rendered according to a value set
* @return null|Element|Container the element found or null if the element does not exist
*/
public function getDirectElement($name, $values = null)
{
foreach ($this->getElements($values) as $elm) {
if ($name == $elm->getName()) {
return $elm;
} elseif (!$elm->getName() && $elm instanceof Container) {
/* @var $elm \UForm\Form\Element\Container */
$element = $elm->getDirectElement($name);
if ($element) {
return $element;
}
}
}
return null;
}
/**
* Get direct elements with the given name
* @param $name
* @param null $values
* @return Element[]
*/
public function getDirectElements($name, $values = null)
{
$elements = [];
foreach ($this->getElements($values) as $elm) {
if ($name == $elm->getName()) {
$elements[] = $elm;
} elseif (!$elm->getName() && $elm instanceof Container) {
/* @var $elm \UForm\Form\Element\Container */
$elements += $elm->getDirectElements($name, $values);
}
}
return $elements;
}
/**
* check if this element contains at least one element that is an instance of the given type
* @param string $className the name of the class to search for
* @return bool true if the instance was found
*/
public function hasDirectElementInstance($className)
{
foreach ($this->getElements() as $el) {
if (is_a($el, $className)) {
return true;
}
}
return false;
}
/**
* Check if this element contains at least one element with the given semantic type
* @param string $type the type to search for
* @return bool true if the semantic type was found
*/
public function hasDirectElementSemanticType($type)
{
foreach ($this->getElements() as $el) {
if ($el->hasSemanticType($type)) {
return true;
}
}
return false;
}
public function prepareFilterChain(FilterChain $filterChain)
{
parent::prepareFilterChain($filterChain);
foreach ($this->getElements() as $v) {
$v->prepareFilterChain($filterChain);
}
}
/**
* @inheritdoc
*/
public function setParent(Container $parent)
{
$r = parent::setParent($parent);
foreach ($this->getElements() as $element) {
$element->refreshParent();
}
return $r;
}
}
|
Java
|
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 03 10:16:39 2013
@author: Grahesh
"""
import pandas
from qstkutil import DataAccess as da
import numpy as np
import math
import copy
import qstkutil.qsdateutil as du
import datetime as dt
import qstkutil.DataAccess as da
import qstkutil.tsutil as tsu
import qstkstudy.EventProfiler as ep
"""
Accepts a list of symbols along with start and end date
Returns the Event Matrix which is a pandas Datamatrix
Event matrix has the following structure :
|IBM |GOOG|XOM |MSFT| GS | JP |
(d1)|nan |nan | 1 |nan |nan | 1 |
(d2)|nan | 1 |nan |nan |nan |nan |
(d3)| 1 |nan | 1 |nan | 1 |nan |
(d4)|nan | 1 |nan | 1 |nan |nan |
...................................
...................................
Also, d1 = start date
nan = no information about any event.
1 = status bit(positively confirms the event occurence)
"""
# Get the data from the data store
storename = "NSEData" # get data from our daily prices source
# Available field names: open, close, high, low, close, actual_close, volume
closefield = "close"
volumefield = "volume"
window = 10
def getHalfYearEndDates(timestamps):
newTS=[]
tempYear=timestamps[0].year
flag=1
for x in range(0, len(timestamps)-1):
if(timestamps[x].year==tempYear):
if(timestamps[x].month==4 and flag==1):
newTS.append(timestamps[x-1])
flag=0
if(timestamps[x].month==10):
newTS.append(timestamps[x-1])
tempYear=timestamps[x].year+1
flag=1
return newTS
def findEvents(symbols, startday,endday, marketSymbol,verbose=False):
# Reading the Data for the list of Symbols.
timeofday=dt.timedelta(hours=16)
timestamps = du.getNSEdays(startday,endday,timeofday)
endOfHalfYear=getHalfYearEndDates(timestamps)
dataobj = da.DataAccess('NSEData')
if verbose:
print __name__ + " reading data"
# Reading the Data
close = dataobj.get_data(timestamps, symbols, closefield)
# Completing the Data - Removing the NaN values from the Matrix
close = (close.fillna(method='ffill')).fillna(method='backfill')
# Calculating Daily Returns for the Market
tsu.returnize0(close.values)
# Calculating the Returns of the Stock Relative to the Market
# So if a Stock went up 5% and the Market rised 3%. The the return relative to market is 2%
mktneutDM = close - close[marketSymbol]
np_eventmat = copy.deepcopy(mktneutDM)
for sym in symbols:
for time in timestamps:
np_eventmat[sym][time]=np.NAN
if verbose:
print __name__ + " finding events"
# Generating the Event Matrix
# Event described is : Analyzing half year events for given stocks.
for symbol in symbols:
for i in endOfHalfYear:
np_eventmat[symbol][i] = 1.0 #overwriting by the bit, marking the event
return np_eventmat
#################################################
################ MAIN CODE ######################
#################################################
symbols = np.loadtxt('NSE500port.csv',dtype='S13',comments='#', skiprows=1)
# You might get a message about some files being missing, don't worry about it.
#symbols =['SPY','BFRE','ATCS','RSERF','GDNEF','LAST','ATTUF','JBFCF','CYVA','SPF','XPO','EHECF','TEMO','AOLS','CSNT','REMI','GLRP','AIFLY','BEE','DJRT','CHSTF','AICAF']
#symbols=['NSE','3MINDIA.NS','AARTIIND.NS','ABAN.NS','ABB.NS','ABGSHIP.NS','ABIRLANUV.NS','ACC.NS','ADANIENT.NS','ADANIPORT.NS','ADANIPOWE.NS','ADVANTA.NS','ALLCARGO.NS','AIAENG.NS','AIL.NS','AZKOINDIA.NS']
startday = dt.datetime(2011,1,1)
endday = dt.datetime(2012,1,1)
eventMatrix = findEvents(symbols,startday,endday,marketSymbol='NSE500',verbose=True)
eventMatrix.to_csv('eventmatrix.csv', sep=',')
eventProfiler = ep.EventProfiler(eventMatrix,startday,endday,lookback_days=20,lookforward_days=20,verbose=True)
eventProfiler.study(filename="HalfYearEventStudy.jpg",plotErrorBars=True,plotMarketNeutral=True,plotEvents=False,marketSymbol='NSE500')
|
Java
|
<?php
include_once 'dynamic_db_connection.php';
/**
* This is the model class for table "THEME_MANAGEMENT".
*
* The followings are the available columns in table 'THEME_MANAGEMENT':
* @property string $PID
* @property string $THEME
*/
class Theme_Management extends CActiveRecord
{
/**
* Returns the static model of the specified AR class.
* @param string $className active record class name.
* @return Theme_Management the static model class
*/
public static function model($className=__CLASS__)
{
return parent::model($className);
}
/**
* @return string the associated database table name
*/
public function tableName()
{
return 'THEME_MANAGEMENT';
}
/**
* @return array validation rules for model attributes.
*/
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('THEME', 'length', 'max'=>20),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('USER_ID,ID, THEME', 'safe', 'on'=>'search'),
);
}
/**
* @return array relational rules.
*/
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
);
}
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels()
{
return array(
'USER_ID' => 'Userid',
'THEME' => 'Theme',
);
}
/**
* Retrieves a list of models based on the current search/filter conditions.
* @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
*/
public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('USER_ID',$this->USER_ID,true);
$criteria->compare('THEME',$this->THEME,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
}
|
Java
|
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = build
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
.PHONY: help
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " applehelp to make an Apple Help Book"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
@echo " coverage to run coverage check of the documentation (if enabled)"
.PHONY: clean
clean:
rm -rf $(BUILDDIR)/*
.PHONY: html
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
.PHONY: dirhtml
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
.PHONY: singlehtml
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
.PHONY: pickle
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
.PHONY: json
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
.PHONY: htmlhelp
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
.PHONY: qthelp
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/pypush2.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/pypush2.qhc"
.PHONY: applehelp
applehelp:
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
@echo
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
@echo "N.B. You won't be able to view it unless you put it in" \
"~/Library/Documentation/Help or install it in your application" \
"bundle."
.PHONY: devhelp
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/pypush2"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/pypush2"
@echo "# devhelp"
.PHONY: epub
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
.PHONY: latex
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
.PHONY: latexpdf
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
.PHONY: latexpdfja
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
.PHONY: text
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
.PHONY: man
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
.PHONY: texinfo
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
.PHONY: info
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
.PHONY: gettext
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
.PHONY: changes
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
.PHONY: linkcheck
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
.PHONY: doctest
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
.PHONY: coverage
coverage:
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
@echo "Testing of coverage in the sources finished, look at the " \
"results in $(BUILDDIR)/coverage/python.txt."
.PHONY: xml
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
.PHONY: pseudoxml
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
|
Java
|
/*
* Copyright (c) 2012 The Native Client Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "native_client/src/include/portability_string.h"
#include "native_client/src/include/nacl_macros.h"
#include "native_client/src/include/nacl_platform.h"
#include "native_client/src/shared/platform/nacl_check.h"
#include "native_client/src/trusted/service_runtime/nacl_syscall_asm_symbols.h"
#include "native_client/src/trusted/service_runtime/nacl_globals.h"
#include "native_client/src/trusted/service_runtime/sel_ldr.h"
#include "native_client/src/trusted/service_runtime/sel_memory.h"
#include "native_client/src/trusted/service_runtime/springboard.h"
#include "native_client/src/trusted/service_runtime/arch/x86/sel_ldr_x86.h"
#include "native_client/src/trusted/service_runtime/arch/x86_64/tramp_64.h"
static uintptr_t AddDispatchThunk(uintptr_t *next_addr,
uintptr_t target_routine) {
struct NaClPatchInfo patch_info;
struct NaClPatch jmp_target;
jmp_target.target = (((uintptr_t) &NaClDispatchThunk_jmp_target)
- sizeof(uintptr_t));
jmp_target.value = target_routine;
NaClPatchInfoCtor(&patch_info);
patch_info.abs64 = &jmp_target;
patch_info.num_abs64 = 1;
patch_info.dst = *next_addr;
patch_info.src = (uintptr_t) &NaClDispatchThunk;
patch_info.nbytes = ((uintptr_t) &NaClDispatchThunkEnd
- (uintptr_t) &NaClDispatchThunk);
NaClApplyPatchToMemory(&patch_info);
*next_addr += patch_info.nbytes;
return patch_info.dst;
}
int NaClMakeDispatchThunk(struct NaClApp *nap) {
int retval = 0; /* fail */
int error;
void *thunk_addr = NULL;
uintptr_t next_addr;
uintptr_t dispatch_thunk = 0;
uintptr_t get_tls_fast_path1 = 0;
uintptr_t get_tls_fast_path2 = 0;
NaClLog(2, "Entered NaClMakeDispatchThunk\n");
if (0 != nap->dispatch_thunk) {
NaClLog(LOG_ERROR, " dispatch_thunk already initialized!\n");
return 1;
}
if (0 != (error = NaCl_page_alloc_randomized(&thunk_addr,
NACL_MAP_PAGESIZE))) {
NaClLog(LOG_INFO,
"NaClMakeDispatchThunk::NaCl_page_alloc failed, errno %d\n",
-error);
retval = 0;
goto cleanup;
}
NaClLog(2, "NaClMakeDispatchThunk: got addr 0x%"NACL_PRIxPTR"\n",
(uintptr_t) thunk_addr);
if (0 != (error = NaCl_mprotect(thunk_addr,
NACL_MAP_PAGESIZE,
PROT_READ | PROT_WRITE))) {
NaClLog(LOG_INFO,
"NaClMakeDispatchThunk::NaCl_mprotect r/w failed, errno %d\n",
-error);
retval = 0;
goto cleanup;
}
NaClFillMemoryRegionWithHalt(thunk_addr, NACL_MAP_PAGESIZE);
next_addr = (uintptr_t) thunk_addr;
dispatch_thunk =
AddDispatchThunk(&next_addr, (uintptr_t) &NaClSyscallSeg);
get_tls_fast_path1 =
AddDispatchThunk(&next_addr, (uintptr_t) &NaClGetTlsFastPath1);
get_tls_fast_path2 =
AddDispatchThunk(&next_addr, (uintptr_t) &NaClGetTlsFastPath2);
if (0 != (error = NaCl_mprotect(thunk_addr,
NACL_MAP_PAGESIZE,
PROT_EXEC|PROT_READ))) {
NaClLog(LOG_INFO,
"NaClMakeDispatchThunk::NaCl_mprotect r/x failed, errno %d\n",
-error);
retval = 0;
goto cleanup;
}
retval = 1;
cleanup:
if (0 == retval) {
if (NULL != thunk_addr) {
NaCl_page_free(thunk_addr, NACL_MAP_PAGESIZE);
thunk_addr = NULL;
}
} else {
nap->dispatch_thunk = dispatch_thunk;
nap->get_tls_fast_path1 = get_tls_fast_path1;
nap->get_tls_fast_path2 = get_tls_fast_path2;
}
return retval;
}
/*
* Install a syscall trampoline at target_addr. NB: Thread-safe.
*/
void NaClPatchOneTrampolineCall(uintptr_t call_target_addr,
uintptr_t target_addr) {
struct NaClPatchInfo patch_info;
struct NaClPatch call_target;
NaClLog(6, "call_target_addr = 0x%"NACL_PRIxPTR"\n", call_target_addr);
CHECK(0 != call_target_addr);
call_target.target = (((uintptr_t) &NaCl_trampoline_call_target)
- sizeof(uintptr_t));
call_target.value = call_target_addr;
NaClPatchInfoCtor(&patch_info);
patch_info.abs64 = &call_target;
patch_info.num_abs64 = 1;
patch_info.dst = target_addr;
patch_info.src = (uintptr_t) &NaCl_trampoline_code;
patch_info.nbytes = ((uintptr_t) &NaCl_trampoline_code_end
- (uintptr_t) &NaCl_trampoline_code);
NaClApplyPatchToMemory(&patch_info);
}
void NaClPatchOneTrampoline(struct NaClApp *nap,
uintptr_t target_addr) {
uintptr_t call_target_addr;
call_target_addr = nap->dispatch_thunk;
NaClPatchOneTrampolineCall(call_target_addr, target_addr);
}
void NaClFillMemoryRegionWithHalt(void *start, size_t size) {
CHECK(!(size % NACL_HALT_LEN));
/* Tell valgrind that this memory is accessible and undefined */
NACL_MAKE_MEM_UNDEFINED(start, size);
memset(start, NACL_HALT_OPCODE, size);
}
void NaClFillTrampolineRegion(struct NaClApp *nap) {
NaClFillMemoryRegionWithHalt(
(void *) (nap->mem_start + NACL_TRAMPOLINE_START),
NACL_TRAMPOLINE_SIZE);
}
void NaClLoadSpringboard(struct NaClApp *nap) {
/*
* There is no springboard for x86-64.
*/
UNREFERENCED_PARAMETER(nap);
}
|
Java
|
// Copyright 2015 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.
#include "platform/fonts/shaping/RunSegmenter.h"
#include "platform/fonts/ScriptRunIterator.h"
#include "platform/fonts/SmallCapsIterator.h"
#include "platform/fonts/SymbolsIterator.h"
#include "platform/fonts/UTF16TextIterator.h"
#include "platform/text/Character.h"
#include "wtf/Assertions.h"
namespace blink {
RunSegmenter::RunSegmenter(const UChar* buffer, unsigned bufferSize, FontOrientation runOrientation, FontVariant variant)
: m_bufferSize(bufferSize)
, m_candidateRange({ 0, 0, USCRIPT_INVALID_CODE, OrientationIterator::OrientationKeep, SmallCapsIterator::SmallCapsSameCase })
, m_scriptRunIterator(adoptPtr(new ScriptRunIterator(buffer, bufferSize)))
, m_orientationIterator(runOrientation == FontOrientation::VerticalMixed ? adoptPtr(new OrientationIterator(buffer, bufferSize, runOrientation)) : nullptr)
, m_smallCapsIterator(variant == FontVariantSmallCaps ? adoptPtr(new SmallCapsIterator(buffer, bufferSize)) : nullptr)
, m_symbolsIterator(adoptPtr(new SymbolsIterator(buffer, bufferSize)))
, m_lastSplit(0)
, m_scriptRunIteratorPosition(0)
, m_orientationIteratorPosition(runOrientation == FontOrientation::VerticalMixed ? 0 : m_bufferSize)
, m_smallCapsIteratorPosition(variant == FontVariantSmallCaps ? 0 : m_bufferSize)
, m_symbolsIteratorPosition(0)
, m_atEnd(false)
{
}
void RunSegmenter::consumeScriptIteratorPastLastSplit()
{
ASSERT(m_scriptRunIterator);
if (m_scriptRunIteratorPosition <= m_lastSplit && m_scriptRunIteratorPosition < m_bufferSize) {
while (m_scriptRunIterator->consume(m_scriptRunIteratorPosition, m_candidateRange.script)) {
if (m_scriptRunIteratorPosition > m_lastSplit)
return;
}
}
}
void RunSegmenter::consumeOrientationIteratorPastLastSplit()
{
if (m_orientationIterator && m_orientationIteratorPosition <= m_lastSplit && m_orientationIteratorPosition < m_bufferSize) {
while (m_orientationIterator->consume(&m_orientationIteratorPosition, &m_candidateRange.renderOrientation)) {
if (m_orientationIteratorPosition > m_lastSplit)
return;
}
}
}
void RunSegmenter::consumeSmallCapsIteratorPastLastSplit()
{
if (m_smallCapsIterator && m_smallCapsIteratorPosition <= m_lastSplit && m_smallCapsIteratorPosition < m_bufferSize) {
while (m_smallCapsIterator->consume(&m_smallCapsIteratorPosition, &m_candidateRange.smallCapsBehavior)) {
if (m_smallCapsIteratorPosition > m_lastSplit)
return;
}
}
}
void RunSegmenter::consumeSymbolsIteratorPastLastSplit()
{
ASSERT(m_symbolsIterator);
if (m_symbolsIteratorPosition <= m_lastSplit && m_symbolsIteratorPosition < m_bufferSize) {
while (m_symbolsIterator->consume(&m_symbolsIteratorPosition, &m_candidateRange.fontFallbackPriority)) {
if (m_symbolsIteratorPosition > m_lastSplit)
return;
}
}
}
bool RunSegmenter::consume(RunSegmenterRange* nextRange)
{
if (m_atEnd || !m_bufferSize)
return false;
consumeScriptIteratorPastLastSplit();
consumeOrientationIteratorPastLastSplit();
consumeSmallCapsIteratorPastLastSplit();
consumeSymbolsIteratorPastLastSplit();
if (m_scriptRunIteratorPosition <= m_orientationIteratorPosition
&& m_scriptRunIteratorPosition <= m_smallCapsIteratorPosition
&& m_scriptRunIteratorPosition <= m_symbolsIteratorPosition) {
m_lastSplit = m_scriptRunIteratorPosition;
}
if (m_orientationIteratorPosition <= m_scriptRunIteratorPosition
&& m_orientationIteratorPosition <= m_smallCapsIteratorPosition
&& m_orientationIteratorPosition <= m_symbolsIteratorPosition) {
m_lastSplit = m_orientationIteratorPosition;
}
if (m_smallCapsIteratorPosition <= m_scriptRunIteratorPosition
&& m_smallCapsIteratorPosition <= m_orientationIteratorPosition
&& m_smallCapsIteratorPosition <= m_symbolsIteratorPosition) {
m_lastSplit = m_smallCapsIteratorPosition;
}
if (m_symbolsIteratorPosition <= m_scriptRunIteratorPosition
&& m_symbolsIteratorPosition <= m_orientationIteratorPosition
&& m_symbolsIteratorPosition <= m_smallCapsIteratorPosition) {
m_lastSplit = m_symbolsIteratorPosition;
}
m_candidateRange.start = m_candidateRange.end;
m_candidateRange.end = m_lastSplit;
*nextRange = m_candidateRange;
m_atEnd = m_lastSplit == m_bufferSize;
return true;
}
} // namespace blink
|
Java
|
{% macro vital(addon, type) %}
<div class="vital">
{% if type in ('updated', 'created') %}
<span class="updated">
{% if type == 'updated' %}
{# L10n: {0} is a date. #}
{{ _('Updated {0}')|f(addon.last_updated|datetime) }}
{% else %}
{# L10n: {0} is a date. #}
{{ _('Added {0}')|f(addon.created|datetime) }}
{% endif %}
</span>
{% elif type in ('downloads', 'adu') %}
{% if type == 'downloads' %}
<span class="downloads adu">
{% trans cnt=addon.weekly_downloads,
num=addon.weekly_downloads|numberfmt %}
{{ num }} weekly download
{% pluralize %}
{{ num }} weekly downloads
{% endtrans %}
</span>
{% else %}
<span class="adu">
{% set adu=addon.average_daily_users %}
{% trans cnt=adu, num=adu|numberfmt %}
{{ num }} user
{% pluralize %}
{{ num }} users
{% endtrans %}
</span>
{% endif %}
{% endif %}
</div>
{% endmacro %}
{% macro addon_heading(addon, version) %}
<h1{{ addon.name|locale_html }}>
{{ addon.name }}
{% if version %}
<span class="version">{{ version.version }}</span>
{% endif %}
</h1>
{% endmacro %}
{% macro sort_vital(addon, field) %}
{% if field in ('popular', 'downloads') or not addon.show_adu() %}
<div class="adu downloads">
{% with num=addon.weekly_downloads %}
{# L10n: {0} is the number of downloads. #}
{{ ngettext('{0} weekly download', '{0} weekly downloads',
num)|f(num|numberfmt) }}
{% endwith %}
</div>
{% else %}
<div class="adu">
{% with num=addon.average_daily_users %}
{# L10n: {0} is the number of users. #}
{{ ngettext('{0} user', '{0} users', num)|f(num|numberfmt) }}
{% endwith %}
</div>
{% endif %}
{% if field in ('created', 'updated') %}
<div class="updated">
{% if field == 'created' %}
{# L10n: {0} is a date. #}
{{ _('Added {0}')|f(addon.created|datetime) }}
{% else %}
{# L10n: {0} is a date. #}
{{ _('Updated {0}')|f(addon.last_updated|datetime) }}
{% endif %}
</div>
{% endif %}
{% endmacro %}
|
Java
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_101) on Sat Aug 20 05:41:48 EDT 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Uses of Class org.apache.solr.search.Sorting (Solr 6.2.0 API)</title>
<meta name="date" content="2016-08-20">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.solr.search.Sorting (Solr 6.2.0 API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/apache/solr/search/Sorting.html" title="class in org.apache.solr.search">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/solr/search/class-use/Sorting.html" target="_top">Frames</a></li>
<li><a href="Sorting.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.apache.solr.search.Sorting" class="title">Uses of Class<br>org.apache.solr.search.Sorting</h2>
</div>
<div class="classUseContainer">No usage of org.apache.solr.search.Sorting</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/apache/solr/search/Sorting.html" title="class in org.apache.solr.search">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/solr/search/class-use/Sorting.html" target="_top">Frames</a></li>
<li><a href="Sorting.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>
<i>Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.</i>
<script src='../../../../../prettify.js' type='text/javascript'></script>
<script type='text/javascript'>
(function(){
var oldonload = window.onload;
if (typeof oldonload != 'function') {
window.onload = prettyPrint;
} else {
window.onload = function() {
oldonload();
prettyPrint();
}
}
})();
</script>
</small></p>
</body>
</html>
|
Java
|
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="lang:clipboard.copy" content="Copy to clipboard">
<meta name="lang:clipboard.copied" content="Copied to clipboard">
<meta name="lang:search.language" content="en">
<meta name="lang:search.pipeline.stopwords" content="True">
<meta name="lang:search.pipeline.trimmer" content="True">
<meta name="lang:search.result.none" content="No matching documents">
<meta name="lang:search.result.one" content="1 matching document">
<meta name="lang:search.result.other" content="# matching documents">
<meta name="lang:search.tokenizer" content="[\s\-]+">
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin="">
<link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700%7CRoboto+Mono:400,500,700&display=fallback">
<style>
body,
input {
font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif
}
code,
kbd,
pre {
font-family: "Roboto Mono", "Courier New", Courier, monospace
}
</style>
<link rel="stylesheet" href="../_static/stylesheets/application.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-palette.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-fixes.css"/>
<link rel="stylesheet" href="../_static/fonts/material-icons.css"/>
<meta name="theme-color" content="#3f51b5">
<script src="../_static/javascripts/modernizr.js"></script>
<title>statsmodels.tsa.vector_ar.svar_model.SVARResults.summary — statsmodels</title>
<link rel="icon" type="image/png" sizes="32x32" href="../_static/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="../_static/icons/favicon-16x16.png">
<link rel="manifest" href="../_static/icons/site.webmanifest">
<link rel="mask-icon" href="../_static/icons/safari-pinned-tab.svg" color="#919191">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="../_static/icons/browserconfig.xml">
<link rel="stylesheet" href="../_static/stylesheets/examples.css">
<link rel="stylesheet" href="../_static/material.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/language_data.js"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true, "ignoreClass": "document", "processClass": "math|output_area"}})</script>
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="statsmodels.tsa.vector_ar.svar_model.SVARResults.svar_ma_rep" href="statsmodels.tsa.vector_ar.svar_model.SVARResults.svar_ma_rep.html" />
<link rel="prev" title="statsmodels.tsa.vector_ar.svar_model.SVARResults.sirf_errband_mc" href="statsmodels.tsa.vector_ar.svar_model.SVARResults.sirf_errband_mc.html" />
<script src="../_static/javascripts/version_dropdown.js"></script>
<script>
var json_loc = "../_static/versions.json",
target_loc = "../../",
text = "Versions";
$( document ).ready( add_version_dropdown(json_loc, target_loc, text));
</script>
</head>
<body dir=ltr
data-md-color-primary=indigo data-md-color-accent=blue>
<svg class="md-svg">
<defs data-children-count="0">
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg>
</defs>
</svg>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search">
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
<a href="#generated/statsmodels.tsa.vector_ar.svar_model.SVARResults.summary" tabindex="1" class="md-skip"> Skip to content </a>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid">
<div class="md-flex navheader">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="../index.html" title="statsmodels"
class="md-header-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" height="26"
alt="statsmodels logo">
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
<span class="md-header-nav__topic">statsmodels 0.11.0</span>
<span class="md-header-nav__topic"> statsmodels.tsa.vector_ar.svar_model.SVARResults.summary </span>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" action="../search.html" method="GET" name="search">
<input type="text" class="md-search__input" name="q" placeholder="Search"
autocapitalize="off" autocomplete="off" spellcheck="false"
data-md-component="query" data-md-state="active">
<label class="md-icon md-search__icon" for="__search"></label>
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">

</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="result">
<div class="md-search-result__meta">
Type to start searching
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
</div>
</div>
</nav>
</header>
<div class="md-container">
<nav class="md-tabs" data-md-component="tabs">
<div class="md-tabs__inner md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item"><a href="../user-guide.html" class="md-tabs__link">User Guide</a></li>
<li class="md-tabs__item"><a href="../vector_ar.html" class="md-tabs__link">Vector Autoregressions <code class="xref py py-mod docutils literal notranslate"><span class="pre">tsa.vector_ar</span></code></a></li>
<li class="md-tabs__item"><a href="statsmodels.tsa.vector_ar.svar_model.SVARResults.html" class="md-tabs__link">statsmodels.tsa.vector_ar.svar_model.SVARResults</a></li>
</ul>
</div>
</nav>
<main class="md-main">
<div class="md-main__inner md-grid" data-md-component="container">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="__drawer">
<a href="../index.html" title="statsmodels" class="md-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" alt=" logo" width="48" height="48">
</a>
<a href="../index.html"
title="statsmodels">statsmodels 0.11.0</a>
</label>
<div class="md-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../install.html" class="md-nav__link">Installing statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../gettingstarted.html" class="md-nav__link">Getting started</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html" class="md-nav__link">User Guide</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../user-guide.html#background" class="md-nav__link">Background</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#regression-and-linear-models" class="md-nav__link">Regression and Linear Models</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#time-series-analysis" class="md-nav__link">Time Series Analysis</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../tsa.html" class="md-nav__link">Time Series analysis <code class="xref py py-mod docutils literal notranslate"><span class="pre">tsa</span></code></a>
</li>
<li class="md-nav__item">
<a href="../statespace.html" class="md-nav__link">Time Series Analysis by State Space Methods <code class="xref py py-mod docutils literal notranslate"><span class="pre">statespace</span></code></a>
</li>
<li class="md-nav__item">
<a href="../vector_ar.html" class="md-nav__link">Vector Autoregressions <code class="xref py py-mod docutils literal notranslate"><span class="pre">tsa.vector_ar</span></code></a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#other-models" class="md-nav__link">Other Models</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#statistics-and-tools" class="md-nav__link">Statistics and Tools</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#data-sets" class="md-nav__link">Data Sets</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#sandbox" class="md-nav__link">Sandbox</a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../examples/index.html" class="md-nav__link">Examples</a>
</li>
<li class="md-nav__item">
<a href="../api.html" class="md-nav__link">API Reference</a>
</li>
<li class="md-nav__item">
<a href="../about.html" class="md-nav__link">About statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../dev/index.html" class="md-nav__link">Developer Page</a>
</li>
<li class="md-nav__item">
<a href="../release/index.html" class="md-nav__link">Release Notes</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary">
<ul class="md-nav__list" data-md-scrollfix="">
<li class="md-nav__item"><a class="md-nav__extra_link" href="../_sources/generated/statsmodels.tsa.vector_ar.svar_model.SVARResults.summary.rst.txt">Show Source</a> </li>
<li id="searchbox" class="md-nav__item"></li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset" role="main">
<h1 id="generated-statsmodels-tsa-vector-ar-svar-model-svarresults-summary--page-root">statsmodels.tsa.vector_ar.svar_model.SVARResults.summary<a class="headerlink" href="#generated-statsmodels-tsa-vector-ar-svar-model-svarresults-summary--page-root" title="Permalink to this headline">¶</a></h1>
<dl class="method">
<dt id="statsmodels.tsa.vector_ar.svar_model.SVARResults.summary">
<code class="sig-prename descclassname">SVARResults.</code><code class="sig-name descname">summary</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#statsmodels.tsa.vector_ar.svar_model.SVARResults.summary" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute console output summary of estimates</p>
<dl class="field-list">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><dl>
<dt><strong>summary</strong><span class="classifier"><code class="xref py py-obj docutils literal notranslate"><span class="pre">VARSummary</span></code></span></dt><dd></dd>
</dl>
</dd>
</dl>
</dd></dl>
</article>
</div>
</div>
</main>
</div>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a href="statsmodels.tsa.vector_ar.svar_model.SVARResults.sirf_errband_mc.html" title="Material"
class="md-flex md-footer-nav__link md-footer-nav__link--prev"
rel="prev">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span
class="md-footer-nav__direction"> Previous </span> statsmodels.tsa.vector_ar.svar_model.SVARResults.sirf_errband_mc </span>
</div>
</a>
<a href="statsmodels.tsa.vector_ar.svar_model.SVARResults.svar_ma_rep.html" title="Admonition"
class="md-flex md-footer-nav__link md-footer-nav__link--next"
rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"><span
class="md-flex__ellipsis"> <span
class="md-footer-nav__direction"> Next </span> statsmodels.tsa.vector_ar.svar_model.SVARResults.svar_ma_rep </span>
</div>
<div class="md-flex__cell md-flex__cell--shrink"><i
class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
© Copyright 2009-2019, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
</div>
Last updated on
Jan 22, 2020.
<br/>
Created using
<a href="http://sphinx-doc.org/">Sphinx</a> 2.3.1.
and
<a href="https://github.com/bashtage/sphinx-material/">Material for
Sphinx</a>
</div>
</div>
</div>
</footer>
<script src="../_static/javascripts/application.js"></script>
<script>app.initialize({version: "1.0.4", url: {base: ".."}})</script>
</body>
</html>
|
Java
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="lang:clipboard.copy" content="Copy to clipboard">
<meta name="lang:clipboard.copied" content="Copied to clipboard">
<meta name="lang:search.language" content="en">
<meta name="lang:search.pipeline.stopwords" content="True">
<meta name="lang:search.pipeline.trimmer" content="True">
<meta name="lang:search.result.none" content="No matching documents">
<meta name="lang:search.result.one" content="1 matching document">
<meta name="lang:search.result.other" content="# matching documents">
<meta name="lang:search.tokenizer" content="[\s\-]+">
<link href="https://fonts.gstatic.com/" rel="preconnect" crossorigin>
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:300,400,400i,700&display=fallback" rel="stylesheet">
<style>
body,
input {
font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif
}
code,
kbd,
pre {
font-family: "Roboto Mono", "Courier New", Courier, monospace
}
</style>
<link rel="stylesheet" href="../_static/stylesheets/application.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-palette.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-fixes.css"/>
<link rel="stylesheet" href="../_static/fonts/material-icons.css"/>
<meta name="theme-color" content="#3f51b5">
<script src="../_static/javascripts/modernizr.js"></script>
<title>statsmodels.discrete.discrete_model.CountResults.llf — statsmodels</title>
<link rel="icon" type="image/png" sizes="32x32" href="../_static/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="../_static/icons/favicon-16x16.png">
<link rel="manifest" href="../_static/icons/site.webmanifest">
<link rel="mask-icon" href="../_static/icons/safari-pinned-tab.svg" color="#919191">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="../_static/icons/browserconfig.xml">
<link rel="stylesheet" href="../_static/stylesheets/examples.css">
<link rel="stylesheet" href="../_static/stylesheets/deprecation.css">
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../_static/material.css" />
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
<link rel="stylesheet" type="text/css" href="../_static/plot_directive.css" />
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="statsmodels.discrete.discrete_model.CountResults.llnull" href="statsmodels.discrete.discrete_model.CountResults.llnull.html" />
<link rel="prev" title="statsmodels.discrete.discrete_model.CountResults.fittedvalues" href="statsmodels.discrete.discrete_model.CountResults.fittedvalues.html" />
</head>
<body dir=ltr
data-md-color-primary=indigo data-md-color-accent=blue>
<svg class="md-svg">
<defs data-children-count="0">
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg>
</defs>
</svg>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search">
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
<a href="#generated/statsmodels.discrete.discrete_model.CountResults.llf" tabindex="1" class="md-skip"> Skip to content </a>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid">
<div class="md-flex navheader">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="../index.html" title="statsmodels"
class="md-header-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" height="26"
alt="statsmodels logo">
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
<span class="md-header-nav__topic">statsmodels v0.13.0</span>
<span class="md-header-nav__topic"> statsmodels.discrete.discrete_model.CountResults.llf </span>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" action="../search.html" method="get" name="search">
<input type="text" class="md-search__input" name="q" placeholder="Search"
autocapitalize="off" autocomplete="off" spellcheck="false"
data-md-component="query" data-md-state="active">
<label class="md-icon md-search__icon" for="__search"></label>
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">

</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="result">
<div class="md-search-result__meta">
Type to start searching
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
</div>
<script src="../_static/javascripts/version_dropdown.js"></script>
<script>
var json_loc = "../../versions-v2.json",
target_loc = "../../",
text = "Versions";
$( document ).ready( add_version_dropdown(json_loc, target_loc, text));
</script>
</div>
</nav>
</header>
<div class="md-container">
<nav class="md-tabs" data-md-component="tabs">
<div class="md-tabs__inner md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item"><a href="../user-guide.html" class="md-tabs__link">User Guide</a></li>
<li class="md-tabs__item"><a href="../discretemod.html" class="md-tabs__link">Regression with Discrete Dependent Variable</a></li>
<li class="md-tabs__item"><a href="statsmodels.discrete.discrete_model.CountResults.html" class="md-tabs__link">statsmodels.discrete.discrete_model.CountResults</a></li>
</ul>
</div>
</nav>
<main class="md-main">
<div class="md-main__inner md-grid" data-md-component="container">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="__drawer">
<a href="../index.html" title="statsmodels" class="md-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" alt=" logo" width="48" height="48">
</a>
<a href="../index.html"
title="statsmodels">statsmodels v0.13.0</a>
</label>
<div class="md-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../install.html" class="md-nav__link">Installing statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../gettingstarted.html" class="md-nav__link">Getting started</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html" class="md-nav__link">User Guide</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../user-guide.html#background" class="md-nav__link">Background</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#regression-and-linear-models" class="md-nav__link">Regression and Linear Models</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../regression.html" class="md-nav__link">Linear Regression</a>
</li>
<li class="md-nav__item">
<a href="../glm.html" class="md-nav__link">Generalized Linear Models</a>
</li>
<li class="md-nav__item">
<a href="../gee.html" class="md-nav__link">Generalized Estimating Equations</a>
</li>
<li class="md-nav__item">
<a href="../gam.html" class="md-nav__link">Generalized Additive Models (GAM)</a>
</li>
<li class="md-nav__item">
<a href="../rlm.html" class="md-nav__link">Robust Linear Models</a>
</li>
<li class="md-nav__item">
<a href="../mixed_linear.html" class="md-nav__link">Linear Mixed Effects Models</a>
</li>
<li class="md-nav__item">
<a href="../discretemod.html" class="md-nav__link">Regression with Discrete Dependent Variable</a>
</li>
<li class="md-nav__item">
<a href="../mixed_glm.html" class="md-nav__link">Generalized Linear Mixed Effects Models</a>
</li>
<li class="md-nav__item">
<a href="../anova.html" class="md-nav__link">ANOVA</a>
</li>
<li class="md-nav__item">
<a href="../other_models.html" class="md-nav__link">Other Models <code class="xref py py-mod docutils literal notranslate"><span class="pre">othermod</span></code></a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#time-series-analysis" class="md-nav__link">Time Series Analysis</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#other-models" class="md-nav__link">Other Models</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#statistics-and-tools" class="md-nav__link">Statistics and Tools</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#data-sets" class="md-nav__link">Data Sets</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#sandbox" class="md-nav__link">Sandbox</a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../examples/index.html" class="md-nav__link">Examples</a>
</li>
<li class="md-nav__item">
<a href="../api.html" class="md-nav__link">API Reference</a>
</li>
<li class="md-nav__item">
<a href="../about.html" class="md-nav__link">About statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../dev/index.html" class="md-nav__link">Developer Page</a>
</li>
<li class="md-nav__item">
<a href="../release/index.html" class="md-nav__link">Release Notes</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary">
<ul class="md-nav__list" data-md-scrollfix="">
<li class="md-nav__item"><a class="md-nav__extra_link" href="../_sources/generated/statsmodels.discrete.discrete_model.CountResults.llf.rst.txt">Show Source</a> </li>
<li id="searchbox" class="md-nav__item"></li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset" role="main">
<h1 id="generated-statsmodels-discrete-discrete-model-countresults-llf--page-root">statsmodels.discrete.discrete_model.CountResults.llf<a class="headerlink" href="#generated-statsmodels-discrete-discrete-model-countresults-llf--page-root" title="Permalink to this headline">¶</a></h1>
<dl class="py attribute">
<dt class="sig sig-object py" id="statsmodels.discrete.discrete_model.CountResults.llf">
<span class="sig-prename descclassname"><span class="pre">CountResults.</span></span><span class="sig-name descname"><span class="pre">llf</span></span><a class="headerlink" href="#statsmodels.discrete.discrete_model.CountResults.llf" title="Permalink to this definition">¶</a></dt>
<dd><p>Log-likelihood of model</p>
</dd></dl>
</article>
</div>
</div>
</main>
</div>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a href="statsmodels.discrete.discrete_model.CountResults.fittedvalues.html" title="statsmodels.discrete.discrete_model.CountResults.fittedvalues"
class="md-flex md-footer-nav__link md-footer-nav__link--prev"
rel="prev">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span
class="md-footer-nav__direction"> Previous </span> statsmodels.discrete.discrete_model.CountResults.fittedvalues </span>
</div>
</a>
<a href="statsmodels.discrete.discrete_model.CountResults.llnull.html" title="statsmodels.discrete.discrete_model.CountResults.llnull"
class="md-flex md-footer-nav__link md-footer-nav__link--next"
rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"><span
class="md-flex__ellipsis"> <span
class="md-footer-nav__direction"> Next </span> statsmodels.discrete.discrete_model.CountResults.llnull </span>
</div>
<div class="md-flex__cell md-flex__cell--shrink"><i
class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
© Copyright 2009-2019, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
</div>
Last updated on
Oct 06, 2021.
<br/>
Created using
<a href="http://www.sphinx-doc.org/">Sphinx</a> 4.0.3.
and
<a href="https://github.com/bashtage/sphinx-material/">Material for
Sphinx</a>
</div>
</div>
</div>
</footer>
<script src="../_static/javascripts/application.js"></script>
<script>app.initialize({version: "1.0.4", url: {base: ".."}})</script>
</body>
</html>
|
Java
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>statsmodels.genmod.families.family.InverseGaussian.loglike — statsmodels 0.9.0 documentation</title>
<link rel="stylesheet" href="../_static/nature.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="shortcut icon" href="../_static/statsmodels_hybi_favico.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="statsmodels.genmod.families.family.InverseGaussian.loglike_obs" href="statsmodels.genmod.families.family.InverseGaussian.loglike_obs.html" />
<link rel="prev" title="statsmodels.genmod.families.family.InverseGaussian.fitted" href="statsmodels.genmod.families.family.InverseGaussian.fitted.html" />
<link rel="stylesheet" href="../_static/examples.css" type="text/css" />
<link rel="stylesheet" href="../_static/facebox.css" type="text/css" />
<script type="text/javascript" src="../_static/scripts.js">
</script>
<script type="text/javascript" src="../_static/facebox.js">
</script>
<script type="text/javascript">
$.facebox.settings.closeImage = "../_static/closelabel.png"
$.facebox.settings.loadingImage = "../_static/loading.gif"
</script>
</head><body>
<div class="headerwrap">
<div class = "header">
<a href = "../index.html">
<img src="../_static/statsmodels_hybi_banner.png" alt="Logo"
style="padding-left: 15px"/></a>
</div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="statsmodels.genmod.families.family.InverseGaussian.loglike_obs.html" title="statsmodels.genmod.families.family.InverseGaussian.loglike_obs"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="statsmodels.genmod.families.family.InverseGaussian.fitted.html" title="statsmodels.genmod.families.family.InverseGaussian.fitted"
accesskey="P">previous</a> |</li>
<li><a href ="../install.html">Install</a></li> |
<li><a href="https://groups.google.com/forum/?hl=en#!forum/pystatsmodels">Support</a></li> |
<li><a href="https://github.com/statsmodels/statsmodels/issues">Bugs</a></li> |
<li><a href="../dev/index.html">Develop</a></li> |
<li><a href="../examples/index.html">Examples</a></li> |
<li><a href="../faq.html">FAQ</a></li> |
<li class="nav-item nav-item-1"><a href="../glm.html" >Generalized Linear Models</a> |</li>
<li class="nav-item nav-item-2"><a href="statsmodels.genmod.families.family.InverseGaussian.html" accesskey="U">statsmodels.genmod.families.family.InverseGaussian</a> |</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="statsmodels-genmod-families-family-inversegaussian-loglike">
<h1>statsmodels.genmod.families.family.InverseGaussian.loglike<a class="headerlink" href="#statsmodels-genmod-families-family-inversegaussian-loglike" title="Permalink to this headline">¶</a></h1>
<dl class="method">
<dt id="statsmodels.genmod.families.family.InverseGaussian.loglike">
<code class="descclassname">InverseGaussian.</code><code class="descname">loglike</code><span class="sig-paren">(</span><em>endog</em>, <em>mu</em>, <em>var_weights=1.0</em>, <em>freq_weights=1.0</em>, <em>scale=1.0</em><span class="sig-paren">)</span><a class="headerlink" href="#statsmodels.genmod.families.family.InverseGaussian.loglike" title="Permalink to this definition">¶</a></dt>
<dd><p>The log-likelihood function in terms of the fitted mean response.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>endog</strong> (<em>array</em>) – Usually the endogenous response variable.</li>
<li><strong>mu</strong> (<em>array</em>) – Usually but not always the fitted mean response variable.</li>
<li><strong>var_weights</strong> (<em>array-like</em>) – 1d array of variance (analytic) weights. The default is 1.</li>
<li><strong>freq_weights</strong> (<em>array-like</em>) – 1d array of frequency weights. The default is 1.</li>
<li><strong>scale</strong> (<em>float</em>) – The scale parameter. The default is 1.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>ll</strong> – The value of the loglikelihood evaluated at
(endog, mu, var_weights, freq_weights, scale) as defined below.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">float</p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<p>Where <span class="math notranslate nohighlight">\(ll_i\)</span> is the by-observation log-likelihood:</p>
<div class="math notranslate nohighlight">
\[ll = \sum(ll_i * freq\_weights_i)\]</div>
<p><code class="docutils literal notranslate"><span class="pre">ll_i</span></code> is defined for each family. endog and mu are not restricted
to <code class="docutils literal notranslate"><span class="pre">endog</span></code> and <code class="docutils literal notranslate"><span class="pre">mu</span></code> respectively. For instance, you could call
both <code class="docutils literal notranslate"><span class="pre">loglike(endog,</span> <span class="pre">endog)</span></code> and <code class="docutils literal notranslate"><span class="pre">loglike(endog,</span> <span class="pre">mu)</span></code> to get the
log-likelihood ratio.</p>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="statsmodels.genmod.families.family.InverseGaussian.fitted.html"
title="previous chapter">statsmodels.genmod.families.family.InverseGaussian.fitted</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="statsmodels.genmod.families.family.InverseGaussian.loglike_obs.html"
title="next chapter">statsmodels.genmod.families.family.InverseGaussian.loglike_obs</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/generated/statsmodels.genmod.families.family.InverseGaussian.loglike.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer" role="contentinfo">
© Copyright 2009-2017, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.4.
</div>
</body>
</html>
|
Java
|
<?php
return [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=campus_rec',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
];
|
Java
|
require_dependency 'spree/calculator'
module Spree
class PaymentCalculator::PerItem < Calculator
preference :amount, :decimal, :default => 0
attr_accessible :preferred_amount
def self.description
I18n.t(:flat_rate_per_item)
end
def compute(object=nil)
return 0 if object.nil?
self.preferred_amount * object.line_items.reduce(0) do |sum, value|
if !matching_products || matching_products.include?(value.product)
value_to_add = value.quantity
else
value_to_add = 0
end
sum + value_to_add
end
end
# Returns all products that match this calculator, but only if the calculator
# is attached to a promotion. If attached to a ShippingMethod, nil is returned.
def matching_products
# Regression check for #1596
# Calculator::PerItem can be used in two cases.
# The first is in a typical promotion, providing a discount per item of a particular item
# The second is a ShippingMethod, where it applies to an entire order
#
# Shipping methods do not have promotions attached, but promotions do
# Therefore we must check for promotions
if self.calculable.respond_to?(:promotion)
self.calculable.promotion.rules.map(&:products).flatten
end
end
end
end
|
Java
|
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: SubFormTest.php 24594 2012-01-05 21:27:01Z matthew $
*/
// Call Zend_Dojo_Form_SubFormTest::main() if this source file is executed directly.
if (!defined("PHPUnit_MAIN_METHOD")) {
define("PHPUnit_MAIN_METHOD", "Zend_Dojo_Form_SubFormTest::main");
}
/** Zend_Dojo_Form_SubForm */
require_once 'Zend/Dojo/Form/SubForm.php';
/** Zend_View */
require_once 'Zend/View.php';
/**
* Test class for Zend_Dojo_SubForm
*
* @category Zend
* @package Zend_Dojo
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @group Zend_Dojo
* @group Zend_Dojo_Form
*/
class Zend_Dojo_Form_SubFormTest extends PHPUnit_Framework_TestCase
{
/**
* Runs the test methods of this class.
*
* @return void
*/
public static function main()
{
$suite = new PHPUnit_Framework_TestSuite("Zend_Dojo_Form_SubFormTest");
$result = PHPUnit_TextUI_TestRunner::run($suite);
}
/**
* Sets up the fixture, for example, open a network connection.
* This method is called before a test is executed.
*
* @return void
*/
public function setUp()
{
$this->form = new Zend_Dojo_Form_SubForm();
$this->form->addElement('TextBox', 'foo')
->addDisplayGroup(array('foo'), 'dg')
->setView(new Zend_View());
}
/**
* Tears down the fixture, for example, close a network connection.
* This method is called after a test is executed.
*
* @return void
*/
public function tearDown()
{
}
public function testDojoFormDecoratorPathShouldBeRegisteredByDefault()
{
$paths = $this->form->getPluginLoader('decorator')->getPaths('Zend_Dojo_Form_Decorator');
$this->assertTrue(is_array($paths));
}
public function testDojoFormElementPathShouldBeRegisteredByDefault()
{
$paths = $this->form->getPluginLoader('element')->getPaths('Zend_Dojo_Form_Element');
$this->assertTrue(is_array($paths));
}
public function testDojoFormElementDecoratorPathShouldBeRegisteredByDefault()
{
$paths = $this->form->foo->getPluginLoader('decorator')->getPaths('Zend_Dojo_Form_Decorator');
$this->assertTrue(is_array($paths));
}
public function testDojoFormDisplayGroupDecoratorPathShouldBeRegisteredByDefault()
{
$paths = $this->form->dg->getPluginLoader()->getPaths('Zend_Dojo_Form_Decorator');
$this->assertTrue(is_array($paths));
}
public function testDefaultDisplayGroupClassShouldBeDojoDisplayGroupByDefault()
{
$this->assertEquals('Zend_Dojo_Form_DisplayGroup', $this->form->getDefaultDisplayGroupClass());
}
public function testDefaultDecoratorsShouldIncludeContentPane()
{
$this->assertNotNull($this->form->getDecorator('ContentPane'));
}
public function testShouldRegisterDojoViewHelperPath()
{
$view = $this->form->getView();
$loader = $view->getPluginLoader('helper');
$paths = $loader->getPaths('Zend_Dojo_View_Helper');
$this->assertTrue(is_array($paths));
}
}
// Call Zend_Dojo_Form_SubFormTest::main() if this source file is executed directly.
if (PHPUnit_MAIN_METHOD == "Zend_Dojo_Form_SubFormTest::main") {
Zend_Dojo_Form_SubFormTest::main();
}
|
Java
|
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="lang:clipboard.copy" content="Copy to clipboard">
<meta name="lang:clipboard.copied" content="Copied to clipboard">
<meta name="lang:search.language" content="en">
<meta name="lang:search.pipeline.stopwords" content="True">
<meta name="lang:search.pipeline.trimmer" content="True">
<meta name="lang:search.result.none" content="No matching documents">
<meta name="lang:search.result.one" content="1 matching document">
<meta name="lang:search.result.other" content="# matching documents">
<meta name="lang:search.tokenizer" content="[\s\-]+">
<link href="https://fonts.gstatic.com/" rel="preconnect" crossorigin>
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:300,400,400i,700&display=fallback" rel="stylesheet">
<style>
body,
input {
font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif
}
code,
kbd,
pre {
font-family: "Roboto Mono", "Courier New", Courier, monospace
}
</style>
<link rel="stylesheet" href="../_static/stylesheets/application.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-palette.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-fixes.css"/>
<link rel="stylesheet" href="../_static/fonts/material-icons.css"/>
<meta name="theme-color" content="#3f51b5">
<script src="../_static/javascripts/modernizr.js"></script>
<title>statsmodels.sandbox.regression.gmm.IVGMMResults.summary — statsmodels</title>
<link rel="icon" type="image/png" sizes="32x32" href="../_static/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="../_static/icons/favicon-16x16.png">
<link rel="manifest" href="../_static/icons/site.webmanifest">
<link rel="mask-icon" href="../_static/icons/safari-pinned-tab.svg" color="#919191">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="../_static/icons/browserconfig.xml">
<link rel="stylesheet" href="../_static/stylesheets/examples.css">
<link rel="stylesheet" href="../_static/material.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/language_data.js"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
<script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true, "ignoreClass": "document", "processClass": "math|output_area"}})</script>
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="statsmodels.sandbox.regression.gmm.IVGMMResults.t_test" href="statsmodels.sandbox.regression.gmm.IVGMMResults.t_test.html" />
<link rel="prev" title="statsmodels.sandbox.regression.gmm.IVGMMResults.save" href="statsmodels.sandbox.regression.gmm.IVGMMResults.save.html" />
<script src="../_static/javascripts/version_dropdown.js"></script>
<script>
var json_loc = "../_static/versions.json",
target_loc = "../../",
text = "Versions";
$( document ).ready( add_version_dropdown(json_loc, target_loc, text));
</script>
</head>
<body dir=ltr
data-md-color-primary=indigo data-md-color-accent=blue>
<svg class="md-svg">
<defs data-children-count="0">
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg>
</defs>
</svg>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search">
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
<a href="#generated/statsmodels.sandbox.regression.gmm.IVGMMResults.summary" tabindex="1" class="md-skip"> Skip to content </a>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid">
<div class="md-flex navheader">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="../index.html" title="statsmodels"
class="md-header-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" height="26"
alt="statsmodels logo">
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
<span class="md-header-nav__topic">statsmodels v0.11.1</span>
<span class="md-header-nav__topic"> statsmodels.sandbox.regression.gmm.IVGMMResults.summary </span>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" action="../search.html" method="GET" name="search">
<input type="text" class="md-search__input" name="q" placeholder="Search"
autocapitalize="off" autocomplete="off" spellcheck="false"
data-md-component="query" data-md-state="active">
<label class="md-icon md-search__icon" for="__search"></label>
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">

</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="result">
<div class="md-search-result__meta">
Type to start searching
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
</div>
</div>
</nav>
</header>
<div class="md-container">
<nav class="md-tabs" data-md-component="tabs">
<div class="md-tabs__inner md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item"><a href="../user-guide.html" class="md-tabs__link">User Guide</a></li>
<li class="md-tabs__item"><a href="../gmm.html" class="md-tabs__link">Generalized Method of Moments <code class="xref py py-mod docutils literal notranslate"><span class="pre">gmm</span></code></a></li>
<li class="md-tabs__item"><a href="statsmodels.sandbox.regression.gmm.IVGMMResults.html" class="md-tabs__link">statsmodels.sandbox.regression.gmm.IVGMMResults</a></li>
</ul>
</div>
</nav>
<main class="md-main">
<div class="md-main__inner md-grid" data-md-component="container">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="__drawer">
<a href="../index.html" title="statsmodels" class="md-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" alt=" logo" width="48" height="48">
</a>
<a href="../index.html"
title="statsmodels">statsmodels v0.11.1</a>
</label>
<div class="md-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../install.html" class="md-nav__link">Installing statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../gettingstarted.html" class="md-nav__link">Getting started</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html" class="md-nav__link">User Guide</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../user-guide.html#background" class="md-nav__link">Background</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#regression-and-linear-models" class="md-nav__link">Regression and Linear Models</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#time-series-analysis" class="md-nav__link">Time Series Analysis</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#other-models" class="md-nav__link">Other Models</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../duration.html" class="md-nav__link">Methods for Survival and Duration Analysis</a>
</li>
<li class="md-nav__item">
<a href="../nonparametric.html" class="md-nav__link">Nonparametric Methods <code class="xref py py-mod docutils literal notranslate"><span class="pre">nonparametric</span></code></a>
</li>
<li class="md-nav__item">
<a href="../gmm.html" class="md-nav__link">Generalized Method of Moments <code class="xref py py-mod docutils literal notranslate"><span class="pre">gmm</span></code></a>
</li>
<li class="md-nav__item">
<a href="../miscmodels.html" class="md-nav__link">Other Models <code class="xref py py-mod docutils literal notranslate"><span class="pre">miscmodels</span></code></a>
</li>
<li class="md-nav__item">
<a href="../multivariate.html" class="md-nav__link">Multivariate Statistics <code class="xref py py-mod docutils literal notranslate"><span class="pre">multivariate</span></code></a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#statistics-and-tools" class="md-nav__link">Statistics and Tools</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#data-sets" class="md-nav__link">Data Sets</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#sandbox" class="md-nav__link">Sandbox</a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../examples/index.html" class="md-nav__link">Examples</a>
</li>
<li class="md-nav__item">
<a href="../api.html" class="md-nav__link">API Reference</a>
</li>
<li class="md-nav__item">
<a href="../about.html" class="md-nav__link">About statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../dev/index.html" class="md-nav__link">Developer Page</a>
</li>
<li class="md-nav__item">
<a href="../release/index.html" class="md-nav__link">Release Notes</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary">
<ul class="md-nav__list" data-md-scrollfix="">
<li class="md-nav__item"><a class="md-nav__extra_link" href="../_sources/generated/statsmodels.sandbox.regression.gmm.IVGMMResults.summary.rst.txt">Show Source</a> </li>
<li id="searchbox" class="md-nav__item"></li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset" role="main">
<h1 id="generated-statsmodels-sandbox-regression-gmm-ivgmmresults-summary--page-root">statsmodels.sandbox.regression.gmm.IVGMMResults.summary<a class="headerlink" href="#generated-statsmodels-sandbox-regression-gmm-ivgmmresults-summary--page-root" title="Permalink to this headline">¶</a></h1>
<dl class="method">
<dt id="statsmodels.sandbox.regression.gmm.IVGMMResults.summary">
<code class="sig-prename descclassname">IVGMMResults.</code><code class="sig-name descname">summary</code><span class="sig-paren">(</span><em class="sig-param">yname=None</em>, <em class="sig-param">xname=None</em>, <em class="sig-param">title=None</em>, <em class="sig-param">alpha=0.05</em><span class="sig-paren">)</span><a class="headerlink" href="#statsmodels.sandbox.regression.gmm.IVGMMResults.summary" title="Permalink to this definition">¶</a></dt>
<dd><p>Summarize the Regression Results</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl>
<dt><strong>yname</strong><span class="classifier"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><code class="docutils literal notranslate"><span class="pre">str</span></code></a>, <code class="xref py py-obj docutils literal notranslate"><span class="pre">optional</span></code></span></dt><dd><p>Default is <cite>y</cite></p>
</dd>
<dt><strong>xname</strong><span class="classifier"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.8)"><code class="docutils literal notranslate"><span class="pre">list</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><code class="docutils literal notranslate"><span class="pre">str</span></code></a>], <code class="xref py py-obj docutils literal notranslate"><span class="pre">optional</span></code></span></dt><dd><p>Default is <cite>var_##</cite> for ## in p the number of regressors</p>
</dd>
<dt><strong>title</strong><span class="classifier"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><code class="docutils literal notranslate"><span class="pre">str</span></code></a>, <code class="xref py py-obj docutils literal notranslate"><span class="pre">optional</span></code></span></dt><dd><p>Title for the top table. If not None, then this replaces the
default title</p>
</dd>
<dt><strong>alpha</strong><span class="classifier"><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.8)"><code class="docutils literal notranslate"><span class="pre">float</span></code></a></span></dt><dd><p>significance level for the confidence intervals</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl>
<dt><strong>smry</strong><span class="classifier"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Summary</span></code> <code class="xref py py-obj docutils literal notranslate"><span class="pre">instance</span></code></span></dt><dd><p>this holds the summary tables and text, which can be printed or
converted to various output formats.</p>
</dd>
</dl>
</dd>
</dl>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="statsmodels.iolib.summary.Summary.html#statsmodels.iolib.summary.Summary" title="statsmodels.iolib.summary.Summary"><code class="xref py py-obj docutils literal notranslate"><span class="pre">statsmodels.iolib.summary.Summary</span></code></a></dt><dd><p>class to hold summary results</p>
</dd>
</dl>
</div>
</dd></dl>
</article>
</div>
</div>
</main>
</div>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a href="statsmodels.sandbox.regression.gmm.IVGMMResults.save.html" title="Material"
class="md-flex md-footer-nav__link md-footer-nav__link--prev"
rel="prev">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span
class="md-footer-nav__direction"> Previous </span> statsmodels.sandbox.regression.gmm.IVGMMResults.save </span>
</div>
</a>
<a href="statsmodels.sandbox.regression.gmm.IVGMMResults.t_test.html" title="Admonition"
class="md-flex md-footer-nav__link md-footer-nav__link--next"
rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"><span
class="md-flex__ellipsis"> <span
class="md-footer-nav__direction"> Next </span> statsmodels.sandbox.regression.gmm.IVGMMResults.t_test </span>
</div>
<div class="md-flex__cell md-flex__cell--shrink"><i
class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
© Copyright 2009-2019, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
</div>
Last updated on
Feb 21, 2020.
<br/>
Created using
<a href="http://www.sphinx-doc.org/">Sphinx</a> 2.4.2.
and
<a href="https://github.com/bashtage/sphinx-material/">Material for
Sphinx</a>
</div>
</div>
</div>
</footer>
<script src="../_static/javascripts/application.js"></script>
<script>app.initialize({version: "1.0.4", url: {base: ".."}})</script>
</body>
</html>
|
Java
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.