text string | size int64 | token_count int64 |
|---|---|---|
#include <CPVFramework/Utility/SharedStringBuilder.hpp>
namespace cpv {
namespace {
/** Get max string size of integer, doesn't include zero terminator */
template <class IntType>
constexpr std::size_t getMaxStringSize(std::size_t base) {
IntType max = std::numeric_limits<IntType>::max();
std::size_t result = 1; // the first digit
if (std::numeric_limits<IntType>::is_signed) {
++result; // the sign
}
while (static_cast<std::make_unsigned_t<IntType>>(max) >= base) {
++result;
max /= base;
}
return result;
}
/** For appending integer */
static const char DecimalDigits[] = "0123456789";
/** Remove tailing zero for string converted from double and append to builder */
template <class CharType>
void trimTailingZeroAndAppend(
BasicSharedStringBuilder<CharType>& builder, const char* data, std::size_t size) {
const char* end = data + size;
while (data < end && *(end - 1) == '0') {
--end;
}
if (data < end && *(end - 1) == '.') {
--end;
} else {
bool constantsDot = false;
for (const char* begin = data; begin < end; ++begin) {
constantsDot |= (*begin == '.');
}
if (!constantsDot) {
end = data + size; // should not trim 12300 to 123
}
}
CharType* ptr = builder.grow(end - data);
while (data < end) {
*ptr++ = static_cast<CharType>(*data++);
}
}
}
/** Append string representation of signed integer to end */
template <class CharType>
BasicSharedStringBuilder<CharType>&
BasicSharedStringBuilder<CharType>::appendImpl(std::intmax_t value) {
static const constexpr std::size_t MaxSize = getMaxStringSize<std::intmax_t>(10);
CharType* ptr = grow(MaxSize);
if (value < 0) {
*ptr++ = '-';
}
CharType* ptrStart = ptr;
do {
int rem = value % 10;
value /= 10;
*ptr++ = static_cast<CharType>(DecimalDigits[rem >= 0 ? rem : -rem]);
} while (value != 0);
std::reverse(ptrStart, ptr);
size_ = static_cast<std::size_t>(ptr - buffer_.data());
return *this;
}
/** Append string representation of unsigned integer to end */
template <class CharType>
BasicSharedStringBuilder<CharType>&
BasicSharedStringBuilder<CharType>::appendImpl(std::uintmax_t value) {
static const constexpr std::size_t MaxSize = getMaxStringSize<std::uintmax_t>(10);
CharType* ptr = grow(MaxSize);
CharType* ptrStart = ptr;
do {
unsigned int rem = value % 10;
value /= 10;
*ptr++ = static_cast<CharType>(DecimalDigits[rem]);
} while (value != 0);
std::reverse(ptrStart, ptr);
size_ = static_cast<std::size_t>(ptr - buffer_.data());
return *this;
}
/** Append string representation of double to end */
template <class CharType>
BasicSharedStringBuilder<CharType>&
BasicSharedStringBuilder<CharType>::appendImpl(double value) {
// to_chars for float is not available in gcc 9, use snprintf now
thread_local static std::array<char, 512> buffer;
int size = std::snprintf(buffer.data(), buffer.size(), "%lf", value);
if (CPV_LIKELY(size > 0)) {
trimTailingZeroAndAppend(*this, buffer.data(), size);
} else {
std::string str = std::to_string(value);
trimTailingZeroAndAppend(*this, str.data(), str.size());
}
return *this;
}
/** Append string representation of long double to end */
template <class CharType>
BasicSharedStringBuilder<CharType>&
BasicSharedStringBuilder<CharType>::appendImpl(long double value) {
// to_chars for float is not available in gcc 9, use snprintf now
thread_local static std::array<char, 1024> buffer;
int size = std::snprintf(buffer.data(), buffer.size(), "%Lf", value);
if (CPV_LIKELY(size > 0)) {
trimTailingZeroAndAppend(*this, buffer.data(), size);
} else {
std::string str = std::to_string(value);
trimTailingZeroAndAppend(*this, str.data(), str.size());
}
return *this;
}
// Template instatiations
template class BasicSharedStringBuilder<char>;
}
| 3,907 | 1,480 |
#include "WindowSum.hpp"
template <>
void SFWindowSum<3>::feedComm(eigen::CColX &buffer, int &row) const {
if (mStiffR.rows() > 0) {
buffer.block(row, 0, mStiffR.size(), 1).real() =
Eigen::Map<const eigen::RColX>(mStiffR.data(),
mStiffR.size());
row += mStiffR.size();
} else if (mStiff.rows() > 0) {
buffer.block(row, 0, mStiff.size(), 1) =
Eigen::Map<const eigen::CColX>(mStiff.data(),
mStiff.size());
row += mStiff.size();
} else {
throw std::runtime_error("SolidWindowSum::feedComm || Buffer allocation failed.");
}
};
template <>
void SFWindowSum<1>::feedComm(eigen::CColX &buffer, int &row) const {
if (mStiffR.rows() > 0) {
buffer.block(row, 0, mStiffR.rows(), 1).real() = mStiffR;
row += mStiffR.rows();
} else if (mStiff.rows() > 0) {
buffer.block(row, 0, mStiff.rows(), 1) = mStiff;
row += mStiff.rows();
} else {
throw std::runtime_error("FluidWindowSum::feedComm || Buffer allocation failed.");
}
};
template <>
void SFWindowSum<3>::extractComm(const eigen::CColX &buffer, int &row) {
if (mStiffR.rows() > 0) {
mStiffR +=
Eigen::Map<const CMat>(&buffer(row), mStiffR.rows(), 3).real();
row += mStiffR.size();
} else if (mStiff.rows() > 0) {
mStiff +=
Eigen::Map<const CMat>(&buffer(row), mStiff.rows(), 3);
row += mStiff.size();
} else {
throw std::runtime_error("SolidWindowSum::extractComm || Buffer allocation failed.");
}
};
template <>
void SFWindowSum<1>::extractComm(const eigen::CColX &buffer, int &row) {
if (mStiffR.rows() > 0) {
mStiffR += buffer.block(row, 0, mStiffR.rows(), 1).real();
row += mStiffR.rows();
} else if (mStiff.rows() > 0) {
mStiff += buffer.block(row, 0, mStiff.rows(), 1);
row += mStiff.rows();
} else {
throw std::runtime_error("FluidWindowSum::extractComm || Buffer allocation failed.");
}
};
| 2,078 | 747 |
// Copyright (C) 1997 Microsoft Corporation
//
// welcome page
//
// 12-15-97 sburns
#include "headers.hxx"
#include "page.hpp"
#include "WelcomePage.hpp"
#include "resource.h"
#include "common.hpp"
#include "state.hpp"
WelcomePage::WelcomePage()
:
DCPromoWizardPage(
IDD_WELCOME,
IDS_WELCOME_PAGE_TITLE,
IDS_WELCOME_PAGE_SUBTITLE,
false)
{
LOG_CTOR(WelcomePage);
}
WelcomePage::~WelcomePage()
{
LOG_DTOR(WelcomePage);
}
// NTRAID#NTBUG9-510384-2002/01/22-sburns
bool
WelcomePage::OnNotify(
HWND /* windowFrom */ ,
UINT_PTR controlIDFrom,
UINT code,
LPARAM /* lParam */ )
{
// LOG_FUNCTION(WelcomePage::OnNotify);
bool result = false;
switch (code)
{
case NM_CLICK:
case NM_RETURN:
{
switch (controlIDFrom)
{
case IDC_PRIMER_LINK:
{
Win::HtmlHelp(
hwnd,
L"adconcepts.chm::/sag_AD_DCInstallTopNode.htm",
HH_DISPLAY_TOPIC,
0);
result = true;
break;
}
default:
{
// do nothing
break;
}
}
}
default:
{
// do nothing
break;
}
}
return result;
}
void
WelcomePage::OnInit()
{
LOG_FUNCTION(WelcomePage::OnInit);
SetLargeFont(hwnd, IDC_BIG_BOLD_TITLE);
Win::PropSheet_SetTitle(
Win::GetParent(hwnd),
0,
String::load(IDS_WIZARD_TITLE));
State& state = State::GetInstance();
int intro1TextId = IDS_INTRO1_INSTALL;
String intro2Text;
switch (state.GetRunContext())
{
case State::NT5_DC:
{
intro1TextId = IDS_INTRO1_DEMOTE;
intro2Text = String::load(IDS_INTRO2_DEMOTE);
// no readme for demote.
Win::ShowWindow(Win::GetDlgItem(hwnd, IDC_PRIMER_LINK), SW_HIDE);
break;
}
case State::NT5_STANDALONE_SERVER:
case State::NT5_MEMBER_SERVER:
{
intro2Text = String::load(IDS_INTRO2_INSTALL);
break;
}
case State::BDC_UPGRADE:
{
intro1TextId = IDS_INTRO1_DC_UPGRADE;
intro2Text = String::load(IDS_INTRO2_BDC_UPGRADE);
break;
}
case State::PDC_UPGRADE:
{
intro1TextId = IDS_INTRO1_DC_UPGRADE;
intro2Text =
String::format(
IDS_INTRO2_PDC_UPGRADE,
state.GetComputer().GetDomainNetbiosName().c_str());
break;
}
default:
{
ASSERT(false);
break;
}
}
Win::SetDlgItemText(hwnd, IDC_INTRO1, String::load(intro1TextId));
Win::SetDlgItemText(hwnd, IDC_INTRO2, intro2Text);
}
bool
WelcomePage::OnSetActive()
{
LOG_FUNCTION(WelcomePage::OnSetActive);
Win::PropSheet_SetWizButtons(Win::GetParent(hwnd), PSWIZB_NEXT);
Win::PostMessage(
Win::GetParent(hwnd),
WM_NEXTDLGCTL,
(WPARAM) Win::GetDlgItem(Win::GetParent(hwnd), Wizard::NEXT_BTN_ID),
TRUE);
State& state = State::GetInstance();
if (state.RunHiddenUnattended())
{
int nextPage = Validate();
if (nextPage != -1)
{
GetWizard().SetNextPageID(hwnd, nextPage);
}
else
{
state.ClearHiddenWhileUnattended();
}
}
return true;
}
int
WelcomePage::Validate()
{
LOG_FUNCTION(WelcomePage::Validate);
int nextPage = -1;
State& state = State::GetInstance();
switch (state.GetRunContext())
{
case State::PDC_UPGRADE:
case State::NT5_STANDALONE_SERVER:
case State::NT5_MEMBER_SERVER:
case State::BDC_UPGRADE:
{
nextPage = IDD_SECWARN;
break;
}
case State::NT5_DC:
{
state.SetOperation(State::DEMOTE);
// NTRAID#NTBUG9-496409-2001/11/29-sburns
if (state.IsForcedDemotion())
{
nextPage = IDD_FORCE_DEMOTE;
}
else
{
nextPage = IDD_DEMOTE;
}
break;
}
default:
{
ASSERT(false);
break;
}
}
return nextPage;
}
| 4,552 | 1,726 |
#include "Analyzer/LockedCandidates.h"
#include <gtest/gtest.h>
TEST(LockedCandidates, DISABLED_LockedCandidates)
{
}
TEST(LockedCandidates, DISABLED_exists)
{
}
int main(int argc, char ** argv)
{
::testing::InitGoogleTest(&argc, argv);
int rv = RUN_ALL_TESTS();
return rv;
}
| 294 | 128 |
//Program 4-8 Knick-knack Program with pointers and switch
#include <iostream.h>
int main()
{
int number;
int *num_ptr;
num_ptr = &number;
cout << "\n Please enter an integer for knick-knacking ";
cin >> *num_ptr;
cout << "\n\n He played knick-knack ";
switch(number) // the number was assigned using the pointer
{
case 1:
cout << "with his thumb \n";
break;
case 2:
cout << "with my shoe \n";
break;
case 3:
cout << "on his knee \n";
break;
case 4:
cout << "at the door \n";
break;
default:
cout << "\n whoa! He doesn't play knick-knack there! \n";
}
return 0;
}
| 660 | 286 |
/*
* Copyright (c) 2021 Morwenn
* SPDX-License-Identifier: MIT
*/
#include <catch2/catch.hpp>
#include <tight_pair.h>
constexpr auto test_swap()
-> bool
{
cruft::tight_pair<int, bool> p1(5, false);
cruft::tight_pair<int, bool> p2(8, true);
swap(p1, p2);
using cruft::get;
return get<0>(p1) == 8
&& get<1>(p1) == true
&& get<0>(p2) == 5
&& get<1>(p2) == false;
}
TEST_CASE( "test constexpr swap (issue #15)" )
{
constexpr bool res = test_swap();
CHECK( res );
static_assert(res);
}
| 547 | 232 |
/****************************************************************
Follow up for "Remove Duplicates":
What if duplicates are allowed at most twice?
For example,
Given sorted array nums = [1,1,1,2,2,3],
Your function should return length = 5, with the first five elements of nums being 1, 1, 2, 2 and 3.
It doesn't matter what you leave beyond the new length.
****************************************************************/
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
if (nums.size() <= 2) return nums.size();
int j = 0, c = 1;
for (int i = 1; i < nums.size(); i++) {
if (nums[i] == nums[j]) {
c++;
if (c <= 2) {
nums[++j] = nums[i];
}
} else {
nums[++j] = nums[i];
c = 1;
}
}
return j + 1;
}
}; | 903 | 274 |
#include "archlab/ArchLab.h"
#include "archlab/PinCallback.h"
#include "archlab/Node.h"
#include <blueprint/NodeBuilder.h>
#include <blueprint/node/Commentary.h>
#include <archgraph/ArchGraph.h>
namespace archlab
{
CU_SINGLETON_DEFINITION(ArchLab);
extern void regist_rttr();
ArchLab::ArchLab()
{
archgraph::ArchGraph::Instance();
regist_rttr();
InitNodes();
InitPinCallback();
}
void ArchLab::InitNodes()
{
const int bp_count = 1;
auto list = rttr::type::get<Node>().get_derived_classes();
m_nodes.reserve(bp_count + list.size());
m_nodes.push_back(std::make_shared<bp::node::Commentary>());
for (auto& t : list)
{
auto obj = t.create();
assert(obj.is_valid());
auto node = obj.get_value<bp::NodePtr>();
assert(node);
m_nodes.push_back(node);
}
}
} | 793 | 326 |
/*=============================================================================
# Author: Teerapat Jenrungrot - https://github.com/mjenrungrot/
# FileName: 11692.cc
# Description: UVa Online Judge - 11692
=============================================================================*/
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
using namespace std;
const double EPS = 1e-9;
double simulate(double L, double K, double T1, double T2,
double rainfall_speed) {
double rainfall_amount, time_to_leak, leak_amount, final_amount;
rainfall_amount = rainfall_speed * T1;
time_to_leak = L / rainfall_speed;
leak_amount =
max(min((T1 - time_to_leak + T2) * K, rainfall_amount - L), 0.0);
final_amount = rainfall_amount - leak_amount;
return final_amount;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int T;
cin >> T;
while (T--) {
double L, K, T1, T2, H;
cin >> L >> K >> T1 >> T2 >> H;
double F1, F2;
double left = 0.001, right = 1000000.01, mid, amount;
while (fabs(left - right) > EPS) {
mid = (left + right) / 2.0;
amount = simulate(L, K, T1, T2, mid);
if (amount < H)
left = mid;
else
right = mid;
}
F1 = left * T1;
left = 0.001, right = 1000000.01;
while (fabs(left - right) > EPS) {
mid = (left + right) / 2.0;
amount = simulate(L, K, T1, T2, mid);
if (amount <= H)
left = mid;
else
right = mid;
}
F2 = left * T1;
cout << setprecision(8) << F1 << " " << F2 << endl;
}
return 0;
} | 1,781 | 622 |
#include "stdafx.h"
#include "ReConfig.h"
/******************************************************************************
Internal Constants
******************************************************************************/
static const DWORD RECONFIGURE_NO_FLAGS = 0;
static const HANDLE RECONFIGURE_NO_ABORT_EVENT = NULL;
/******************************************************************************
Internal Declarations
******************************************************************************/
static HRESULT Reconnect( IGraphBuilder* pFilterGraph, IPin* pOutputPin );
template<class T> T* _CreateInstance( void )
{
try
{
T* pNewObject = new T;
pNewObject->AddRef();
return pNewObject;
}
catch( CMemoryException* pOutOfMemory )
{
pOutOfMemory->Delete();
return NULL;
}
}
/******************************************************************************
Reconfigure Helper Functions
******************************************************************************/
/******************************************************************************
PreventStateChangesWhileOperationExecutes
PreventStateChangesWhileOperationExecutes() ensures that other threads do
not change the filter graph's state while IGraphConfigCallback::Reconfigure()
executes. If the current version of Direct Show does not support Dynamic Graph
Building, then this function fails.
Parameters:
- pGraphBuilder [in]
The filter graph which WILL be locked. Other threads cannot modify the
filter graph's state while it's locked.
- pCallback [in]
The callback which will be called to preform a user defined operation.
- pReconfigureParameter [in]
The pvConext parameters IGraphConfigCallback::Reconfigure() receives when
it's called.
Return Value:
An HRESULT. S_OK if no error occur. Otherwise, an error HRESULT.
******************************************************************************/
extern HRESULT PreventStateChangesWhileOperationExecutes
(
IGraphBuilder* pGraphBuilder,
IGraphConfigCallback* pCallback,
void* pReconfigureParameter
)
{
// The user should pass a valid IGraphBuilder object and a
// valid IGraphConfigCallback object.
ASSERT( (NULL != pGraphBuilder) && (NULL != pCallback) );
IGraphConfig* pGraphConfig;
// Does Direct Show supports Dynamic Graph Building?
HRESULT hr = pGraphBuilder->QueryInterface( IID_IGraphConfig, (void**)&pGraphConfig );
if( FAILED( hr ) ) {
return hr;
}
hr = pGraphConfig->Reconfigure( pCallback,
(void*)pReconfigureParameter,
RECONFIGURE_NO_FLAGS,
RECONFIGURE_NO_ABORT_EVENT );
pGraphConfig->Release();
if( FAILED( hr ) ) {
return hr;
}
return S_OK;
}
/******************************************************************************
IfPossiblePreventStateChangesWhileOperationExecutes
If the current version of Direct Show supports Dynamic Graph Building,
IfPossiblePreventStateChangesWhileOperationExecutes() ensures that other
threads do not change the filter graph's state while
IGraphConfigCallback::Reconfigure() executes. If the current version of Direct
Show does not support Dynamic Graph Building, then the filter graph state
should not change unless this thread changes it.
Parameters:
- pGraphBuilder [in]
The filter graph which MAY be locked. Other threads cannot modify the
filter graph's state while it's locked.
- pCallback [in]
The callback which will be called to preform a user defined operation.
- pReconfigureParameter [in]
The pvConext parameters IGraphConfigCallback::Reconfigure() receives when
it's called.
Return Value:
An HRESULT. S_OK if no error occur. Otherwise, an error HRESULT.
******************************************************************************/
extern HRESULT IfPossiblePreventStateChangesWhileOperationExecutes
(
IGraphBuilder* pGraphBuilder,
IGraphConfigCallback* pCallback,
void* pReconfigureParameter
)
{
// The user should pass a valid IGraphBuilder object and a
// valid IGraphConfigCallback object.
ASSERT( (NULL != pGraphBuilder) && (NULL != pCallback) );
IGraphConfig* pGraphConfig;
// Does Direct Show supports Dynamic Graph Building?
HRESULT hr = pGraphBuilder->QueryInterface( IID_IGraphConfig, (void**)&pGraphConfig );
if( SUCCEEDED( hr ) ) {
// Dynamic Graph Building supported.
hr = pGraphConfig->Reconfigure( pCallback,
pReconfigureParameter,
RECONFIGURE_NO_FLAGS,
RECONFIGURE_NO_ABORT_EVENT );
pGraphConfig->Release();
if( FAILED( hr ) ) {
return hr;
}
} else if( E_NOINTERFACE == hr ) {
// Dynamic Graph Building is not supported.
hr = pCallback->Reconfigure( pReconfigureParameter, RECONFIGURE_NO_FLAGS );
if( FAILED( hr ) ) {
return hr;
}
} else {
return hr;
}
return S_OK;
}
/******************************************************************************
CReconfigure Public Methods
******************************************************************************/
CGraphConfigCallback::CGraphConfigCallback( const TCHAR* pName, LPUNKNOWN pUnk ) :
CUnknown( pName, pUnk )
{
}
STDMETHODIMP CGraphConfigCallback::NonDelegatingQueryInterface( REFIID riid, void** ppv )
{
if( IID_IGraphConfigCallback == riid ) {
return GetInterface( this, ppv );
} else {
return CUnknown::NonDelegatingQueryInterface( riid, ppv );
}
}
/******************************************************************************
CPrintGraphAsHTMLCallback Public Methods
******************************************************************************/
CPrintGraphAsHTMLCallback::CPrintGraphAsHTMLCallback() :
CGraphConfigCallback( NAME("CPrintGraphAsHTMLCallback"), NULL )
{
}
STDMETHODIMP CPrintGraphAsHTMLCallback::Reconfigure( PVOID pvContext, DWORD dwFlags )
{
// No valid flags have been defined. Therefore, this parameter should be 0.
ASSERT( 0 == dwFlags );
PARAMETERS_FOR_PRINTGRAPHASHTMLINTERNAL* pParameters = (PARAMETERS_FOR_PRINTGRAPHASHTMLINTERNAL*)pvContext;
CBoxNetDoc* pDoc = pParameters->pDocument;
pDoc->PrintGraphAsHTML( pParameters->hFileHandle );
return S_OK;
}
IGraphConfigCallback* CPrintGraphAsHTMLCallback::CreateInstance( void )
{
return _CreateInstance<CPrintGraphAsHTMLCallback>();
}
/******************************************************************************
CUpdateFiltersCallback Public Methods
******************************************************************************/
CUpdateFiltersCallback::CUpdateFiltersCallback() :
CGraphConfigCallback( NAME("CUpdateFiltersCallback"), NULL )
{
}
STDMETHODIMP CUpdateFiltersCallback::Reconfigure( PVOID pvContext, DWORD dwFlags )
{
// No valid flags have been defined. Therefore, this parameter should be 0.
ASSERT( 0 == dwFlags );
CBoxNetDoc* pDoc = (CBoxNetDoc*)pvContext;
pDoc->UpdateFiltersInternal();
return S_OK;
}
IGraphConfigCallback* CUpdateFiltersCallback::CreateInstance( void )
{
return _CreateInstance<CUpdateFiltersCallback>();
}
/******************************************************************************
CEnumerateFilterCacheCallback Public Methods
******************************************************************************/
CEnumerateFilterCacheCallback::CEnumerateFilterCacheCallback() :
CGraphConfigCallback( NAME("CEnumerateFilterCacheCallback"), NULL )
{
}
STDMETHODIMP CEnumerateFilterCacheCallback::Reconfigure( PVOID pvContext, DWORD dwFlags )
{
// No valid flags have been defined. Therefore, this parameter should be 0.
ASSERT( 0 == dwFlags );
CBoxNetDoc* pDoc = (CBoxNetDoc*)pvContext;
pDoc->OnGraphEnumCachedFiltersInternal();
return S_OK;
}
IGraphConfigCallback* CEnumerateFilterCacheCallback::CreateInstance( void )
{
return _CreateInstance<CEnumerateFilterCacheCallback>();
}
| 8,527 | 2,339 |
#include "window.h"
namespace editor
{
std::string Window::getTitle() const
{
return getTypeDescriptor().name;
}
void Window::setFocus(bool focus)
{
if (m_hasFocus != focus)
{
m_hasFocus = focus;
onFocusChange(m_hasFocus);
}
}
REFLECT_IMP(Window)
} | 272 | 116 |
#ifndef SRC_CPP_FILE_RAW_HPP_
#define SRC_CPP_FILE_RAW_HPP_
#include <fcntl.h>
#include <fmt/core.h>
#include <sys/stat.h>
#include <unistd.h>
#include <filesystem>
#include "logging.hpp"
#include "logging_helpers.hpp"
#include "storage.hpp"
class FileRaw {
public:
static FileRaw Create(const std::filesystem::path &filename, bool delete_before_open)
{
return FileRaw(StorageContext{.local_filename = filename}, delete_before_open);
}
static FileRaw CreateWithK(
StorageContext storage_context,
uint8_t k_unused,
bool delete_before_open,
bool file_size_known = false,
size_t file_size = 0)
{
return FileRaw(std::move(storage_context), delete_before_open);
}
static FileRaw CreateForTesting(
const std::filesystem::path &filename,
size_t cache_size_unused = 0)
{
return FileRaw(StorageContext{.local_filename = filename}, true);
}
void Open()
{
// if the file is already open, don't do anything
if (fileno_ > 0)
return;
fileno_ = open(GetFileName().c_str(), O_RDWR | O_CREAT, 0600);
if (fileno_ < 0) {
std::string error_message =
"Could not open " + GetFileName() + ": " + ::strerror(errno) + ".";
throw std::runtime_error(error_message);
}
}
FileRaw(FileRaw &&other)
{
storage_context_ = std::move(other.storage_context_);
fileno_ = other.fileno_;
other.fileno_ = -1;
}
FileRaw(const FileRaw &) = delete;
FileRaw &operator=(const FileRaw &) = delete;
void Close()
{
if (fileno_ < 0)
return;
close(fileno_);
fileno_ = -1;
}
void CloseAndDelete()
{
Close();
std::filesystem::remove(GetFileName());
}
std::error_code CloseAndRename(const std::filesystem::path &to)
{
std::error_code ec;
Close();
std::filesystem::rename(GetFileName(), to, ec);
return ec;
}
~FileRaw() { Close(); }
void Read(uint64_t begin, uint8_t *memcache, uint64_t length)
{
Open();
logging::LogDiskAccess(GetFileName(), "read", begin, length);
const auto result = pread(fileno_, memcache, length, begin);
if (result < 0) {
throw std::runtime_error(std::string("bad read: ") + ::strerror(errno));
}
if (static_cast<uint64_t>(result) != length) {
throw std::runtime_error(fmt::format(
"read too few bytes: requested {}+{} from {} file {}",
begin,
length,
FileSize(),
GetFileName()));
}
}
void Write(uint64_t begin, const uint8_t *memcache, uint64_t length)
{
Open();
logging::LogDiskAccess(GetFileName(), "write", begin, length);
const auto result = pwrite(fileno_, memcache, length, begin);
if (result < 0) {
throw std::runtime_error(std::string("bad write: ") + ::strerror(errno));
}
if (static_cast<uint64_t>(result) != length) {
throw std::runtime_error("wrote too few bytes");
}
}
std::string GetFileName() const { return storage_context_.FullLocalPath(); }
const StorageContext &GetStorageContext() const { return storage_context_; }
void Truncate(uint64_t new_size)
{
Close();
logging::LogDiskAccess(GetFileName(), "truncate", 0, 0);
const auto result = truncate(GetFileName().c_str(), new_size);
if (result < 0) {
throw std::runtime_error("bad truncate");
}
}
private:
explicit FileRaw(StorageContext storage_context, bool delete_before_open)
: storage_context_(std::move(storage_context)), fileno_(-1)
{
if (delete_before_open) {
std::filesystem::remove(GetFileName());
}
Open();
}
size_t FileSize() const
{
struct stat st;
logging::LogDiskAccess(GetFileName(), "stat", 0, 0);
const auto result = fstat(fileno_, &st);
if (result < 0) {
throw std::runtime_error(std::string("couldn't get size: ") + ::strerror(errno));
}
return st.st_size;
}
StorageContext storage_context_;
int fileno_;
};
#endif // SRC_CPP_FILE_RAW_HPP_
| 4,381 | 1,394 |
// ydb_op.cpp
// Author: Allen Porter <allen@thebends.org>
#include <map>
#include "ydb_lock.h"
#include "ydb_map.h"
#include "ydb_op.h"
Ydb_ReadOp::Ydb_ReadOp(const string& key, string* retval)
: Ydb_Op(READLOCK, key), retval_(retval)
{ }
Ydb_RetCode Ydb_ReadOp::Execute(Ydb_Map& map) {
if (map.Get(key_, retval_)) {
return YDB_OK;
} else {
return YDB_NOT_FOUND;
}
}
void Ydb_ReadOp::Rollback(Ydb_Map& map) {
// nothing to do
}
Ydb_WriteOp::Ydb_WriteOp(const string& key, const string& value)
: Ydb_Op(WRITELOCK, key), value_(value)
{ }
Ydb_RetCode Ydb_WriteOp::Execute(Ydb_Map& map) {
exists_ = map.Get(key_, &orig_value_);
map.Put(key_, value_);
return YDB_OK;
}
void Ydb_WriteOp::Rollback(Ydb_Map& map) {
if (exists_) {
map.Put(key_, orig_value_);
}
}
Ydb_DeleteOp::Ydb_DeleteOp(const string& key)
: Ydb_Op(WRITELOCK, key)
{ }
Ydb_RetCode Ydb_DeleteOp::Execute(Ydb_Map& map) {
exists_ = map.Get(key_, &orig_value_);
if (exists_) {
map.Del(key_);
return YDB_OK;
} else {
return YDB_NOT_FOUND;
}
}
void Ydb_DeleteOp::Rollback(Ydb_Map& map) {
if (exists_) {
map.Put(key_, orig_value_);
}
}
| 1,165 | 524 |
// Enum.hpp includes enhancements to the "enum class" types.
#pragma once
#include <type_traits>
namespace util
{
// Returns the value of the enum class. This should be used in place of
// static_cast<some_numeric_type>(some_variable).
//
// @example
//
// enum class SomeType : uint32_t { kValue1 = 1, kValue2 = 2 };
// SomeType some_variable = SomeType::kValue1;
// uint32_t numeric_variable = util::Value(some_variable);
//
// @param enum_type_value variable you would like to get the value of.
// @return the value of the enum class type variable of with the underlying
// type of the enum class.
template <typename Enum, typename Type = typename std::underlying_type_t<Enum>>
constexpr Type Value(Enum enum_type_value)
{
return static_cast<Type>(enum_type_value);
}
} // namespace util
//
// Below is the set of bitwise operator overloads for enum class types
//
// This struct is used in the template evaluation to determine if bitwise
// operators are enabled.
// This generic instance will match with all enumeration types that do not have
// their own template specializations. This will disable bit mask operations for
// all types. See the comments for SJ2_ENABLE_BITMASK_OPERATIONS for more
// details for the template specialization.
template <typename Enum>
struct EnableBitMaskOperators_t
{
static constexpr bool kEnable = false;
};
// This macro, when used on an enum class type, will create a specialized
// version of the "EnableBitMaskOperators_t" that enables that enum class
// to use bitwise operators without the need of static_cast.
//
// Example from within a class:
//
// class SomeClass
// {
// enum class SomeEnum : int32_t { kValue1 = -1, kValue2 = 2 };
// };
// SJ2_ENABLE_BITMASK_OPERATORS(SomeClass::SomeEnum);
//
#define SJ2_ENABLE_BITMASK_OPERATORS(x) \
template <> \
struct EnableBitMaskOperators_t<x> \
{ \
static constexpr bool kEnable = true; \
}
// @tparam Enum is the type used in this operator overload
// @tparam class= is used as a select. The compiler will use this
// implementation of the | operator if that type has a
// EnableBitMaskOperators_t<> specialization of the Enum type
// or, in other words, the SJ2_ENABLE_BITMASK_OPERATORS was used
// on it.
// The following is the same for all operators beyond this point.
template <typename Enum, class = typename std::enable_if_t<
EnableBitMaskOperators_t<Enum>::kEnable, Enum>>
constexpr Enum operator|(Enum lhs, Enum rhs)
{
using underlying = typename std::underlying_type<Enum>::type;
return static_cast<Enum>(static_cast<underlying>(lhs) |
static_cast<underlying>(rhs));
}
template <typename Enum, class = typename std::enable_if_t<
EnableBitMaskOperators_t<Enum>::kEnable, Enum>>
constexpr Enum operator&(Enum lhs, Enum rhs)
{
using underlying = typename std::underlying_type<Enum>::type;
return static_cast<Enum>(static_cast<underlying>(lhs) &
static_cast<underlying>(rhs));
}
template <typename Enum, class = typename std::enable_if_t<
EnableBitMaskOperators_t<Enum>::kEnable, Enum>>
constexpr Enum operator^(Enum lhs, Enum rhs)
{
using underlying = typename std::underlying_type<Enum>::type;
return static_cast<Enum>(static_cast<underlying>(lhs) ^
static_cast<underlying>(rhs));
}
template <typename Enum, class = typename std::enable_if_t<
EnableBitMaskOperators_t<Enum>::kEnable, Enum>>
constexpr Enum operator~(Enum rhs)
{
using underlying = typename std::underlying_type<Enum>::type;
return static_cast<Enum>(~static_cast<underlying>(rhs));
}
template <typename Enum, class = typename std::enable_if_t<
EnableBitMaskOperators_t<Enum>::kEnable, Enum>>
constexpr Enum & operator|=(Enum & lhs, Enum rhs)
{
using underlying = typename std::underlying_type<Enum>::type;
lhs = static_cast<Enum>(static_cast<underlying>(lhs) |
static_cast<underlying>(rhs));
return lhs;
}
template <typename Enum, class = typename std::enable_if_t<
EnableBitMaskOperators_t<Enum>::kEnable, Enum>>
constexpr Enum & operator&=(Enum & lhs, Enum rhs)
{
using underlying = typename std::underlying_type<Enum>::type;
lhs = static_cast<Enum>(static_cast<underlying>(lhs) &
static_cast<underlying>(rhs));
return lhs;
}
template <typename Enum, class = typename std::enable_if_t<
EnableBitMaskOperators_t<Enum>::kEnable, Enum>>
constexpr Enum & operator^=(Enum & lhs, Enum rhs)
{
using underlying = typename std::underlying_type<Enum>::type;
lhs = static_cast<Enum>(static_cast<underlying>(lhs) ^
static_cast<underlying>(rhs));
return lhs;
}
| 5,066 | 1,498 |
// COPYRIGHT Dassault Systemes 2018
//===================================================================
//
// CopyPasteDlg.cpp
// The dialog : CopyPasteDlg
//
//===================================================================
//
// Usage notes:
//
//===================================================================
//
// Nov 2018 Creation: Code generated by the CAA wizard Administrator
//===================================================================
#include "CopyPasteDlg.h"
#include "CATApplicationFrame.h"
#include "CATDlgGridConstraints.h"
#include "CATMsgCatalog.h"
#ifdef CopyPasteDlg_ParameterEditorInclude
#include "CATIParameterEditorFactory.h"
#include "CATIParameterEditor.h"
#include "CATICkeParm.h"
#endif
//-------------------------------------------------------------------------
// Constructor
//-------------------------------------------------------------------------
CopyPasteDlg::CopyPasteDlg() :
CATDlgDialog ((CATApplicationFrame::GetApplicationFrame())->GetMainWindow(),
//CAA2 WIZARD CONSTRUCTOR DECLARATION SECTION
"CopyPasteDlg",CATDlgWndBtnOKCancel|CATDlgWndTitleBarHelp|CATDlgGridLayout
//END CAA2 WIZARD CONSTRUCTOR DECLARATION SECTION
)
{
//CAA2 WIZARD CONSTRUCTOR INITIALIZATION SECTION
_LabelSource = NULL;
_SelectorListSource = NULL;
_LabelTarget = NULL;
_SelectorListTarget = NULL;
//END CAA2 WIZARD CONSTRUCTOR INITIALIZATION SECTION
}
//-------------------------------------------------------------------------
// Destructor
//-------------------------------------------------------------------------
CopyPasteDlg::~CopyPasteDlg()
{
// Do not delete the control elements of your dialog:
// this is done automatically
// --------------------------------------------------
//CAA2 WIZARD DESTRUCTOR DECLARATION SECTION
_LabelSource = NULL;
_SelectorListSource = NULL;
_LabelTarget = NULL;
_SelectorListTarget = NULL;
//END CAA2 WIZARD DESTRUCTOR DECLARATION SECTION
}
void CopyPasteDlg::Build()
{
// TODO: This call builds your dialog from the layout declaration file
// -------------------------------------------------------------------
//CAA2 WIZARD WIDGET CONSTRUCTION SECTION
_LabelSource = new CATDlgLabel(this, "LabelSource");
_LabelSource -> SetGridConstraints(0, 0, 1, 1, CATGRID_4SIDES);
_SelectorListSource = new CATDlgSelectorList(this, "SelectorListSource");
_SelectorListSource -> SetVisibleTextHeight(10);
_SelectorListSource -> SetVisibleTextWidth(30);
_SelectorListSource -> SetGridConstraints(0, 1, 1, 1, CATGRID_4SIDES);
_LabelTarget = new CATDlgLabel(this, "LabelTarget");
_LabelTarget -> SetGridConstraints(1, 0, 1, 1, CATGRID_4SIDES);
_SelectorListTarget = new CATDlgSelectorList(this, "SelectorListTarget");
_SelectorListTarget -> SetVisibleTextHeight(1);
_SelectorListTarget -> SetGridConstraints(1, 1, 1, 1, CATGRID_4SIDES);
//END CAA2 WIZARD WIDGET CONSTRUCTION SECTION
//CAA2 WIZARD CALLBACK DECLARATION SECTION
//END CAA2 WIZARD CALLBACK DECLARATION SECTION
CATUnicodeString iInitialShow = "No Selection";
_SelectorListSource->SetLine(iInitialShow,-1,CATDlgDataAdd);
_SelectorListTarget->SetLine(iInitialShow,-1,CATDlgDataAdd);
int iTabRow = 0;
_SelectorListSource->SetSelect(&iTabRow,1,1);
}
CATDlgSelectorList * CopyPasteDlg::GetSelectorListTarget()
{
return _SelectorListTarget;
}
CATDlgSelectorList * CopyPasteDlg::GetSelectorListSource()
{
return _SelectorListSource;
} | 3,427 | 1,043 |
#pragma once
#include <memory>
#include <type_traits>
#include <utility>
namespace mbgl {
namespace util {
class peer {
public:
peer() noexcept : storage(nullptr, noop_deleter) {}
template <class T>
peer(T&& value) noexcept : storage(new std::decay_t<T>(std::forward<T>(value)), cast_deleter<std::decay_t<T>>) {
static_assert(!std::is_same<peer, std::decay_t<T>>::value, "Peer must not wrap itself.");
}
bool has_value() const noexcept { return static_cast<bool>(storage); }
template <class T>
T& get() noexcept { return *reinterpret_cast<T*>(storage.get()); }
private:
template <typename T>
static void cast_deleter(void* ptr) noexcept { delete reinterpret_cast<T*>(ptr); }
static void noop_deleter(void*) noexcept {}
using storage_t = std::unique_ptr<void, void(*)(void*)>;
storage_t storage;
};
} // namespace util
} // namespace mbgl
| 903 | 317 |
#include <Core/Mesh/DCEL/Face.hpp>
#include <Core/Mesh/DCEL/HalfEdge.hpp>
namespace Ra {
namespace Core {
/// HALFEDGE
inline HalfEdge_ptr Face::HE() const {
return m_he;
}
inline HalfEdge_ptr& Face::HE() {
return m_he;
}
inline void Face::setHE( const HalfEdge_ptr& he ) {
m_he = he;
}
} // namespace Core
} // namespace Ra
| 352 | 146 |
#include <iostream>
#include <string>
#include <vector>
#include <stdlib.h>
using namespace std;
int main();
bool menu();
void ruffini();
void fechas();
int*** crearMatriz(int);
void limpiarMatriz(int***, int);
void imprimirMatriz(int***,int,int);
string calculofechas(int,int,int,int);
int main(){
while(menu()){
cout<<endl;
}
return 0;
}//main
bool menu(){
cout<<"Programacion 3 Laboratorio 3"<<endl
<<" Numero 1: Poda y Busca"<<endl
<<" Numero 2: Teorema de Rufinni"<<endl
<<" Numero 3: Vector de Fechas"<<endl
<<" Numero 4: Salir"<<endl
<<" Ingrese su opcion: ";
int opcion = 0;
cin>>opcion;
cout<<endl;
if(opcion==1){
return true;
}else if(opcion==2){
ruffini();
return true;
}else if(opcion==3){
fechas();
return true;
}else if(opcion==4){
return false;
}else{
cout<<"Numero Invalido";
return true;
}//if y elses
}//menu
void ruffini(){
cout<<"Ingrese el grado mas alto del polinomio: ";
int grado;
cin>>grado;
int contador = grado;
int*** matriz = crearMatriz(grado+1);
while(contador>=0){
cout<<"Ingrese el valor de x^"<<contador<<": ";
int valor;
cin>>valor;
for(int i=0;i<grado+1;i++){
matriz[i][0][grado-contador]=valor;
}//for
contador--;
}//while
int a;
cout<<"Ingrese a: ";
cin>>a;
for(int i=0;i<grado+1;i++){
if(i==0){
for(int j=0;j<grado+1;j++){
matriz[j][2][i]=matriz[j][i][i];
}//for j
}else{
for(int j=i;j<grado+1;j++){
matriz[j][1][i]=matriz[j][2][i-1]*a;
matriz[j][2][i]=matriz[j][0][i]+matriz[j][1][i];
}//for j
}//if else
}//for
cout<<"El cociente es: ";
for(int i=0;i<grado;i++){
if(i==grado-1){
cout<<matriz[grado][2][grado-1]<<endl;
}else{
cout<<matriz[grado][2][i]<<"x^"<<grado-1-i<<" + ";
}//if
}//for
cout<<"El recipiente es: "<<matriz[grado][2][grado]<<endl;
cout<<"------------------------------"<<endl;
imprimirMatriz(matriz,grado+1,a);
limpiarMatriz(matriz, grado+1);
}//ruffini
int*** crearMatriz(int size){
int*** matrix = new int**[size];
for(int i=0;i<size;i++){
matrix[i]= new int*[3];
}
for(int i=0;i<size;i++){
for(int j=0;j<3;j++){
matrix[i][j]=new int[size];
}
}
return matrix;
}//crearMatriz
void limpiarMatriz(int*** matrix, int size){
for(int i=0;i<size;i++){
for(int j=0;j<3;j++){
delete [] matrix[i][j];
matrix[i][j]=NULL;
}//for j
}//for i
for(int i=0;i<size;i++){
delete[] matrix[i];
matrix[i]=NULL;
}//for i
delete[] matrix;
}//LimpiarMatriz
void imprimirMatriz(int*** matrix,int size,int a){
for(int i=0;i<size;i++){
for(int j=0;j<3;j++){
for(int k=0;k<size;k++){
cout<<matrix[i][j][k]<<" ";
}//for k
if(j!=2){
cout<<"| ";
if(j==0){
cout<<a;
}else{
cout<<endl<<"-----------------------";
}//if else
}//if
cout<<endl;
}//for j
cout<<"-------------------------------"<<endl;
}//for i
}//imprimirMatriz
void fechas(){
int bandera=0;
vector <string> dates;
do{
cout<<"1.Agregar Fecha"<<endl
<<"2.Listar Todo"<<endl
<<"3.Listar Ordenado"<<endl
<<"4.Volver al menu"<<endl
<<"Ingrese una opcion: ";
cin>>bandera;
if(bandera==1){
cout<<"Ingrese una cadena: ";
string fecha;
cin>>fecha;
while(fecha.size()!=8){
cout<<"Formato no valido: ";
cin>>fecha;
}//while
int ano = atoi((fecha.substr(0,2)).c_str());
int ano2 = atoi((fecha.substr(2,2)).c_str());
int mes = atoi((fecha.substr(4,2)).c_str());
int dia = atoi((fecha.substr(6,2)).c_str());
if(mes<0&&mes>13){
if(dia<0&&dia>32){
if((mes == 2 || mes == 4 ||mes == 6 || mes == 9 || mes == 11)&& dia==31){
cout<<"La fecha ingresada no existe."<<endl;
}else{
if(mes==2){
if(ano2%4){
if(dia<30){
}else{
cout<<"La fecha ingresada no existe."<<endl;
}//if dia febrero possible
}else{
if(dia<29){
}else{
cout<<"La fecha ingresada no existe."<<endl;
}//if dia febrero possible
}//if aΓ±o bisiestro
}else{
}//if febrero
}//if dia del mes possible
}else{
cout<<"La fecha ingresada no existe,"<<endl;
}//if dia possible
}else{
cout<<"La fecha ingresada no existe."<<endl;
}//if mes possible
}else if(bandera==2){
}else if(bandera==3){
}else if(bandera==4){
}else{
cout<<"Opcion no valida."<<endl;
}//if elses
}while(bandera!=4);
}//fecha
//ano = aΓ±o
string calculofecha(int ano, int ano2,int mes, int dia){
return "";
}//calculofechas
| 4,512 | 2,266 |
#pragma once
namespace gfx {
inline namespace v1 {
template<typename T, size_t S>
template<std::size_t... Is>
constexpr vec<T, S>::vec(std::index_sequence<Is...>, T&& value) noexcept : detail::vec_components<T, S>{(static_cast<void>(Is), value)...}
{}
template<typename T, size_t S>
template<typename X, size_t D, std::size_t... Is>
constexpr vec<T, S>::vec(std::index_sequence<Is...>, const vec<X, D>& other) noexcept
: detail::vec_components<T, S>{static_cast<T>(other[Is])...}
{}
template<typename T, size_t S>
template<typename X, std::size_t... Is>
constexpr vec<T, S>::vec(std::index_sequence<Is...>, const X* other) noexcept : detail::vec_components<T, S>{static_cast<T>(other[Is])...}
{}
template<typename T, size_t S>
constexpr vec<T, S>::vec() noexcept : vec(T{})
{}
template<typename T, size_t S>
template<typename X, size_t D, typename>
constexpr vec<T, S>::vec(const vec<X, D>& other) noexcept : vec(std::make_index_sequence<std::min(S, D)>(), other)
{}
template<typename T, size_t S>
template<typename X, typename>
constexpr vec<T, S>::vec(const X* ptr) : vec(std::make_index_sequence<S>(), ptr)
{}
template<typename T, size_t S>
template<typename X, typename>
constexpr vec<T, S>::vec(X* ptr) : vec(std::make_index_sequence<S>(), ptr)
{}
template<typename T, size_t S>
constexpr vec<T, S>::vec(T&& value) noexcept : vec(std::make_index_sequence<S>(), std::forward<T&&>(value))
{}
template<typename T, size_t S>
template<typename... Ts, typename>
constexpr vec<T, S>::vec(Ts&&... ts) noexcept : detail::vec_components<T, S>{static_cast<value_type>(ts)...}
{}
template<typename T, size_t S>
template<std::size_t ...Is, typename UnaryConvertFun>
inline constexpr auto vec<T, S>::apply(std::index_sequence<Is...>, UnaryConvertFun && fun) const noexcept
{
using type = decltype(fun(this->components[0]));
if constexpr (std::is_same_v< type, void>)
(fun(this->components[Is]), ...);
else
return vec<type, S>(fun(this->components[Is])...);
}
template<typename T, size_t S>
template<std::size_t ...Is, typename UnaryConvertFun>
inline constexpr auto vec<T, S>::apply(std::index_sequence<Is...>, const vec & other, UnaryConvertFun && fun) const noexcept
{
using type = decltype(fun(this->components[0], other.components[0]));
if constexpr (std::is_same_v<type, void>)
(fun(this->components[Is], other.components[Is]), ...);
else
return vec<type, S>(fun(this->components[Is], other.components[Is])...);
}
template<typename T, size_t S>
inline constexpr auto vec<T, S>::real() const noexcept
{
return apply(std::make_index_sequence<S>{}, [](const auto& x) { return std::real(x); });
}
template<typename T, size_t S>
inline constexpr auto vec<T, S>::imag() const noexcept
{
return apply(std::make_index_sequence<S>{}, [](const auto& x) { return std::real(x); });
}
template<typename T, size_t S>
constexpr typename vec<T, S>::reference vec<T, S>::at(size_type index)
{
return detail::vec_components<T, S>::components[index];
}
template<typename T, size_t S>
constexpr typename vec<T, S>::const_reference vec<T, S>::at(size_type index) const
{
return detail::vec_components<T, S>::components[index];
}
template<typename T, size_t S>
constexpr typename vec<T, S>::reference vec<T, S>::operator[](size_type index)
{
return detail::vec_components<T, S>::components[index];
}
template<typename T, size_t S>
constexpr typename vec<T, S>::const_reference vec<T, S>::operator[](size_type index) const
{
return detail::vec_components<T, S>::components[index];
}
template<typename T, size_t S>
constexpr typename vec<T, S>::pointer vec<T, S>::data() noexcept
{
return this->components;
}
template<typename T, size_t S>
constexpr typename vec<T, S>::const_pointer vec<T, S>::data() const noexcept
{
return this->components;
}
template<typename T, size_t S>
constexpr typename vec<T, S>::size_type vec<T, S>::size() const noexcept
{
return S;
}
template<typename T, size_t S>
constexpr void vec<T, S>::fill(const T& value)
{
std::fill_n(this->components, S, value);
}
} // namespace v1
} // namespace gfx | 4,076 | 1,461 |
#include <iostream>
#include <thread>
#include <mutex>
#include <condition_variable>
using namespace std;
void func(mutex &mx)
{
{
lock_guard<mutex> lock(mx);
cout << "Inside Thread :: " << this_thread::get_id() << endl;
this_thread::sleep_for(chrono::seconds(4));
}
}
// bool run = true;
void conFunc(mutex &mx, condition_variable &cvar)
{
unique_lock<mutex> lock(mx);
cvar.wait(lock);
// while (run)
// {
// }
cout << "Inside conFunc Thread :: " << this_thread::get_id() << endl;
lock.unlock();
}
int main()
{
mutex mxt;
// thread t1(func, ref(mxt));
// this_thread::sleep_for(chrono::seconds(1));
// unique_lock<mutex> lock(mxt);
// cout << "Inside Main Thread :: " << this_thread::get_id() << endl;
// lock.unlock();
// t1.join();
condition_variable cvar;
thread t2(conFunc, ref(mxt), ref(cvar));
cout << "Inside Main Thread :: " << this_thread::get_id() << endl;
this_thread::sleep_for(chrono::seconds(10));
{
lock_guard<mutex> lock(mxt);
cvar.notify_all();
}
// run = false;
t2.join();
return 0;
} | 1,147 | 422 |
// ========================== EXAMPLE ALL POINTERS ========================== //
// Project: Type Utilities
// Name: example_all_pointers.cpp
// Description: Use cases for [remove/copy/clone]_all_pointers
// Creator: Vincent Reverdy
// Contributor(s): Vincent Reverdy [2018]
// License: BSD 3-Clause License
// ========================================================================== //
// ================================ PREAMBLE ================================ //
// C++ standard library
#include <vector>
#include <iostream>
// Project sources
#include "../include/type_utilities.hpp"
// Third-party libraries
// Miscellaneous
using namespace type_utilities;
// ========================================================================== //
// ============================= IMPLEMENTATION ============================= //
// Enables if the type is a pointer to a tensor element
template <class T> using enable_if_element_pointer_t = std::enable_if_t<
std::is_pointer_v<T> && !std::is_pointer_v<std::remove_pointer_t<T>>
>;
// Gets an element: tail
template <class T, class = enable_if_element_pointer_t<T>>
constexpr remove_all_pointers_t<T> get_element(T& tensor) {
return tensor ? *tensor : remove_all_pointers_t<T>();
}
// Gets an element: recursive call
template <class T, class... Indices>
constexpr remove_all_pointers_t<T> get_element(
T& tensor, std::size_t idx, Indices&&... idxs
) {
return tensor && tensor[idx]
? get_element(tensor[idx], std::forward<Indices>(idxs)...)
: remove_all_pointers_t<T>();
}
// Sets an element: tail
template <std::size_t N, class T, class = enable_if_element_pointer_t<T>>
void set_element(const remove_all_pointers_t<T>& val, T& tensor) {
using raw_t = remove_all_pointers_t<T>;
tensor ? (*tensor = val, 0) : (tensor = new raw_t(val), 0);
}
// Sets an element: recursive call
template <std::size_t N, class T, class... I>
void set_element(
const remove_all_pointers_t<T>& val, T& tensor, std::size_t idx, I&&... idxs
) {
if (!tensor) {
tensor = new std::remove_pointer_t<T>[N];
for (std::size_t i = 0; i < N; ++i) tensor[i] = nullptr;
}
set_element<N>(val, tensor[idx], std::forward<I>(idxs)...);
}
// Deallocates the entire tensor
template <std::size_t N, class T>
void deallocate(T& tensor) {
if constexpr (!std::is_pointer_v<std::remove_pointer_t<T>>) {
delete tensor;
tensor = nullptr;
} else if constexpr (std::is_pointer_v<std::remove_pointer_t<T>>) {
if (tensor) {
for (std::size_t i = 0; i < N; ++i) deallocate<N>(tensor[i]);
delete[] tensor;
tensor = nullptr;
}
}
}
// ========================================================================== //
// ================================== MAIN ================================== //
// Main function
int main(int, char**)
{
// Initialization
constexpr std::size_t dimension = 4;
using type = unsigned long long int;
type***** tensor = nullptr;
std::size_t i = 0;
// Fill
for (std::size_t i0 = 0; i0 < dimension; ++i0) {
for (std::size_t i1 = 0; i1 < dimension; ++i1) {
for (std::size_t i2 = 0; i2 < dimension; ++i2) {
for (std::size_t i3 = 0; i3 < dimension; ++i3) {
set_element<dimension>(i++, tensor, i0, i1, i2, i3);
}
}
}
}
// Display
for (std::size_t i0 = 0; i0 < dimension; ++i0) {
for (std::size_t i1 = 0; i1 < dimension; ++i1) {
for (std::size_t i2 = 0; i2 < dimension; ++i2) {
for (std::size_t i3 = 0; i3 < dimension; ++i3) {
std::cout << "[" << i0 << ", " << i1 << ", ";
std::cout << i2 << ", " << i3 << "]: ";
std::cout << get_element(tensor, i0, i1, i2, i3) << "\n";
}
}
}
}
// Finalization
deallocate<dimension>(tensor);
return 0;
}
// ========================================================================== //
| 4,120 | 1,338 |
#ifndef REYES_ADDSYMBOLHELPER_HPP_INCLUDED
#define REYES_ADDSYMBOLHELPER_HPP_INCLUDED
#include "ValueType.hpp"
#include "ValueStorage.hpp"
#include <vector>
#include <memory>
namespace reyes
{
class Grid;
class Symbol;
class Value;
class Renderer;
class SymbolTable;
/**
// Syntax helper to provide a convenient syntax for constructing hierarchical
// symbol tables.
*/
class AddSymbolHelper
{
SymbolTable* symbol_table_; ///< The SymbolTable to add Symbols to.
std::shared_ptr<Symbol> symbol_; ///< The most recently added Symbol.
public:
AddSymbolHelper( SymbolTable* symbol_table );
AddSymbolHelper& operator()( const char* identifier, ValueType type, ValueStorage storage = STORAGE_VARYING );
AddSymbolHelper& operator()( const char* identifier, void (*function)(const Renderer&, const Grid&), ValueType type, ValueStorage storage = STORAGE_VARYING );
AddSymbolHelper& operator()( const char* identifier, void (*function)(const Renderer&, const Grid&, std::shared_ptr<Value> a0), ValueType type, ValueStorage storage = STORAGE_VARYING );
AddSymbolHelper& operator()( const char* identifier, void (*function)(const Renderer&, const Grid&, std::shared_ptr<Value> a0, std::shared_ptr<Value> a1), ValueType type, ValueStorage storage = STORAGE_VARYING );
AddSymbolHelper& operator()( const char* identifier, void (*function)(const Renderer&, const Grid&, std::shared_ptr<Value> a0, std::shared_ptr<Value> a1, std::shared_ptr<Value> a2), ValueType type, ValueStorage storage = STORAGE_VARYING );
AddSymbolHelper& operator()( const char* identifier, void (*function)(const Renderer&, const Grid&, std::shared_ptr<Value> a0, std::shared_ptr<Value> a1, std::shared_ptr<Value> a2, std::shared_ptr<Value> a3), ValueType type, ValueStorage storage = STORAGE_VARYING );
AddSymbolHelper& operator()( const char* identifier, void (*function)(const Renderer&, const Grid&, std::shared_ptr<Value> a0, std::shared_ptr<Value> a1, std::shared_ptr<Value> a2, std::shared_ptr<Value> a3, std::shared_ptr<Value> a4), ValueType type, ValueStorage storage = STORAGE_VARYING );
AddSymbolHelper& operator()( const char* identifier, void (*function)(const Renderer&, const Grid&, std::shared_ptr<Value> a0, std::shared_ptr<Value> a1, std::shared_ptr<Value> a2, std::shared_ptr<Value> a3, std::shared_ptr<Value> a4, std::shared_ptr<Value> a5), ValueType type, ValueStorage storage = STORAGE_VARYING );
AddSymbolHelper& operator()( ValueType type, ValueStorage storage = STORAGE_VARYING );
AddSymbolHelper& operator()( const char* identifier, float value );
};
}
#endif
| 2,646 | 840 |
// 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 "device/udev_linux/udev1_loader.h"
#include "library_loaders/libudev1.h"
namespace device {
Udev1Loader::Udev1Loader() {
}
Udev1Loader::~Udev1Loader() {
}
bool Udev1Loader::Init() {
if (lib_loader_)
return lib_loader_->loaded();
lib_loader_.reset(new LibUdev1Loader);
return lib_loader_->Load("libudev.so.1");
}
const char* Udev1Loader::udev_device_get_action(udev_device* udev_device) {
return lib_loader_->udev_device_get_action(udev_device);
}
const char* Udev1Loader::udev_device_get_devnode(udev_device* udev_device) {
return lib_loader_->udev_device_get_devnode(udev_device);
}
udev_device* Udev1Loader::udev_device_get_parent(udev_device* udev_device) {
return lib_loader_->udev_device_get_parent(udev_device);
}
udev_device* Udev1Loader::udev_device_get_parent_with_subsystem_devtype(
udev_device* udev_device,
const char* subsystem,
const char* devtype) {
return lib_loader_->udev_device_get_parent_with_subsystem_devtype(
udev_device, subsystem, devtype);
}
const char* Udev1Loader::udev_device_get_property_value(
udev_device* udev_device,
const char* key) {
return lib_loader_->udev_device_get_property_value(udev_device, key);
}
const char* Udev1Loader::udev_device_get_subsystem(udev_device* udev_device) {
return lib_loader_->udev_device_get_subsystem(udev_device);
}
const char* Udev1Loader::udev_device_get_sysattr_value(udev_device* udev_device,
const char* sysattr) {
return lib_loader_->udev_device_get_sysattr_value(udev_device, sysattr);
}
const char* Udev1Loader::udev_device_get_sysname(udev_device* udev_device) {
return lib_loader_->udev_device_get_sysname(udev_device);
}
const char* Udev1Loader::udev_device_get_syspath(udev_device* udev_device) {
return lib_loader_->udev_device_get_syspath(udev_device);
}
udev_device* Udev1Loader::udev_device_new_from_devnum(udev* udev,
char type,
dev_t devnum) {
return lib_loader_->udev_device_new_from_devnum(udev, type, devnum);
}
udev_device* Udev1Loader::udev_device_new_from_syspath(udev* udev,
const char* syspath) {
return lib_loader_->udev_device_new_from_syspath(udev, syspath);
}
void Udev1Loader::udev_device_unref(udev_device* udev_device) {
lib_loader_->udev_device_unref(udev_device);
}
int Udev1Loader::udev_enumerate_add_match_subsystem(
udev_enumerate* udev_enumerate,
const char* subsystem) {
return lib_loader_->udev_enumerate_add_match_subsystem(udev_enumerate,
subsystem);
}
udev_list_entry* Udev1Loader::udev_enumerate_get_list_entry(
udev_enumerate* udev_enumerate) {
return lib_loader_->udev_enumerate_get_list_entry(udev_enumerate);
}
udev_enumerate* Udev1Loader::udev_enumerate_new(udev* udev) {
return lib_loader_->udev_enumerate_new(udev);
}
int Udev1Loader::udev_enumerate_scan_devices(udev_enumerate* udev_enumerate) {
return lib_loader_->udev_enumerate_scan_devices(udev_enumerate);
}
void Udev1Loader::udev_enumerate_unref(udev_enumerate* udev_enumerate) {
lib_loader_->udev_enumerate_unref(udev_enumerate);
}
udev_list_entry* Udev1Loader::udev_list_entry_get_next(
udev_list_entry* list_entry) {
return lib_loader_->udev_list_entry_get_next(list_entry);
}
const char* Udev1Loader::udev_list_entry_get_name(udev_list_entry* list_entry) {
return lib_loader_->udev_list_entry_get_name(list_entry);
}
int Udev1Loader::udev_monitor_enable_receiving(udev_monitor* udev_monitor) {
return lib_loader_->udev_monitor_enable_receiving(udev_monitor);
}
int Udev1Loader::udev_monitor_filter_add_match_subsystem_devtype(
udev_monitor* udev_monitor,
const char* subsystem,
const char* devtype) {
return lib_loader_->udev_monitor_filter_add_match_subsystem_devtype(
udev_monitor, subsystem, devtype);
}
int Udev1Loader::udev_monitor_get_fd(udev_monitor* udev_monitor) {
return lib_loader_->udev_monitor_get_fd(udev_monitor);
}
udev_monitor* Udev1Loader::udev_monitor_new_from_netlink(udev* udev,
const char* name) {
return lib_loader_->udev_monitor_new_from_netlink(udev, name);
}
udev_device* Udev1Loader::udev_monitor_receive_device(
udev_monitor* udev_monitor) {
return lib_loader_->udev_monitor_receive_device(udev_monitor);
}
void Udev1Loader::udev_monitor_unref(udev_monitor* udev_monitor) {
lib_loader_->udev_monitor_unref(udev_monitor);
}
udev* Udev1Loader::udev_new() {
return lib_loader_->udev_new();
}
void Udev1Loader::udev_set_log_fn(
struct udev* udev,
void (*log_fn)(struct udev* udev, int priority,
const char* file, int line,
const char* fn, const char* format, va_list args)) {
return lib_loader_->udev_set_log_fn(udev, log_fn);
}
void Udev1Loader::udev_set_log_priority(struct udev* udev, int priority) {
return lib_loader_->udev_set_log_priority(udev, priority);
}
void Udev1Loader::udev_unref(udev* udev) {
lib_loader_->udev_unref(udev);
}
} // namespace device
| 5,396 | 2,010 |
/*
* File: ElftosbAST.cpp
*
* Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
* See included license file for license details.
*/
#include "ElftosbAST.h"
#include <stdexcept>
#include <math.h>
#include <assert.h>
#include "ElftosbErrors.h"
#include "format_string.h"
using namespace elftosb;
#pragma mark = ASTNode =
void ASTNode::printTree(int indent) const
{
printIndent(indent);
printf("%s\n", nodeName().c_str());
}
void ASTNode::printIndent(int indent) const
{
int i;
for (i=0; i<indent; ++i)
{
printf(" ");
}
}
void ASTNode::setLocation(token_loc_t & first, token_loc_t & last)
{
m_location.m_firstLine = first.m_firstLine;
m_location.m_lastLine = last.m_lastLine;
}
void ASTNode::setLocation(ASTNode * first, ASTNode * last)
{
m_location.m_firstLine = first->getLocation().m_firstLine;
m_location.m_lastLine = last->getLocation().m_lastLine;
}
#pragma mark = ListASTNode =
ListASTNode::ListASTNode(const ListASTNode & other)
: ASTNode(other), m_list()
{
// deep copy each item of the original's list
const_iterator it = other.begin();
for (; it != other.end(); ++it)
{
m_list.push_back((*it)->clone());
}
}
//! Deletes child node in the list.
//!
ListASTNode::~ListASTNode()
{
iterator it = begin();
for (; it != end(); it++)
{
delete *it;
}
}
//! If \a node is NULL then the list is left unmodified.
//!
//! The list node's location is automatically updated after the node is added by a call
//! to updateLocation().
void ListASTNode::appendNode(ASTNode * node)
{
if (node)
{
m_list.push_back(node);
updateLocation();
}
}
void ListASTNode::printTree(int indent) const
{
ASTNode::printTree(indent);
int n = 0;
const_iterator it = begin();
for (; it != end(); it++, n++)
{
printIndent(indent + 1);
printf("%d:\n", n);
(*it)->printTree(indent + 2);
}
}
void ListASTNode::updateLocation()
{
token_loc_t current = { 0 };
const_iterator it = begin();
for (; it != end(); it++)
{
const ASTNode * node = *it;
const token_loc_t & loc = node->getLocation();
// handle first node
if (current.m_firstLine == 0)
{
current = loc;
continue;
}
if (loc.m_firstLine < current.m_firstLine)
{
current.m_firstLine = loc.m_firstLine;
}
if (loc.m_lastLine > current.m_lastLine)
{
current.m_lastLine = loc.m_lastLine;
}
}
setLocation(current);
}
#pragma mark = CommandFileASTNode =
CommandFileASTNode::CommandFileASTNode()
: ASTNode(), m_options(), m_constants(), m_sources(), m_sections()
{
}
CommandFileASTNode::CommandFileASTNode(const CommandFileASTNode & other)
: ASTNode(other), m_options(), m_constants(), m_sources(), m_sections()
{
m_options = dynamic_cast<ListASTNode*>(other.m_options->clone());
m_constants = dynamic_cast<ListASTNode*>(other.m_constants->clone());
m_sources = dynamic_cast<ListASTNode*>(other.m_sources->clone());
m_sections = dynamic_cast<ListASTNode*>(other.m_sections->clone());
}
void CommandFileASTNode::printTree(int indent) const
{
ASTNode::printTree(indent);
printIndent(indent + 1);
printf("options:\n");
if (m_options) m_options->printTree(indent + 2);
printIndent(indent + 1);
printf("constants:\n");
if (m_constants) m_constants->printTree(indent + 2);
printIndent(indent + 1);
printf("sources:\n");
if (m_sources) m_sources->printTree(indent + 2);
printIndent(indent + 1);
printf("sections:\n");
if (m_sections) m_sections->printTree(indent + 2);
}
#pragma mark = ExprASTNode =
int_size_t ExprASTNode::resultIntSize(int_size_t a, int_size_t b)
{
int_size_t result;
switch (a)
{
case kWordSize:
result = kWordSize;
break;
case kHalfWordSize:
if (b == kWordSize)
{
result = kWordSize;
}
else
{
result = kHalfWordSize;
}
break;
case kByteSize:
if (b == kWordSize)
{
result = kWordSize;
}
else if (b == kHalfWordSize)
{
result = kHalfWordSize;
}
else
{
result = kByteSize;
}
break;
}
return result;
}
#pragma mark = IntConstExprASTNode =
IntConstExprASTNode::IntConstExprASTNode(const IntConstExprASTNode & other)
: ExprASTNode(other), m_value(other.m_value), m_size(other.m_size)
{
}
void IntConstExprASTNode::printTree(int indent) const
{
printIndent(indent);
char sizeChar='?';
switch (m_size)
{
case kWordSize:
sizeChar = 'w';
break;
case kHalfWordSize:
sizeChar = 'h';
break;
case kByteSize:
sizeChar = 'b';
break;
}
printf("%s(%d:%c)\n", nodeName().c_str(), m_value, sizeChar);
}
#pragma mark = VariableExprASTNode =
VariableExprASTNode::VariableExprASTNode(const VariableExprASTNode & other)
: ExprASTNode(other), m_variable()
{
m_variable = new std::string(*other.m_variable);
}
void VariableExprASTNode::printTree(int indent) const
{
printIndent(indent);
printf("%s(%s)\n", nodeName().c_str(), m_variable->c_str());
}
ExprASTNode * VariableExprASTNode::reduce(EvalContext & context)
{
if (!context.isVariableDefined(*m_variable))
{
throw std::runtime_error(format_string("line %d: undefined variable '%s'", getFirstLine(), m_variable->c_str()));
}
uint32_t value = context.getVariableValue(*m_variable);
int_size_t size = context.getVariableSize(*m_variable);
return new IntConstExprASTNode(value, size);
}
#pragma mark = SymbolRefExprASTNode =
SymbolRefExprASTNode::SymbolRefExprASTNode(const SymbolRefExprASTNode & other)
: ExprASTNode(other), m_symbol(NULL)
{
if (other.m_symbol)
{
m_symbol = dynamic_cast<SymbolASTNode*>(other.m_symbol->clone());
}
}
void SymbolRefExprASTNode::printTree(int indent) const
{
}
ExprASTNode * SymbolRefExprASTNode::reduce(EvalContext & context)
{
EvalContext::SourceFileManager * manager = context.getSourceFileManager();
if (!manager)
{
throw std::runtime_error("no source manager available");
}
if (!m_symbol)
{
throw semantic_error("no symbol provided");
}
// Get the name of the symbol
std::string * symbolName = m_symbol->getSymbolName();
// if (!symbolName)
// {
// throw semantic_error(format_string("line %d: no symbol name provided", getFirstLine()));
// }
// Get the source file.
std::string * sourceName = m_symbol->getSource();
SourceFile * sourceFile;
if (sourceName)
{
sourceFile = manager->getSourceFile(*sourceName);
if (!sourceFile)
{
throw semantic_error(format_string("line %d: no source file named %s", getFirstLine(), sourceName->c_str()));
}
}
else
{
sourceFile = manager->getDefaultSourceFile();
if (!sourceFile)
{
throw semantic_error(format_string("line %d: no default source file is set", getFirstLine()));
}
}
// open the file if it hasn't already been
if (!sourceFile->isOpen())
{
sourceFile->open();
}
// Make sure the source file supports symbols before going any further
if (symbolName && !sourceFile->supportsNamedSymbols())
{
throw semantic_error(format_string("line %d: source file %s does not support symbols", getFirstLine(), sourceFile->getPath().c_str()));
}
if (!symbolName && !sourceFile->hasEntryPoint())
{
throw semantic_error(format_string("line %d: source file %s does not have an entry point", getFirstLine(), sourceFile->getPath().c_str()));
}
// Returns a const expr node with the symbol's value.
uint32_t value;
if (symbolName)
{
value = sourceFile->getSymbolValue(*symbolName);
}
else
{
value = sourceFile->getEntryPointAddress();
}
return new IntConstExprASTNode(value);
}
#pragma mark = NegativeExprASTNode =
NegativeExprASTNode::NegativeExprASTNode(const NegativeExprASTNode & other)
: ExprASTNode(other), m_expr()
{
m_expr = dynamic_cast<ExprASTNode*>(other.m_expr->clone());
}
void NegativeExprASTNode::printTree(int indent) const
{
ExprASTNode::printTree(indent);
if (m_expr) m_expr->printTree(indent + 1);
}
ExprASTNode * NegativeExprASTNode::reduce(EvalContext & context)
{
if (!m_expr)
{
return this;
}
m_expr = m_expr->reduce(context);
IntConstExprASTNode * intConst = dynamic_cast<IntConstExprASTNode*>(m_expr.get());
if (intConst)
{
int32_t value = -(int32_t)intConst->getValue();
return new IntConstExprASTNode((uint32_t)value, intConst->getSize());
}
else
{
return this;
}
}
#pragma mark = BooleanNotExprASTNode =
BooleanNotExprASTNode::BooleanNotExprASTNode(const BooleanNotExprASTNode & other)
: ExprASTNode(other), m_expr()
{
m_expr = dynamic_cast<ExprASTNode*>(other.m_expr->clone());
}
void BooleanNotExprASTNode::printTree(int indent) const
{
ExprASTNode::printTree(indent);
if (m_expr) m_expr->printTree(indent + 1);
}
ExprASTNode * BooleanNotExprASTNode::reduce(EvalContext & context)
{
if (!m_expr)
{
return this;
}
m_expr = m_expr->reduce(context);
IntConstExprASTNode * intConst = dynamic_cast<IntConstExprASTNode*>(m_expr.get());
if (intConst)
{
int32_t value = !((int32_t)intConst->getValue());
return new IntConstExprASTNode((uint32_t)value, intConst->getSize());
}
else
{
throw semantic_error(format_string("line %d: expression did not evaluate to an integer", m_expr->getFirstLine()));
}
}
#pragma mark = SourceFileFunctionASTNode =
SourceFileFunctionASTNode::SourceFileFunctionASTNode(const SourceFileFunctionASTNode & other)
: ExprASTNode(other), m_functionName(), m_sourceFile()
{
m_functionName = new std::string(*other.m_functionName);
m_sourceFile = new std::string(*other.m_sourceFile);
}
void SourceFileFunctionASTNode::printTree(int indent) const
{
ExprASTNode::printTree(indent);
printIndent(indent+1);
// for some stupid reason the msft C++ compiler barfs on the following line if the ".get()" parts are remove,
// even though the first line of reduce() below has the same expression, just in parentheses. stupid compiler.
if (m_functionName.get() && m_sourceFile.get())
{
printf("%s ( %s )\n", m_functionName->c_str(), m_sourceFile->c_str());
}
}
ExprASTNode * SourceFileFunctionASTNode::reduce(EvalContext & context)
{
if (!(m_functionName && m_sourceFile))
{
throw std::runtime_error("unset function name or source file");
}
// Get source file manager from evaluation context. This will be the
// conversion controller itself.
EvalContext::SourceFileManager * mgr = context.getSourceFileManager();
if (!mgr)
{
throw std::runtime_error("source file manager is not set");
}
// Perform function
uint32_t functionResult = 0;
if (*m_functionName == "exists")
{
functionResult = static_cast<uint32_t>(mgr->hasSourceFile(*m_sourceFile));
}
// Return function result as an expression node
return new IntConstExprASTNode(functionResult);
}
#pragma mark = DefinedOperatorASTNode =
DefinedOperatorASTNode::DefinedOperatorASTNode(const DefinedOperatorASTNode & other)
: ExprASTNode(other), m_constantName()
{
m_constantName = new std::string(*other.m_constantName);
}
void DefinedOperatorASTNode::printTree(int indent) const
{
ExprASTNode::printTree(indent);
printIndent(indent+1);
if (m_constantName)
{
printf("defined ( %s )\n", m_constantName->c_str());
}
}
ExprASTNode * DefinedOperatorASTNode::reduce(EvalContext & context)
{
assert(m_constantName);
// Return function result as an expression node
return new IntConstExprASTNode(context.isVariableDefined(m_constantName) ? 1 : 0);
}
#pragma mark = SizeofOperatorASTNode =
SizeofOperatorASTNode::SizeofOperatorASTNode(const SizeofOperatorASTNode & other)
: ExprASTNode(other), m_constantName(), m_symbol()
{
m_constantName = new std::string(*other.m_constantName);
m_symbol = dynamic_cast<SymbolASTNode*>(other.m_symbol->clone());
}
void SizeofOperatorASTNode::printTree(int indent) const
{
ExprASTNode::printTree(indent);
printIndent(indent+1);
if (m_constantName)
{
printf("sizeof: %s\n", m_constantName->c_str());
}
else if (m_symbol)
{
printf("sizeof:\n");
m_symbol->printTree(indent + 2);
}
}
ExprASTNode * SizeofOperatorASTNode::reduce(EvalContext & context)
{
// One or the other must be defined.
assert(m_constantName || m_symbol);
EvalContext::SourceFileManager * manager = context.getSourceFileManager();
assert(manager);
unsigned sizeInBytes = 0;
SourceFile * sourceFile;
if (m_symbol)
{
// Get the symbol name.
std::string * symbolName = m_symbol->getSymbolName();
assert(symbolName);
// Get the source file, using the default if one is not specified.
std::string * sourceName = m_symbol->getSource();
if (sourceName)
{
sourceFile = manager->getSourceFile(*sourceName);
if (!sourceFile)
{
throw semantic_error(format_string("line %d: invalid source file: %s", getFirstLine(), sourceName->c_str()));
}
}
else
{
sourceFile = manager->getDefaultSourceFile();
if (!sourceFile)
{
throw semantic_error(format_string("line %d: no default source file is set", getFirstLine()));
}
}
// Get the size of the symbol.
if (sourceFile->hasSymbol(*symbolName))
{
sizeInBytes = sourceFile->getSymbolSize(*symbolName);
}
}
else if (m_constantName)
{
// See if the "constant" is really a constant or if it's a source name.
if (manager->hasSourceFile(m_constantName))
{
sourceFile = manager->getSourceFile(m_constantName);
if (sourceFile)
{
sizeInBytes = sourceFile->getSize();
}
}
else
{
// Regular constant.
if (!context.isVariableDefined(*m_constantName))
{
throw semantic_error(format_string("line %d: cannot get size of undefined constant %s", getFirstLine(), m_constantName->c_str()));
}
int_size_t intSize = context.getVariableSize(*m_constantName);
switch (intSize)
{
case kWordSize:
sizeInBytes = sizeof(uint32_t);
break;
case kHalfWordSize:
sizeInBytes = sizeof(uint16_t);
break;
case kByteSize:
sizeInBytes = sizeof(uint8_t);
break;
}
}
}
// Return function result as an expression node
return new IntConstExprASTNode(sizeInBytes);
}
#pragma mark = BinaryOpExprASTNode =
BinaryOpExprASTNode::BinaryOpExprASTNode(const BinaryOpExprASTNode & other)
: ExprASTNode(other), m_left(), m_op(other.m_op), m_right()
{
m_left = dynamic_cast<ExprASTNode*>(other.m_left->clone());
m_right = dynamic_cast<ExprASTNode*>(other.m_right->clone());
}
void BinaryOpExprASTNode::printTree(int indent) const
{
ExprASTNode::printTree(indent);
printIndent(indent + 1);
printf("left:\n");
if (m_left) m_left->printTree(indent + 2);
printIndent(indent + 1);
printf("op: %s\n", getOperatorName().c_str());
printIndent(indent + 1);
printf("right:\n");
if (m_right) m_right->printTree(indent + 2);
}
std::string BinaryOpExprASTNode::getOperatorName() const
{
switch (m_op)
{
case kAdd:
return "+";
case kSubtract:
return "-";
case kMultiply:
return "*";
case kDivide:
return "/";
case kModulus:
return "%";
case kPower:
return "**";
case kBitwiseAnd:
return "&";
case kBitwiseOr:
return "|";
case kBitwiseXor:
return "^";
case kShiftLeft:
return "<<";
case kShiftRight:
return ">>";
case kLessThan:
return "<";
case kGreaterThan:
return ">";
case kLessThanEqual:
return "<=";
case kGreaterThanEqual:
return ">";
case kEqual:
return "==";
case kNotEqual:
return "!=";
case kBooleanAnd:
return "&&";
case kBooleanOr:
return "||";
}
return "???";
}
//! \todo Fix power operator under windows!!!
//!
ExprASTNode * BinaryOpExprASTNode::reduce(EvalContext & context)
{
if (!m_left || !m_right)
{
return this;
}
IntConstExprASTNode * leftIntConst = NULL;
IntConstExprASTNode * rightIntConst = NULL;
uint32_t leftValue;
uint32_t rightValue;
uint32_t result = 0;
// Always reduce the left hand side.
m_left = m_left->reduce(context);
leftIntConst = dynamic_cast<IntConstExprASTNode*>(m_left.get());
if (!leftIntConst)
{
throw semantic_error(format_string("left hand side of %s operator failed to evaluate to an integer", getOperatorName().c_str()));
}
leftValue = leftIntConst->getValue();
// Boolean && and || operators are handled separately so that we can perform
// short-circuit evaluation.
if (m_op == kBooleanAnd || m_op == kBooleanOr)
{
// Reduce right hand side only if required to evaluate the boolean operator.
if ((m_op == kBooleanAnd && leftValue != 0) || (m_op == kBooleanOr && leftValue == 0))
{
m_right = m_right->reduce(context);
rightIntConst = dynamic_cast<IntConstExprASTNode*>(m_right.get());
if (!rightIntConst)
{
throw semantic_error(format_string("right hand side of %s operator failed to evaluate to an integer", getOperatorName().c_str()));
}
rightValue = rightIntConst->getValue();
// Perform the boolean operation.
switch (m_op)
{
case kBooleanAnd:
result = leftValue && rightValue;
break;
case kBooleanOr:
result = leftValue && rightValue;
break;
}
}
else if (m_op == kBooleanAnd)
{
// The left hand side is false, so the && operator's result must be false
// without regard to the right hand side.
result = 0;
}
else if (m_op == kBooleanOr)
{
// The left hand value is true so the || result is automatically true.
result = 1;
}
}
else
{
// Reduce right hand side always for most operators.
m_right = m_right->reduce(context);
rightIntConst = dynamic_cast<IntConstExprASTNode*>(m_right.get());
if (!rightIntConst)
{
throw semantic_error(format_string("right hand side of %s operator failed to evaluate to an integer", getOperatorName().c_str()));
}
rightValue = rightIntConst->getValue();
switch (m_op)
{
case kAdd:
result = leftValue + rightValue;
break;
case kSubtract:
result = leftValue - rightValue;
break;
case kMultiply:
result = leftValue * rightValue;
break;
case kDivide:
result = leftValue / rightValue;
break;
case kModulus:
result = leftValue % rightValue;
break;
case kPower:
#ifdef WIN32
result = 0;
#else
result = lroundf(powf(float(leftValue), float(rightValue)));
#endif
break;
case kBitwiseAnd:
result = leftValue & rightValue;
break;
case kBitwiseOr:
result = leftValue | rightValue;
break;
case kBitwiseXor:
result = leftValue ^ rightValue;
break;
case kShiftLeft:
result = leftValue << rightValue;
break;
case kShiftRight:
result = leftValue >> rightValue;
break;
case kLessThan:
result = leftValue < rightValue;
break;
case kGreaterThan:
result = leftValue > rightValue;
break;
case kLessThanEqual:
result = leftValue <= rightValue;
break;
case kGreaterThanEqual:
result = leftValue >= rightValue;
break;
case kEqual:
result = leftValue == rightValue;
break;
case kNotEqual:
result = leftValue != rightValue;
break;
}
}
// Create the result value.
int_size_t resultSize;
if (leftIntConst && rightIntConst)
{
resultSize = resultIntSize(leftIntConst->getSize(), rightIntConst->getSize());
}
else if (leftIntConst)
{
resultSize = leftIntConst->getSize();
}
else
{
// This shouldn't really be possible, but just in case.
resultSize = kWordSize;
}
return new IntConstExprASTNode(result, resultSize);
}
#pragma mark = IntSizeExprASTNode =
IntSizeExprASTNode::IntSizeExprASTNode(const IntSizeExprASTNode & other)
: ExprASTNode(other), m_expr(), m_size(other.m_size)
{
m_expr = dynamic_cast<ExprASTNode*>(other.m_expr->clone());
}
void IntSizeExprASTNode::printTree(int indent) const
{
ExprASTNode::printTree(indent);
char sizeChar='?';
switch (m_size)
{
case kWordSize:
sizeChar = 'w';
break;
case kHalfWordSize:
sizeChar = 'h';
break;
case kByteSize:
sizeChar = 'b';
break;
}
printIndent(indent + 1);
printf("size: %c\n", sizeChar);
printIndent(indent + 1);
printf("expr:\n");
if (m_expr) m_expr->printTree(indent + 2);
}
ExprASTNode * IntSizeExprASTNode::reduce(EvalContext & context)
{
if (!m_expr)
{
return this;
}
m_expr = m_expr->reduce(context);
IntConstExprASTNode * intConst = dynamic_cast<IntConstExprASTNode*>(m_expr.get());
if (!intConst)
{
return this;
}
return new IntConstExprASTNode(intConst->getValue(), m_size);
}
#pragma mark = ExprConstASTNode =
ExprConstASTNode::ExprConstASTNode(const ExprConstASTNode & other)
: ConstASTNode(other), m_expr()
{
m_expr = dynamic_cast<ExprASTNode*>(other.m_expr->clone());
}
void ExprConstASTNode::printTree(int indent) const
{
ConstASTNode::printTree(indent);
if (m_expr) m_expr->printTree(indent + 1);
}
#pragma mark = StringConstASTNode =
StringConstASTNode::StringConstASTNode(const StringConstASTNode & other)
: ConstASTNode(other), m_value()
{
m_value = new std::string(other.m_value);
}
void StringConstASTNode::printTree(int indent) const
{
printIndent(indent);
printf("%s(%s)\n", nodeName().c_str(), m_value->c_str());
}
#pragma mark = BlobConstASTNode =
BlobConstASTNode::BlobConstASTNode(const BlobConstASTNode & other)
: ConstASTNode(other), m_blob()
{
m_blob = new Blob(*other.m_blob);
}
void BlobConstASTNode::printTree(int indent) const
{
printIndent(indent);
const uint8_t * dataPtr = m_blob->getData();
unsigned dataLen = m_blob->getLength();
printf("%s(%p:%d)\n", nodeName().c_str(), dataPtr, dataLen);
}
#pragma mark = IVTConstASTNode =
IVTConstASTNode::IVTConstASTNode(const IVTConstASTNode & other)
: ConstASTNode(other), m_fields()
{
m_fields = dynamic_cast<ListASTNode*>(other.m_fields->clone());
}
void IVTConstASTNode::printTree(int indent) const
{
printIndent(indent);
printf("%s:\n", nodeName().c_str());
if (m_fields)
{
m_fields->printTree(indent + 1);
}
}
#pragma mark = AssignmentASTNode =
AssignmentASTNode::AssignmentASTNode(const AssignmentASTNode & other)
: ASTNode(other), m_ident(), m_value()
{
m_ident = new std::string(*other.m_ident);
m_value = dynamic_cast<ConstASTNode*>(other.m_value->clone());
}
void AssignmentASTNode::printTree(int indent) const
{
printIndent(indent);
printf("%s(%s)\n", nodeName().c_str(), m_ident->c_str());
if (m_value) m_value->printTree(indent + 1);
}
#pragma mark = SourceDefASTNode =
SourceDefASTNode::SourceDefASTNode(const SourceDefASTNode & other)
: ASTNode(other), m_name()
{
m_name = new std::string(*other.m_name);
}
#pragma mark = PathSourceDefASTNode =
PathSourceDefASTNode::PathSourceDefASTNode(const PathSourceDefASTNode & other)
: SourceDefASTNode(other), m_path()
{
m_path = new std::string(*other.m_path);
}
void PathSourceDefASTNode::printTree(int indent) const
{
SourceDefASTNode::printTree(indent);
printIndent(indent+1);
printf("path: %s\n", m_path->c_str());
printIndent(indent+1);
printf("attributes:\n");
if (m_attributes)
{
m_attributes->printTree(indent+2);
}
}
#pragma mark = ExternSourceDefASTNode =
ExternSourceDefASTNode::ExternSourceDefASTNode(const ExternSourceDefASTNode & other)
: SourceDefASTNode(other), m_expr()
{
m_expr = dynamic_cast<ExprASTNode*>(other.m_expr->clone());
}
void ExternSourceDefASTNode::printTree(int indent) const
{
SourceDefASTNode::printTree(indent);
printIndent(indent+1);
printf("expr:\n");
if (m_expr) m_expr->printTree(indent + 2);
printIndent(indent+1);
printf("attributes:\n");
if (m_attributes)
{
m_attributes->printTree(indent+2);
}
}
#pragma mark = SectionContentsASTNode =
SectionContentsASTNode::SectionContentsASTNode(const SectionContentsASTNode & other)
: ASTNode(other), m_sectionExpr()
{
m_sectionExpr = dynamic_cast<ExprASTNode*>(other.m_sectionExpr->clone());
}
void SectionContentsASTNode::printTree(int indent) const
{
ASTNode::printTree(indent);
printIndent(indent + 1);
printf("section#:\n");
if (m_sectionExpr) m_sectionExpr->printTree(indent + 2);
}
#pragma mark = DataSectionContentsASTNode =
DataSectionContentsASTNode::DataSectionContentsASTNode(const DataSectionContentsASTNode & other)
: SectionContentsASTNode(other), m_contents()
{
m_contents = dynamic_cast<ASTNode*>(other.m_contents->clone());
}
void DataSectionContentsASTNode::printTree(int indent) const
{
SectionContentsASTNode::printTree(indent);
if (m_contents)
{
m_contents->printTree(indent + 1);
}
}
#pragma mark = BootableSectionContentsASTNode =
BootableSectionContentsASTNode::BootableSectionContentsASTNode(const BootableSectionContentsASTNode & other)
: SectionContentsASTNode(other), m_statements()
{
m_statements = dynamic_cast<ListASTNode*>(other.m_statements->clone());
}
void BootableSectionContentsASTNode::printTree(int indent) const
{
SectionContentsASTNode::printTree(indent);
printIndent(indent + 1);
printf("statements:\n");
if (m_statements) m_statements->printTree(indent + 2);
}
#pragma mark = IfStatementASTNode =
//! \warning Be careful; this method could enter an infinite loop if m_nextIf feeds
//! back onto itself. m_nextIf must be NULL at some point down the next if list.
IfStatementASTNode::IfStatementASTNode(const IfStatementASTNode & other)
: StatementASTNode(),
m_conditionExpr(),
m_ifStatements(),
m_nextIf(),
m_elseStatements()
{
m_conditionExpr = dynamic_cast<ExprASTNode*>(other.m_conditionExpr->clone());
m_ifStatements = dynamic_cast<ListASTNode*>(other.m_ifStatements->clone());
m_nextIf = dynamic_cast<IfStatementASTNode*>(other.m_nextIf->clone());
m_elseStatements = dynamic_cast<ListASTNode*>(other.m_elseStatements->clone());
}
#pragma mark = ModeStatementASTNode =
ModeStatementASTNode::ModeStatementASTNode(const ModeStatementASTNode & other)
: StatementASTNode(other), m_modeExpr()
{
m_modeExpr = dynamic_cast<ExprASTNode*>(other.m_modeExpr->clone());
}
void ModeStatementASTNode::printTree(int indent) const
{
StatementASTNode::printTree(indent);
printIndent(indent + 1);
printf("mode:\n");
if (m_modeExpr) m_modeExpr->printTree(indent + 2);
}
#pragma mark = MessageStatementASTNode =
MessageStatementASTNode::MessageStatementASTNode(const MessageStatementASTNode & other)
: StatementASTNode(other), m_type(other.m_type), m_message()
{
m_message = new std::string(*other.m_message);
}
void MessageStatementASTNode::printTree(int indent) const
{
StatementASTNode::printTree(indent);
printIndent(indent + 1);
printf("%s: %s\n", getTypeName(), m_message->c_str());
}
const char * MessageStatementASTNode::getTypeName() const
{
switch (m_type)
{
case kInfo:
return "info";
case kWarning:
return "warning";
case kError:
return "error";
}
return "unknown";
}
#pragma mark = LoadStatementASTNode =
LoadStatementASTNode::LoadStatementASTNode(const LoadStatementASTNode & other)
: StatementASTNode(other), m_data(), m_target(), m_isDCDLoad(other.m_isDCDLoad)
{
m_data = other.m_data->clone();
m_target = other.m_target->clone();
}
void LoadStatementASTNode::printTree(int indent) const
{
StatementASTNode::printTree(indent);
printIndent(indent + 1);
printf("data:\n");
if (m_data) m_data->printTree(indent + 2);
printIndent(indent + 1);
printf("target:\n");
if (m_target) m_target->printTree(indent + 2);
}
#pragma mark = CallStatementASTNode =
CallStatementASTNode::CallStatementASTNode(const CallStatementASTNode & other)
: StatementASTNode(other), m_type(other.m_type), m_target(), m_arg()
{
m_target = other.m_target->clone();
m_arg = other.m_arg->clone();
}
void CallStatementASTNode::printTree(int indent) const
{
printIndent(indent);
printf("%s(%s)%s\n", nodeName().c_str(), (m_type == kCallType ? "call" : "jump"), (m_isHAB ? "/HAB" : ""));
printIndent(indent + 1);
printf("target:\n");
if (m_target) m_target->printTree(indent + 2);
printIndent(indent + 1);
printf("arg:\n");
if (m_arg) m_arg->printTree(indent + 2);
}
#pragma mark = SourceASTNode =
SourceASTNode::SourceASTNode(const SourceASTNode & other)
: ASTNode(other), m_name()
{
m_name = new std::string(*other.m_name);
}
void SourceASTNode::printTree(int indent) const
{
printIndent(indent);
printf("%s(%s)\n", nodeName().c_str(), m_name->c_str());
}
#pragma mark = SectionMatchListASTNode =
SectionMatchListASTNode::SectionMatchListASTNode(const SectionMatchListASTNode & other)
: ASTNode(other), m_sections(), m_source()
{
if (other.m_sections)
{
m_sections = dynamic_cast<ListASTNode *>(other.m_sections->clone());
}
if (other.m_source)
{
m_source = new std::string(*other.m_source);
}
}
void SectionMatchListASTNode::printTree(int indent) const
{
ASTNode::printTree(indent);
printIndent(indent+1);
printf("sections:\n");
if (m_sections)
{
m_sections->printTree(indent+2);
}
printIndent(indent+1);
printf("source: ", m_source->c_str());
if (m_source)
{
printf("%s\n", m_source->c_str());
}
else
{
printf("\n");
}
}
#pragma mark = SectionASTNode =
SectionASTNode::SectionASTNode(const SectionASTNode & other)
: ASTNode(other), m_name(), m_source()
{
m_action = other.m_action;
if (other.m_name)
{
m_name = new std::string(*other.m_name);
}
if (other.m_source)
{
m_source = new std::string(*other.m_source);
}
}
void SectionASTNode::printTree(int indent) const
{
printIndent(indent);
const char * actionName;
switch (m_action)
{
case kInclude:
actionName = "include";
break;
case kExclude:
actionName = "exclude";
break;
}
if (m_source)
{
printf("%s(%s:%s:%s)\n", nodeName().c_str(), actionName, m_name->c_str(), m_source->c_str());
}
else
{
printf("%s(%s:%s)\n", nodeName().c_str(), actionName, m_name->c_str());
}
}
#pragma mark = SymbolASTNode =
SymbolASTNode::SymbolASTNode(const SymbolASTNode & other)
: ASTNode(other), m_symbol(), m_source()
{
m_symbol = new std::string(*other.m_symbol);
m_source = new std::string(*other.m_source);
}
void SymbolASTNode::printTree(int indent) const
{
printIndent(indent);
const char * symbol = NULL;
if (m_symbol)
{
symbol = m_symbol->c_str();
}
const char * source = NULL;
if (m_source)
{
source = m_source->c_str();
}
printf("%s(", nodeName().c_str());
if (source)
{
printf(source);
}
else
{
printf(".");
}
printf(":");
if (symbol)
{
printf(symbol);
}
else
{
printf(".");
}
printf(")\n");
}
#pragma mark = AddressRangeASTNode =
AddressRangeASTNode::AddressRangeASTNode(const AddressRangeASTNode & other)
: ASTNode(other), m_begin(), m_end()
{
m_begin = other.m_begin->clone();
m_end = other.m_end->clone();
}
void AddressRangeASTNode::printTree(int indent) const
{
ASTNode::printTree(indent);
printIndent(indent + 1);
printf("begin:\n");
if (m_begin) m_begin->printTree(indent + 2);
printIndent(indent + 1);
printf("end:\n");
if (m_end) m_end->printTree(indent + 2);
}
#pragma mark = FromStatementASTNode =
FromStatementASTNode::FromStatementASTNode(std::string * source, ListASTNode * statements)
: StatementASTNode(), m_source(source), m_statements(statements)
{
}
FromStatementASTNode::FromStatementASTNode(const FromStatementASTNode & other)
: StatementASTNode(), m_source(), m_statements()
{
m_source = new std::string(*other.m_source);
m_statements = dynamic_cast<ListASTNode*>(other.m_statements->clone());
}
void FromStatementASTNode::printTree(int indent) const
{
ASTNode::printTree(indent);
printIndent(indent + 1);
printf("source: ");
if (m_source) printf("%s\n", m_source->c_str());
printIndent(indent + 1);
printf("statements:\n");
if (m_statements) m_statements->printTree(indent + 2);
}
| 31,194 | 11,765 |
/**
*
* gamepad_button_up_event.cpp
*
**/
#include"gamepad_button_up_event.hpp"
#include<sdl.h>
#include<cmath>
namespace aab {
namespace events{
GamepadButtonUpEvent::GamepadButtonUpEvent (InternalEvent internalEvent) : Event (getClassEventType ())
{
SDL_Event * event = static_cast <SDL_Event *> (internalEvent-> getReference ());
id = event-> jbutton.which;
button = event-> jbutton.button;
}
GamepadButtonUpEvent::~GamepadButtonUpEvent () throw ()
{
// nothing //
}
int GamepadButtonUpEvent::getGamePadId () const
{
return id;
}
int GamepadButtonUpEvent::getButton () const
{
return button;
}
EventType GamepadButtonUpEvent::getClassEventType ()
{
return gamepad_button_up_event;
}
} // events
} // aab
| 780 | 301 |
/*----------------------------------------------------------------------
Copyright (c) 1998 Gipsysoft. All Rights Reserved.
Please see the file "licence.txt" for licencing details.
File: HTMLImage.cpp
Owner: russf@gipsysoft.com
Purpose: HTML Image object
----------------------------------------------------------------------*/
#include "stdafx.h"
#include "HTMLParse.h"
#include "defaults.h"
#include "HTMLSectionCreator.h"
#include "HTMLImageSection.h"
CHTMLImage::CHTMLImage( int nWidth, int nHeight, int nBorder, LPCTSTR pcszFilename, CStyle::Align alg, CQHTMImageABC *pImage, const CStaticString &strALTText )
: CHTMLParagraphObject( CHTMLParagraphObject::knNone )
, m_nWidth( nWidth )
, m_nHeight( nHeight )
, m_nBorder( nBorder )
, m_strFilename( pcszFilename )
, m_alg( alg )
, m_pImage( pImage )
, m_strALTText( strALTText.GetData(), strALTText.GetLength() )
{
}
CHTMLImage::~CHTMLImage()
{
// Since images are cached in the document, they are not owned here.
// This object just points to the image in the document.
// delete m_pImage;
}
#ifdef _DEBUG
void CHTMLImage::Dump() const
{
TRACENL( _T("Image\n") );
TRACENL( _T("\tName(%s)\n"), (LPCTSTR)m_strFilename );
TRACENL( _T("\t Width(%d)\n"), m_nWidth );
TRACENL( _T("\t Height(%d)\n"), m_nHeight );
TRACENL( _T("\tAlignment (%s)\n"), GetStringFromAlignment( m_alg ) );
}
#endif // _DEBUG
void CHTMLImage::AddDisplayElements( class CHTMLSectionCreator *psc )
{
#ifdef QHTM_BUILD_INTERNAL_IMAGING
ASSERT( m_pImage );
WinHelper::CSize size( m_pImage->GetSize() );
#else // QHTM_BUILD_INTERNAL_IMAGING
WinHelper::CSize size( 100, 100 );
if( m_pImage )
size = m_pImage->GetSize();
#endif // QHTM_BUILD_INTERNAL_IMAGING
if( psc->GetDC().IsPrinting() )
size = psc->GetDC().Scale( size );
int nWidth = m_nWidth;
int nHeight = m_nHeight;
const int nBorder = m_nBorder;
if( nWidth == 0 )
{
nWidth = size.cx;
}
else if( nWidth < 0 )
{
nWidth = psc->GetCurrentWidth();
}
else
{
nWidth = psc->GetDC().ScaleX( nWidth );
}
if( nHeight == 0 )
nHeight = size.cy;
else
nHeight = psc->GetDC().ScaleY( nHeight );
nWidth += psc->GetDC().ScaleX(nBorder * 2);
nHeight += psc->GetDC().ScaleY(nBorder * 2);
int nTop = psc->GetCurrentYPos();
int nBaseline = nHeight;
if( nWidth > psc->GetRightMargin() - psc->GetCurrentXPos() )
{
psc->CarriageReturn( true );
nTop = psc->GetCurrentYPos();
}
int nLeft = psc->GetCurrentXPos();
switch( m_alg )
{
case CStyle::algBottom:
break;
case CStyle::algCentre:
case CStyle::algMiddle:
nBaseline = nHeight / 2;
break;
case CStyle::algTop:
nBaseline = psc->GetDC().GetCurrentFontBaseline();
break;
case CStyle::algLeft:
{
nLeft = psc->GetLeftMargin();
psc->AddNewLeftMargin( nLeft + nWidth + g_defaults.m_nImageMargin, psc->GetCurrentYPos() + nHeight );
if( psc->GetCurrentXPos() == nLeft )
psc->SetCurrentXPos( psc->GetLeftMargin() );
}
break;
case CStyle::algRight:
{
nLeft = psc->GetRightMargin() - nWidth;
psc->AddNewRightMargin( nLeft - g_defaults.m_nImageMargin, psc->GetCurrentYPos() + nHeight );
}
break;
}
CHTMLImageSection *pImageSection = (CHTMLImageSection *)psc->GetHTMLSection()->GetKeeperItemByID( m_uID );
if( !pImageSection )
{
pImageSection = new CHTMLImageSection( psc->GetHTMLSection(), m_pImage, nBorder );
pImageSection->SetID( m_uID );
pImageSection->SetElementID( m_strElementID );
}
if( m_strALTText.GetLength() )
{
pImageSection->SetTipText( m_strALTText );
}
psc->AddSection( pImageSection );
pImageSection->Set( nLeft, nTop, nLeft + nWidth, nTop + nHeight );
if( m_alg != CStyle::algLeft && m_alg != CStyle::algRight )
{
psc->SetCurrentXPos( psc->GetCurrentXPos() + nWidth );
psc->AddBaseline( nBaseline );
}
} | 3,777 | 1,569 |
#include "infer_yellow.hpp"
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace std;
using namespace yellow;
//Get all image name
bool getImageName(const char *fileName, vector<string> &imageName)
{
FILE *f = fopen(fileName, "r");
if (f == NULL)
return false;
char buffer[300];
while (fgets(buffer, 300, f))
{
//Cut '\n'
int len = strlen(buffer);
if(buffer[len - 1] == '\n')
buffer[strlen(buffer) - 1] = '\0';
imageName.push_back(string(buffer));
}
fclose(f);
return true;
}
int main(int argc, char const *argv[])
{
if(argc<4)
{
std::cout<<"error : miss some models."<<endl;
return 0;
}
//output the models of inputs
for(int i=1;i<argc;i++)
{
std::cout<<argv[i]<<std::endl;
}
//the batch of model
const int batch = 8;
std::vector<std::string> models;
//u can load multi models
{
models.push_back(argv[1]);
models.push_back(argv[2]);
models.push_back(argv[3]);
}
int code = -1;
char *err = nullptr;
int gpuid = 0;
// Do createNet
auto *handle = createNet(models, gpuid, &code, &err);
if (code == 200)
{
vector<string> imageName;
// Judge images can be open
if (!getImageName("../images/file.txt", imageName))
{
cerr << "Can't open image" << endl;
}
int num_times = imageName.size()/batch;
//deal with the images not matches
bool full_batch=true;
if(num_times*batch!=imageName.size())
{
num_times++;
full_batch=false;
}
//Get the image number of each inference
int each_time_images=batch;
//Do inference
for (int i = 0; i < num_times; ++i)
{
// Read image from file to bytes
vector<cv::Mat> imgs;
//Get image index of each inference.
if(!full_batch && i==num_times-1)
each_time_images=imageName.size()%batch;
for (int n = 0; n < each_time_images; n++)
{
string name = imageName[i * batch + n];
cv::Mat img = cv::imread("../images/" + name);
if (!img.data)
{
cerr << "Read image " << name << " error, No Data!" << endl;
continue;
}
imgs.push_back(img);
}
vector<string> results;
//Infer body
netInference(handle, imgs, &code, &err,&results);
if (code == 200)
{
//Get the results of each infer.
for (int i = 0; i < imgs.size(); i++)
{
std::cout <<results.at(i) << std::endl;
}
}
else
{
std::cout << err << std::endl;
}
}
}
else
{
std::cout << err << std::endl;
}
//release variables space
releaseNet(handle,&code,&err);
return 0;
}
| 3,168 | 997 |
#include <cstdio>
#include <cstring>
#include <map>
#include <vector>
using namespace std;
map<int, vector<int> > letter_bucket;
char p[110];
bool check_suffix(char *p) {
int length = strlen(p);
int pointer = -1;
for(int i = 0; i < length; i++) {
if(('a' > p[i]) or ('z' < p[i]))
continue;
int ans = -1;
int letter = p[i];
int left = 0;
vector<int> arr = letter_bucket[letter];
int right = arr.size();
while(left <= right) {
int middle = (left+right)/2;
if (arr[middle] <= pointer)
left = middle + 1;
else {
ans = middle;
right = middle - 1;
}
}
if(ans == -1)
return false;
else
pointer = ans;
}
return true;
}
void solve() {
scanf("%s\n", p);
int length = strlen(p);
int left = 0;
int right = length;
int ans;
while(left <= right) {
int middle = (left+right)/2;
bool flag = check_suffix(p + middle);
if(flag) {
right = middle - 1;
ans = middle;
}
else
left = middle + 1;
}
printf("%d\n", (length - ans));
}
int main() {
char S[1000009];
int N;
scanf("%s\n", S);
for(int i = 0; S[i] != '\0'; i++) {
letter_bucket[S[i]].push_back(i);
}
scanf("%d", &N);
for(int i = 0; i < N; i++)
solve();
}
| 1,479 | 523 |
//
// Copyright (C) 2004-2011 by Autodesk, Inc.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of version 2.1 of the GNU Lesser
// General Public License as published by the Free Software Foundation.
//
// This library 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 library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
#include "Foundation.h"
//-------------------------------------------------------------------------
// Constructors and Destructors
//-------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////
// <summary>
// The default constructor for a MgStreamParser object. However, since
// this method is protected and this class is merely a wrapper for various
// static methods, this constructor should never be called.
// </summary>
MgStreamParser::MgStreamParser( void )
{
};
//-------------------------------------------------------------------------
// Public Methods
//-------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////
// <summary>
// This static method reads and consumes the STREAM START header from the
// stream encapsulted by the given StreamData* parameter. It sets the
// version of the StreamData object during the read.
// </summary>
//
// <param name = "pStreamData">
// A pointer the the StreamData object that encapsulates the incoming and
// outgoing stream information.
// </param>
//
// <returns>
// Returns true if successful; false otherwise.
// </returns>
bool MgStreamParser::ParseStreamHeader( MgStreamData* pStreamData )
{
ACE_ASSERT( pStreamData );
bool ret = false;
if ( pStreamData )
{
MgStreamHelper* pHelper = pStreamData->GetStreamHelper();
UINT32 header = 0;
MgStreamHelper::MgStreamStatus stat = pHelper->GetUINT32( header, true , false );
if ( MgStreamHelper::mssDone == stat && MgStreamParser::mshStreamStart == header )
{
UINT32 version = 0;
stat = pHelper->GetUINT32( version, true, false );
if ( MgStreamHelper::mssDone == stat )
{
pStreamData->SetVersion( version );
ret = true;
}
}
if (false == ret)
{
// The stream may contain garbage when the connection is dropped for
// some reason. This exception may be ignored to reduce noise.
throw new MgInvalidStreamHeaderException(L"MgStreamParser.ParseStreamHeader",
__LINE__, __WFILE__, NULL, L"", NULL);
}
else if (MgStreamParser::StreamVersion != pStreamData->GetVersion())
{
throw new MgStreamIoException(L"MgStreamParser.ParseStreamHeader",
__LINE__, __WFILE__, NULL, L"MgInvalidTCPProtocol", NULL);
}
}
return ret;
};
///////////////////////////////////////////////////////////////////////////
// <summary>
// This static method reads and consumes the DATA header from the
// stream encapsulted by the given StreamData* parameter.
// </summary>
//
// <param name = "pStreamData">
// A pointer the the StreamData object that encapsulates the incoming and
// outgoing stream information.
// </param>
//
// <returns>
// Returns true if successful; false otherwise.
// </returns>
bool MgStreamParser::ParseDataHeader( MgStreamData* pStreamData )
{
ACE_ASSERT( pStreamData );
bool ret = false;
if ( pStreamData )
{
MgStreamHelper* pHelper = pStreamData->GetStreamHelper();
UINT32 header = 0;
MgStreamHelper::MgStreamStatus stat = pHelper->GetUINT32( header, true, false );
if ( MgStreamHelper::mssDone == stat && MgStreamParser::mshStreamData == header )
{
ret = true;
}
}
return ret;
};
///////////////////////////////////////////////////////////////////////////
// <summary>
// This static method reads and consumes the STREAM END header from the
// stream encapsulted by the given StreamData* parameter.
// </summary>
//
// <param name = "pStreamData">
// A pointer the the StreamData object that encapsulates the incoming and
// outgoing stream information.
// </param>
//
// <returns>
// Returns true if successful; false otherwise.
// </returns>
bool MgStreamParser::ParseEndHeader( MgStreamData* pStreamData )
{
ACE_ASSERT( pStreamData );
bool ret = false;
if ( pStreamData )
{
MgStreamHelper* pHelper = pStreamData->GetStreamHelper();
UINT32 header = 0;
MgStreamHelper::MgStreamStatus stat = pHelper->GetUINT32( header, true, false );
if ( MgStreamHelper::mssDone == stat && MgStreamParser::mshStreamEnd == header )
{
ret = true;
}
}
return ret;
};
///////////////////////////////////////////////////////////////////////////
// <summary>
// This static method writes a STREAM START header to the
// stream encapsulted by the given StreamData* parameter.
// </summary>
//
// <param name = "pStreamData">
// A pointer the the StreamData object that encapsulates the incoming and
// outgoing stream information.
// </param>
//
// <returns>
// Returns true if successful; false otherwise.
// </returns>
bool MgStreamParser::WriteStreamHeader( MgStreamData* pStreamData )
{
ACE_ASSERT ( pStreamData );
bool ret = false;
if ( pStreamData )
{
MgStreamHelper* pHelper = pStreamData->GetStreamHelper();
MgStreamHelper::MgStreamStatus stat = pHelper->WriteUINT32( MgStreamParser::mshStreamStart );
if ( MgStreamHelper::mssDone == stat )
{
//stat = pHelper->WriteUINT32( pStreamData->GetVersion() );
stat = pHelper->WriteUINT32( 1 ); // TODO: majik number
ret = ( stat != MgStreamHelper::mssDone ) ? false : true;
}
}
return ret;
};
///////////////////////////////////////////////////////////////////////////
// <summary>
// This static method writes a STREAM END header to the
// stream encapsulted by the given StreamData* parameter.
// </summary>
//
// <param name = "pStreamData">
// A pointer the the StreamData object that encapsulates the incoming and
// outgoing stream information.
// </param>
//
// <returns>
// Returns true if successful; false otherwise.
// </returns>
bool MgStreamParser::WriteEndHeader( MgStreamData* pStreamData )
{
ACE_ASSERT( pStreamData );
bool ret = false;
if ( pStreamData )
{
MgStreamHelper* pHelper = pStreamData->GetStreamHelper();
MgStreamHelper::MgStreamStatus stat = pHelper->WriteUINT32( MgStreamParser::mshStreamEnd );
ret = ( stat != MgStreamHelper::mssDone ) ? false : true;
}
return ret;
};
| 7,265 | 2,075 |
//
// Particle.cpp
// Shapes
//
// Created by Jildert Viet on 18-02-15.
//
//
#include "Particle.h"
Particle::Particle(){
}
Particle::Particle(ofVec3f *destination, bool startAtDest){
this->destination = destination;
if(startAtDest){
loc = ofVec2f(ofRandom(ofGetWindowWidth()),ofRandom(ofGetWindowHeight()));
switch((int)ofRandom(4)){
case 0:
loc.x = 0;
break;
case 1:
loc.x = ofGetWindowWidth();
break;
case 2:
loc.y = 0;
break;
case 3:
loc.y = ofGetWindowHeight();
break;
}
} else{
loc = *destination;
}
}
Particle::Particle(ofVec2f destination){
loc = ofVec2f(ofRandom(ofGetWindowWidth()), ofRandom(ofGetWindowHeight()));
*(this->destination) = destination;
}
void Particle::display(){
ofSetColor(ofColor::white);
ofDrawRectangle(loc, 1, 1);
}
void Particle::update(){
if(!state){ // Free
direction.normalize();
acceleration = direction * 0.5;
velocity += acceleration;
velocity.limit(topspeed);
loc += velocity;
// checkBorders();
} else{ // In formation
ofVec2f dir2 = *destination - loc;
dir2.normalize();
dir2 *= 0.4;
acceleration = dir2;
velocity += acceleration;
if(addNoise){
loc += ofVec2f(ofRandom(-noise_max, noise_max), ofRandom(-noise_max, noise_max));
addNoise = false;
}
velocity.limit(topspeed);
loc += velocity;
// So it doesn't vibrate when in formation
float distance = loc.squareDistance(*destination);
if(distance < 100)
velocity *= 0.001;
}
// checkBorders();
// if(loc.x > ofGetViewportWidth()) {
//// cout << ofGetViewportWidth() << endl;
// velocity.x *= -1;
// direction.x *= -1;
// return;
// }
// if(loc.x < 0){
// velocity.x *= -1;
// direction.x *= -1;
// return;
// }
// if (loc.y > ofGetViewportHeight()) {
// direction.y *= -1;
// velocity.y *= -1;
// return;
// }
// if(loc.y < 0){
// direction.y *= -1;
// velocity.y *= -1;
// return;
// }
}
void Particle::changeMode(){
state = !state;
if(state)
direction = ofVec2f( ((int)ofRandom(-8,8)) *0.25, ((int)ofRandom(-8, 8))*0.25 );
}
void Particle::locationIsDestination(){
loc = *destination;
}
void Particle::connectParticle(Particle* p){
// if(checkIfConnected(p)){
connectedParticles.push_back(p);
p->connectedParticles.push_back(this);
// }
}
bool Particle::checkIfConnected(Particle* p){
for(int i=0; i<connectedParticles.size(); i++){
if(this==p){
return true;
}
}
return false;
}
void Particle::clearConnectedParticles(){
connectedParticles.clear();
}
| 3,267 | 1,063 |
//
// Created by tomer on 11/4/19.
//
#include <cassert>
#include <cstdlib>
#include "Permutation.h"
Permutation::Permutation(size_t mod) : mod(mod) {
// assert (mod <= P31);
// size_t index = rand() % 5;
size_t index = 0;
mult_const = primitive_root_array[index];
mult_inv_const = inv_primitive_root_array[index];
//todo: translate from python the general case.
}
uint32_t Permutation::get_perm(size_t el) {
// if (DB) assert (el < mod);
return (el * mult_const) % mod;
}
uint64_t Permutation::get_perm64(uint64_t el) {
// if (DB) assert (el < mod);
return (el * mult_const) % mod;
}
uint32_t Permutation::get_perm_inv(size_t el) {
// if (DB) assert (el < mod);
return (el * mult_inv_const) % mod;
}
//uint32_t Permutation::operator()(size_t el) {
// assert (el < mod);
// return el*mu;
//}
| 847 | 348 |
#pragma once
// (C) Copyright Takayama Fumihiko 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
#include <IOKit/hid/IOHIDUsageTables.h>
#include <functional>
#include <iostream>
#include <type_safe/strong_typedef.hpp>
namespace pqrs {
namespace osx {
struct iokit_hid_usage : type_safe::strong_typedef<iokit_hid_usage, int32_t>,
type_safe::strong_typedef_op::equality_comparison<iokit_hid_usage>,
type_safe::strong_typedef_op::relational_comparison<iokit_hid_usage> {
using strong_typedef::strong_typedef;
};
inline std::ostream& operator<<(std::ostream& stream, const iokit_hid_usage& value) {
return stream << type_safe::get(value);
}
constexpr iokit_hid_usage iokit_hid_usage_generic_desktop_pointer(kHIDUsage_GD_Pointer);
constexpr iokit_hid_usage iokit_hid_usage_generic_desktop_mouse(kHIDUsage_GD_Mouse);
constexpr iokit_hid_usage iokit_hid_usage_generic_desktop_keyboard(kHIDUsage_GD_Keyboard);
constexpr iokit_hid_usage iokit_hid_usage_generic_desktop_keypad(kHIDUsage_GD_Keypad);
constexpr iokit_hid_usage iokit_hid_usage_generic_desktop_x(kHIDUsage_GD_X);
constexpr iokit_hid_usage iokit_hid_usage_generic_desktop_y(kHIDUsage_GD_Y);
constexpr iokit_hid_usage iokit_hid_usage_generic_desktop_z(kHIDUsage_GD_Z);
constexpr iokit_hid_usage iokit_hid_usage_generic_desktop_wheel(kHIDUsage_GD_Wheel);
constexpr iokit_hid_usage iokit_hid_usage_led_caps_lock(kHIDUsage_LED_CapsLock);
constexpr iokit_hid_usage iokit_hid_usage_consumer_consumer_control(kHIDUsage_Csmr_ConsumerControl);
constexpr iokit_hid_usage iokit_hid_usage_consumer_power(kHIDUsage_Csmr_Power);
constexpr iokit_hid_usage iokit_hid_usage_consumer_display_brightness_increment(kHIDUsage_Csmr_DisplayBrightnessIncrement);
constexpr iokit_hid_usage iokit_hid_usage_consumer_display_brightness_decrement(kHIDUsage_Csmr_DisplayBrightnessDecrement);
constexpr iokit_hid_usage iokit_hid_usage_consumer_fast_forward(kHIDUsage_Csmr_FastForward);
constexpr iokit_hid_usage iokit_hid_usage_consumer_rewind(kHIDUsage_Csmr_Rewind);
constexpr iokit_hid_usage iokit_hid_usage_consumer_scan_next_track(kHIDUsage_Csmr_ScanNextTrack);
constexpr iokit_hid_usage iokit_hid_usage_consumer_scan_previous_track(kHIDUsage_Csmr_ScanPreviousTrack);
constexpr iokit_hid_usage iokit_hid_usage_consumer_eject(kHIDUsage_Csmr_Eject);
constexpr iokit_hid_usage iokit_hid_usage_consumer_play_or_pause(kHIDUsage_Csmr_PlayOrPause);
constexpr iokit_hid_usage iokit_hid_usage_consumer_mute(kHIDUsage_Csmr_Mute);
constexpr iokit_hid_usage iokit_hid_usage_consumer_volume_increment(kHIDUsage_Csmr_VolumeIncrement);
constexpr iokit_hid_usage iokit_hid_usage_consumer_volume_decrement(kHIDUsage_Csmr_VolumeDecrement);
constexpr iokit_hid_usage iokit_hid_usage_consumer_ac_pan(kHIDUsage_Csmr_ACPan);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case(0x0001);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_display(0x0002);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_accelerometer(0x0003);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_ambient_light_sensor(0x0004);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_temperature_sensor(0x0005);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard(0x0006);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_headset(0x0007);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_proximity_sensor(0x0008);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_gyro(0x0009);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_compass(0x000A);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_device_management(0x000B);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_trackpad(0x000C);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case_reserved(0x000D);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_motion(0x000E);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_backlight(0x000F);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_device_motion_lite(0x0010);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_force(0x0011);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_bluetooth_radio(0x0012);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_orb(0x0013);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_accessory_battery(0x0014);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_humidity(0x0015);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_hid_event_relay(0x0016);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_nx_event(0x0017);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_nx_event_translated(0x0018);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_nx_event_diagnostic(0x0019);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_homer(0x0020);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_color(0x0021);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_accessibility(0x0022);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_spotlight(0x0001);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_dashboard(0x0002);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_function(0x0003);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_launchpad(0x0004);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_reserved(0x000a);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_caps_lock_delay_enable(0x000b);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_power_state(0x000c);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_expose_all(0x0010);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_expose_desktop(0x0011);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_brightness_up(0x0020);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_brightness_down(0x0021);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_language(0x0030);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_multitouch_power_off(0x0001);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_multitouch_device_ready(0x0002);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_multitouch_external_message(0x0003);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_multitouch_will_power_on(0x0004);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_multitouch_touch_cancel(0x0005);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case_keyboard_fn(0x0003);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case_brightness_up(0x0004);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case_brightness_down(0x0005);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case_video_mirror(0x0006);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case_illumination_toggle(0x0007);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case_illumination_up(0x0008);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case_illumination_down(0x0009);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case_clamshell_latched(0x000a);
constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case_reserved_mouse_data(0x00c0);
} // namespace osx
} // namespace pqrs
namespace std {
template <>
struct hash<pqrs::osx::iokit_hid_usage> : type_safe::hashable<pqrs::osx::iokit_hid_usage> {
};
} // namespace std
| 7,456 | 3,297 |
#pragma once
#include "signals.hpp"
#include "tor.hpp"
#include "user.hpp"
#include "tor/TorControl.h"
#include "tor/TorManager.h"
#include "core/IdentityManager.h"
//
// Tego Context
//
struct tego_context
{
public:
tego_context();
void start_tor(const tego_tor_launch_config_t* config);
bool get_tor_daemon_configured() const;
size_t get_tor_logs_size() const;
const std::vector<std::string>& get_tor_logs() const;
const char* get_tor_version_string() const;
tego_tor_control_status_t get_tor_control_status() const;
tego_tor_process_status_t get_tor_process_status() const;
tego_tor_network_status_t get_tor_network_status() const;
int32_t get_tor_bootstrap_progress() const;
tego_tor_bootstrap_tag_t get_tor_bootstrap_tag() const;
void start_service(
tego_ed25519_private_key_t const* hostPrivateKey,
tego_user_id_t const* const* userBuffer,
tego_user_type_t* const userTypeBuffer,
size_t userCount);
void start_service();
void update_tor_daemon_config(const tego_tor_daemon_config_t* config);
void update_disable_network_flag(bool disableNetwork);
void save_tor_daemon_config();
void set_host_onion_service_state(tego_host_onion_service_state_t state);
std::unique_ptr<tego_user_id_t> get_host_user_id() const;
tego_host_onion_service_state_t get_host_onion_service_state() const;
void send_chat_request(
const tego_user_id_t* user,
const char* message,
size_t messageLength);
void acknowledge_chat_request(
const tego_user_id_t* user,
tego_chat_acknowledge_t response);
tego_message_id_t send_message(
const tego_user_id_t* user,
const std::string& message);
tego_user_type_t get_user_type(tego_user_id_t const* user) const;
size_t get_user_count() const;
std::vector<tego_user_id_t*> get_users() const;
void forget_user(const tego_user_id_t* user);
std::tuple<tego_file_transfer_id_t, std::unique_ptr<tego_file_hash_t>, tego_file_size_t> send_file_transfer_request(
tego_user_id_t const* user,
std::string const& filePath);
void respond_file_transfer_request(
tego_user_id_t const* user,
tego_file_transfer_id_t fileTransfer,
tego_file_transfer_response_t response,
std::string const& destPath);
void cancel_file_transfer_transfer(
tego_user_id_t const* user,
tego_file_transfer_id_t);
tego::callback_registry callback_registry_;
tego::callback_queue callback_queue_;
// anything that touches internal state should do so through
// this 'global' (actually per tego_context) mutex
std::mutex mutex_;
// TODO: figure out ownership of these Qt types
Tor::TorManager* torManager = nullptr;
Tor::TorControl* torControl = nullptr;
IdentityManager* identityManager = nullptr;
// we store the thread id that this context is associated with
// calls which go into our qt internals must be called from the same
// thread as the context was created on
// (this is not entirely true, they must be called from the thread with the Qt
// event loop, which in our case is the thread the context is created on)
std::thread::id threadId;
private:
class ContactUser* getContactUser(const tego_user_id_t*) const;
mutable std::string torVersion;
mutable std::vector<std::string> torLogs;
tego_host_onion_service_state_t hostUserState = tego_host_onion_service_state_none;
}; | 3,513 | 1,147 |
#ifndef MARNAV__SEATALK__MESSAGE_11__HPP
#define MARNAV__SEATALK__MESSAGE_11__HPP
#include "message.hpp"
namespace marnav
{
namespace seatalk
{
/// @brief Apparent Wind Speed
///
/// @code
/// 11 01 XX 0Y
///
/// Apparent Wind Speed: (XX & 0x7F) + Y/10 Knots
/// Units flag: XX&0x80=0 => Display value in Knots
/// XX&0x80=0x80 => Display value in Meter/Second
/// @endcode
///
/// Corresponding NMEA sentence: MWV
///
class message_11 : public message
{
public:
constexpr static const message_id ID = message_id::apparent_wind_speed;
constexpr static size_t SIZE = 4;
message_11();
message_11(const message_11 &) = default;
message_11 & operator=(const message_11 &) = default;
virtual raw get_data() const override;
static std::unique_ptr<message> parse(const raw & data);
private:
uint8_t unit_; // unit of value
uint16_t speed_; // wind speed in 1/10th of unit
public:
uint8_t get_unit() const noexcept { return unit_; }
uint16_t get_speed() const noexcept { return speed_; }
void set_unit(uint8_t t) noexcept { unit_ = t; }
void set_speed(uint16_t t) noexcept { speed_ = t; }
};
}
}
#endif
| 1,136 | 447 |
#include "persona.h"
#include <string>
Persona::Persona(){} //Constructor por default.
Persona::Persona(std::string nombre, std::string nacionalidad, int edad)
{
this->nombre=nombre;
this->nacionalidad=nacionalidad;
this->edad=edad;
}
Persona::saludar(Persona persona)
{
persona.devolverSaludo(nombre);
return "Hola! Soy " << this->nombre << "\n ΒΏy tΓΊ?";
}
| 381 | 142 |
// Copyright (C) 2018-2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "ngraph_reader_tests.hpp"
#include <string>
TEST_F(NGraphReaderTests, ReadBatchNormInferenceNetwork) {
std::string model = R"V0G0N(
<net name="BNFusion" version="10">
<layers>
<layer name="in1" type="Parameter" id="0" version="opset1">
<data element_type="f32" shape="1,3,22,22"/>
<output>
<port id="0" precision="FP32">
<dim>1</dim>
<dim>3</dim>
<dim>22</dim>
<dim>22</dim>
</port>
</output>
</layer>
<layer id="11" name="conv_weights" type="Const" version="opset1">
<data offset="0" size="36" />
<output>
<port id="0" precision="FP32">
<dim>3</dim>
<dim>3</dim>
<dim>1</dim>
<dim>1</dim>
</port>
</output>
</layer>
<layer id="12" name="conv" type="Convolution" version="opset1">
<data dilations="1,1" group="1" kernel="1,1" output="0" pads_begin="0,0" pads_end="0,0" strides="1,1"/>
<input>
<port id="0" precision="FP32">
<dim>1</dim>
<dim>3</dim>
<dim>22</dim>
<dim>22</dim>
</port>
<port id="1" precision="FP32">
<dim>3</dim>
<dim>3</dim>
<dim>1</dim>
<dim>1</dim>
</port>
</input>
<output>
<port id="2" precision="FP32">
<dim>1</dim>
<dim>3</dim>
<dim>22</dim>
<dim>22</dim>
</port>
</output>
</layer>
<layer id="1" name="a" type="Const" version="opset1">
<data offset="0" size="12"/>
<output>
<port id="0" precision="FP32">
<dim>3</dim>
</port>
</output>
</layer>
<layer id="2" name="a1" type="Const" version="opset1">
<data offset="12" size="12"/>
<output>
<port id="0" precision="FP32">
<dim>3</dim>
</port>
</output>
</layer>
<layer id="3" name="a2" type="Const" version="opset1">
<data offset="24" size="12"/>
<output>
<port id="0" precision="FP32">
<dim>3</dim>
</port>
</output>
</layer>
<layer id="4" name="a3" type="Const" version="opset1">
<data offset="36" size="12"/>
<output>
<port id="0" precision="FP32">
<dim>3</dim>
</port>
</output>
</layer>
<layer name="bn" id="5" type="BatchNormInference" version="opset1">
<data eps="0.1" />
<input>
<port id="1" precision="FP32">
<dim>1</dim>
<dim>3</dim>
<dim>22</dim>
<dim>22</dim>
</port>
<port id="2" precision="FP32">
<dim>3</dim>
</port>
<port id="3" precision="FP32">
<dim>3</dim>
</port>
<port id="4" precision="FP32">
<dim>3</dim>
</port>
<port id="5" precision="FP32">
<dim>3</dim>
</port>
</input>
<output>
<port id="6" precision="FP32">
<dim>1</dim>
<dim>3</dim>
<dim>22</dim>
<dim>22</dim>
</port>
</output>
</layer>
<layer name="output" type="Result" id="6" version="opset1">
<input>
<port id="0" precision="FP32">
<dim>1</dim>
<dim>3</dim>
<dim>22</dim>
<dim>22</dim>
</port>
</input>
</layer>
</layers>
<edges>
<edge from-layer="0" from-port="0" to-layer="12" to-port="0"/>
<edge from-layer="11" from-port="0" to-layer="12" to-port="1"/>
<edge from-layer="12" from-port="2" to-layer="5" to-port="1"/>
<edge from-layer="1" from-port="0" to-layer="5" to-port="2"/>
<edge from-layer="2" from-port="0" to-layer="5" to-port="3"/>
<edge from-layer="3" from-port="0" to-layer="5" to-port="4"/>
<edge from-layer="4" from-port="0" to-layer="5" to-port="5"/>
<edge from-layer="5" from-port="6" to-layer="6" to-port="0"/>
</edges>
</net>
)V0G0N";
std::string modelV5 = R"V0G0N(
<net name="BNFusion" version="5" precision="FP32" batch="1">
<layers>
<layer id="0" name="in1" precision="FP32" type="Input">
<output>
<port id="0">
<dim>1</dim>
<dim>3</dim>
<dim>22</dim>
<dim>22</dim>
</port>
</output>
</layer>
<layer id="3" name="bn" precision="FP32" type="Convolution">
<data dilations="1,1" group="1" kernel="1,1" output="3" pads_begin="0,0" pads_end="0,0" strides="1,1"/>
<input>
<port id="0">
<dim>1</dim>
<dim>3</dim>
<dim>22</dim>
<dim>22</dim>
</port>
</input>
<output>
<port id="3">
<dim>1</dim>
<dim>3</dim>
<dim>22</dim>
<dim>22</dim>
</port>
</output>
<weights offset="0" size="36" />
<biases offset="0" size="12"/>
</layer>
</layers>
<edges>
<edge from-layer="0" from-port="0" to-layer="3" to-port="0"/>
</edges>
</net>
)V0G0N";
compareIRs(model, modelV5, 139840);
}
| 6,351 | 2,064 |
/**
* Main Kernel Definitions
*/
#ifndef _kernel_hpp
#define _kernel_hpp
#include "program.hpp"
#include "statement.hpp"
#include "status.hpp"
#include <Arduino.h>
struct setup {
int num_cores;
bool serial;
bool net;
bool sdcard;
};
void stop();
int kmain();
// Add kernel tasks like breath or serial console to tasks list
#endif
| 342 | 123 |
/**************************************************************************\
*
* This file is part of the Coin 3D visualization library.
* Copyright (C) by Kongsberg Oil & Gas Technologies.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* ("GPL") version 2 as published by the Free Software Foundation.
* See the file LICENSE.GPL at the root directory of this source
* distribution for additional information about the GNU GPL.
*
* For using Coin with software that can not be combined with the GNU
* GPL, and for taking advantage of the additional benefits of our
* support services, please contact Kongsberg Oil & Gas Technologies
* about acquiring a Coin Professional Edition License.
*
* See http://www.coin3d.org/ for more information.
*
* Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
* http://www.sim.no/ sales@sim.no coin-support@coin3d.org
*
\**************************************************************************/
/*!
\class SoBoundingBoxCache Inventor/caches/SoBoundingBoxCache.h
\brief The SoBoundingBoxCache class is used to cache bounding boxes.
\ingroup caches
*/
// *************************************************************************
#include <Inventor/caches/SoBoundingBoxCache.h>
#include <Inventor/elements/SoCacheElement.h>
#include <Inventor/errors/SoDebugError.h>
#include "tidbitsp.h"
// *************************************************************************
class SoBoundingBoxCacheP {
public:
SbXfBox3f bbox;
SbBox3f localbbox;
SbVec3f centerpoint;
unsigned int centerset : 1;
unsigned int linesorpoints : 1;
};
#define PRIVATE(p) ((p)->pimpl)
// *************************************************************************
/*!
Constructor with \a state being the current state.
*/
SoBoundingBoxCache::SoBoundingBoxCache(SoState *state)
: SoCache(state)
{
PRIVATE(this) = new SoBoundingBoxCacheP;
PRIVATE(this)->centerset = 0;
PRIVATE(this)->linesorpoints = 0;
#if COIN_DEBUG
if (coin_debug_caching_level() > 0) {
SoDebugError::postInfo("SoBoundingBoxCache::SoBoundingBoxCache",
"Cache created: %p", this);
}
#endif // debug
}
/*!
Destructor.
*/
SoBoundingBoxCache::~SoBoundingBoxCache()
{
#if COIN_DEBUG
if (coin_debug_caching_level() > 0) {
SoDebugError::postInfo("SoBoundingBoxCache::~SoBoundingBoxCache",
"Cache destructed: %p", this);
}
#endif // debug
delete PRIVATE(this);
}
/*!
Sets the data for this cache. \a boundingBox is the node's bounding
box, \a centerSet and \a centerPoints specifies the center of the
geometry inside \a boundingBox.
*/
void
SoBoundingBoxCache::set(const SbXfBox3f & boundingbox,
SbBool centerset,
const SbVec3f & centerpoint)
{
PRIVATE(this)->bbox = boundingbox;
PRIVATE(this)->localbbox = boundingbox.project();
PRIVATE(this)->centerset = centerset ? 1 : 0;
if (centerset) { PRIVATE(this)->centerpoint = centerpoint; }
}
/*!
Returns the bounding box for this cache.
*/
const SbXfBox3f &
SoBoundingBoxCache::getBox(void) const
{
return PRIVATE(this)->bbox;
}
/*!
Returns the projected bounding box for this cache.
*/
const SbBox3f &
SoBoundingBoxCache::getProjectedBox(void) const
{
return PRIVATE(this)->localbbox;
}
/*!
Returns whether the center of the bounding box was set in the
SoBoundingBoxCache::set() method.
\sa SoBoundingBoxCache::getCenter()
*/
SbBool
SoBoundingBoxCache::isCenterSet(void) const
{
return PRIVATE(this)->centerset == 1;
}
/*!
Returns the center of the bounding box. Should only be used if
SoBoundingBoxCache::isCenterSet() returns \c TRUE.
*/
const SbVec3f &
SoBoundingBoxCache::getCenter(void) const
{
return PRIVATE(this)->centerpoint;
}
/*!
Sets the flag returned from SoBoundingBoxCache::hasLinesOrPoints()
to \c TRUE for all open bounding box caches.
The reason bounding box caches keep a lines-or-points flag is to
make it known to client code if the shape(s) they contain have any
of these primitives -- or are rendered with these primitives. The
reason this is important to know for the client code is because it
might need to add an "epsilon" slack value to the calculated
bounding box to account for smoothing / anti-aliasing effects in the
renderer, so lines and points graphics is not accidently clipped by
near and far clipping planes, for instance.
This method is a static method on the class. It will upon invocation
scan through the state stack and set the flag for all open
SoBoundingBoxCache elements. It has been made to work like this so
it can easily be invoked on all current bounding box cache instances
from the SoShape-type nodes using lines and / or point primitives.
\sa hasLinesOrPoints()
*/
void
SoBoundingBoxCache::setHasLinesOrPoints(SoState * state)
{
SoCacheElement * elem = static_cast<SoCacheElement *>(
state->getElementNoPush(SoCacheElement::getClassStackIndex())
);
while (elem) {
SoBoundingBoxCache * cache = static_cast<SoBoundingBoxCache *>(elem->getCache());
if (cache) { PRIVATE(cache)->linesorpoints = TRUE; }
elem = elem->getNextCacheElement();
}
}
/*!
Return \c TRUE if the hasLinesOrPoints flag has been set.
\sa setHasLinesOrPoints()
*/
SbBool
SoBoundingBoxCache::hasLinesOrPoints(void) const
{
return PRIVATE(this)->linesorpoints == 1;
}
#undef PRIVATE
| 5,519 | 1,750 |
// Copyright (c) 2017-2019 The Multiverse developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "walletdb.h"
#include "leveldbeng.h"
#include <boost/foreach.hpp>
#include <boost/bind.hpp>
using namespace std;
using namespace walleve;
using namespace multiverse::storage;
//////////////////////////////
// CWalletAddrDB
bool CWalletAddrDB::Initialize(const boost::filesystem::path& pathWallet)
{
CLevelDBArguments args;
args.path = (pathWallet / "addr").string();
args.syncwrite = true;
args.files = 8;
args.cache = 1 << 20;
CLevelDBEngine *engine = new CLevelDBEngine(args);
if (!Open(engine))
{
delete engine;
return false;
}
return true;
}
void CWalletAddrDB::Deinitialize()
{
Close();
}
bool CWalletAddrDB::UpdateKey(const crypto::CPubKey& pubkey,int version,const crypto::CCryptoCipher& cipher)
{
vector<unsigned char> vch;
vch.resize( 4 + 48 + 8);
memcpy(&vch[0],&version,4);
memcpy(&vch[4],cipher.encrypted,48);
memcpy(&vch[52],&cipher.nonce,8);
return Write(CDestination(pubkey),vch);
}
bool CWalletAddrDB::UpdateTemplate(const CTemplateId& tid,const vector<unsigned char>& vchData)
{
return Write(CDestination(tid),vchData);
}
bool CWalletAddrDB::EraseAddress(const CDestination& dest)
{
return Erase(dest);
}
bool CWalletAddrDB::WalkThroughAddress(CWalletDBAddrWalker& walker)
{
return WalkThrough(boost::bind(&CWalletAddrDB::AddressDBWalker,this,_1,_2,boost::ref(walker)));
}
bool CWalletAddrDB::AddressDBWalker(CWalleveBufStream& ssKey,CWalleveBufStream& ssValue,CWalletDBAddrWalker& walker)
{
CDestination dest;
vector<unsigned char> vch;
ssKey >> dest;
ssValue >> vch;
if (dest.IsTemplate())
{
return walker.WalkTemplate(dest.GetTemplateId(),vch);
}
crypto::CPubKey pubkey;
if (dest.GetPubKey(pubkey) && vch.size() == 4 + 48 + 8)
{
int version;
crypto::CCryptoCipher cipher;
memcpy(&version,&vch[0],4);
memcpy(cipher.encrypted,&vch[4],48);
memcpy(&cipher.nonce,&vch[52],8);
return walker.WalkPubkey(pubkey,version,cipher);
}
return false;
}
//////////////////////////////
// CWalletTxDB
bool CWalletTxDB::Initialize(const boost::filesystem::path& pathWallet)
{
CLevelDBArguments args;
args.path = (pathWallet / "wtx").string();
CLevelDBEngine *engine = new CLevelDBEngine(args);
if (!Open(engine))
{
delete engine;
return false;
}
if (!Read(string("txcount"),nTxCount) || !Read(string("sequence"),nSequence))
{
return Reset();
}
return true;
}
void CWalletTxDB::Deinitialize()
{
Close();
}
bool CWalletTxDB::Clear()
{
RemoveAll();
return Reset();
}
bool CWalletTxDB::AddNewTx(const CWalletTx& wtx)
{
pair<uint64,CWalletTx> pairWalletTx;
if (Read(make_pair(string("wtx"),wtx.txid),pairWalletTx))
{
pairWalletTx.second = wtx;
return Write(make_pair(string("wtx"),wtx.txid),pairWalletTx);
}
pairWalletTx.first = nSequence++;
pairWalletTx.second = wtx;
if (!TxnBegin())
{
return false;
}
if (!Write(make_pair(string("wtx"),wtx.txid),pairWalletTx)
|| !Write(make_pair(string("seq"),pairWalletTx.first),CWalletTxSeq(wtx))
|| !Write(string("txcount"),nTxCount + 1)
|| !Write(string("sequence"),nSequence))
{
TxnAbort();
return false;
}
if (!TxnCommit())
{
return false;
}
++nTxCount;
return true;
}
bool CWalletTxDB::UpdateTx(const vector<CWalletTx>& vWalletTx,const vector<uint256>& vRemove)
{
int nTxAddNew = 0;
vector<pair<uint64,CWalletTx> > vTxUpdate;
vTxUpdate.reserve(vWalletTx.size());
BOOST_FOREACH(const CWalletTx& wtx,vWalletTx)
{
pair<uint64,CWalletTx> pairWalletTx;
if (Read(make_pair(string("wtx"),wtx.txid),pairWalletTx))
{
vTxUpdate.push_back(make_pair(pairWalletTx.first,wtx));
}
else
{
vTxUpdate.push_back(make_pair(nSequence++,wtx));
++nTxAddNew;
}
}
vector<pair<uint64,uint256> > vTxRemove;
vTxRemove.reserve(vRemove.size());
BOOST_FOREACH(const uint256& txid,vRemove)
{
pair<uint64,CWalletTx> pairWalletTx;
if (Read(make_pair(string("wtx"),txid),pairWalletTx))
{
vTxRemove.push_back(make_pair(pairWalletTx.first,txid));
}
}
if (!TxnBegin())
{
return false;
}
for (int i = 0;i < vTxUpdate.size();i++)
{
pair<uint64,CWalletTx>& pairWalletTx = vTxUpdate[i];
if (!Write(make_pair(string("wtx"),pairWalletTx.second.txid),pairWalletTx)
|| !Write(make_pair(string("seq"),pairWalletTx.first),CWalletTxSeq(pairWalletTx.second)))
{
TxnAbort();
return false;
}
}
for (int i = 0;i < vTxRemove.size();i++)
{
if (!Erase(make_pair(string("wtx"),vTxRemove[i].second))
|| !Erase(make_pair(string("seq"),vTxRemove[i].first)))
{
TxnAbort();
return false;
}
}
if (!Write(string("txcount"),nTxCount + nTxAddNew - vTxRemove.size())
|| !Write(string("sequence"),nSequence))
{
TxnAbort();
return false;
}
if (!TxnCommit())
{
return false;
}
nTxCount += nTxAddNew - vTxRemove.size();
return true;
}
bool CWalletTxDB::RetrieveTx(const uint256& txid,CWalletTx& wtx)
{
pair<uint64,CWalletTx> pairWalletTx;
if (!Read(make_pair(string("wtx"),txid),pairWalletTx))
{
return false;
}
wtx = pairWalletTx.second;
return true;
}
bool CWalletTxDB::ExistsTx(const uint256& txid)
{
pair<uint64,CWalletTx> pairWalletTx;
return Read(make_pair(string("wtx"),txid),pairWalletTx);
}
size_t CWalletTxDB::GetTxCount()
{
return nTxCount;
}
bool CWalletTxDB::WalkThroughTxSeq(CWalletDBTxSeqWalker& walker)
{
return WalkThrough(boost::bind(&CWalletTxDB::TxSeqWalker,this,_1,_2,boost::ref(walker)),
make_pair(string("seq"),uint64(0)));
}
bool CWalletTxDB::WalkThroughTx(CWalletDBTxWalker& walker)
{
return WalkThrough(boost::bind(&CWalletTxDB::TxWalker,this,_1,_2,boost::ref(walker)),
make_pair(string("seq"),uint64(0)));
}
bool CWalletTxDB::TxSeqWalker(CWalleveBufStream& ssKey,CWalleveBufStream& ssValue,CWalletDBTxSeqWalker& walker)
{
string strPrefix;
uint64 nSeqNum;
CWalletTxSeq txSeq;
ssKey >> strPrefix;
if (strPrefix != "seq")
{
return false;
}
ssKey >> nSeqNum;
ssValue >> txSeq;
return walker.Walk(txSeq.txid,txSeq.hashFork,txSeq.nBlockHeight);
}
bool CWalletTxDB::TxWalker(CWalleveBufStream& ssKey,CWalleveBufStream& ssValue,CWalletDBTxWalker& walker)
{
string strPrefix;
uint64 nSeqNum;
CWalletTxSeq txSeq;
ssKey >> strPrefix;
if (strPrefix != "seq")
{
return false;
}
ssKey >> nSeqNum;
ssValue >> txSeq;
CWalletTx wtx;
if (!RetrieveTx(txSeq.txid,wtx))
{
return false;
}
return walker.Walk(wtx);
}
bool CWalletTxDB::Reset()
{
nSequence = 0;
nTxCount = 0;
if (!TxnBegin())
{
return false;
}
if (!Write(string("txcount"),size_t(0)))
{
TxnAbort();
return false;
}
if (!Write(string("sequence"),nSequence))
{
TxnAbort();
return false;
}
return TxnCommit();
}
//////////////////////////////
// CWalletDBListTxSeqWalker
class CWalletDBListTxSeqWalker : public CWalletDBTxSeqWalker
{
public:
CWalletDBListTxSeqWalker(int nOffsetIn,int nMaxCountIn)
: nOffset(nOffsetIn), nMaxCount(nMaxCountIn), nIndex(0)
{
}
bool Walk(const uint256& txid,const uint256& hashFork,const int nBlockHeight)
{
if (nIndex++ < nOffset)
{
return true;
}
vWalletTxid.push_back(txid);
return (vWalletTxid.size() < nMaxCount);
}
public:
int nOffset;
int nMaxCount;
int nIndex;
vector<uint256> vWalletTxid;
};
//////////////////////////////
// CWalletDBRollBackTxSeqWalker
class CWalletDBRollBackTxSeqWalker : public CWalletDBTxSeqWalker
{
public:
CWalletDBRollBackTxSeqWalker(const uint256& hashForkIn,int nMinHeightIn,vector<uint256>& vForkTxIn)
: hashFork(hashForkIn), nMinHeight(nMinHeightIn), vForkTx(vForkTxIn)
{
}
bool Walk(const uint256& txidIn,const uint256& hashForkIn,const int nBlockHeightIn)
{
if (hashForkIn == hashFork && (nBlockHeightIn < 0 || nBlockHeightIn >= nMinHeight))
{
vForkTx.push_back(txidIn);
}
return true;
}
public:
uint256 hashFork;
int nMinHeight;
vector<uint256>& vForkTx;
};
//////////////////////////////
// CWalletDB
CWalletDB::CWalletDB()
{
}
CWalletDB::~CWalletDB()
{
Deinitialize();
}
bool CWalletDB::Initialize(const boost::filesystem::path& pathWallet)
{
if (!boost::filesystem::exists(pathWallet))
{
boost::filesystem::create_directories(pathWallet);
}
if (!boost::filesystem::is_directory(pathWallet))
{
return false;
}
if (!dbAddr.Initialize(pathWallet))
{
return false;
}
if (!dbWtx.Initialize(pathWallet))
{
return false;
}
return true;
}
void CWalletDB::Deinitialize()
{
vector<CWalletTx> vWalletTx;
txCache.ListTx(0,-1,vWalletTx);
if (!vWalletTx.empty())
{
UpdateTx(vWalletTx);
}
txCache.Clear();
dbWtx.Deinitialize();
dbAddr.Deinitialize();
}
bool CWalletDB::UpdateKey(const crypto::CPubKey& pubkey,int version,const crypto::CCryptoCipher& cipher)
{
return dbAddr.UpdateKey(pubkey,version,cipher);
}
bool CWalletDB::UpdateTemplate(const CTemplateId& tid,const vector<unsigned char>& vchData)
{
return dbAddr.UpdateTemplate(tid,vchData);
}
bool CWalletDB::WalkThroughAddress(CWalletDBAddrWalker& walker)
{
return dbAddr.WalkThroughAddress(walker);
}
bool CWalletDB::AddNewTx(const CWalletTx& wtx)
{
if (wtx.nBlockHeight < 0)
{
txCache.AddNew(wtx);
return true;
}
return dbWtx.AddNewTx(wtx);
}
bool CWalletDB::UpdateTx(const vector<CWalletTx>& vWalletTx,const vector<uint256>& vRemove)
{
if (!dbWtx.UpdateTx(vWalletTx,vRemove))
{
return false;
}
BOOST_FOREACH(const CWalletTx& wtx,vWalletTx)
{
txCache.Remove(wtx.txid);
}
BOOST_FOREACH(const uint256& txid,vRemove)
{
txCache.Remove(txid);
}
return true;
}
bool CWalletDB::RetrieveTx(const uint256& txid,CWalletTx& wtx)
{
if (txCache.Get(txid,wtx))
{
return true;
}
return dbWtx.RetrieveTx(txid,wtx);
}
bool CWalletDB::ExistsTx(const uint256& txid)
{
if (txCache.Exists(txid))
{
return true;
}
return dbWtx.ExistsTx(txid);
}
size_t CWalletDB::GetTxCount()
{
return dbWtx.GetTxCount() + txCache.Count();
}
bool CWalletDB::ListTx(int nOffset,int nCount,vector<CWalletTx>& vWalletTx)
{
size_t nDBTx = dbWtx.GetTxCount();
if (nOffset < nDBTx)
{
if (!ListDBTx(nOffset, nCount, vWalletTx))
{
return false;
}
if (vWalletTx.size() < nCount)
{
txCache.ListTx(0, nCount - vWalletTx.size(), vWalletTx);
}
}
else
{
txCache.ListTx(nOffset - nDBTx, nCount, vWalletTx);
}
return true;
}
bool CWalletDB::ListDBTx(int nOffset,int nCount,vector<CWalletTx>& vWalletTx)
{
CWalletDBListTxSeqWalker walker(nOffset,nCount);
if (!dbWtx.WalkThroughTxSeq(walker))
{
return false;
}
BOOST_FOREACH(const uint256& txid,walker.vWalletTxid)
{
CWalletTx wtx;
if (!dbWtx.RetrieveTx(txid,wtx))
{
return false;
}
vWalletTx.push_back(wtx);
}
return true;
}
bool CWalletDB::ListRollBackTx(const uint256& hashFork,int nMinHeight,vector<uint256>& vForkTx)
{
CWalletDBRollBackTxSeqWalker walker(hashFork,nMinHeight,vForkTx);
if (!dbWtx.WalkThroughTxSeq(walker))
{
return false;
}
txCache.ListForkTx(hashFork,vForkTx);
return true;
}
bool CWalletDB::WalkThroughTx(CWalletDBTxWalker& walker)
{
return dbWtx.WalkThroughTx(walker);
}
bool CWalletDB::ClearTx()
{
txCache.Clear();
return dbWtx.Clear();
}
| 12,618 | 5,195 |
#pragma once
#include <QTextEdit>
#include <QTimer>
#include "widgets/settingspages/SettingsPage.hpp"
namespace chatterino {
class CommandPage : public SettingsPage
{
public:
CommandPage();
private:
QTimer commandsEditTimer_;
};
} // namespace chatterino
| 270 | 86 |
/// Causal Dynamical Triangulations in C++ using CGAL
///
/// Copyright Β© 2017-2020 Adam Getchell
///
/// Template class for all move algorithms, e.g. Metropolis, MoveAlways
///
/// @file Move_strategy.hpp
/// @brief Base class for move algorithms on Delaunay Triangulations
/// @author Adam Getchell
#ifndef INCLUDE_MOVE_ALGORITHM_HPP_
#define INCLUDE_MOVE_ALGORITHM_HPP_
#include "Move_command.hpp"
#include <memory>
static Int_precision constexpr NUMBER_OF_3D_MOVES = 5;
static Int_precision constexpr NUMBER_OF_4D_MOVES = 7;
/// @brief Determine ergodic moves for a given dimension at compile-time
/// @param dim Dimensionality of the triangulation
/// @return The number of ergodic moves for that dimensionality
constexpr auto moves_per_dimension(Int_precision dim) -> std::size_t
{
if (dim == 3) { return NUMBER_OF_3D_MOVES; }
if (dim == 4) { return NUMBER_OF_4D_MOVES; }
return 0; // Error condition
}
/// @brief The data and methods to track ergodic moves
/// @tparam dimension The dimensionality of the ergodic moves
template <size_t dimension>
class Move_tracker
{
std::array<Int_precision, moves_per_dimension(dimension)> moves = {0};
public:
auto operator[](std::size_t index)
{
Ensures(moves.size() == 5 || moves.size() == 7);
return moves[index];
}
// 3D Ergodic moves
template <std::size_t dim, std::enable_if_t<dim == 3, int> = 0>
auto two_three_moves()
{
return moves[0];
}
template <std::size_t dim, std::enable_if_t<dim == 3, int> = 0>
auto three_two_moves()
{
return moves[1];
}
template <std::size_t dim, std::enable_if_t<dim == 3, int> = 0>
auto two_six_moves()
{
return moves[2];
}
template <std::size_t dim, std::enable_if_t<dim == 3, int> = 0>
auto six_two_moves()
{
return moves[3];
}
template <std::size_t dim, std::enable_if_t<dim == 3, int> = 0>
auto four_four_moves()
{
return moves[4];
}
// 4D Ergodic moves
template <std::size_t dim, std::enable_if_t<dim == 4, int> = 0>
auto two_four_moves()
{
return moves[0];
}
};
using Move_tracker_3 = Move_tracker<3>;
using Move_tracker_4 = Move_tracker<4>;
/// @brief The algorithms available to make ergodic moves
enum Strategies
{
MOVE_ALWAYS,
METROPOLIS
};
/// @brief Select an algorithm to make ergodic moves upon triangulations
/// @tparam strategies The algorithm that chooses ergodic moves
/// @tparam dimension The dimensionality of the triangulation
template <Strategies strategies, size_t dimension>
class MoveStrategy
{
};
#endif // INCLUDE_MOVE_ALGORITHM_HPP_
| 2,565 | 977 |
/*
* Copyright (C) 2020 Igalia S.L
*
* This library 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 library 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 library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include "WebKitWebsiteDataAccessPermissionRequest.h"
#include "WebKitPermissionRequest.h"
#include "WebKitWebsiteDataAccessPermissionRequestPrivate.h"
#include <wtf/CompletionHandler.h>
#include <wtf/glib/WTFGType.h>
/**
* SECTION: WebKitWebsiteDataAccessPermissionRequest
* @Short_description: A permission request for accessing website data from third-party domains
* @Title: WebKitWebsiteDataAccessPermissionRequest
* @See_also: #WebKitPermissionRequest, #WebKitWebView
*
* WebKitWebsiteDataAccessPermissionRequest represents a request for
* permission to allow a third-party domain access its cookies.
*
* When a WebKitWebsiteDataAccessPermissionRequest is not handled by the user,
* it is denied by default.
*
* Since: 2.30
*/
static void webkit_permission_request_interface_init(WebKitPermissionRequestIface*);
struct _WebKitWebsiteDataAccessPermissionRequestPrivate {
CString requestingDomain;
CString currentDomain;
CompletionHandler<void(bool)> completionHandler;
};
WEBKIT_DEFINE_TYPE_WITH_CODE(
WebKitWebsiteDataAccessPermissionRequest, webkit_website_data_access_permission_request, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE(WEBKIT_TYPE_PERMISSION_REQUEST, webkit_permission_request_interface_init))
static void webkitWebsiteDataAccessPermissionRequestAllow(WebKitPermissionRequest* request)
{
ASSERT(WEBKIT_IS_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST(request));
auto* priv = WEBKIT_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST(request)->priv;
if (priv->completionHandler)
priv->completionHandler(true);
}
static void webkitWebsiteDataAccessPermissionRequestDeny(WebKitPermissionRequest* request)
{
ASSERT(WEBKIT_IS_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST(request));
auto* priv = WEBKIT_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST(request)->priv;
if (priv->completionHandler)
priv->completionHandler(false);
}
static void webkit_permission_request_interface_init(WebKitPermissionRequestIface* iface)
{
iface->allow = webkitWebsiteDataAccessPermissionRequestAllow;
iface->deny = webkitWebsiteDataAccessPermissionRequestDeny;
}
static void webkitWebsiteDataAccessPermissionRequestDispose(GObject* object)
{
// Default behaviour when no decision has been made is denying the request.
webkitWebsiteDataAccessPermissionRequestDeny(WEBKIT_PERMISSION_REQUEST(object));
G_OBJECT_CLASS(webkit_website_data_access_permission_request_parent_class)->dispose(object);
}
static void webkit_website_data_access_permission_request_class_init(WebKitWebsiteDataAccessPermissionRequestClass* klass)
{
GObjectClass* objectClass = G_OBJECT_CLASS(klass);
objectClass->dispose = webkitWebsiteDataAccessPermissionRequestDispose;
}
WebKitWebsiteDataAccessPermissionRequest* webkitWebsiteDataAccessPermissionRequestCreate(const WebCore::RegistrableDomain& requestingDomain, const WebCore::RegistrableDomain& currentDomain, CompletionHandler<void(bool)>&& completionHandler)
{
auto* websiteDataPermissionRequest = WEBKIT_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST(g_object_new(WEBKIT_TYPE_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST, nullptr));
websiteDataPermissionRequest->priv->requestingDomain = requestingDomain.string().utf8();
websiteDataPermissionRequest->priv->currentDomain = currentDomain.string().utf8();
websiteDataPermissionRequest->priv->completionHandler = WTFMove(completionHandler);
return websiteDataPermissionRequest;
}
/**
* webkit_website_data_access_permission_request_get_requesting_domain:
* @request: a #WebKitWebsiteDataAccessPermissionRequest
*
* Get the domain requesting permission to access its cookies while browsing the current domain.
*
* Returns: the requesting domain name
*
* Since: 2.30
*/
const char* webkit_website_data_access_permission_request_get_requesting_domain(WebKitWebsiteDataAccessPermissionRequest* request)
{
g_return_val_if_fail(WEBKIT_IS_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST(request), nullptr);
return request->priv->requestingDomain.data();
}
/**
* webkit_website_data_access_permission_request_get_current_domain:
* @request: a #WebKitWebsiteDataAccessPermissionRequest
*
* Get the current domain being browsed.
*
* Returns: the current domain name
*
* Since: 2.30
*/
const char* webkit_website_data_access_permission_request_get_current_domain(WebKitWebsiteDataAccessPermissionRequest* request)
{
g_return_val_if_fail(WEBKIT_IS_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST(request), nullptr);
return request->priv->currentDomain.data();
}
| 5,336 | 1,601 |
// 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 "components/suggestions/webui/suggestions_source.h"
#include "base/barrier_closure.h"
#include "base/base64.h"
#include "base/bind.h"
#include "base/strings/string16.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "components/suggestions/proto/suggestions.pb.h"
#include "net/base/escape.h"
#include "ui/base/l10n/time_format.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/image/image_skia.h"
namespace suggestions {
namespace {
const char kHtmlHeader[] =
"<!DOCTYPE html>\n<html>\n<head>\n<title>Suggestions</title>\n"
"<meta charset=\"utf-8\">\n"
"<style type=\"text/css\">\nli {white-space: nowrap;}\n</style>\n";
const char kHtmlBody[] = "</head>\n<body>\n";
const char kHtmlFooter[] = "</body>\n</html>\n";
const char kRefreshPath[] = "refresh";
std::string GetRefreshHtml(const std::string& base_url, bool is_refresh) {
if (is_refresh)
return "<p>Refreshing in the background, reload to see new data.</p>\n";
return std::string("<p><a href=\"") + base_url + kRefreshPath +
"\">Refresh</a></p>\n";
}
// Returns the HTML needed to display the suggestions.
std::string RenderOutputHtml(
const std::string& base_url,
bool is_refresh,
const SuggestionsProfile& profile,
const std::map<GURL, std::string>& base64_encoded_pngs) {
std::vector<std::string> out;
out.push_back(kHtmlHeader);
out.push_back(kHtmlBody);
out.push_back("<h1>Suggestions</h1>\n");
out.push_back(GetRefreshHtml(base_url, is_refresh));
out.push_back("<ul>");
int64_t now = (base::Time::NowFromSystemTime() - base::Time::UnixEpoch())
.ToInternalValue();
size_t size = profile.suggestions_size();
for (size_t i = 0; i < size; ++i) {
const ChromeSuggestion& suggestion = profile.suggestions(i);
base::TimeDelta remaining_time =
base::TimeDelta::FromMicroseconds(suggestion.expiry_ts() - now);
base::string16 remaining_time_formatted = ui::TimeFormat::Detailed(
ui::TimeFormat::Format::FORMAT_DURATION,
ui::TimeFormat::Length::LENGTH_LONG, -1, remaining_time);
std::string line;
line += "<li><a href=\"";
line += net::EscapeForHTML(suggestion.url());
line += "\" target=\"_blank\">";
line += net::EscapeForHTML(suggestion.title());
std::map<GURL, std::string>::const_iterator it =
base64_encoded_pngs.find(GURL(suggestion.url()));
if (it != base64_encoded_pngs.end()) {
line += "<br><img src='";
line += it->second;
line += "'>";
}
line += "</a> Expires in ";
line += base::UTF16ToUTF8(remaining_time_formatted);
std::vector<std::string> providers;
for (int p = 0; p < suggestion.providers_size(); ++p)
providers.push_back(base::IntToString(suggestion.providers(p)));
line += ". Provider IDs: " + base::JoinString(providers, ", ");
line += "</li>\n";
out.push_back(line);
}
out.push_back("</ul>");
out.push_back(kHtmlFooter);
return base::JoinString(out, base::StringPiece());
}
// Returns the HTML needed to display that no suggestions are available.
std::string RenderOutputHtmlNoSuggestions(const std::string& base_url,
bool is_refresh) {
std::vector<std::string> out;
out.push_back(kHtmlHeader);
out.push_back(kHtmlBody);
out.push_back("<h1>Suggestions</h1>\n");
out.push_back("<p>You have no suggestions.</p>\n");
out.push_back(GetRefreshHtml(base_url, is_refresh));
out.push_back(kHtmlFooter);
return base::JoinString(out, base::StringPiece());
}
} // namespace
SuggestionsSource::SuggestionsSource(SuggestionsService* suggestions_service,
const std::string& base_url)
: suggestions_service_(suggestions_service),
base_url_(base_url),
weak_ptr_factory_(this) {}
SuggestionsSource::~SuggestionsSource() {}
SuggestionsSource::RequestContext::RequestContext(
bool is_refresh_in,
const SuggestionsProfile& suggestions_profile_in,
const GotDataCallback& callback_in)
: is_refresh(is_refresh_in),
suggestions_profile(suggestions_profile_in), // Copy.
callback(callback_in) // Copy.
{}
SuggestionsSource::RequestContext::~RequestContext() {}
void SuggestionsSource::StartDataRequest(const std::string& path,
const GotDataCallback& callback) {
// If this was called as "chrome://suggestions/refresh", we also trigger an
// async update of the suggestions.
bool is_refresh = (path == kRefreshPath);
// |suggestions_service| is null for guest profiles.
if (!suggestions_service_) {
std::string output = RenderOutputHtmlNoSuggestions(base_url_, is_refresh);
callback.Run(base::RefCountedString::TakeString(&output));
return;
}
if (is_refresh)
suggestions_service_->FetchSuggestionsData();
SuggestionsProfile suggestions_profile =
suggestions_service_->GetSuggestionsDataFromCache().value_or(
SuggestionsProfile());
size_t size = suggestions_profile.suggestions_size();
if (!size) {
std::string output = RenderOutputHtmlNoSuggestions(base_url_, is_refresh);
callback.Run(base::RefCountedString::TakeString(&output));
} else {
RequestContext* context =
new RequestContext(is_refresh, suggestions_profile, callback);
base::Closure barrier = BarrierClosure(
size, base::BindOnce(&SuggestionsSource::OnThumbnailsFetched,
weak_ptr_factory_.GetWeakPtr(), context));
for (size_t i = 0; i < size; ++i) {
const ChromeSuggestion& suggestion = suggestions_profile.suggestions(i);
// Fetch the thumbnail for this URL (exercising the fetcher). After all
// fetches are done, including NULL callbacks for unavailable thumbnails,
// SuggestionsSource::OnThumbnailsFetched will be called.
suggestions_service_->GetPageThumbnail(
GURL(suggestion.url()),
base::Bind(&SuggestionsSource::OnThumbnailAvailable,
weak_ptr_factory_.GetWeakPtr(), context, barrier));
}
}
}
std::string SuggestionsSource::GetMimeType(const std::string& path) const {
return "text/html";
}
void SuggestionsSource::OnThumbnailsFetched(RequestContext* context) {
std::unique_ptr<RequestContext> context_deleter(context);
std::string output = RenderOutputHtml(base_url_, context->is_refresh,
context->suggestions_profile,
context->base64_encoded_pngs);
context->callback.Run(base::RefCountedString::TakeString(&output));
}
void SuggestionsSource::OnThumbnailAvailable(RequestContext* context,
const base::Closure& barrier,
const GURL& url,
const gfx::Image& image) {
if (!image.IsEmpty()) {
std::vector<unsigned char> output;
gfx::PNGCodec::EncodeBGRASkBitmap(*image.ToSkBitmap(), false, &output);
std::string encoded_output;
base::Base64Encode(
base::StringPiece(reinterpret_cast<const char*>(output.data()),
output.size()),
&encoded_output);
context->base64_encoded_pngs[url] = "data:image/png;base64,";
context->base64_encoded_pngs[url] += encoded_output;
}
barrier.Run();
}
} // namespace suggestions
| 7,712 | 2,448 |
#pragma once
#pragma region
//C RunTime Header Files
#include <wchar.h>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <memory>
using namespace std;
#pragma endregion stl
#pragma region
//SDL and opengl Header files
#include "staticDependancies/glad/glad.h"
#include <SDL.h>
#include <SDL_opengl.h>
#pragma endregion sdl-opengl
#pragma region
#ifndef GLM_FORCE_LEFT_HANDED
#define GLM_FORCE_LEFT_HANDED
#endif
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
using namespace glm;
#pragma endregion glm
#pragma region
//*****************************************************************************
//Declare templates for releasing interfaces and deleting objects
//*****************************************************************************
template<class Interface>
inline void SafeRelease(Interface &pInterfaceToRelease)
{
if (pInterfaceToRelease != 0)
{
pInterfaceToRelease->Release();
pInterfaceToRelease = 0;
}
}
template<class T>
inline void SafeDelete(T &pObjectToDelete)
{
if (pObjectToDelete != 0)
{
delete(pObjectToDelete);
pObjectToDelete = 0;
}
}
template<typename T>
inline void Clamp(T& value, T hi, T lo)
{
if (value > hi)
value = hi;
if (value < lo)
value = lo;
}
#pragma endregion Templates
#pragma region
#include "Components/TransformComponent.hpp"
#include "Content/ContentManager.hpp"
#include "Base\Context.hpp"
#include "Base\Settings.hpp"
#include "Base\InputManager.hpp"
#include "Helper/Logger.hpp"
#include "Helper/MathHelper.hpp"
#include "Helper/PerformanceInfo.hpp"
//Working singleton Set
#define TIME Context::GetInstance()->pTime
#define CAMERA Context::GetInstance()->pCamera
#define SCENE Context::GetInstance()->pScene
#define SETTINGS Settings::GetInstance()
#define INPUT InputManager::GetInstance()
#define LOGGER Logger
#define CONTENT ContentManager
#define TRANSFORM GetTransform()
#define WINDOW Settings::GetInstance()->Window
#define GRAPHICS Settings::GetInstance()->Graphics
#define PERFORMANCE PerformanceInfo::GetInstance()
#pragma endregion Macros | 2,133 | 698 |
#include "emonesp.h"
#include "input.h"
#include "wifi.h"
#include "app_config.h"
#include "RapiSender.h"
#include <WiFiClientSecure.h>
#include <ESP8266HTTPClient.h>
#include <Arduino.h>
#define ACTIVE_TAG_START "<active>"
#define ACTIVE_TAG_END "</active>"
//Server strings for Ohm Connect
const char *ohm_host = "login.ohmconnect.com";
const char *ohm_url = "/verify-ohm-hour/";
const int ohm_httpsPort = 443;
const char *ohm_fingerprint =
"0C 53 16 B1 DE 52 CD 3E 57 C5 6C A9 45 A2 DD 0A 04 1A AD C6";
String ohm_hour = "NotConnected";
int evse_sleep = 0;
extern RapiSender rapiSender;
// -------------------------------------------------------------------
// Ohm Connect "Ohm Hour"
//
// Call every once every 60 seconds if connected to the WiFi and
// Ohm Key is set
// -------------------------------------------------------------------
void ohm_loop()
{
Profile_Start(ohm_loop);
if (ohm != 0)
{
WiFiClientSecure client;
if (!client.connect(ohm_host, ohm_httpsPort)) {
DBUGLN(F("ERROR Ohm Connect - connection failed"));
return;
}
if (client.verify(ohm_fingerprint, ohm_host))
{
client.print(String("GET ") + ohm_url + ohm + " HTTP/1.1\r\n" +
"Host: " + ohm_host + "\r\n" +
"User-Agent: OpenEVSE\r\n" + "Connection: close\r\n\r\n");
String line = client.readString();
DBUGVAR(line);
int active_start = line.indexOf(ACTIVE_TAG_START);
int active_end = line.indexOf(ACTIVE_TAG_END);
if(active_start > 0 && active_end > 0)
{
active_start += sizeof(ACTIVE_TAG_START) - 1;
String new_ohm_hour = line.substring(active_start, active_end);
DBUGVAR(new_ohm_hour);
if(new_ohm_hour != ohm_hour)
{
ohm_hour = new_ohm_hour;
if(ohm_hour == "True")
{
DBUGLN(F("Ohm Hour"));
if (evse_sleep == 0)
{
evse_sleep = 1;
rapiSender.sendCmd(F("$FS"), [](int ret)
{
if(RAPI_RESPONSE_OK == ret) {
DBUGLN(F("Charge Stopped"));
}
});
}
}
else
{
DBUGLN(F("It is not an Ohm Hour"));
if (evse_sleep == 1)
{
evse_sleep = 0;
rapiSender.sendCmd(F("$FE"), [](int ret)
{
if(RAPI_RESPONSE_OK == ret) {
DBUGLN(F("Charging enabled"));
}
});
}
}
}
}
} else {
DBUGLN(F("ERROR Ohm Connect - Certificate Invalid"));
}
}
Profile_End(ohm_loop, 5);
}
| 2,700 | 971 |
#include <ros/ros.h>
#include <visualization_msgs/Marker.h>
#include <cmath>
int main( int argc, char** argv )
{
ros::init(argc, argv, "PNC_Obs");
ros::NodeHandle n;
ros::Publisher marker_pub = n.advertise<visualization_msgs::Marker>("Obs_Pub", 10);
ros::Rate r(1);
//εε»ΊδΈδΈͺ visualization_msgs/MarkerζΆζ―
visualization_msgs::Marker obs;
obs.header.frame_id = "/my_frame";
obs.header.stamp = ros::Time::now();
obs.ns = "PNC_Obs";
obs.action = visualization_msgs::Marker::ADD;
obs.pose.orientation.w = 1.0;
obs.pose.position.x= 45;
obs.pose.position.y= -32;
obs.pose.position.z=1;
// obs.pose.orientation.z=0.5;
//ει
id
obs.id = 1;
obs.type = visualization_msgs::Marker::CUBE;
obs.scale.x = 2;
obs.scale.y = 1;
obs.scale.z= 2;
obs.color.r = 1.0;
obs.color.a = 1.0;
while (ros::ok())
{
//εεΈmarkers
marker_pub.publish(obs);
r.sleep();
}
}
| 958 | 425 |
#include <DB/Core/FieldVisitors.h>
namespace DB
{
String FieldVisitorDump::operator() (const String & x) const
{
String res;
WriteBufferFromString wb(res);
writeQuoted(x, wb);
return res;
}
String FieldVisitorDump::operator() (const Array & x) const
{
String res;
WriteBufferFromString wb(res);
FieldVisitorDump visitor;
wb.write("Array_[", 7);
for (Array::const_iterator it = x.begin(); it != x.end(); ++it)
{
if (it != x.begin())
wb.write(", ", 2);
writeString(apply_visitor(visitor, *it), wb);
}
writeChar(']', wb);
return res;
}
String FieldVisitorDump::operator() (const Tuple & x_def) const
{
auto & x = x_def.t;
String res;
WriteBufferFromString wb(res);
FieldVisitorDump visitor;
wb.write("Tuple_[", 7);
for (auto it = x.begin(); it != x.end(); ++it)
{
if (it != x.begin())
wb.write(", ", 2);
writeString(apply_visitor(visitor, *it), wb);
}
writeChar(']', wb);
return res;
}
String FieldVisitorToString::formatFloat(const Float64 x)
{
DoubleConverter<true>::BufferType buffer;
double_conversion::StringBuilder builder{buffer, sizeof(buffer)};
const auto result = DoubleConverter<true>::instance().ToShortest(x, &builder);
if (!result)
throw Exception("Cannot print float or double number", ErrorCodes::CANNOT_PRINT_FLOAT_OR_DOUBLE_NUMBER);
return { buffer, buffer + builder.position() };
}
String FieldVisitorToString::operator() (const Array & x) const
{
String res;
WriteBufferFromString wb(res);
FieldVisitorToString visitor;
writeChar('[', wb);
for (Array::const_iterator it = x.begin(); it != x.end(); ++it)
{
if (it != x.begin())
wb.write(", ", 2);
writeString(apply_visitor(visitor, *it), wb);
}
writeChar(']', wb);
return res;
}
String FieldVisitorToString::operator() (const Tuple & x_def) const
{
auto & x = x_def.t;
String res;
WriteBufferFromString wb(res);
FieldVisitorToString visitor;
writeChar('(', wb);
for (auto it = x.begin(); it != x.end(); ++it)
{
if (it != x.begin())
wb.write(", ", 2);
writeString(apply_visitor(visitor, *it), wb);
}
writeChar(')', wb);
return res;
}
UInt64 stringToDateOrDateTime(const String & s)
{
ReadBufferFromString in(s);
if (s.size() == strlen("YYYY-MM-DD"))
{
DayNum_t date{};
readDateText(date, in);
return UInt64(date);
}
else
{
time_t date_time{};
readDateTimeText(date_time, in);
if (!in.eof())
throw Exception("String is too long for DateTime: " + s);
return UInt64(date_time);
}
}
}
| 2,480 | 1,006 |
/*
* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) 2021, Stefan Seitz
*
*/
#include <common/file_utils.hpp>
#include <fstream>
std::string load_file_as_string(const std::filesystem::path& file_path) {
if ( exists(file_path) ) {
std::ifstream file_stream(file_path.c_str());
if ( !file_stream.is_open() ) {
throw std::runtime_error("could not open file for reading");
}
size_t file_size;
file_stream.seekg(0, std::ios::end);
file_size = file_stream.tellg();
file_stream.seekg(0);
std::string out;
out.resize(file_size);
file_stream.read(&out.front(), file_size);
return out;
} else {
throw std::runtime_error("file does not exist");
}
}
struct filesystem_watcher::private_data
{
};
filesystem_watcher::filesystem_watcher() {
}
filesystem_watcher::~filesystem_watcher() {
}
fdescriptor::fdtype filesystem_watcher::get_fd() const {
return fdescriptor::INVALID_FD;
}
bool filesystem_watcher::wait(uint32_t fd_op_flags, uint32_t timeout_ms) {
return false;
}
| 1,113 | 401 |
#include "ui.h"
#include <memory>
#include <vector>
#include <glibmm/main.h>
#include <gtkmm/main.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/textbuffer.h>
#include <gtkmm/textview.h>
#include <gtkmm/widget.h>
#include <gtkmm.h>
#include <time.h>
#include "debug.h"
#include "gettext.h"
#include <deadbeef/deadbeef.h>
using namespace std;
using namespace Gtk;
using namespace Glib;
struct linessizes{
int titlesize;
int artistsize;
int newlinesize;
};
struct timespec tss = {0, 100000000};
int width;
// TODO: eliminate all the global objects, as their initialization is not well defined
static TextView *lyricView;
static ScrolledWindow *lyricbar;
static RefPtr<TextBuffer> refBuffer;
static RefPtr<TextTag> tagItalic, tagBold, tagLarge, tagCenter, tagSmall, tagForegroundColor, tagLeftmargin, tagRightmargin;
static vector<RefPtr<TextTag>> tagsTitle, tagsArtist, tagsSyncline, tagsNosyncline, tagPadding;
vector<RefPtr<TextTag>> tags;
vector<int> sizelines(DB_playItem_t * track, Glib::ustring lyrics){
//std::cout << "Sizelines" << "\n";
set_lyrics(track, lyrics,"","","");
nanosleep(&tss, NULL);
int sumatory = 0;
int temporaly = 0;
vector<int> values;
values.push_back(lyricbar->get_allocation().get_height()/3);
values.push_back(0);
Gdk::Rectangle rectangle;
for (int i = 2; i < refBuffer->get_line_count()-1; i++){
lyricView->get_iter_location(refBuffer->get_iter_at_line(i-2), rectangle);
values.push_back(rectangle.get_y() - temporaly);
temporaly = rectangle.get_y();
}
for (unsigned i = 2; i < values.size()-2; i++){
sumatory += values[i];
if (sumatory > (values[0] - values[2] - values[3] - values[4])){
values[1] = i-2;
break;
}
}
return values;
}
void set_lyrics(DB_playItem_t *track, ustring past, ustring present, ustring future, ustring padding) {
signal_idle().connect_once([track, past, present, future, padding ] {
ustring artist, title;
{
pl_lock_guard guard;
if (!is_playing(track))
return;
artist = deadbeef->pl_find_meta(track, "artist") ?: _("Unknown Artist");
title = deadbeef->pl_find_meta(track, "title") ?: _("Unknown Title");
}
refBuffer->erase(refBuffer->begin(), refBuffer->end());
refBuffer->insert_with_tags(refBuffer->begin(), title, tagsTitle);
refBuffer->insert_with_tags(refBuffer->end(), ustring{"\n"} + artist + "\n\n", tagsArtist);
vector<RefPtr<TextTag>> tags;
refBuffer->insert_with_tags(refBuffer->end(), padding, tagPadding);
refBuffer->insert_with_tags(refBuffer->end(),past, tagsNosyncline);
refBuffer->insert_with_tags(refBuffer->end(),present, tagsSyncline);
refBuffer->insert_with_tags(refBuffer->end(),future, tagsNosyncline);
last = track;
});
}
Justification get_justification() {
int align = deadbeef->conf_get_int("lyricbar.lyrics.alignment", 1);
switch (align) {
case 0:
return JUSTIFY_LEFT;
case 2:
return JUSTIFY_RIGHT;
default:
return JUSTIFY_CENTER;
}
}
extern "C"
GtkWidget *construct_lyricbar() {
Gtk::Main::init_gtkmm_internals();
refBuffer = TextBuffer::create();
tagItalic = refBuffer->create_tag();
tagItalic->property_style() = Pango::STYLE_ITALIC;
tagLeftmargin = refBuffer->create_tag();
tagLeftmargin->property_left_margin() = 22;
tagRightmargin = refBuffer->create_tag();
tagRightmargin->property_right_margin() = 22;
tagBold = refBuffer->create_tag();
tagBold->property_weight() = Pango::WEIGHT_BOLD;
tagLarge = refBuffer->create_tag();
tagLarge->property_scale() = Pango::SCALE_LARGE;
tagSmall = refBuffer->create_tag();
tagSmall->property_scale() = Pango::SCALE_MEDIUM/17;
tagCenter = refBuffer->create_tag();
tagCenter->property_justification() = JUSTIFY_CENTER;
tagForegroundColor = refBuffer->create_tag();
tagForegroundColor->property_foreground() = deadbeef->conf_get_str_fast("lyricbar.highlightcolor", "#571c1c");
tagsTitle = {tagLarge, tagBold, tagCenter};
tagsArtist = {tagItalic, tagCenter};
tagsSyncline = {tagBold, tagCenter, tagForegroundColor};
tagsNosyncline = {tagLeftmargin, tagRightmargin};
tagPadding = {tagSmall, tagCenter};
lyricView = new TextView(refBuffer);
lyricView->set_editable(false);
lyricView->set_can_focus(false);
lyricView->set_name("lyricView");
lyricView->set_left_margin(2);
lyricView->set_right_margin(2);
lyricView->set_justification(get_justification());
lyricView->get_vadjustment()->set_value(1000);
lyricView->set_wrap_mode(WRAP_WORD_CHAR);
if (get_justification() == JUSTIFY_LEFT) {
lyricView->set_left_margin(20);
}
lyricView->show();
lyricbar = new ScrolledWindow();
lyricbar->add(*lyricView);
lyricbar->set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC);
/**********/
//load css
auto data = g_strdup_printf("\
#lyricView text {\
background-color: #F6F6F6;\
}\
");
Glib::RefPtr<Gtk::CssProvider> cssProvider = Gtk::CssProvider::create();
cssProvider->load_from_data(data);
Glib::RefPtr<Gtk::StyleContext> styleContext = Gtk::StyleContext::create();
//get default screen
Glib::RefPtr<Gdk::Screen> screen = Gdk::Screen::get_default();
//add provider for screen in all application
styleContext->add_provider_for_screen(screen, cssProvider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
return GTK_WIDGET(lyricbar->gobj());
}
extern "C"
int message_handler(struct ddb_gtkui_widget_s*, uint32_t id, uintptr_t ctx, uint32_t, uint32_t) {
auto event = reinterpret_cast<ddb_event_track_t *>(ctx);
switch (id) {
case DB_EV_CONFIGCHANGED:
debug_out << "CONFIG CHANGED\n";
signal_idle().connect_once([]{ lyricView->set_justification(get_justification()); });
break;
case DB_EV_SONGSTARTED:
debug_out << "SONG STARTED\n";
// case DB_EV_TRACKINFOCHANGED:
if (!event->track || event->track == last || deadbeef->pl_get_item_duration(event->track) <= 0)
return 0;
//std::cout << "TRACKINFOCHANGED" << "\n";
auto tid = deadbeef->thread_start(update_lyrics, event->track);
deadbeef->thread_detach(tid);
break;
}
return 0;
}
extern "C"
void lyricbar_destroy() {
delete lyricbar;
delete lyricView;
tagsArtist.clear();
tagsSyncline.clear();
tagsNosyncline.clear();
tagsTitle.clear();
tagLarge.reset();
tagSmall.reset();
tagBold.reset();
tagItalic.reset();
tagRightmargin.reset();
tagLeftmargin.reset();
refBuffer.reset();
}
| 6,320 | 2,502 |
// 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.
// ReportingService specialized to report UKM metrics.
#include "components/ukm/ukm_reporting_service.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_macros.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/ukm/persisted_logs_metrics_impl.h"
#include "components/ukm/ukm_pref_names.h"
#include "components/ukm/ukm_service.h"
namespace ukm {
namespace {
// The UKM server's URL.
constexpr char kMimeType[] = "application/vnd.chrome.ukm";
// The number of UKM logs that will be stored in PersistedLogs before logs
// start being dropped.
constexpr int kMinPersistedLogs = 8;
// The number of bytes UKM logs that will be stored in PersistedLogs before
// logs start being dropped.
// This ensures that a reasonable amount of history will be stored even if there
// is a long series of very small logs.
constexpr int kMinPersistedBytes = 300000;
// If an upload fails, and the transmission was over this byte count, then we
// will discard the log, and not try to retransmit it. We also don't persist
// the log to the prefs for transmission during the next chrome session if this
// limit is exceeded.
constexpr size_t kMaxLogRetransmitSize = 100 * 1024;
std::string GetServerUrl() {
constexpr char kDefaultServerUrl[] = "https://clients4.google.com/ukm";
std::string server_url =
base::GetFieldTrialParamValueByFeature(kUkmFeature, "ServerUrl");
if (!server_url.empty())
return server_url;
return kDefaultServerUrl;
}
} // namespace
// static
void UkmReportingService::RegisterPrefs(PrefRegistrySimple* registry) {
registry->RegisterListPref(prefs::kUkmPersistedLogs);
// Base class already registered by MetricsReportingService::RegisterPrefs
// ReportingService::RegisterPrefs(registry);
}
UkmReportingService::UkmReportingService(metrics::MetricsServiceClient* client,
PrefService* local_state)
: ReportingService(client, local_state, kMaxLogRetransmitSize),
persisted_logs_(base::MakeUnique<ukm::PersistedLogsMetricsImpl>(),
local_state,
prefs::kUkmPersistedLogs,
kMinPersistedLogs,
kMinPersistedBytes,
kMaxLogRetransmitSize) {}
UkmReportingService::~UkmReportingService() {}
metrics::LogStore* UkmReportingService::log_store() {
return &persisted_logs_;
}
std::string UkmReportingService::GetUploadUrl() const {
return GetServerUrl();
}
base::StringPiece UkmReportingService::upload_mime_type() const {
return kMimeType;
}
metrics::MetricsLogUploader::MetricServiceType
UkmReportingService::service_type() const {
return metrics::MetricsLogUploader::UKM;
}
void UkmReportingService::LogCellularConstraint(bool upload_canceled) {
UMA_HISTOGRAM_BOOLEAN("UKM.LogUpload.Canceled.CellularConstraint",
upload_canceled);
}
void UkmReportingService::LogResponseOrErrorCode(int response_code,
int error_code) {
UMA_HISTOGRAM_SPARSE_SLOWLY("UKM.LogUpload.ResponseOrErrorCode",
response_code >= 0 ? response_code : error_code);
}
void UkmReportingService::LogSuccess(size_t log_size) {
UMA_HISTOGRAM_COUNTS_10000("UKM.LogSize.OnSuccess", log_size / 1024);
}
void UkmReportingService::LogLargeRejection(size_t log_size) {}
} // namespace metrics
| 3,622 | 1,155 |
/*
* Copyright (c) 2020 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "call/adaptation/video_stream_adapter.h"
#include <string>
#include <utility>
#include "absl/types/optional.h"
#include "api/scoped_refptr.h"
#include "api/video/video_adaptation_reason.h"
#include "api/video_codecs/video_codec.h"
#include "api/video_codecs/video_encoder.h"
#include "api/video_codecs/video_encoder_config.h"
#include "call/adaptation/adaptation_constraint.h"
#include "call/adaptation/encoder_settings.h"
#include "call/adaptation/test/fake_frame_rate_provider.h"
#include "call/adaptation/test/fake_resource.h"
#include "call/adaptation/test/fake_video_stream_input_state_provider.h"
#include "call/adaptation/video_source_restrictions.h"
#include "call/adaptation/video_stream_input_state.h"
#include "rtc_base/string_encode.h"
#include "test/field_trial.h"
#include "test/gmock.h"
#include "test/gtest.h"
#include "test/testsupport/rtc_expect_death.h"
namespace webrtc {
using ::testing::_;
using ::testing::DoAll;
using ::testing::Return;
using ::testing::SaveArg;
namespace {
const int kBalancedHighResolutionPixels = 1280 * 720;
const int kBalancedHighFrameRateFps = 30;
const int kBalancedMediumResolutionPixels = 640 * 480;
const int kBalancedMediumFrameRateFps = 20;
const int kBalancedLowResolutionPixels = 320 * 240;
const int kBalancedLowFrameRateFps = 10;
std::string BalancedFieldTrialConfig() {
return "WebRTC-Video-BalancedDegradationSettings/pixels:" +
rtc::ToString(kBalancedLowResolutionPixels) + "|" +
rtc::ToString(kBalancedMediumResolutionPixels) + "|" +
rtc::ToString(kBalancedHighResolutionPixels) +
",fps:" + rtc::ToString(kBalancedLowFrameRateFps) + "|" +
rtc::ToString(kBalancedMediumFrameRateFps) + "|" +
rtc::ToString(kBalancedHighFrameRateFps) + "/";
}
// Responsible for adjusting the inputs to VideoStreamAdapter (SetInput), such
// as pixels and frame rate, according to the most recent source restrictions.
// This helps tests that apply adaptations multiple times: if the input is not
// adjusted between adaptations, the subsequent adaptations fail with
// kAwaitingPreviousAdaptation.
class FakeVideoStream {
public:
FakeVideoStream(VideoStreamAdapter* adapter,
FakeVideoStreamInputStateProvider* provider,
int input_pixels,
int input_fps,
int min_pixels_per_frame)
: adapter_(adapter),
provider_(provider),
input_pixels_(input_pixels),
input_fps_(input_fps),
min_pixels_per_frame_(min_pixels_per_frame) {
provider_->SetInputState(input_pixels_, input_fps_, min_pixels_per_frame_);
}
int input_pixels() const { return input_pixels_; }
int input_fps() const { return input_fps_; }
// Performs ApplyAdaptation() followed by SetInput() with input pixels and
// frame rate adjusted according to the resulting restrictions.
void ApplyAdaptation(Adaptation adaptation) {
adapter_->ApplyAdaptation(adaptation, nullptr);
// Update input pixels and fps according to the resulting restrictions.
auto restrictions = adapter_->source_restrictions();
if (restrictions.target_pixels_per_frame().has_value()) {
RTC_DCHECK(!restrictions.max_pixels_per_frame().has_value() ||
restrictions.max_pixels_per_frame().value() >=
restrictions.target_pixels_per_frame().value());
input_pixels_ = restrictions.target_pixels_per_frame().value();
} else if (restrictions.max_pixels_per_frame().has_value()) {
input_pixels_ = restrictions.max_pixels_per_frame().value();
}
if (restrictions.max_frame_rate().has_value()) {
input_fps_ = restrictions.max_frame_rate().value();
}
provider_->SetInputState(input_pixels_, input_fps_, min_pixels_per_frame_);
}
private:
VideoStreamAdapter* adapter_;
FakeVideoStreamInputStateProvider* provider_;
int input_pixels_;
int input_fps_;
int min_pixels_per_frame_;
};
class FakeVideoStreamAdapterListner : public VideoSourceRestrictionsListener {
public:
void OnVideoSourceRestrictionsUpdated(
VideoSourceRestrictions restrictions,
const VideoAdaptationCounters& adaptation_counters,
rtc::scoped_refptr<Resource> reason,
const VideoSourceRestrictions& unfiltered_restrictions) override {
calls_++;
last_restrictions_ = unfiltered_restrictions;
}
int calls() const { return calls_; }
VideoSourceRestrictions last_restrictions() const {
return last_restrictions_;
}
private:
int calls_ = 0;
VideoSourceRestrictions last_restrictions_;
};
class MockAdaptationConstraint : public AdaptationConstraint {
public:
MOCK_METHOD(bool,
IsAdaptationUpAllowed,
(const VideoStreamInputState& input_state,
const VideoSourceRestrictions& restrictions_before,
const VideoSourceRestrictions& restrictions_after),
(const, override));
// MOCK_METHOD(std::string, Name, (), (const, override));
std::string Name() const override { return "MockAdaptationConstraint"; }
};
} // namespace
class VideoStreamAdapterTest : public ::testing::Test {
public:
VideoStreamAdapterTest()
: field_trials_(BalancedFieldTrialConfig()),
resource_(FakeResource::Create("FakeResource")),
adapter_(&input_state_provider_, &encoder_stats_observer_) {}
protected:
webrtc::test::ScopedFieldTrials field_trials_;
FakeVideoStreamInputStateProvider input_state_provider_;
rtc::scoped_refptr<Resource> resource_;
testing::StrictMock<MockVideoStreamEncoderObserver> encoder_stats_observer_;
VideoStreamAdapter adapter_;
};
TEST_F(VideoStreamAdapterTest, NoRestrictionsByDefault) {
EXPECT_EQ(VideoSourceRestrictions(), adapter_.source_restrictions());
EXPECT_EQ(0, adapter_.adaptation_counters().Total());
}
TEST_F(VideoStreamAdapterTest, MaintainFramerate_DecreasesPixelsToThreeFifths) {
const int kInputPixels = 1280 * 720;
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
input_state_provider_.SetInputState(kInputPixels, 30,
kDefaultMinPixelsPerFrame);
Adaptation adaptation = adapter_.GetAdaptationDown();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
adapter_.ApplyAdaptation(adaptation, nullptr);
EXPECT_EQ(static_cast<size_t>((kInputPixels * 3) / 5),
adapter_.source_restrictions().max_pixels_per_frame());
EXPECT_EQ(absl::nullopt,
adapter_.source_restrictions().target_pixels_per_frame());
EXPECT_EQ(absl::nullopt, adapter_.source_restrictions().max_frame_rate());
EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations);
}
TEST_F(VideoStreamAdapterTest,
MaintainFramerate_DecreasesPixelsToLimitReached) {
const int kMinPixelsPerFrame = 640 * 480;
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
input_state_provider_.SetInputState(kMinPixelsPerFrame + 1, 30,
kMinPixelsPerFrame);
EXPECT_CALL(encoder_stats_observer_, OnMinPixelLimitReached());
// Even though we are above kMinPixelsPerFrame, because adapting down would
// have exceeded the limit, we are said to have reached the limit already.
// This differs from the frame rate adaptation logic, which would have clamped
// to the limit in the first step and reported kLimitReached in the second
// step.
Adaptation adaptation = adapter_.GetAdaptationDown();
EXPECT_EQ(Adaptation::Status::kLimitReached, adaptation.status());
}
TEST_F(VideoStreamAdapterTest, MaintainFramerate_IncreasePixelsToFiveThirds) {
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30,
kDefaultMinPixelsPerFrame);
// Go down twice, ensuring going back up is still a restricted resolution.
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
EXPECT_EQ(2, adapter_.adaptation_counters().resolution_adaptations);
int input_pixels = fake_stream.input_pixels();
// Go up once. The target is 5/3 and the max is 12/5 of the target.
const int target = (input_pixels * 5) / 3;
fake_stream.ApplyAdaptation(adapter_.GetAdaptationUp());
EXPECT_EQ(static_cast<size_t>((target * 12) / 5),
adapter_.source_restrictions().max_pixels_per_frame());
EXPECT_EQ(static_cast<size_t>(target),
adapter_.source_restrictions().target_pixels_per_frame());
EXPECT_EQ(absl::nullopt, adapter_.source_restrictions().max_frame_rate());
EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations);
}
TEST_F(VideoStreamAdapterTest, MaintainFramerate_IncreasePixelsToUnrestricted) {
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30,
kDefaultMinPixelsPerFrame);
// We are unrestricted by default and should not be able to adapt up.
EXPECT_EQ(Adaptation::Status::kLimitReached,
adapter_.GetAdaptationUp().status());
// If we go down once and then back up we should not have any restrictions.
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations);
fake_stream.ApplyAdaptation(adapter_.GetAdaptationUp());
EXPECT_EQ(VideoSourceRestrictions(), adapter_.source_restrictions());
EXPECT_EQ(0, adapter_.adaptation_counters().Total());
}
TEST_F(VideoStreamAdapterTest, MaintainResolution_DecreasesFpsToTwoThirds) {
const int kInputFps = 30;
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION);
input_state_provider_.SetInputState(1280 * 720, kInputFps,
kDefaultMinPixelsPerFrame);
Adaptation adaptation = adapter_.GetAdaptationDown();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
adapter_.ApplyAdaptation(adaptation, nullptr);
EXPECT_EQ(absl::nullopt,
adapter_.source_restrictions().max_pixels_per_frame());
EXPECT_EQ(absl::nullopt,
adapter_.source_restrictions().target_pixels_per_frame());
EXPECT_EQ(static_cast<double>((kInputFps * 2) / 3),
adapter_.source_restrictions().max_frame_rate());
EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations);
}
TEST_F(VideoStreamAdapterTest, MaintainResolution_DecreasesFpsToLimitReached) {
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION);
FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720,
kMinFrameRateFps + 1, kDefaultMinPixelsPerFrame);
// If we are not yet at the limit and the next step would exceed it, the step
// is clamped such that we end up exactly on the limit.
Adaptation adaptation = adapter_.GetAdaptationDown();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
fake_stream.ApplyAdaptation(adaptation);
EXPECT_EQ(static_cast<double>(kMinFrameRateFps),
adapter_.source_restrictions().max_frame_rate());
EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations);
// Having reached the limit, the next adaptation down is not valid.
EXPECT_EQ(Adaptation::Status::kLimitReached,
adapter_.GetAdaptationDown().status());
}
TEST_F(VideoStreamAdapterTest, MaintainResolution_IncreaseFpsToThreeHalves) {
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION);
FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30,
kDefaultMinPixelsPerFrame);
// Go down twice, ensuring going back up is still a restricted frame rate.
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
EXPECT_EQ(2, adapter_.adaptation_counters().fps_adaptations);
int input_fps = fake_stream.input_fps();
// Go up once. The target is 3/2 of the input.
Adaptation adaptation = adapter_.GetAdaptationUp();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
fake_stream.ApplyAdaptation(adaptation);
EXPECT_EQ(absl::nullopt,
adapter_.source_restrictions().max_pixels_per_frame());
EXPECT_EQ(absl::nullopt,
adapter_.source_restrictions().target_pixels_per_frame());
EXPECT_EQ(static_cast<double>((input_fps * 3) / 2),
adapter_.source_restrictions().max_frame_rate());
EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations);
}
TEST_F(VideoStreamAdapterTest, MaintainResolution_IncreaseFpsToUnrestricted) {
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION);
FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30,
kDefaultMinPixelsPerFrame);
// We are unrestricted by default and should not be able to adapt up.
EXPECT_EQ(Adaptation::Status::kLimitReached,
adapter_.GetAdaptationUp().status());
// If we go down once and then back up we should not have any restrictions.
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations);
fake_stream.ApplyAdaptation(adapter_.GetAdaptationUp());
EXPECT_EQ(VideoSourceRestrictions(), adapter_.source_restrictions());
EXPECT_EQ(0, adapter_.adaptation_counters().Total());
}
TEST_F(VideoStreamAdapterTest, Balanced_DecreaseFrameRate) {
adapter_.SetDegradationPreference(DegradationPreference::BALANCED);
input_state_provider_.SetInputState(kBalancedMediumResolutionPixels,
kBalancedHighFrameRateFps,
kDefaultMinPixelsPerFrame);
// If our frame rate is higher than the frame rate associated with our
// resolution we should try to adapt to the frame rate associated with our
// resolution: kBalancedMediumFrameRateFps.
Adaptation adaptation = adapter_.GetAdaptationDown();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
adapter_.ApplyAdaptation(adaptation, nullptr);
EXPECT_EQ(absl::nullopt,
adapter_.source_restrictions().max_pixels_per_frame());
EXPECT_EQ(absl::nullopt,
adapter_.source_restrictions().target_pixels_per_frame());
EXPECT_EQ(static_cast<double>(kBalancedMediumFrameRateFps),
adapter_.source_restrictions().max_frame_rate());
EXPECT_EQ(0, adapter_.adaptation_counters().resolution_adaptations);
EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations);
}
TEST_F(VideoStreamAdapterTest, Balanced_DecreaseResolution) {
adapter_.SetDegradationPreference(DegradationPreference::BALANCED);
FakeVideoStream fake_stream(
&adapter_, &input_state_provider_, kBalancedHighResolutionPixels,
kBalancedHighFrameRateFps, kDefaultMinPixelsPerFrame);
// If we are not below the current resolution's frame rate limit, we should
// adapt resolution according to "maintain-framerate" logic (three fifths).
//
// However, since we are unlimited at the start and input frame rate is not
// below kBalancedHighFrameRateFps, we first restrict the frame rate to
// kBalancedHighFrameRateFps even though that is our current frame rate. This
// does prevent the source from going higher, though, so it's technically not
// a NO-OP.
{
Adaptation adaptation = adapter_.GetAdaptationDown();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
fake_stream.ApplyAdaptation(adaptation);
}
EXPECT_EQ(absl::nullopt,
adapter_.source_restrictions().max_pixels_per_frame());
EXPECT_EQ(absl::nullopt,
adapter_.source_restrictions().target_pixels_per_frame());
EXPECT_EQ(static_cast<double>(kBalancedHighFrameRateFps),
adapter_.source_restrictions().max_frame_rate());
EXPECT_EQ(0, adapter_.adaptation_counters().resolution_adaptations);
EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations);
// Verify "maintain-framerate" logic the second time we adapt: Frame rate
// restrictions remains the same and resolution goes down.
{
Adaptation adaptation = adapter_.GetAdaptationDown();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
fake_stream.ApplyAdaptation(adaptation);
}
constexpr size_t kReducedPixelsFirstStep =
static_cast<size_t>((kBalancedHighResolutionPixels * 3) / 5);
EXPECT_EQ(kReducedPixelsFirstStep,
adapter_.source_restrictions().max_pixels_per_frame());
EXPECT_EQ(absl::nullopt,
adapter_.source_restrictions().target_pixels_per_frame());
EXPECT_EQ(static_cast<double>(kBalancedHighFrameRateFps),
adapter_.source_restrictions().max_frame_rate());
EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations);
EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations);
// If we adapt again, because the balanced settings' proposed frame rate is
// still kBalancedHighFrameRateFps, "maintain-framerate" will trigger again.
static_assert(kReducedPixelsFirstStep > kBalancedMediumResolutionPixels,
"The reduced resolution is still greater than the next lower "
"balanced setting resolution");
constexpr size_t kReducedPixelsSecondStep = (kReducedPixelsFirstStep * 3) / 5;
{
Adaptation adaptation = adapter_.GetAdaptationDown();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
fake_stream.ApplyAdaptation(adaptation);
}
EXPECT_EQ(kReducedPixelsSecondStep,
adapter_.source_restrictions().max_pixels_per_frame());
EXPECT_EQ(absl::nullopt,
adapter_.source_restrictions().target_pixels_per_frame());
EXPECT_EQ(static_cast<double>(kBalancedHighFrameRateFps),
adapter_.source_restrictions().max_frame_rate());
EXPECT_EQ(2, adapter_.adaptation_counters().resolution_adaptations);
EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations);
}
// Testing when to adapt frame rate and when to adapt resolution is quite
// entangled, so this test covers both cases.
//
// There is an asymmetry: When we adapt down we do it in one order, but when we
// adapt up we don't do it in the reverse order. Instead we always try to adapt
// frame rate first according to balanced settings' configs and only when the
// frame rate is already achieved do we adjust the resolution.
TEST_F(VideoStreamAdapterTest, Balanced_IncreaseFrameRateAndResolution) {
adapter_.SetDegradationPreference(DegradationPreference::BALANCED);
FakeVideoStream fake_stream(
&adapter_, &input_state_provider_, kBalancedHighResolutionPixels,
kBalancedHighFrameRateFps, kDefaultMinPixelsPerFrame);
// The desired starting point of this test is having adapted frame rate twice.
// This requires performing a number of adaptations.
constexpr size_t kReducedPixelsFirstStep =
static_cast<size_t>((kBalancedHighResolutionPixels * 3) / 5);
constexpr size_t kReducedPixelsSecondStep = (kReducedPixelsFirstStep * 3) / 5;
constexpr size_t kReducedPixelsThirdStep = (kReducedPixelsSecondStep * 3) / 5;
static_assert(kReducedPixelsFirstStep > kBalancedMediumResolutionPixels,
"The first pixel reduction is greater than the balanced "
"settings' medium pixel configuration");
static_assert(kReducedPixelsSecondStep > kBalancedMediumResolutionPixels,
"The second pixel reduction is greater than the balanced "
"settings' medium pixel configuration");
static_assert(kReducedPixelsThirdStep <= kBalancedMediumResolutionPixels,
"The third pixel reduction is NOT greater than the balanced "
"settings' medium pixel configuration");
// The first adaptation should affect the frame rate: See
// Balanced_DecreaseResolution for explanation why.
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
EXPECT_EQ(static_cast<double>(kBalancedHighFrameRateFps),
adapter_.source_restrictions().max_frame_rate());
// The next three adaptations affects the resolution, because we have to reach
// kBalancedMediumResolutionPixels before a lower frame rate is considered by
// BalancedDegradationSettings. The number three is derived from the
// static_asserts above.
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
EXPECT_EQ(kReducedPixelsFirstStep,
adapter_.source_restrictions().max_pixels_per_frame());
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
EXPECT_EQ(kReducedPixelsSecondStep,
adapter_.source_restrictions().max_pixels_per_frame());
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
EXPECT_EQ(kReducedPixelsThirdStep,
adapter_.source_restrictions().max_pixels_per_frame());
// Thus, the next adaptation will reduce frame rate to
// kBalancedMediumFrameRateFps.
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
EXPECT_EQ(static_cast<double>(kBalancedMediumFrameRateFps),
adapter_.source_restrictions().max_frame_rate());
EXPECT_EQ(3, adapter_.adaptation_counters().resolution_adaptations);
EXPECT_EQ(2, adapter_.adaptation_counters().fps_adaptations);
// Adapt up!
// While our resolution is in the medium-range, the frame rate associated with
// the next resolution configuration up ("high") is kBalancedHighFrameRateFps
// and "balanced" prefers adapting frame rate if not already applied.
{
Adaptation adaptation = adapter_.GetAdaptationUp();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
fake_stream.ApplyAdaptation(adaptation);
EXPECT_EQ(static_cast<double>(kBalancedHighFrameRateFps),
adapter_.source_restrictions().max_frame_rate());
EXPECT_EQ(3, adapter_.adaptation_counters().resolution_adaptations);
EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations);
}
// Now that we have already achieved the next frame rate up, we act according
// to "maintain-framerate". We go back up in resolution. Due to rounding
// errors we don't end up back at kReducedPixelsSecondStep. Rather we get to
// kReducedPixelsSecondStepUp, which is off by one compared to
// kReducedPixelsSecondStep.
constexpr size_t kReducedPixelsSecondStepUp =
(kReducedPixelsThirdStep * 5) / 3;
{
Adaptation adaptation = adapter_.GetAdaptationUp();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
fake_stream.ApplyAdaptation(adaptation);
EXPECT_EQ(kReducedPixelsSecondStepUp,
adapter_.source_restrictions().target_pixels_per_frame());
EXPECT_EQ(2, adapter_.adaptation_counters().resolution_adaptations);
EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations);
}
// Now that our resolution is back in the high-range, the next frame rate to
// try out is "unlimited".
{
Adaptation adaptation = adapter_.GetAdaptationUp();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
fake_stream.ApplyAdaptation(adaptation);
EXPECT_EQ(absl::nullopt, adapter_.source_restrictions().max_frame_rate());
EXPECT_EQ(2, adapter_.adaptation_counters().resolution_adaptations);
EXPECT_EQ(0, adapter_.adaptation_counters().fps_adaptations);
}
// Now only adapting resolution remains.
constexpr size_t kReducedPixelsFirstStepUp =
(kReducedPixelsSecondStepUp * 5) / 3;
{
Adaptation adaptation = adapter_.GetAdaptationUp();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
fake_stream.ApplyAdaptation(adaptation);
EXPECT_EQ(kReducedPixelsFirstStepUp,
adapter_.source_restrictions().target_pixels_per_frame());
EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations);
EXPECT_EQ(0, adapter_.adaptation_counters().fps_adaptations);
}
// The last step up should make us entirely unrestricted.
{
Adaptation adaptation = adapter_.GetAdaptationUp();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
fake_stream.ApplyAdaptation(adaptation);
EXPECT_EQ(VideoSourceRestrictions(), adapter_.source_restrictions());
EXPECT_EQ(0, adapter_.adaptation_counters().Total());
}
}
TEST_F(VideoStreamAdapterTest, Balanced_LimitReached) {
adapter_.SetDegradationPreference(DegradationPreference::BALANCED);
FakeVideoStream fake_stream(
&adapter_, &input_state_provider_, kBalancedLowResolutionPixels,
kBalancedLowFrameRateFps, kDefaultMinPixelsPerFrame);
// Attempting to adapt up while unrestricted should result in kLimitReached.
EXPECT_EQ(Adaptation::Status::kLimitReached,
adapter_.GetAdaptationUp().status());
// Adapting down once result in restricted frame rate, in this case we reach
// the lowest possible frame rate immediately: kBalancedLowFrameRateFps.
EXPECT_CALL(encoder_stats_observer_, OnMinPixelLimitReached()).Times(2);
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
EXPECT_EQ(static_cast<double>(kBalancedLowFrameRateFps),
adapter_.source_restrictions().max_frame_rate());
EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations);
// Any further adaptation must follow "maintain-framerate" rules (these are
// covered in more depth by the MaintainFramerate tests). This test does not
// assert exactly how resolution is adjusted, only that resolution always
// decreases and that we eventually reach kLimitReached.
size_t previous_resolution = kBalancedLowResolutionPixels;
bool did_reach_limit = false;
// If we have not reached the limit within 5 adaptations something is wrong...
for (int i = 0; i < 5; i++) {
Adaptation adaptation = adapter_.GetAdaptationDown();
if (adaptation.status() == Adaptation::Status::kLimitReached) {
did_reach_limit = true;
break;
}
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
fake_stream.ApplyAdaptation(adaptation);
EXPECT_LT(adapter_.source_restrictions().max_pixels_per_frame().value(),
previous_resolution);
previous_resolution =
adapter_.source_restrictions().max_pixels_per_frame().value();
}
EXPECT_TRUE(did_reach_limit);
// Frame rate restrictions are the same as before.
EXPECT_EQ(static_cast<double>(kBalancedLowFrameRateFps),
adapter_.source_restrictions().max_frame_rate());
EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations);
}
// kAwaitingPreviousAdaptation is only supported in "maintain-framerate".
TEST_F(VideoStreamAdapterTest,
MaintainFramerate_AwaitingPreviousAdaptationDown) {
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
input_state_provider_.SetInputState(1280 * 720, 30,
kDefaultMinPixelsPerFrame);
// Adapt down once, but don't update the input.
adapter_.ApplyAdaptation(adapter_.GetAdaptationDown(), nullptr);
EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations);
{
// Having performed the adaptation, but not updated the input based on the
// new restrictions, adapting again in the same direction will not work.
Adaptation adaptation = adapter_.GetAdaptationDown();
EXPECT_EQ(Adaptation::Status::kAwaitingPreviousAdaptation,
adaptation.status());
}
}
// kAwaitingPreviousAdaptation is only supported in "maintain-framerate".
TEST_F(VideoStreamAdapterTest, MaintainFramerate_AwaitingPreviousAdaptationUp) {
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30,
kDefaultMinPixelsPerFrame);
// Perform two adaptation down so that adapting up twice is possible.
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
EXPECT_EQ(2, adapter_.adaptation_counters().resolution_adaptations);
// Adapt up once, but don't update the input.
adapter_.ApplyAdaptation(adapter_.GetAdaptationUp(), nullptr);
EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations);
{
// Having performed the adaptation, but not updated the input based on the
// new restrictions, adapting again in the same direction will not work.
Adaptation adaptation = adapter_.GetAdaptationUp();
EXPECT_EQ(Adaptation::Status::kAwaitingPreviousAdaptation,
adaptation.status());
}
}
TEST_F(VideoStreamAdapterTest,
MaintainResolution_AdaptsUpAfterSwitchingDegradationPreference) {
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION);
FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30,
kDefaultMinPixelsPerFrame);
// Adapt down in fps for later.
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations);
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
fake_stream.ApplyAdaptation(adapter_.GetAdaptationUp());
EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations);
EXPECT_EQ(0, adapter_.adaptation_counters().resolution_adaptations);
// We should be able to adapt in framerate one last time after the change of
// degradation preference.
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION);
Adaptation adaptation = adapter_.GetAdaptationUp();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
fake_stream.ApplyAdaptation(adapter_.GetAdaptationUp());
EXPECT_EQ(0, adapter_.adaptation_counters().fps_adaptations);
}
TEST_F(VideoStreamAdapterTest,
MaintainFramerate_AdaptsUpAfterSwitchingDegradationPreference) {
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30,
kDefaultMinPixelsPerFrame);
// Adapt down in resolution for later.
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations);
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION);
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
fake_stream.ApplyAdaptation(adapter_.GetAdaptationUp());
EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations);
EXPECT_EQ(0, adapter_.adaptation_counters().fps_adaptations);
// We should be able to adapt in framerate one last time after the change of
// degradation preference.
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
Adaptation adaptation = adapter_.GetAdaptationUp();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
fake_stream.ApplyAdaptation(adapter_.GetAdaptationUp());
EXPECT_EQ(0, adapter_.adaptation_counters().resolution_adaptations);
}
TEST_F(VideoStreamAdapterTest,
PendingResolutionIncreaseAllowsAdaptUpAfterSwitchToMaintainResolution) {
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION);
FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30,
kDefaultMinPixelsPerFrame);
// Adapt fps down so we can adapt up later in the test.
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
// Apply adaptation up but don't update input.
adapter_.ApplyAdaptation(adapter_.GetAdaptationUp(), nullptr);
EXPECT_EQ(Adaptation::Status::kAwaitingPreviousAdaptation,
adapter_.GetAdaptationUp().status());
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION);
Adaptation adaptation = adapter_.GetAdaptationUp();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
}
TEST_F(VideoStreamAdapterTest,
MaintainFramerate_AdaptsDownAfterSwitchingDegradationPreference) {
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION);
FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30,
kDefaultMinPixelsPerFrame);
// Adapt down once, should change FPS.
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations);
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
// Adaptation down should apply after the degradation prefs change.
Adaptation adaptation = adapter_.GetAdaptationDown();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
fake_stream.ApplyAdaptation(adaptation);
EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations);
EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations);
}
TEST_F(VideoStreamAdapterTest,
MaintainResolution_AdaptsDownAfterSwitchingDegradationPreference) {
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30,
kDefaultMinPixelsPerFrame);
// Adapt down once, should change FPS.
fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown());
EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations);
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION);
Adaptation adaptation = adapter_.GetAdaptationDown();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
fake_stream.ApplyAdaptation(adaptation);
EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations);
EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations);
}
TEST_F(
VideoStreamAdapterTest,
PendingResolutionDecreaseAllowsAdaptDownAfterSwitchToMaintainResolution) {
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30,
kDefaultMinPixelsPerFrame);
// Apply adaptation but don't update the input.
adapter_.ApplyAdaptation(adapter_.GetAdaptationDown(), nullptr);
EXPECT_EQ(Adaptation::Status::kAwaitingPreviousAdaptation,
adapter_.GetAdaptationDown().status());
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION);
Adaptation adaptation = adapter_.GetAdaptationDown();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
}
TEST_F(VideoStreamAdapterTest, RestrictionBroadcasted) {
FakeVideoStreamAdapterListner listener;
adapter_.AddRestrictionsListener(&listener);
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30,
kDefaultMinPixelsPerFrame);
// Not broadcast on invalid ApplyAdaptation.
{
Adaptation adaptation = adapter_.GetAdaptationUp();
adapter_.ApplyAdaptation(adaptation, nullptr);
EXPECT_EQ(0, listener.calls());
}
// Broadcast on ApplyAdaptation.
{
Adaptation adaptation = adapter_.GetAdaptationDown();
fake_stream.ApplyAdaptation(adaptation);
EXPECT_EQ(1, listener.calls());
EXPECT_EQ(adaptation.restrictions(), listener.last_restrictions());
}
// Broadcast on ClearRestrictions().
adapter_.ClearRestrictions();
EXPECT_EQ(2, listener.calls());
EXPECT_EQ(VideoSourceRestrictions(), listener.last_restrictions());
}
TEST_F(VideoStreamAdapterTest, AdaptationHasNextRestrcitions) {
// Any non-disabled DegradationPreference will do.
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30,
kDefaultMinPixelsPerFrame);
// When adaptation is not possible.
{
Adaptation adaptation = adapter_.GetAdaptationUp();
EXPECT_EQ(Adaptation::Status::kLimitReached, adaptation.status());
EXPECT_EQ(adaptation.restrictions(), adapter_.source_restrictions());
EXPECT_EQ(0, adaptation.counters().Total());
}
// When we adapt down.
{
Adaptation adaptation = adapter_.GetAdaptationDown();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
fake_stream.ApplyAdaptation(adaptation);
EXPECT_EQ(adaptation.restrictions(), adapter_.source_restrictions());
EXPECT_EQ(adaptation.counters(), adapter_.adaptation_counters());
}
// When we adapt up.
{
Adaptation adaptation = adapter_.GetAdaptationUp();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
fake_stream.ApplyAdaptation(adaptation);
EXPECT_EQ(adaptation.restrictions(), adapter_.source_restrictions());
EXPECT_EQ(adaptation.counters(), adapter_.adaptation_counters());
}
}
TEST_F(VideoStreamAdapterTest,
SetDegradationPreferenceToOrFromBalancedClearsRestrictions) {
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
input_state_provider_.SetInputState(1280 * 720, 30,
kDefaultMinPixelsPerFrame);
adapter_.ApplyAdaptation(adapter_.GetAdaptationDown(), nullptr);
EXPECT_NE(VideoSourceRestrictions(), adapter_.source_restrictions());
EXPECT_NE(0, adapter_.adaptation_counters().Total());
// Changing from non-balanced to balanced clears the restrictions.
adapter_.SetDegradationPreference(DegradationPreference::BALANCED);
EXPECT_EQ(VideoSourceRestrictions(), adapter_.source_restrictions());
EXPECT_EQ(0, adapter_.adaptation_counters().Total());
// Apply adaptation again.
adapter_.ApplyAdaptation(adapter_.GetAdaptationDown(), nullptr);
EXPECT_NE(VideoSourceRestrictions(), adapter_.source_restrictions());
EXPECT_NE(0, adapter_.adaptation_counters().Total());
// Changing from balanced to non-balanced clears the restrictions.
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION);
EXPECT_EQ(VideoSourceRestrictions(), adapter_.source_restrictions());
EXPECT_EQ(0, adapter_.adaptation_counters().Total());
}
TEST_F(VideoStreamAdapterTest,
GetAdaptDownResolutionAdaptsResolutionInMaintainFramerate) {
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
input_state_provider_.SetInputState(1280 * 720, 30,
kDefaultMinPixelsPerFrame);
auto adaptation = adapter_.GetAdaptDownResolution();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
EXPECT_EQ(1, adaptation.counters().resolution_adaptations);
EXPECT_EQ(0, adaptation.counters().fps_adaptations);
}
TEST_F(VideoStreamAdapterTest,
GetAdaptDownResolutionReturnsWithStatusInDisabledAndMaintainResolution) {
adapter_.SetDegradationPreference(DegradationPreference::DISABLED);
input_state_provider_.SetInputState(1280 * 720, 30,
kDefaultMinPixelsPerFrame);
EXPECT_EQ(Adaptation::Status::kAdaptationDisabled,
adapter_.GetAdaptDownResolution().status());
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION);
EXPECT_EQ(Adaptation::Status::kLimitReached,
adapter_.GetAdaptDownResolution().status());
}
TEST_F(VideoStreamAdapterTest,
GetAdaptDownResolutionAdaptsFpsAndResolutionInBalanced) {
// Note: This test depends on BALANCED implementation, but with current
// implementation and input state settings, BALANCED will adapt resolution and
// frame rate once.
adapter_.SetDegradationPreference(DegradationPreference::BALANCED);
input_state_provider_.SetInputState(1280 * 720, 30,
kDefaultMinPixelsPerFrame);
auto adaptation = adapter_.GetAdaptDownResolution();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
EXPECT_EQ(1, adaptation.counters().resolution_adaptations);
EXPECT_EQ(1, adaptation.counters().fps_adaptations);
}
TEST_F(
VideoStreamAdapterTest,
GetAdaptDownResolutionAdaptsOnlyResolutionIfFpsAlreadyAdapterInBalanced) {
// Note: This test depends on BALANCED implementation, but with current
// implementation and input state settings, BALANCED will adapt resolution
// only.
adapter_.SetDegradationPreference(DegradationPreference::BALANCED);
input_state_provider_.SetInputState(1280 * 720, 5, kDefaultMinPixelsPerFrame);
FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30,
kDefaultMinPixelsPerFrame);
auto first_adaptation = adapter_.GetAdaptationDown();
fake_stream.ApplyAdaptation(first_adaptation);
auto adaptation = adapter_.GetAdaptDownResolution();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
EXPECT_EQ(1, adaptation.counters().resolution_adaptations);
EXPECT_EQ(first_adaptation.counters().fps_adaptations,
adaptation.counters().fps_adaptations);
}
TEST_F(VideoStreamAdapterTest,
GetAdaptDownResolutionAdaptsOnlyFpsIfResolutionLowInBalanced) {
// Note: This test depends on BALANCED implementation, but with current
// implementation and input state settings, BALANCED will adapt resolution
// only.
adapter_.SetDegradationPreference(DegradationPreference::BALANCED);
input_state_provider_.SetInputState(kDefaultMinPixelsPerFrame, 30,
kDefaultMinPixelsPerFrame);
auto adaptation = adapter_.GetAdaptDownResolution();
EXPECT_EQ(Adaptation::Status::kValid, adaptation.status());
EXPECT_EQ(0, adaptation.counters().resolution_adaptations);
EXPECT_EQ(1, adaptation.counters().fps_adaptations);
}
TEST_F(VideoStreamAdapterTest,
AdaptationDisabledStatusAlwaysWhenDegradationPreferenceDisabled) {
adapter_.SetDegradationPreference(DegradationPreference::DISABLED);
input_state_provider_.SetInputState(1280 * 720, 30,
kDefaultMinPixelsPerFrame);
EXPECT_EQ(Adaptation::Status::kAdaptationDisabled,
adapter_.GetAdaptationDown().status());
EXPECT_EQ(Adaptation::Status::kAdaptationDisabled,
adapter_.GetAdaptationUp().status());
EXPECT_EQ(Adaptation::Status::kAdaptationDisabled,
adapter_.GetAdaptDownResolution().status());
}
TEST_F(VideoStreamAdapterTest, AdaptationConstraintAllowsAdaptationsUp) {
testing::StrictMock<MockAdaptationConstraint> adaptation_constraint;
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
adapter_.AddAdaptationConstraint(&adaptation_constraint);
input_state_provider_.SetInputState(1280 * 720, 30,
kDefaultMinPixelsPerFrame);
FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30,
kDefaultMinPixelsPerFrame);
// Adapt down once so we can adapt up later.
auto first_adaptation = adapter_.GetAdaptationDown();
fake_stream.ApplyAdaptation(first_adaptation);
EXPECT_CALL(adaptation_constraint,
IsAdaptationUpAllowed(_, first_adaptation.restrictions(), _))
.WillOnce(Return(true));
EXPECT_EQ(Adaptation::Status::kValid, adapter_.GetAdaptationUp().status());
adapter_.RemoveAdaptationConstraint(&adaptation_constraint);
}
TEST_F(VideoStreamAdapterTest, AdaptationConstraintDisallowsAdaptationsUp) {
testing::StrictMock<MockAdaptationConstraint> adaptation_constraint;
adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
adapter_.AddAdaptationConstraint(&adaptation_constraint);
input_state_provider_.SetInputState(1280 * 720, 30,
kDefaultMinPixelsPerFrame);
FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30,
kDefaultMinPixelsPerFrame);
// Adapt down once so we can adapt up later.
auto first_adaptation = adapter_.GetAdaptationDown();
fake_stream.ApplyAdaptation(first_adaptation);
EXPECT_CALL(adaptation_constraint,
IsAdaptationUpAllowed(_, first_adaptation.restrictions(), _))
.WillOnce(Return(false));
EXPECT_EQ(Adaptation::Status::kRejectedByConstraint,
adapter_.GetAdaptationUp().status());
adapter_.RemoveAdaptationConstraint(&adaptation_constraint);
}
// Death tests.
// Disabled on Android because death tests misbehave on Android, see
// base/test/gtest_util.h.
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
TEST(VideoStreamAdapterDeathTest,
SetDegradationPreferenceInvalidatesAdaptations) {
FakeVideoStreamInputStateProvider input_state_provider;
testing::StrictMock<MockVideoStreamEncoderObserver> encoder_stats_observer_;
VideoStreamAdapter adapter(&input_state_provider, &encoder_stats_observer_);
adapter.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE);
input_state_provider.SetInputState(1280 * 720, 30, kDefaultMinPixelsPerFrame);
Adaptation adaptation = adapter.GetAdaptationDown();
adapter.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION);
EXPECT_DEATH(adapter.ApplyAdaptation(adaptation, nullptr), "");
}
TEST(VideoStreamAdapterDeathTest, AdaptDownInvalidatesAdaptations) {
FakeVideoStreamInputStateProvider input_state_provider;
testing::StrictMock<MockVideoStreamEncoderObserver> encoder_stats_observer_;
VideoStreamAdapter adapter(&input_state_provider, &encoder_stats_observer_);
adapter.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION);
input_state_provider.SetInputState(1280 * 720, 30, kDefaultMinPixelsPerFrame);
Adaptation adaptation = adapter.GetAdaptationDown();
adapter.GetAdaptationDown();
EXPECT_DEATH(adapter.ApplyAdaptation(adaptation, nullptr), "");
}
#endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
} // namespace webrtc
| 46,210 | 15,433 |
/* ------------------------------------------------------------------------------------
*
* File SkyBox.cpp
* Description This source file is part of OGRE
* (Object-oriented Graphics Rendering Engine)
* Author Y.H Mun
*
* ------------------------------------------------------------------------------------
*
* Copyright (c) 2010-2013 XMSoft. All rights reserved.
*
* Contact Email: xmsoft77@gmail.com
*
* ------------------------------------------------------------------------------------
*
* Copyright (c) 2010-2012 Torus Knot Software Ltd.
*
* For the latest info, see http://www.ogre3d.org/
*
* ------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ------------------------------------------------------------------------------------ */
#include "Precompiled.h"
#include "SkyBox.h"
Sample_SkyBox::Sample_SkyBox ( KDvoid )
{
m_aInfo [ "Title" ] = "Sky Box";
m_aInfo [ "Description" ] = "Shows how to use skyboxes (fixed-distance cubes used for backgrounds).";
m_aInfo [ "Thumbnail" ] = "thumb_skybox.png";
m_aInfo [ "Category" ] = "Environment";
}
KDvoid Sample_SkyBox::setupContent ( KDvoid )
{
// setup some basic lighting for our scene
m_pSceneMgr->setAmbientLight ( ColourValue ( 0.3, 0.3, 0.3 ) );
m_pSceneMgr->createLight ( )->setPosition ( 20, 80, 50 );
m_pSceneMgr->setSkyBox ( true, "Examples/SpaceSkyBox", 5000 ); // set our skybox
// create a spaceship model, and place it at the origin
m_pSceneMgr->getRootSceneNode ( )->attachObject ( m_pSceneMgr->createEntity ( "Razor", "razor.mesh" ) );
// create a particle system with 200 quota, then set its material and dimensions
ParticleSystem* pThrusters = m_pSceneMgr->createParticleSystem ( 25 );
pThrusters->setMaterialName ( "Examples/Flare" );
pThrusters->setDefaultDimensions ( 25, 25 );
// create two emitters for our thruster particle system
for ( KDuint i = 0; i < 2; i++ )
{
ParticleEmitter* pEmitter = pThrusters->addEmitter ( "Point" ); // add a point emitter
// set the emitter properties
pEmitter->setAngle ( Degree ( 3 ) );
pEmitter->setTimeToLive ( 0.5 );
pEmitter->setEmissionRate ( 25 );
pEmitter->setParticleVelocity ( 25 );
pEmitter->setDirection ( Vector3::NEGATIVE_UNIT_Z);
pEmitter->setColour ( ColourValue::White, ColourValue::Red );
pEmitter->setPosition ( Vector3 ( i == 0 ? 5.7 : -18, 0, 0 ) );
}
// attach our thruster particles to the rear of the ship
m_pSceneMgr->getRootSceneNode ( )->createChildSceneNode ( Vector3 ( 0, 6.5, -67 ) )->attachObject ( pThrusters );
// set the camera's initial position and orientation
m_pCamera->setPosition ( 0, 0, 150 );
m_pCamera->yaw ( Degree ( 5 ) );
}
| 4,085 | 1,327 |
#include <iostream>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <succinct/mapper.hpp>
#include "index_types.hpp"
#include "util.hpp"
typedef uint32_t term_id_type;
typedef std::vector<term_id_type> term_id_vec;
bool read_query(term_id_vec& ret, std::istream& is = std::cin) {
ret.clear();
std::string line;
if (!std::getline(is, line))
return false;
std::istringstream iline(line);
term_id_type term_id;
while (iline >> term_id) {
ret.push_back(term_id);
}
return true;
}
template <typename Enum>
static uint64_t intersect(uint64_t num_docs, std::vector<Enum>& enums,
std::vector<uint32_t>& out) {
// increasing frequency
if (enums[0].size() > enums[1].size()) {
std::swap(enums[0], enums[1]);
}
uint64_t results = 0;
uint64_t candidate = enums[0].docid();
size_t i = 1;
while (candidate < num_docs) {
for (; i < 2; ++i) {
enums[i].next_geq(candidate);
if (enums[i].docid() != candidate) {
candidate = enums[i].docid();
i = 0;
break;
}
}
if (i == 2) {
out[results] = candidate;
++results;
enums[0].next();
candidate = enums[0].docid();
i = 1;
}
}
return results;
}
template <typename Index>
void perftest(const char* index_filename) {
using namespace ds2i;
Index index;
logger() << "Loading index from " << index_filename << std::endl;
boost::iostreams::mapped_file_source m(index_filename);
succinct::mapper::map(index, m);
std::vector<term_id_vec> queries;
term_id_vec q;
while (read_query(q)) {
assert(q.size() == 2);
queries.push_back(q);
}
uint32_t num_queries = queries.size();
logger() << "Executing " << num_queries << " pair-wise intersections..."
<< std::endl;
uint64_t num_docs = index.num_docs();
std::vector<uint32_t> out(num_docs);
double total_usecs = 0.0;
// first run if for warming up
static const int runs = 10 + 1;
size_t total = 0;
typedef typename Index::document_enumerator enum_type;
std::vector<enum_type> qq;
qq.reserve(2);
for (int run = 0; run != runs; ++run) {
double start = get_time_usecs();
for (uint32_t i = 0; i != num_queries; ++i) {
qq.clear();
for (auto term : queries[i]) {
qq.push_back(index[term]);
}
uint64_t size = intersect(num_docs, qq, out);
total += size;
}
double end = get_time_usecs();
double elapsed = end - start;
if (run) {
total_usecs += elapsed;
}
}
// for debug
std::cout << total << std::endl;
printf(
"\t %d intersections took %lf [musecs] (avg. among %d "
"runs)\n",
num_queries, total_usecs / (runs - 1), runs - 1);
printf(
"\t %lf [musecs] per intersection (avg. among %d "
"queries)\n",
total_usecs / (runs - 1) / num_queries, num_queries);
}
int main(int argc, const char** argv) {
using namespace ds2i;
int mandatory = 3;
if (argc < mandatory) {
std::cerr << argv[0] << " <index_type> <index_filename> < query_log"
<< std::endl;
return 1;
}
std::string index_type = argv[1];
const char* index_filename = argv[2];
if (false) {
#define LOOP_BODY(R, DATA, T) \
} \
else if (index_type == BOOST_PP_STRINGIZE(T)) { \
perftest<BOOST_PP_CAT(T, _index)>(index_filename); \
/**/
BOOST_PP_SEQ_FOR_EACH(LOOP_BODY, _, DS2I_INDEX_TYPES);
#undef LOOP_BODY
} else {
logger() << "ERROR: Unknown index type " << index_type << std::endl;
}
return 0;
}
| 4,006 | 1,425 |
// Copyright Carl Philipp Reh 2009 - 2017.
// Copyright Philipp Middendorf 2009 - 2017.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef FCPPT_MATH_CLAMP_HPP_INCLUDED
#define FCPPT_MATH_CLAMP_HPP_INCLUDED
#include <fcppt/optional/make_if.hpp>
#include <fcppt/optional/object_impl.hpp>
#include <fcppt/config/external_begin.hpp>
#include <algorithm>
#include <fcppt/config/external_end.hpp>
namespace fcppt::math
{
/**
\brief Clamps a value into a range.
\ingroup fcpptmath
*/
template <typename T>
fcppt::optional::object<T> clamp(T const &_value, T const &_vmin, T const &_vmax)
{
return fcppt::optional::make_if(
_vmin <= _vmax,
[&_value, &_vmin, &_vmax] { return std::max(std::min(_value, _vmax), _vmin); });
}
}
#endif
| 887 | 366 |
bool bValue = true;
if (!bValue)
cout << "The if statement was true" << endl;
else
cout << "The if statement was false" << endl; | 136 | 43 |
#include <bits/stdc++.h>
#define ll long long
#define int long long
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define all(a) (a).begin(),(a).end()
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define endl '\n'
#define hell 1000000007
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std;
bool dfs(int s,vector<vi>&adj,vector<bool>&vis,vi &color,int par){
if (par == -1)color[s] = 0;
else color[s] = 1 - color[par];
vis[s] = true;
rep(i,0,sz(adj[s])){
if (adj[s][i] == par)continue;
if (vis[adj[s][i]]){
if (color[adj[s][i]] == color[s])return false;
else continue;
}
else{
if (!dfs(adj[s][i],adj,vis,color,s))return false;
}
}
//write here
return true;
}
int32_t main(){
cin.tie(NULL);
ios::sync_with_stdio(false);
//insert code
int n,m;
cin>>n>>m;
vector<vector<int>>adj(n);
vector<bool>vis(n,false);
vector<int>color(n,-1);
int u,v;
rep(i,0,m){
cin>>u>>v;
u--;v--;
adj[u].pb(v);
adj[v].pb(u);
}
rep(i,0,n){
if (!vis[i]){
if (!dfs(i,adj,vis,color,-1)){
cout<<"IMPOSSIBLE"<<endl;
return 0;
}
}
}
rep(i,0,n)cout<<color[i]+1<<" ";
return 0;
} | 1,343 | 638 |
/*********************************************************************
*
* Software License Agreement (BSD License)
*
* Copyright (c) 2008, Willow Garage, 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:
*
* * 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 Willow Garage 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.
*
* Author: Eitan Marder-Eppstein
*********************************************************************/
#include <upo_navigation/trajectory_planner.h>
#include <costmap_2d/footprint.h>
#include <string>
#include <sstream>
#include <math.h>
#include <angles/angles.h>
#include <boost/algorithm/string.hpp>
#include <ros/console.h>
//for computing path distance
#include <queue>
using namespace std;
using namespace costmap_2d;
namespace upo_nav{
void TrajectoryPlanner::reconfigure(BaseLocalPlannerConfig &cfg)
{
BaseLocalPlannerConfig config(cfg);
boost::mutex::scoped_lock l(configuration_mutex_);
acc_lim_x_ = config.acc_lim_x;
acc_lim_y_ = config.acc_lim_y;
acc_lim_theta_ = config.acc_lim_theta;
max_vel_x_ = config.max_vel_x;
min_vel_x_ = config.min_vel_x;
max_vel_th_ = config.max_vel_theta;
min_vel_th_ = config.min_vel_theta;
min_in_place_vel_th_ = config.min_in_place_vel_theta;
sim_time_ = config.sim_time;
sim_granularity_ = config.sim_granularity;
angular_sim_granularity_ = config.angular_sim_granularity;
pdist_scale_ = config.pdist_scale;
gdist_scale_ = config.gdist_scale;
occdist_scale_ = config.occdist_scale;
if (meter_scoring_) {
//if we use meter scoring, then we want to multiply the biases by the resolution of the costmap
double resolution = costmap_.getResolution();
gdist_scale_ *= resolution;
pdist_scale_ *= resolution;
occdist_scale_ *= resolution;
}
oscillation_reset_dist_ = config.oscillation_reset_dist;
escape_reset_dist_ = config.escape_reset_dist;
escape_reset_theta_ = config.escape_reset_theta;
vx_samples_ = config.vx_samples;
vtheta_samples_ = config.vtheta_samples;
if (vx_samples_ <= 0) {
config.vx_samples = 1;
vx_samples_ = config.vx_samples;
ROS_WARN("You've specified that you don't want any samples in the x dimension. We'll at least assume that you want to sample one value... so we're going to set vx_samples to 1 instead");
}
if(vtheta_samples_ <= 0) {
config.vtheta_samples = 1;
vtheta_samples_ = config.vtheta_samples;
ROS_WARN("You've specified that you don't want any samples in the theta dimension. We'll at least assume that you want to sample one value... so we're going to set vtheta_samples to 1 instead");
}
heading_lookahead_ = config.heading_lookahead;
holonomic_robot_ = config.holonomic_robot;
backup_vel_ = config.escape_vel;
dwa_ = config.dwa;
heading_scoring_ = config.heading_scoring;
heading_scoring_timestep_ = config.heading_scoring_timestep;
simple_attractor_ = config.simple_attractor;
//y-vels
string y_string = config.y_vels;
vector<string> y_strs;
boost::split(y_strs, y_string, boost::is_any_of(", "), boost::token_compress_on);
vector<double>y_vels;
for(vector<string>::iterator it=y_strs.begin(); it != y_strs.end(); ++it) {
istringstream iss(*it);
double temp;
iss >> temp;
y_vels.push_back(temp);
//ROS_INFO("Adding y_vel: %e", temp);
}
y_vels_ = y_vels;
}
TrajectoryPlanner::TrajectoryPlanner(WorldModel& world_model,
const Costmap2D& costmap,
std::vector<geometry_msgs::Point> footprint_spec,
double acc_lim_x, double acc_lim_y, double acc_lim_theta,
double sim_time, double sim_granularity,
int vx_samples, int vtheta_samples,
double pdist_scale, double gdist_scale, double occdist_scale,
double heading_lookahead, double oscillation_reset_dist,
double escape_reset_dist, double escape_reset_theta,
bool holonomic_robot,
double max_vel_x, double min_vel_x,
double max_vel_th, double min_vel_th, double min_in_place_vel_th,
double backup_vel,
bool dwa, bool heading_scoring, double heading_scoring_timestep, bool meter_scoring, bool simple_attractor,
vector<double> y_vels, double stop_time_buffer, double sim_period, double angular_sim_granularity)
: path_map_(costmap.getSizeInCellsX(), costmap.getSizeInCellsY()),
goal_map_(costmap.getSizeInCellsX(), costmap.getSizeInCellsY()),
costmap_(costmap),
world_model_(world_model), footprint_spec_(footprint_spec),
sim_time_(sim_time), sim_granularity_(sim_granularity), angular_sim_granularity_(angular_sim_granularity),
vx_samples_(vx_samples), vtheta_samples_(vtheta_samples),
pdist_scale_(pdist_scale), gdist_scale_(gdist_scale), occdist_scale_(occdist_scale),
acc_lim_x_(acc_lim_x), acc_lim_y_(acc_lim_y), acc_lim_theta_(acc_lim_theta),
prev_x_(0), prev_y_(0), escape_x_(0), escape_y_(0), escape_theta_(0), heading_lookahead_(heading_lookahead),
oscillation_reset_dist_(oscillation_reset_dist), escape_reset_dist_(escape_reset_dist),
escape_reset_theta_(escape_reset_theta), holonomic_robot_(holonomic_robot),
max_vel_x_(max_vel_x), min_vel_x_(min_vel_x),
max_vel_th_(max_vel_th), min_vel_th_(min_vel_th), min_in_place_vel_th_(min_in_place_vel_th),
backup_vel_(backup_vel),
dwa_(dwa), heading_scoring_(heading_scoring), heading_scoring_timestep_(heading_scoring_timestep),
simple_attractor_(simple_attractor), y_vels_(y_vels), stop_time_buffer_(stop_time_buffer), sim_period_(sim_period)
{
//the robot is not stuck to begin with
stuck_left = false;
stuck_right = false;
stuck_left_strafe = false;
stuck_right_strafe = false;
rotating_left = false;
rotating_right = false;
strafe_left = false;
strafe_right = false;
escaping_ = false;
final_goal_position_valid_ = false;
costmap_2d::calculateMinAndMaxDistances(footprint_spec_, inscribed_radius_, circumscribed_radius_);
}
TrajectoryPlanner::~TrajectoryPlanner(){}
bool TrajectoryPlanner::getCellCosts(int cx, int cy, float &path_cost, float &goal_cost, float &occ_cost, float &total_cost) {
MapCell cell = path_map_(cx, cy);
MapCell goal_cell = goal_map_(cx, cy);
if (cell.within_robot) {
return false;
}
occ_cost = costmap_.getCost(cx, cy);
if (cell.target_dist == path_map_.obstacleCosts() ||
cell.target_dist == path_map_.unreachableCellCosts() ||
occ_cost >= costmap_2d::INSCRIBED_INFLATED_OBSTACLE) {
return false;
}
path_cost = cell.target_dist;
goal_cost = goal_cell.target_dist;
total_cost = pdist_scale_ * path_cost + gdist_scale_ * goal_cost + occdist_scale_ * occ_cost;
return true;
}
/**
* create and score a trajectory given the current pose of the robot and selected velocities
*/
void TrajectoryPlanner::generateTrajectory(
double x, double y, double theta,
double vx, double vy, double vtheta,
double vx_samp, double vy_samp, double vtheta_samp,
double acc_x, double acc_y, double acc_theta,
double impossible_cost,
Trajectory& traj) {
// make sure the configuration doesn't change mid run
boost::mutex::scoped_lock l(configuration_mutex_);
double x_i = x;
double y_i = y;
double theta_i = theta;
double vx_i, vy_i, vtheta_i;
vx_i = vx;
vy_i = vy;
vtheta_i = vtheta;
//compute the magnitude of the velocities
double vmag = hypot(vx_samp, vy_samp);
//compute the number of steps we must take along this trajectory to be "safe"
int num_steps;
if(!heading_scoring_) {
num_steps = int(max((vmag * sim_time_) / sim_granularity_, fabs(vtheta_samp) / angular_sim_granularity_) + 0.5);
} else {
num_steps = int(sim_time_ / sim_granularity_ + 0.5);
}
//we at least want to take one step... even if we won't move, we want to score our current position
if(num_steps == 0) {
num_steps = 1;
}
double dt = sim_time_ / num_steps;
double time = 0.0;
//create a potential trajectory
traj.resetPoints();
traj.xv_ = vx_samp;
traj.yv_ = vy_samp;
traj.thetav_ = vtheta_samp;
traj.cost_ = -1.0;
//initialize the costs for the trajectory
double path_dist = 0.0;
double goal_dist = 0.0;
double occ_cost = 0.0;
double heading_diff = 0.0;
for(int i = 0; i < num_steps; ++i){
//get map coordinates of a point
unsigned int cell_x, cell_y;
//we don't want a path that goes off the know map
if(!costmap_.worldToMap(x_i, y_i, cell_x, cell_y)){
traj.cost_ = -1.0;
return;
}
//check the point on the trajectory for legality
double footprint_cost = footprintCost(x_i, y_i, theta_i);
//if the footprint hits an obstacle this trajectory is invalid
if(footprint_cost < 0){
traj.cost_ = -1.0;
return;
//TODO: Really look at getMaxSpeedToStopInTime... dues to discretization errors and high acceleration limits,
//it can actually cause the robot to hit obstacles. There may be something to be done to fix, but I'll have to
//come back to it when I have time. Right now, pulling it out as it'll just make the robot a bit more conservative,
//but safe.
/*
double max_vel_x, max_vel_y, max_vel_th;
//we want to compute the max allowable speeds to be able to stop
//to be safe... we'll make sure we can stop some time before we actually hit
getMaxSpeedToStopInTime(time - stop_time_buffer_ - dt, max_vel_x, max_vel_y, max_vel_th);
//check if we can stop in time
if(fabs(vx_samp) < max_vel_x && fabs(vy_samp) < max_vel_y && fabs(vtheta_samp) < max_vel_th){
ROS_ERROR("v: (%.2f, %.2f, %.2f), m: (%.2f, %.2f, %.2f) t:%.2f, st: %.2f, dt: %.2f", vx_samp, vy_samp, vtheta_samp, max_vel_x, max_vel_y, max_vel_th, time, stop_time_buffer_, dt);
//if we can stop... we'll just break out of the loop here.. no point in checking future points
break;
}
else{
traj.cost_ = -1.0;
return;
}
*/
}
occ_cost = std::max(std::max(occ_cost, footprint_cost), double(costmap_.getCost(cell_x, cell_y)));
//do we want to follow blindly
if (simple_attractor_) {
goal_dist = (x_i - global_plan_[global_plan_.size() -1].pose.position.x) *
(x_i - global_plan_[global_plan_.size() -1].pose.position.x) +
(y_i - global_plan_[global_plan_.size() -1].pose.position.y) *
(y_i - global_plan_[global_plan_.size() -1].pose.position.y);
} else {
bool update_path_and_goal_distances = true;
// with heading scoring, we take into account heading diff, and also only score
// path and goal distance for one point of the trajectory
if (heading_scoring_) {
if (time >= heading_scoring_timestep_ && time < heading_scoring_timestep_ + dt) {
heading_diff = headingDiff(cell_x, cell_y, x_i, y_i, theta_i);
} else {
update_path_and_goal_distances = false;
}
}
if (update_path_and_goal_distances) {
//update path and goal distances
path_dist = path_map_(cell_x, cell_y).target_dist;
goal_dist = goal_map_(cell_x, cell_y).target_dist;
//if a point on this trajectory has no clear path to goal it is invalid
if(impossible_cost <= goal_dist || impossible_cost <= path_dist){
// ROS_DEBUG("No path to goal with goal distance = %f, path_distance = %f and max cost = %f",
// goal_dist, path_dist, impossible_cost);
traj.cost_ = -2.0;
return;
}
}
}
//the point is legal... add it to the trajectory
traj.addPoint(x_i, y_i, theta_i);
//calculate velocities
vx_i = computeNewVelocity(vx_samp, vx_i, acc_x, dt);
vy_i = computeNewVelocity(vy_samp, vy_i, acc_y, dt);
vtheta_i = computeNewVelocity(vtheta_samp, vtheta_i, acc_theta, dt);
//calculate positions
x_i = computeNewXPosition(x_i, vx_i, vy_i, theta_i, dt);
y_i = computeNewYPosition(y_i, vx_i, vy_i, theta_i, dt);
theta_i = computeNewThetaPosition(theta_i, vtheta_i, dt);
//increment time
time += dt;
} // end for i < numsteps
//ROS_INFO("OccCost: %f, vx: %.2f, vy: %.2f, vtheta: %.2f", occ_cost, vx_samp, vy_samp, vtheta_samp);
double cost = -1.0;
if (!heading_scoring_) {
cost = pdist_scale_ * path_dist + goal_dist * gdist_scale_ + occdist_scale_ * occ_cost;
} else {
cost = occdist_scale_ * occ_cost + pdist_scale_ * path_dist + 0.3 * heading_diff + goal_dist * gdist_scale_;
}
traj.cost_ = cost;
}
double TrajectoryPlanner::headingDiff(int cell_x, int cell_y, double x, double y, double heading){
double heading_diff = DBL_MAX;
unsigned int goal_cell_x, goal_cell_y;
const double v2_x = cos(heading);
const double v2_y = sin(heading);
//find a clear line of sight from the robot's cell to a point on the path
for (int i = global_plan_.size() - 1; i >=0; --i) {
if (costmap_.worldToMap(global_plan_[i].pose.position.x, global_plan_[i].pose.position.y, goal_cell_x, goal_cell_y)) {
if (lineCost(cell_x, goal_cell_x, cell_y, goal_cell_y) >= 0) {
double gx, gy;
costmap_.mapToWorld(goal_cell_x, goal_cell_y, gx, gy);
double v1_x = gx - x;
double v1_y = gy - y;
double perp_dot = v1_x * v2_y - v1_y * v2_x;
double dot = v1_x * v2_x + v1_y * v2_y;
//get the signed angle
double vector_angle = atan2(perp_dot, dot);
heading_diff = fabs(vector_angle);
return heading_diff;
}
}
}
return heading_diff;
}
//calculate the cost of a ray-traced line
double TrajectoryPlanner::lineCost(int x0, int x1,
int y0, int y1){
//Bresenham Ray-Tracing
int deltax = abs(x1 - x0); // The difference between the x's
int deltay = abs(y1 - y0); // The difference between the y's
int x = x0; // Start x off at the first pixel
int y = y0; // Start y off at the first pixel
int xinc1, xinc2, yinc1, yinc2;
int den, num, numadd, numpixels;
double line_cost = 0.0;
double point_cost = -1.0;
if (x1 >= x0) // The x-values are increasing
{
xinc1 = 1;
xinc2 = 1;
}
else // The x-values are decreasing
{
xinc1 = -1;
xinc2 = -1;
}
if (y1 >= y0) // The y-values are increasing
{
yinc1 = 1;
yinc2 = 1;
}
else // The y-values are decreasing
{
yinc1 = -1;
yinc2 = -1;
}
if (deltax >= deltay) // There is at least one x-value for every y-value
{
xinc1 = 0; // Don't change the x when numerator >= denominator
yinc2 = 0; // Don't change the y for every iteration
den = deltax;
num = deltax / 2;
numadd = deltay;
numpixels = deltax; // There are more x-values than y-values
} else { // There is at least one y-value for every x-value
xinc2 = 0; // Don't change the x for every iteration
yinc1 = 0; // Don't change the y when numerator >= denominator
den = deltay;
num = deltay / 2;
numadd = deltax;
numpixels = deltay; // There are more y-values than x-values
}
for (int curpixel = 0; curpixel <= numpixels; curpixel++) {
point_cost = pointCost(x, y); //Score the current point
if (point_cost < 0) {
return -1;
}
if (line_cost < point_cost) {
line_cost = point_cost;
}
num += numadd; // Increase the numerator by the top of the fraction
if (num >= den) { // Check if numerator >= denominator
num -= den; // Calculate the new numerator value
x += xinc1; // Change the x as appropriate
y += yinc1; // Change the y as appropriate
}
x += xinc2; // Change the x as appropriate
y += yinc2; // Change the y as appropriate
}
return line_cost;
}
double TrajectoryPlanner::pointCost(int x, int y){
unsigned char cost = costmap_.getCost(x, y);
//if the cell is in an obstacle the path is invalid
if(cost == LETHAL_OBSTACLE || cost == INSCRIBED_INFLATED_OBSTACLE || cost == NO_INFORMATION){
return -1;
}
return cost;
}
void TrajectoryPlanner::updatePlan(const vector<geometry_msgs::PoseStamped>& new_plan, bool compute_dists){
global_plan_.resize(new_plan.size());
for(unsigned int i = 0; i < new_plan.size(); ++i){
global_plan_[i] = new_plan[i];
}
if( global_plan_.size() > 0 ){
geometry_msgs::PoseStamped& final_goal_pose = global_plan_[ global_plan_.size() - 1 ];
final_goal_x_ = final_goal_pose.pose.position.x;
final_goal_y_ = final_goal_pose.pose.position.y;
final_goal_position_valid_ = true;
} else {
final_goal_position_valid_ = false;
}
if (compute_dists) {
//reset the map for new operations
path_map_.resetPathDist();
goal_map_.resetPathDist();
//make sure that we update our path based on the global plan and compute costs
path_map_.setTargetCells(costmap_, global_plan_);
goal_map_.setLocalGoal(costmap_, global_plan_);
ROS_DEBUG("Path/Goal distance computed");
}
}
bool TrajectoryPlanner::checkTrajectory(double x, double y, double theta, double vx, double vy,
double vtheta, double vx_samp, double vy_samp, double vtheta_samp){
Trajectory t;
double cost = scoreTrajectory(x, y, theta, vx, vy, vtheta, vx_samp, vy_samp, vtheta_samp);
//if the trajectory is a legal one... the check passes
if(cost >= 0) {
return true;
}
ROS_WARN("Invalid Trajectory %f, %f, %f, cost: %f", vx_samp, vy_samp, vtheta_samp, cost);
//otherwise the check fails
return false;
}
double TrajectoryPlanner::scoreTrajectory(double x, double y, double theta, double vx, double vy,
double vtheta, double vx_samp, double vy_samp, double vtheta_samp) {
Trajectory t;
double impossible_cost = path_map_.obstacleCosts();
generateTrajectory(x, y, theta,
vx, vy, vtheta,
vx_samp, vy_samp, vtheta_samp,
acc_lim_x_, acc_lim_y_, acc_lim_theta_,
impossible_cost, t);
// return the cost.
return double( t.cost_ );
}
/*
* create the trajectories we wish to score
*/
Trajectory TrajectoryPlanner::createTrajectories(double x, double y, double theta,
double vx, double vy, double vtheta,
double acc_x, double acc_y, double acc_theta) {
//compute feasible velocity limits in robot space
double max_vel_x = max_vel_x_, max_vel_theta;
double min_vel_x, min_vel_theta;
if( final_goal_position_valid_ ){
double final_goal_dist = hypot( final_goal_x_ - x, final_goal_y_ - y );
max_vel_x = min( max_vel_x, final_goal_dist / sim_time_ );
}
//should we use the dynamic window approach?
if (dwa_) {
max_vel_x = max(min(max_vel_x, vx + acc_x * sim_period_), min_vel_x_);
min_vel_x = max(min_vel_x_, vx - acc_x * sim_period_);
max_vel_theta = min(max_vel_th_, vtheta + acc_theta * sim_period_);
min_vel_theta = max(min_vel_th_, vtheta - acc_theta * sim_period_);
} else {
max_vel_x = max(min(max_vel_x, vx + acc_x * sim_time_), min_vel_x_);
min_vel_x = max(min_vel_x_, vx - acc_x * sim_time_);
max_vel_theta = min(max_vel_th_, vtheta + acc_theta * sim_time_);
min_vel_theta = max(min_vel_th_, vtheta - acc_theta * sim_time_);
}
//we want to sample the velocity space regularly
double dvx = (max_vel_x - min_vel_x) / (vx_samples_ - 1);
double dvtheta = (max_vel_theta - min_vel_theta) / (vtheta_samples_ - 1);
double vx_samp = min_vel_x;
double vtheta_samp = min_vel_theta;
double vy_samp = 0.0;
//keep track of the best trajectory seen so far
Trajectory* best_traj = &traj_one;
best_traj->cost_ = -1.0;
Trajectory* comp_traj = &traj_two;
comp_traj->cost_ = -1.0;
Trajectory* swap = NULL;
//any cell with a cost greater than the size of the map is impossible
double impossible_cost = path_map_.obstacleCosts();
//if we're performing an escape we won't allow moving forward
if (!escaping_) {
//loop through all x velocities
for(int i = 0; i < vx_samples_; ++i) {
vtheta_samp = 0;
//first sample the straight trajectory
generateTrajectory(x, y, theta, vx, vy, vtheta, vx_samp, vy_samp, vtheta_samp,
acc_x, acc_y, acc_theta, impossible_cost, *comp_traj);
//if the new trajectory is better... let's take it
if(comp_traj->cost_ >= 0 && (comp_traj->cost_ < best_traj->cost_ || best_traj->cost_ < 0)){
swap = best_traj;
best_traj = comp_traj;
comp_traj = swap;
}
vtheta_samp = min_vel_theta;
//next sample all theta trajectories
for(int j = 0; j < vtheta_samples_ - 1; ++j){
generateTrajectory(x, y, theta, vx, vy, vtheta, vx_samp, vy_samp, vtheta_samp,
acc_x, acc_y, acc_theta, impossible_cost, *comp_traj);
//if the new trajectory is better... let's take it
if(comp_traj->cost_ >= 0 && (comp_traj->cost_ < best_traj->cost_ || best_traj->cost_ < 0)){
swap = best_traj;
best_traj = comp_traj;
comp_traj = swap;
}
vtheta_samp += dvtheta;
}
vx_samp += dvx;
}
//only explore y velocities with holonomic robots
if (holonomic_robot_) {
//explore trajectories that move forward but also strafe slightly
vx_samp = 0.1;
vy_samp = 0.1;
vtheta_samp = 0.0;
generateTrajectory(x, y, theta, vx, vy, vtheta, vx_samp, vy_samp, vtheta_samp,
acc_x, acc_y, acc_theta, impossible_cost, *comp_traj);
//if the new trajectory is better... let's take it
if(comp_traj->cost_ >= 0 && (comp_traj->cost_ < best_traj->cost_ || best_traj->cost_ < 0)){
swap = best_traj;
best_traj = comp_traj;
comp_traj = swap;
}
vx_samp = 0.1;
vy_samp = -0.1;
vtheta_samp = 0.0;
generateTrajectory(x, y, theta, vx, vy, vtheta, vx_samp, vy_samp, vtheta_samp,
acc_x, acc_y, acc_theta, impossible_cost, *comp_traj);
//if the new trajectory is better... let's take it
if(comp_traj->cost_ >= 0 && (comp_traj->cost_ < best_traj->cost_ || best_traj->cost_ < 0)){
swap = best_traj;
best_traj = comp_traj;
comp_traj = swap;
}
}
} // end if not escaping
//next we want to generate trajectories for rotating in place
vtheta_samp = min_vel_theta;
vx_samp = 0.0;
vy_samp = 0.0;
//let's try to rotate toward open space
double heading_dist = DBL_MAX;
for(int i = 0; i < vtheta_samples_; ++i) {
//enforce a minimum rotational velocity because the base can't handle small in-place rotations
double vtheta_samp_limited = vtheta_samp > 0 ? max(vtheta_samp, min_in_place_vel_th_)
: min(vtheta_samp, -1.0 * min_in_place_vel_th_);
generateTrajectory(x, y, theta, vx, vy, vtheta, vx_samp, vy_samp, vtheta_samp_limited,
acc_x, acc_y, acc_theta, impossible_cost, *comp_traj);
//if the new trajectory is better... let's take it...
//note if we can legally rotate in place we prefer to do that rather than move with y velocity
if(comp_traj->cost_ >= 0
&& (comp_traj->cost_ <= best_traj->cost_ || best_traj->cost_ < 0 || best_traj->yv_ != 0.0)
&& (vtheta_samp > dvtheta || vtheta_samp < -1 * dvtheta)){
double x_r, y_r, th_r;
comp_traj->getEndpoint(x_r, y_r, th_r);
x_r += heading_lookahead_ * cos(th_r);
y_r += heading_lookahead_ * sin(th_r);
unsigned int cell_x, cell_y;
//make sure that we'll be looking at a legal cell
if (costmap_.worldToMap(x_r, y_r, cell_x, cell_y)) {
double ahead_gdist = goal_map_(cell_x, cell_y).target_dist;
if (ahead_gdist < heading_dist) {
//if we haven't already tried rotating left since we've moved forward
if (vtheta_samp < 0 && !stuck_left) {
swap = best_traj;
best_traj = comp_traj;
comp_traj = swap;
heading_dist = ahead_gdist;
}
//if we haven't already tried rotating right since we've moved forward
else if(vtheta_samp > 0 && !stuck_right) {
swap = best_traj;
best_traj = comp_traj;
comp_traj = swap;
heading_dist = ahead_gdist;
}
}
}
}
vtheta_samp += dvtheta;
}
//do we have a legal trajectory
if (best_traj->cost_ >= 0) {
// avoid oscillations of in place rotation and in place strafing
if ( ! (best_traj->xv_ > 0)) {
if (best_traj->thetav_ < 0) {
if (rotating_right) {
stuck_right = true;
}
rotating_left = true;
} else if (best_traj->thetav_ > 0) {
if (rotating_left){
stuck_left = true;
}
rotating_right = true;
} else if(best_traj->yv_ > 0) {
if (strafe_right) {
stuck_right_strafe = true;
}
strafe_left = true;
} else if(best_traj->yv_ < 0){
if (strafe_left) {
stuck_left_strafe = true;
}
strafe_right = true;
}
//set the position we must move a certain distance away from
prev_x_ = x;
prev_y_ = y;
}
double dist = hypot(x - prev_x_, y - prev_y_);
if (dist > oscillation_reset_dist_) {
rotating_left = false;
rotating_right = false;
strafe_left = false;
strafe_right = false;
stuck_left = false;
stuck_right = false;
stuck_left_strafe = false;
stuck_right_strafe = false;
}
dist = hypot(x - escape_x_, y - escape_y_);
if(dist > escape_reset_dist_ ||
fabs(angles::shortest_angular_distance(escape_theta_, theta)) > escape_reset_theta_){
escaping_ = false;
}
return *best_traj;
}
//only explore y velocities with holonomic robots
if (holonomic_robot_) {
//if we can't rotate in place or move forward... maybe we can move sideways and rotate
vtheta_samp = min_vel_theta;
vx_samp = 0.0;
//loop through all y velocities
for(unsigned int i = 0; i < y_vels_.size(); ++i){
vtheta_samp = 0;
vy_samp = y_vels_[i];
//sample completely horizontal trajectories
generateTrajectory(x, y, theta, vx, vy, vtheta, vx_samp, vy_samp, vtheta_samp,
acc_x, acc_y, acc_theta, impossible_cost, *comp_traj);
//if the new trajectory is better... let's take it
if(comp_traj->cost_ >= 0 && (comp_traj->cost_ <= best_traj->cost_ || best_traj->cost_ < 0)){
double x_r, y_r, th_r;
comp_traj->getEndpoint(x_r, y_r, th_r);
x_r += heading_lookahead_ * cos(th_r);
y_r += heading_lookahead_ * sin(th_r);
unsigned int cell_x, cell_y;
//make sure that we'll be looking at a legal cell
if(costmap_.worldToMap(x_r, y_r, cell_x, cell_y)) {
double ahead_gdist = goal_map_(cell_x, cell_y).target_dist;
if (ahead_gdist < heading_dist) {
//if we haven't already tried strafing left since we've moved forward
if (vy_samp > 0 && !stuck_left_strafe) {
swap = best_traj;
best_traj = comp_traj;
comp_traj = swap;
heading_dist = ahead_gdist;
}
//if we haven't already tried rotating right since we've moved forward
else if(vy_samp < 0 && !stuck_right_strafe) {
swap = best_traj;
best_traj = comp_traj;
comp_traj = swap;
heading_dist = ahead_gdist;
}
}
}
}
}
}
//do we have a legal trajectory
if (best_traj->cost_ >= 0) {
if (!(best_traj->xv_ > 0)) {
if (best_traj->thetav_ < 0) {
if (rotating_right){
stuck_right = true;
}
rotating_left = true;
} else if(best_traj->thetav_ > 0) {
if(rotating_left){
stuck_left = true;
}
rotating_right = true;
} else if(best_traj->yv_ > 0) {
if(strafe_right){
stuck_right_strafe = true;
}
strafe_left = true;
} else if(best_traj->yv_ < 0) {
if(strafe_left){
stuck_left_strafe = true;
}
strafe_right = true;
}
//set the position we must move a certain distance away from
prev_x_ = x;
prev_y_ = y;
}
double dist = hypot(x - prev_x_, y - prev_y_);
if(dist > oscillation_reset_dist_) {
rotating_left = false;
rotating_right = false;
strafe_left = false;
strafe_right = false;
stuck_left = false;
stuck_right = false;
stuck_left_strafe = false;
stuck_right_strafe = false;
}
dist = hypot(x - escape_x_, y - escape_y_);
if(dist > escape_reset_dist_ || fabs(angles::shortest_angular_distance(escape_theta_, theta)) > escape_reset_theta_) {
escaping_ = false;
}
return *best_traj;
}
//and finally, if we can't do anything else, we want to generate trajectories that move backwards slowly
vtheta_samp = 0.0;
vx_samp = backup_vel_;
vy_samp = 0.0;
generateTrajectory(x, y, theta, vx, vy, vtheta, vx_samp, vy_samp, vtheta_samp,
acc_x, acc_y, acc_theta, impossible_cost, *comp_traj);
//if the new trajectory is better... let's take it
/*
if(comp_traj->cost_ >= 0 && (comp_traj->cost_ < best_traj->cost_ || best_traj->cost_ < 0)){
swap = best_traj;
best_traj = comp_traj;
comp_traj = swap;
}
*/
//we'll allow moving backwards slowly even when the static map shows it as blocked
swap = best_traj;
best_traj = comp_traj;
comp_traj = swap;
double dist = hypot(x - prev_x_, y - prev_y_);
if (dist > oscillation_reset_dist_) {
rotating_left = false;
rotating_right = false;
strafe_left = false;
strafe_right = false;
stuck_left = false;
stuck_right = false;
stuck_left_strafe = false;
stuck_right_strafe = false;
}
//only enter escape mode when the planner has given a valid goal point
if (!escaping_ && best_traj->cost_ > -2.0) {
escape_x_ = x;
escape_y_ = y;
escape_theta_ = theta;
escaping_ = true;
}
dist = hypot(x - escape_x_, y - escape_y_);
if (dist > escape_reset_dist_ ||
fabs(angles::shortest_angular_distance(escape_theta_, theta)) > escape_reset_theta_) {
escaping_ = false;
}
//---Comented by NoΓ© ---------------------------------
//if the trajectory failed because the footprint hits something, we're still going to back up
//if(best_traj->cost_ == -1.0)
// best_traj->cost_ = 1.0;
//--NoΓ©-- Add to remove the scaping behavior------------
//escaping_ = false;
//------------------------------------------------------
return *best_traj;
}
//given the current state of the robot, find a good trajectory
Trajectory TrajectoryPlanner::findBestPath(tf::Stamped<tf::Pose> global_pose, tf::Stamped<tf::Pose> global_vel,
tf::Stamped<tf::Pose>& drive_velocities){
Eigen::Vector3f pos(global_pose.getOrigin().getX(), global_pose.getOrigin().getY(), tf::getYaw(global_pose.getRotation()));
Eigen::Vector3f vel(global_vel.getOrigin().getX(), global_vel.getOrigin().getY(), tf::getYaw(global_vel.getRotation()));
//reset the map for new operations
path_map_.resetPathDist();
goal_map_.resetPathDist();
//temporarily remove obstacles that are within the footprint of the robot
std::vector<upo_navigation::Position2DInt> footprint_list =
footprint_helper_.getFootprintCells(
pos,
footprint_spec_,
costmap_,
true);
//mark cells within the initial footprint of the robot
for (unsigned int i = 0; i < footprint_list.size(); ++i) {
path_map_(footprint_list[i].x, footprint_list[i].y).within_robot = true;
}
//make sure that we update our path based on the global plan and compute costs
path_map_.setTargetCells(costmap_, global_plan_);
goal_map_.setLocalGoal(costmap_, global_plan_);
ROS_DEBUG("Path/Goal distance computed");
//rollout trajectories and find the minimum cost one
Trajectory best = createTrajectories(pos[0], pos[1], pos[2],
vel[0], vel[1], vel[2],
acc_lim_x_, acc_lim_y_, acc_lim_theta_);
ROS_DEBUG("Trajectories created");
/*
//If we want to print a ppm file to draw goal dist
char buf[4096];
sprintf(buf, "base_local_planner.ppm");
FILE *fp = fopen(buf, "w");
if(fp){
fprintf(fp, "P3\n");
fprintf(fp, "%d %d\n", map_.size_x_, map_.size_y_);
fprintf(fp, "255\n");
for(int j = map_.size_y_ - 1; j >= 0; --j){
for(unsigned int i = 0; i < map_.size_x_; ++i){
int g_dist = 255 - int(map_(i, j).goal_dist);
int p_dist = 255 - int(map_(i, j).path_dist);
if(g_dist < 0)
g_dist = 0;
if(p_dist < 0)
p_dist = 0;
fprintf(fp, "%d 0 %d ", g_dist, 0);
}
fprintf(fp, "\n");
}
fclose(fp);
}
*/
if(best.cost_ < 0){
drive_velocities.setIdentity();
}
else{
tf::Vector3 start(best.xv_, best.yv_, 0);
drive_velocities.setOrigin(start);
tf::Matrix3x3 matrix;
matrix.setRotation(tf::createQuaternionFromYaw(best.thetav_));
drive_velocities.setBasis(matrix);
}
return best;
}
//we need to take the footprint of the robot into account when we calculate cost to obstacles
double TrajectoryPlanner::footprintCost(double x_i, double y_i, double theta_i){
//check if the footprint is legal
return world_model_.footprintCost(x_i, y_i, theta_i, footprint_spec_, inscribed_radius_, circumscribed_radius_);
}
void TrajectoryPlanner::getLocalGoal(double& x, double& y){
x = path_map_.goal_x_;
y = path_map_.goal_y_;
}
};
| 36,711 | 12,825 |
// Copyright 2020 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/updater/app/app.h"
#include <utility>
#include "base/bind.h"
#include "base/callback.h"
#include "base/message_loop/message_pump_type.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_executor.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/threading/thread_restrictions.h"
namespace updater {
constexpr base::StringPiece App::kThreadPoolName;
App::App() = default;
App::~App() = default;
void App::InitializeThreadPool() {
base::ThreadPoolInstance::CreateAndStartWithDefaultParams(kThreadPoolName);
}
int App::Run() {
InitializeThreadPool();
base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI);
Initialize();
int exit_code = 0;
{
base::ScopedDisallowBlocking no_blocking_allowed_on_ui_thread;
base::RunLoop runloop;
quit_ = base::BindOnce(
[](base::OnceClosure quit, int* exit_code_out, int exit_code) {
*exit_code_out = exit_code;
std::move(quit).Run();
},
runloop.QuitWhenIdleClosure(), &exit_code);
FirstTaskRun();
runloop.Run();
}
Uninitialize();
// Shutting down the thread pool involves joining threads.
base::ThreadPoolInstance::Get()->Shutdown();
return exit_code;
}
void App::Shutdown(int exit_code) {
std::move(quit_).Run(exit_code);
}
} // namespace updater
| 1,522 | 520 |
#include <imageview/internal/ImageViewIterator.h>
#include <imageview/pixel_formats/PixelFormatRGB24.h>
#include <gtest/gtest.h>
namespace imageview {
namespace {
// Sample flat image used in several tests.
constexpr std::size_t kSampleNumPixels = 6;
constexpr std::array<std::byte, kSampleNumPixels * PixelFormatRGB24::kBytesPerPixel> kSampleData{
std::byte{0}, std::byte{1}, std::byte{2},
std::byte{3}, std::byte{4}, std::byte{5},
std::byte{6}, std::byte{7}, std::byte{8},
std::byte{9}, std::byte{10}, std::byte{11},
std::byte{12}, std::byte{13}, std::byte{14},
std::byte{15}, std::byte{16}, std::byte{17}
};
using ConstIteratorRGB24 = detail::ImageViewIterator<PixelFormatRGB24, false>;
constexpr PixelFormatRGB24 kSamplePixelFormat;
constexpr ConstIteratorRGB24 kSampleImageBegin(kSampleData.data(), kSamplePixelFormat);
constexpr ConstIteratorRGB24 kSampleImageEnd(kSampleData.data() + kSampleData.size(), kSamplePixelFormat);
TEST(ImageViewIterator, Dereference) {
static_assert(*kSampleImageBegin == RGB24(0, 1, 2), "Must be {0, 1, 2}.");
}
TEST(ImageViewIterator, PreIncrement) {
ConstIteratorRGB24 iter = kSampleImageBegin;
static_assert(std::is_same_v<decltype(++iter), ConstIteratorRGB24&>, "Must be ConstIteratorRGB24&");
ConstIteratorRGB24& iter2 = ++iter;
// iter2 must be a reference to iter.
EXPECT_EQ(std::addressof(iter2), std::addressof(iter));
// The resulting iterator must point to pixel[1].
EXPECT_EQ(*iter, RGB24(3, 4, 5));
}
TEST(ImageViewIterator, PostIncrement) {
ConstIteratorRGB24 iter = kSampleImageBegin;
static_assert(std::is_same_v<decltype(iter++), ConstIteratorRGB24>, "Must be ConstIteratorRGB24");
ConstIteratorRGB24 iter2 = iter++;
// iter2 must point to pixel[0].
EXPECT_EQ(*iter2, RGB24(0, 1, 2));
// iter must point to pixel[1].
EXPECT_EQ(*iter, RGB24(3, 4, 5));
}
TEST(ImageViewIterator, NonConst) {
using IteratorRGB24 = detail::ImageViewIterator<PixelFormatRGB24, true>;
constexpr std::size_t kNumPixels = 6;
constexpr PixelFormatRGB24 kPixelFormat;
std::array<std::byte, kNumPixels * PixelFormatRGB24::kBytesPerPixel> data{};
IteratorRGB24 iter(data.data(), kPixelFormat);
*iter = RGB24{13, 181, 254};
EXPECT_EQ(data[0], std::byte{13});
EXPECT_EQ(data[1], std::byte{181});
EXPECT_EQ(data[2], std::byte{254});
}
} // namespace
} // namespace imageview
| 2,386 | 908 |
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int i, n, a; // Π¨Π΅ΡΠ΅Π½Π³Π°
cout << "ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΠ΅Π½ΠΈΠΊΠΎΠ² = ";
cin >> n;
cout << "ΡΠΎΡΡ ΠΠ΅ΡΠΈ = ";
cin >> a;
int *arr = new int [n];
for (i = 0; i < n; i++)
{
cout << "ΡΠΎΡΡ ΡΡΠ΅Π½ΠΈΠΊΠ°[" << i << "]= ";
cin >> arr[i];
}
for (i = n - 1; i >= 0; i--)
{
if (a <= arr[i]) {
cout << i + 1; // ΠΌΠ΅ΡΡΠΎ ΠΠ΅ΡΠΈ Π² ΡΠ΅ΡΠ΅Π½Π³Π΅, Π΅ΡΠ»ΠΈ ΡΠΎΡΡ ΡΡΠ΅Π½ΠΈΠΊΠΎΠ² ΠΎΠ΄ΠΈΠ½Π°ΠΊΠΎΠ²ΡΠΉ, ΡΠΎ ΠΎΠ½ Π²ΡΡΠ°ΡΡ Π·Π° Π½ΠΈΠΌΠΈ
break;
}
}
} | 608 | 214 |
#include <stdio.h>
#include <iostream>
using namespace std;
struct KDListNode
{
KDListNode *nextNode;
int nodeValue;
};
KDListNode *KDlist()
{
KDListNode *listHead = NULL;
KDListNode *node = NULL;
KDListNode *prenode = NULL;
for (int i = 0; i < 5; ++i)
{
node = (KDListNode *)malloc(sizeof(KDListNode));
node->nodeValue = i;
node->nextNode = NULL;
if (i == 0)
{
listHead = node;
}
if (i != 0)
{
prenode->nextNode = node;
}
prenode = node;
}
return listHead;
}
//第ε
ι’ εεΊζε°ιΎθ‘¨
void KDPrintListReverse(KDListNode *list)
{
if (list == NULL)
return;
if (list->nextNode != NULL)
{
KDPrintListReverse(list->nextNode);
}
printf("%d\n",list->nodeValue);
}
int main()
{
KDListNode *list = KDlist();
// for (int i = 0; i < 5; ++i)
// {
// printf("%d\n",list->nodeValue);
// list = list->nextNode;
// }
KDPrintListReverse(list);
} | 893 | 425 |
/**
* Projectiles
*/
#ifndef _PROJECTILE_HPP_INCLUDED_
#define _PROJECTILE_HPP_INCLUDED_
#include "euclidean2/math/vec3.hpp"
//extern
static constexpr float GRAVITY = -9.8f;
struct projectile_t
{
vec3_t position;
vec3_t velocity;
material_t mat;
};
/**
* Create a projectile
*/
void projectile_create(float x, float y, float z, float pitch, float yaw, float power);
void projectile_create(float x, float y, float z, float pitch, float vx, float vz, float power);
/**
* Update a projectile
*/
void projectile_update(float dt);
/**
* Draw a projectile
*/
void projectile_draw();
#endif
| 634 | 252 |
/*******************************************************************************
* Copyright 2020 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
*
*
* SPDX-License-Identifier: Apache-2.0
*******************************************************************************/
#include "oneapi/mkl/blas/detail/blas_loader.hpp"
#include "function_table_initializer.hpp"
#include "blas/function_table.hpp"
namespace oneapi {
namespace mkl {
namespace blas {
namespace column_major {
namespace detail {
static oneapi::mkl::detail::table_initializer<domain::blas, blas_function_table_t> function_tables;
// Buffer APIs
void asum(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<float, 1> &result) {
function_tables[libkey].column_major_scasum_sycl(queue, n, x, incx, result);
}
void asum(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<double, 1> &result) {
function_tables[libkey].column_major_dzasum_sycl(queue, n, x, incx, result);
}
void asum(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, cl::sycl::buffer<float, 1> &result) {
function_tables[libkey].column_major_sasum_sycl(queue, n, x, incx, result);
}
void asum(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, cl::sycl::buffer<double, 1> &result) {
function_tables[libkey].column_major_dasum_sycl(queue, n, x, incx, result);
}
void axpy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, float alpha,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, cl::sycl::buffer<float, 1> &y,
std::int64_t incy) {
function_tables[libkey].column_major_saxpy_sycl(queue, n, alpha, x, incx, y, incy);
}
void axpy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, double alpha,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, cl::sycl::buffer<double, 1> &y,
std::int64_t incy) {
function_tables[libkey].column_major_daxpy_sycl(queue, n, alpha, x, incx, y, incy);
}
void axpy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy) {
function_tables[libkey].column_major_caxpy_sycl(queue, n, alpha, x, incx, y, incy);
}
void axpy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &x,
std::int64_t incx, cl::sycl::buffer<std::complex<double>, 1> &y, std::int64_t incy) {
function_tables[libkey].column_major_zaxpy_sycl(queue, n, alpha, x, incx, y, incy);
}
void copy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, cl::sycl::buffer<float, 1> &y,
std::int64_t incy) {
function_tables[libkey].column_major_scopy_sycl(queue, n, x, incx, y, incy);
}
void copy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, cl::sycl::buffer<double, 1> &y,
std::int64_t incy) {
function_tables[libkey].column_major_dcopy_sycl(queue, n, x, incx, y, incy);
}
void copy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy) {
function_tables[libkey].column_major_ccopy_sycl(queue, n, x, incx, y, incy);
}
void copy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<double>, 1> &y, std::int64_t incy) {
function_tables[libkey].column_major_zcopy_sycl(queue, n, x, incx, y, incy);
}
void dot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, cl::sycl::buffer<float, 1> &y,
std::int64_t incy, cl::sycl::buffer<float, 1> &result) {
function_tables[libkey].column_major_sdot_sycl(queue, n, x, incx, y, incy, result);
}
void dot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, cl::sycl::buffer<double, 1> &y,
std::int64_t incy, cl::sycl::buffer<double, 1> &result) {
function_tables[libkey].column_major_ddot_sycl(queue, n, x, incx, y, incy, result);
}
void dot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, cl::sycl::buffer<float, 1> &y,
std::int64_t incy, cl::sycl::buffer<double, 1> &result) {
function_tables[libkey].column_major_dsdot_sycl(queue, n, x, incx, y, incy, result);
}
void dotc(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<float>, 1> &result) {
function_tables[libkey].column_major_cdotc_sycl(queue, n, x, incx, y, incy, result);
}
void dotc(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<double>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<double>, 1> &result) {
function_tables[libkey].column_major_zdotc_sycl(queue, n, x, incx, y, incy, result);
}
void dotu(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<float>, 1> &result) {
function_tables[libkey].column_major_cdotu_sycl(queue, n, x, incx, y, incy, result);
}
void dotu(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<double>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<double>, 1> &result) {
function_tables[libkey].column_major_zdotu_sycl(queue, n, x, incx, y, incy, result);
}
void iamin(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<float, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::int64_t, 1> &result) {
function_tables[libkey].column_major_isamin_sycl(queue, n, x, incx, result);
}
void iamin(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<double, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::int64_t, 1> &result) {
function_tables[libkey].column_major_idamin_sycl(queue, n, x, incx, result);
}
void iamin(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::int64_t, 1> &result) {
function_tables[libkey].column_major_icamin_sycl(queue, n, x, incx, result);
}
void iamin(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::int64_t, 1> &result) {
function_tables[libkey].column_major_izamin_sycl(queue, n, x, incx, result);
}
void iamax(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<float, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::int64_t, 1> &result) {
function_tables[libkey].column_major_isamax_sycl(queue, n, x, incx, result);
}
void iamax(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<double, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::int64_t, 1> &result) {
function_tables[libkey].column_major_idamax_sycl(queue, n, x, incx, result);
}
void iamax(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::int64_t, 1> &result) {
function_tables[libkey].column_major_icamax_sycl(queue, n, x, incx, result);
}
void iamax(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::int64_t, 1> &result) {
function_tables[libkey].column_major_izamax_sycl(queue, n, x, incx, result);
}
void nrm2(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<float, 1> &result) {
function_tables[libkey].column_major_scnrm2_sycl(queue, n, x, incx, result);
}
void nrm2(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<double, 1> &result) {
function_tables[libkey].column_major_dznrm2_sycl(queue, n, x, incx, result);
}
void nrm2(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, cl::sycl::buffer<float, 1> &result) {
function_tables[libkey].column_major_snrm2_sycl(queue, n, x, incx, result);
}
void nrm2(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, cl::sycl::buffer<double, 1> &result) {
function_tables[libkey].column_major_dnrm2_sycl(queue, n, x, incx, result);
}
void rot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy, float c, float s) {
function_tables[libkey].column_major_srot_sycl(queue, n, x, incx, y, incy, c, s);
}
void rot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<double>, 1> &y, std::int64_t incy, double c, double s) {
function_tables[libkey].column_major_drot_sycl(queue, n, x, incx, y, incy, c, s);
}
void rot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, cl::sycl::buffer<float, 1> &y,
std::int64_t incy, float c, float s) {
function_tables[libkey].column_major_csrot_sycl(queue, n, x, incx, y, incy, c, s);
}
void rot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, cl::sycl::buffer<double, 1> &y,
std::int64_t incy, double c, double s) {
function_tables[libkey].column_major_zdrot_sycl(queue, n, x, incx, y, incy, c, s);
}
void rotg(oneapi::mkl::device libkey, cl::sycl::queue &queue, cl::sycl::buffer<float, 1> &a,
cl::sycl::buffer<float, 1> &b, cl::sycl::buffer<float, 1> &c,
cl::sycl::buffer<float, 1> &s) {
function_tables[libkey].column_major_srotg_sycl(queue, a, b, c, s);
}
void rotg(oneapi::mkl::device libkey, cl::sycl::queue &queue, cl::sycl::buffer<double, 1> &a,
cl::sycl::buffer<double, 1> &b, cl::sycl::buffer<double, 1> &c,
cl::sycl::buffer<double, 1> &s) {
function_tables[libkey].column_major_drotg_sycl(queue, a, b, c, s);
}
void rotg(oneapi::mkl::device libkey, cl::sycl::queue &queue,
cl::sycl::buffer<std::complex<float>, 1> &a, cl::sycl::buffer<std::complex<float>, 1> &b,
cl::sycl::buffer<float, 1> &c, cl::sycl::buffer<std::complex<float>, 1> &s) {
function_tables[libkey].column_major_crotg_sycl(queue, a, b, c, s);
}
void rotg(oneapi::mkl::device libkey, cl::sycl::queue &queue,
cl::sycl::buffer<std::complex<double>, 1> &a,
cl::sycl::buffer<std::complex<double>, 1> &b, cl::sycl::buffer<double, 1> &c,
cl::sycl::buffer<std::complex<double>, 1> &s) {
function_tables[libkey].column_major_zrotg_sycl(queue, a, b, c, s);
}
void rotm(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, cl::sycl::buffer<float, 1> &y,
std::int64_t incy, cl::sycl::buffer<float, 1> ¶m) {
function_tables[libkey].column_major_srotm_sycl(queue, n, x, incx, y, incy, param);
}
void rotm(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, cl::sycl::buffer<double, 1> &y,
std::int64_t incy, cl::sycl::buffer<double, 1> ¶m) {
function_tables[libkey].column_major_drotm_sycl(queue, n, x, incx, y, incy, param);
}
void rotmg(oneapi::mkl::device libkey, cl::sycl::queue &queue, cl::sycl::buffer<float, 1> &d1,
cl::sycl::buffer<float, 1> &d2, cl::sycl::buffer<float, 1> &x1, float y1,
cl::sycl::buffer<float, 1> ¶m) {
function_tables[libkey].column_major_srotmg_sycl(queue, d1, d2, x1, y1, param);
}
void rotmg(oneapi::mkl::device libkey, cl::sycl::queue &queue, cl::sycl::buffer<double, 1> &d1,
cl::sycl::buffer<double, 1> &d2, cl::sycl::buffer<double, 1> &x1, double y1,
cl::sycl::buffer<double, 1> ¶m) {
function_tables[libkey].column_major_drotmg_sycl(queue, d1, d2, x1, y1, param);
}
void scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, float alpha,
cl::sycl::buffer<float, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_sscal_sycl(queue, n, alpha, x, incx);
}
void scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, double alpha,
cl::sycl::buffer<double, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_dscal_sycl(queue, n, alpha, x, incx);
}
void scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &x,
std::int64_t incx) {
function_tables[libkey].column_major_cscal_sycl(queue, n, alpha, x, incx);
}
void scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &x,
std::int64_t incx) {
function_tables[libkey].column_major_csscal_sycl(queue, n, alpha, x, incx);
}
void scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, float alpha,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_zscal_sycl(queue, n, alpha, x, incx);
}
void scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, double alpha,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_zdscal_sycl(queue, n, alpha, x, incx);
}
void sdsdot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, float sb,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, cl::sycl::buffer<float, 1> &y,
std::int64_t incy, cl::sycl::buffer<float, 1> &result) {
function_tables[libkey].column_major_sdsdot_sycl(queue, n, sb, x, incx, y, incy, result);
}
void swap(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, cl::sycl::buffer<float, 1> &y,
std::int64_t incy) {
function_tables[libkey].column_major_sswap_sycl(queue, n, x, incx, y, incy);
}
void swap(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, cl::sycl::buffer<double, 1> &y,
std::int64_t incy) {
function_tables[libkey].column_major_dswap_sycl(queue, n, x, incx, y, incy);
}
void swap(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy) {
function_tables[libkey].column_major_cswap_sycl(queue, n, x, incx, y, incy);
}
void swap(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<double>, 1> &y, std::int64_t incy) {
function_tables[libkey].column_major_zswap_sycl(queue, n, x, incx, y, incy);
}
void gbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans, std::int64_t m,
std::int64_t n, std::int64_t kl, std::int64_t ku, float alpha,
cl::sycl::buffer<float, 1> &a, std::int64_t lda, cl::sycl::buffer<float, 1> &x,
std::int64_t incx, float beta, cl::sycl::buffer<float, 1> &y, std::int64_t incy) {
function_tables[libkey].column_major_sgbmv_sycl(queue, trans, m, n, kl, ku, alpha, a, lda, x,
incx, beta, y, incy);
}
void gbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans, std::int64_t m,
std::int64_t n, std::int64_t kl, std::int64_t ku, double alpha,
cl::sycl::buffer<double, 1> &a, std::int64_t lda, cl::sycl::buffer<double, 1> &x,
std::int64_t incx, double beta, cl::sycl::buffer<double, 1> &y, std::int64_t incy) {
function_tables[libkey].column_major_dgbmv_sycl(queue, trans, m, n, kl, ku, alpha, a, lda, x,
incx, beta, y, incy);
}
void gbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans, std::int64_t m,
std::int64_t n, std::int64_t kl, std::int64_t ku, std::complex<float> alpha,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx, std::complex<float> beta,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy) {
function_tables[libkey].column_major_cgbmv_sycl(queue, trans, m, n, kl, ku, alpha, a, lda, x,
incx, beta, y, incy);
}
void gbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans, std::int64_t m,
std::int64_t n, std::int64_t kl, std::int64_t ku, std::complex<double> alpha,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
std::complex<double> beta, cl::sycl::buffer<std::complex<double>, 1> &y,
std::int64_t incy) {
function_tables[libkey].column_major_zgbmv_sycl(queue, trans, m, n, kl, ku, alpha, a, lda, x,
incx, beta, y, incy);
}
void gemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans, std::int64_t m,
std::int64_t n, float alpha, cl::sycl::buffer<float, 1> &a, std::int64_t lda,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, float beta,
cl::sycl::buffer<float, 1> &y, std::int64_t incy) {
function_tables[libkey].column_major_sgemv_sycl(queue, trans, m, n, alpha, a, lda, x, incx,
beta, y, incy);
}
void gemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans, std::int64_t m,
std::int64_t n, double alpha, cl::sycl::buffer<double, 1> &a, std::int64_t lda,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, double beta,
cl::sycl::buffer<double, 1> &y, std::int64_t incy) {
function_tables[libkey].column_major_dgemv_sycl(queue, trans, m, n, alpha, a, lda, x, incx,
beta, y, incy);
}
void gemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans, std::int64_t m,
std::int64_t n, std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
std::complex<float> beta, cl::sycl::buffer<std::complex<float>, 1> &y,
std::int64_t incy) {
function_tables[libkey].column_major_cgemv_sycl(queue, trans, m, n, alpha, a, lda, x, incx,
beta, y, incy);
}
void gemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans, std::int64_t m,
std::int64_t n, std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
std::complex<double> beta, cl::sycl::buffer<std::complex<double>, 1> &y,
std::int64_t incy) {
function_tables[libkey].column_major_zgemv_sycl(queue, trans, m, n, alpha, a, lda, x, incx,
beta, y, incy);
}
void ger(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m, std::int64_t n,
float alpha, cl::sycl::buffer<float, 1> &x, std::int64_t incx,
cl::sycl::buffer<float, 1> &y, std::int64_t incy, cl::sycl::buffer<float, 1> &a,
std::int64_t lda) {
function_tables[libkey].column_major_sger_sycl(queue, m, n, alpha, x, incx, y, incy, a, lda);
}
void ger(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m, std::int64_t n,
double alpha, cl::sycl::buffer<double, 1> &x, std::int64_t incx,
cl::sycl::buffer<double, 1> &y, std::int64_t incy, cl::sycl::buffer<double, 1> &a,
std::int64_t lda) {
function_tables[libkey].column_major_dger_sycl(queue, m, n, alpha, x, incx, y, incy, a, lda);
}
void gerc(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda) {
function_tables[libkey].column_major_cgerc_sycl(queue, m, n, alpha, x, incx, y, incy, a, lda);
}
void gerc(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &x,
std::int64_t incx, cl::sycl::buffer<std::complex<double>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda) {
function_tables[libkey].column_major_zgerc_sycl(queue, m, n, alpha, x, incx, y, incy, a, lda);
}
void geru(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda) {
function_tables[libkey].column_major_cgeru_sycl(queue, m, n, alpha, x, incx, y, incy, a, lda);
}
void geru(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &x,
std::int64_t incx, cl::sycl::buffer<std::complex<double>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda) {
function_tables[libkey].column_major_zgeru_sycl(queue, m, n, alpha, x, incx, y, incy, a, lda);
}
void hbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::int64_t k, std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
std::complex<float> beta, cl::sycl::buffer<std::complex<float>, 1> &y,
std::int64_t incy) {
function_tables[libkey].column_major_chbmv_sycl(queue, upper_lower, n, k, alpha, a, lda, x,
incx, beta, y, incy);
}
void hbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::int64_t k, std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
std::complex<double> beta, cl::sycl::buffer<std::complex<double>, 1> &y,
std::int64_t incy) {
function_tables[libkey].column_major_zhbmv_sycl(queue, upper_lower, n, k, alpha, a, lda, x,
incx, beta, y, incy);
}
void hemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx, std::complex<float> beta,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy) {
function_tables[libkey].column_major_chemv_sycl(queue, upper_lower, n, alpha, a, lda, x, incx,
beta, y, incy);
}
void hemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
std::complex<double> beta, cl::sycl::buffer<std::complex<double>, 1> &y,
std::int64_t incy) {
function_tables[libkey].column_major_zhemv_sycl(queue, upper_lower, n, alpha, a, lda, x, incx,
beta, y, incy);
}
void her(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
float alpha, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda) {
function_tables[libkey].column_major_cher_sycl(queue, upper_lower, n, alpha, x, incx, a, lda);
}
void her(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
double alpha, cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda) {
function_tables[libkey].column_major_zher_sycl(queue, upper_lower, n, alpha, x, incx, a, lda);
}
void her2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda) {
function_tables[libkey].column_major_cher2_sycl(queue, upper_lower, n, alpha, x, incx, y, incy,
a, lda);
}
void her2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &x,
std::int64_t incx, cl::sycl::buffer<std::complex<double>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda) {
function_tables[libkey].column_major_zher2_sycl(queue, upper_lower, n, alpha, x, incx, y, incy,
a, lda);
}
void hpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &a,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx, std::complex<float> beta,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy) {
function_tables[libkey].column_major_chpmv_sycl(queue, upper_lower, n, alpha, a, x, incx, beta,
y, incy);
}
void hpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &a,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
std::complex<double> beta, cl::sycl::buffer<std::complex<double>, 1> &y,
std::int64_t incy) {
function_tables[libkey].column_major_zhpmv_sycl(queue, upper_lower, n, alpha, a, x, incx, beta,
y, incy);
}
void hpr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
float alpha, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &a) {
function_tables[libkey].column_major_chpr_sycl(queue, upper_lower, n, alpha, x, incx, a);
}
void hpr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
double alpha, cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<double>, 1> &a) {
function_tables[libkey].column_major_zhpr_sycl(queue, upper_lower, n, alpha, x, incx, a);
}
void hpr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<float>, 1> &a) {
function_tables[libkey].column_major_chpr2_sycl(queue, upper_lower, n, alpha, x, incx, y, incy,
a);
}
void hpr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &x,
std::int64_t incx, cl::sycl::buffer<std::complex<double>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<double>, 1> &a) {
function_tables[libkey].column_major_zhpr2_sycl(queue, upper_lower, n, alpha, x, incx, y, incy,
a);
}
void sbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::int64_t k, float alpha, cl::sycl::buffer<float, 1> &a, std::int64_t lda,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, float beta,
cl::sycl::buffer<float, 1> &y, std::int64_t incy) {
function_tables[libkey].column_major_ssbmv_sycl(queue, upper_lower, n, k, alpha, a, lda, x,
incx, beta, y, incy);
}
void sbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::int64_t k, double alpha, cl::sycl::buffer<double, 1> &a, std::int64_t lda,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, double beta,
cl::sycl::buffer<double, 1> &y, std::int64_t incy) {
function_tables[libkey].column_major_dsbmv_sycl(queue, upper_lower, n, k, alpha, a, lda, x,
incx, beta, y, incy);
}
void spmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
float alpha, cl::sycl::buffer<float, 1> &a, cl::sycl::buffer<float, 1> &x,
std::int64_t incx, float beta, cl::sycl::buffer<float, 1> &y, std::int64_t incy) {
function_tables[libkey].column_major_sspmv_sycl(queue, upper_lower, n, alpha, a, x, incx, beta,
y, incy);
}
void spmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
double alpha, cl::sycl::buffer<double, 1> &a, cl::sycl::buffer<double, 1> &x,
std::int64_t incx, double beta, cl::sycl::buffer<double, 1> &y, std::int64_t incy) {
function_tables[libkey].column_major_dspmv_sycl(queue, upper_lower, n, alpha, a, x, incx, beta,
y, incy);
}
void spr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
float alpha, cl::sycl::buffer<float, 1> &x, std::int64_t incx,
cl::sycl::buffer<float, 1> &a) {
function_tables[libkey].column_major_sspr_sycl(queue, upper_lower, n, alpha, x, incx, a);
}
void spr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
double alpha, cl::sycl::buffer<double, 1> &x, std::int64_t incx,
cl::sycl::buffer<double, 1> &a) {
function_tables[libkey].column_major_dspr_sycl(queue, upper_lower, n, alpha, x, incx, a);
}
void spr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
float alpha, cl::sycl::buffer<float, 1> &x, std::int64_t incx,
cl::sycl::buffer<float, 1> &y, std::int64_t incy, cl::sycl::buffer<float, 1> &a) {
function_tables[libkey].column_major_sspr2_sycl(queue, upper_lower, n, alpha, x, incx, y, incy,
a);
}
void spr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
double alpha, cl::sycl::buffer<double, 1> &x, std::int64_t incx,
cl::sycl::buffer<double, 1> &y, std::int64_t incy, cl::sycl::buffer<double, 1> &a) {
function_tables[libkey].column_major_dspr2_sycl(queue, upper_lower, n, alpha, x, incx, y, incy,
a);
}
void symv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
float alpha, cl::sycl::buffer<float, 1> &a, std::int64_t lda,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, float beta,
cl::sycl::buffer<float, 1> &y, std::int64_t incy) {
function_tables[libkey].column_major_ssymv_sycl(queue, upper_lower, n, alpha, a, lda, x, incx,
beta, y, incy);
}
void symv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
double alpha, cl::sycl::buffer<double, 1> &a, std::int64_t lda,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, double beta,
cl::sycl::buffer<double, 1> &y, std::int64_t incy) {
function_tables[libkey].column_major_dsymv_sycl(queue, upper_lower, n, alpha, a, lda, x, incx,
beta, y, incy);
}
void syr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
float alpha, cl::sycl::buffer<float, 1> &x, std::int64_t incx,
cl::sycl::buffer<float, 1> &a, std::int64_t lda) {
function_tables[libkey].column_major_ssyr_sycl(queue, upper_lower, n, alpha, x, incx, a, lda);
}
void syr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
double alpha, cl::sycl::buffer<double, 1> &x, std::int64_t incx,
cl::sycl::buffer<double, 1> &a, std::int64_t lda) {
function_tables[libkey].column_major_dsyr_sycl(queue, upper_lower, n, alpha, x, incx, a, lda);
}
void syr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
float alpha, cl::sycl::buffer<float, 1> &x, std::int64_t incx,
cl::sycl::buffer<float, 1> &y, std::int64_t incy, cl::sycl::buffer<float, 1> &a,
std::int64_t lda) {
function_tables[libkey].column_major_ssyr2_sycl(queue, upper_lower, n, alpha, x, incx, y, incy,
a, lda);
}
void syr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
double alpha, cl::sycl::buffer<double, 1> &x, std::int64_t incx,
cl::sycl::buffer<double, 1> &y, std::int64_t incy, cl::sycl::buffer<double, 1> &a,
std::int64_t lda) {
function_tables[libkey].column_major_dsyr2_sycl(queue, upper_lower, n, alpha, x, incx, y, incy,
a, lda);
}
void tbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, std::int64_t k, cl::sycl::buffer<float, 1> &a,
std::int64_t lda, cl::sycl::buffer<float, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_stbmv_sycl(queue, upper_lower, trans, unit_diag, n, k, a,
lda, x, incx);
}
void tbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, std::int64_t k, cl::sycl::buffer<double, 1> &a,
std::int64_t lda, cl::sycl::buffer<double, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_dtbmv_sycl(queue, upper_lower, trans, unit_diag, n, k, a,
lda, x, incx);
}
void tbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, std::int64_t k,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_ctbmv_sycl(queue, upper_lower, trans, unit_diag, n, k, a,
lda, x, incx);
}
void tbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, std::int64_t k,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_ztbmv_sycl(queue, upper_lower, trans, unit_diag, n, k, a,
lda, x, incx);
}
void tbsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, std::int64_t k, cl::sycl::buffer<float, 1> &a,
std::int64_t lda, cl::sycl::buffer<float, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_stbsv_sycl(queue, upper_lower, trans, unit_diag, n, k, a,
lda, x, incx);
}
void tbsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, std::int64_t k, cl::sycl::buffer<double, 1> &a,
std::int64_t lda, cl::sycl::buffer<double, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_dtbsv_sycl(queue, upper_lower, trans, unit_diag, n, k, a,
lda, x, incx);
}
void tbsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, std::int64_t k,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_ctbsv_sycl(queue, upper_lower, trans, unit_diag, n, k, a,
lda, x, incx);
}
void tbsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, std::int64_t k,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_ztbsv_sycl(queue, upper_lower, trans, unit_diag, n, k, a,
lda, x, incx);
}
void tpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<float, 1> &a,
cl::sycl::buffer<float, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_stpmv_sycl(queue, upper_lower, trans, unit_diag, n, a, x,
incx);
}
void tpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<double, 1> &a,
cl::sycl::buffer<double, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_dtpmv_sycl(queue, upper_lower, trans, unit_diag, n, a, x,
incx);
}
void tpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<std::complex<float>, 1> &a,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_ctpmv_sycl(queue, upper_lower, trans, unit_diag, n, a, x,
incx);
}
void tpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<std::complex<double>, 1> &a,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_ztpmv_sycl(queue, upper_lower, trans, unit_diag, n, a, x,
incx);
}
void tpsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<float, 1> &a,
cl::sycl::buffer<float, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_stpsv_sycl(queue, upper_lower, trans, unit_diag, n, a, x,
incx);
}
void tpsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<double, 1> &a,
cl::sycl::buffer<double, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_dtpsv_sycl(queue, upper_lower, trans, unit_diag, n, a, x,
incx);
}
void tpsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<std::complex<float>, 1> &a,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_ctpsv_sycl(queue, upper_lower, trans, unit_diag, n, a, x,
incx);
}
void tpsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<std::complex<double>, 1> &a,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_ztpsv_sycl(queue, upper_lower, trans, unit_diag, n, a, x,
incx);
}
void trmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<float, 1> &a, std::int64_t lda,
cl::sycl::buffer<float, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_strmv_sycl(queue, upper_lower, trans, unit_diag, n, a, lda,
x, incx);
}
void trmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<double, 1> &a, std::int64_t lda,
cl::sycl::buffer<double, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_dtrmv_sycl(queue, upper_lower, trans, unit_diag, n, a, lda,
x, incx);
}
void trmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<std::complex<float>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_ctrmv_sycl(queue, upper_lower, trans, unit_diag, n, a, lda,
x, incx);
}
void trmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<std::complex<double>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_ztrmv_sycl(queue, upper_lower, trans, unit_diag, n, a, lda,
x, incx);
}
void trsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<float, 1> &a, std::int64_t lda,
cl::sycl::buffer<float, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_strsv_sycl(queue, upper_lower, trans, unit_diag, n, a, lda,
x, incx);
}
void trsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<double, 1> &a, std::int64_t lda,
cl::sycl::buffer<double, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_dtrsv_sycl(queue, upper_lower, trans, unit_diag, n, a, lda,
x, incx);
}
void trsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<std::complex<float>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_ctrsv_sycl(queue, upper_lower, trans, unit_diag, n, a, lda,
x, incx);
}
void trsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<std::complex<double>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx) {
function_tables[libkey].column_major_ztrsv_sycl(queue, upper_lower, trans, unit_diag, n, a, lda,
x, incx);
}
void gemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa, transpose transb,
std::int64_t m, std::int64_t n, std::int64_t k, float alpha,
cl::sycl::buffer<float, 1> &a, std::int64_t lda, cl::sycl::buffer<float, 1> &b,
std::int64_t ldb, float beta, cl::sycl::buffer<float, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_sgemm_sycl(queue, transa, transb, m, n, k, alpha, a, lda,
b, ldb, beta, c, ldc);
}
void gemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa, transpose transb,
std::int64_t m, std::int64_t n, std::int64_t k, double alpha,
cl::sycl::buffer<double, 1> &a, std::int64_t lda, cl::sycl::buffer<double, 1> &b,
std::int64_t ldb, double beta, cl::sycl::buffer<double, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_dgemm_sycl(queue, transa, transb, m, n, k, alpha, a, lda,
b, ldb, beta, c, ldc);
}
void gemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa, transpose transb,
std::int64_t m, std::int64_t n, std::int64_t k, std::complex<float> alpha,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &b, std::int64_t ldb, std::complex<float> beta,
cl::sycl::buffer<std::complex<float>, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_cgemm_sycl(queue, transa, transb, m, n, k, alpha, a, lda,
b, ldb, beta, c, ldc);
}
void gemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa, transpose transb,
std::int64_t m, std::int64_t n, std::int64_t k, std::complex<double> alpha,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<double>, 1> &b, std::int64_t ldb, std::complex<double> beta,
cl::sycl::buffer<std::complex<double>, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_zgemm_sycl(queue, transa, transb, m, n, k, alpha, a, lda,
b, ldb, beta, c, ldc);
}
void gemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa, transpose transb,
std::int64_t m, std::int64_t n, std::int64_t k, half alpha, cl::sycl::buffer<half, 1> &a,
std::int64_t lda, cl::sycl::buffer<half, 1> &b, std::int64_t ldb, half beta,
cl::sycl::buffer<half, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_hgemm_sycl(queue, transa, transb, m, n, k, alpha, a, lda,
b, ldb, beta, c, ldc);
}
void gemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa, transpose transb,
std::int64_t m, std::int64_t n, std::int64_t k, float alpha, cl::sycl::buffer<half, 1> &a,
std::int64_t lda, cl::sycl::buffer<half, 1> &b, std::int64_t ldb, float beta,
cl::sycl::buffer<float, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_gemm_f16f16f32_sycl(queue, transa, transb, m, n, k, alpha,
a, lda, b, ldb, beta, c, ldc);
}
void hemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
std::int64_t m, std::int64_t n, std::complex<float> alpha,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &b, std::int64_t ldb, std::complex<float> beta,
cl::sycl::buffer<std::complex<float>, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_chemm_sycl(queue, left_right, upper_lower, m, n, alpha, a,
lda, b, ldb, beta, c, ldc);
}
void hemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
std::int64_t m, std::int64_t n, std::complex<double> alpha,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<double>, 1> &b, std::int64_t ldb, std::complex<double> beta,
cl::sycl::buffer<std::complex<double>, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_zhemm_sycl(queue, left_right, upper_lower, m, n, alpha, a,
lda, b, ldb, beta, c, ldc);
}
void herk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, float alpha, cl::sycl::buffer<std::complex<float>, 1> &a,
std::int64_t lda, float beta, cl::sycl::buffer<std::complex<float>, 1> &c,
std::int64_t ldc) {
function_tables[libkey].column_major_cherk_sycl(queue, upper_lower, trans, n, k, alpha, a, lda,
beta, c, ldc);
}
void herk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, double alpha,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda, double beta,
cl::sycl::buffer<std::complex<double>, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_zherk_sycl(queue, upper_lower, trans, n, k, alpha, a, lda,
beta, c, ldc);
}
void her2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, std::complex<float> alpha,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &b, std::int64_t ldb, float beta,
cl::sycl::buffer<std::complex<float>, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_cher2k_sycl(queue, upper_lower, trans, n, k, alpha, a, lda,
b, ldb, beta, c, ldc);
}
void her2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, std::complex<double> alpha,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<double>, 1> &b, std::int64_t ldb, double beta,
cl::sycl::buffer<std::complex<double>, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_zher2k_sycl(queue, upper_lower, trans, n, k, alpha, a, lda,
b, ldb, beta, c, ldc);
}
void symm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
std::int64_t m, std::int64_t n, float alpha, cl::sycl::buffer<float, 1> &a,
std::int64_t lda, cl::sycl::buffer<float, 1> &b, std::int64_t ldb, float beta,
cl::sycl::buffer<float, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_ssymm_sycl(queue, left_right, upper_lower, m, n, alpha, a,
lda, b, ldb, beta, c, ldc);
}
void symm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
std::int64_t m, std::int64_t n, double alpha, cl::sycl::buffer<double, 1> &a,
std::int64_t lda, cl::sycl::buffer<double, 1> &b, std::int64_t ldb, double beta,
cl::sycl::buffer<double, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_dsymm_sycl(queue, left_right, upper_lower, m, n, alpha, a,
lda, b, ldb, beta, c, ldc);
}
void symm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
std::int64_t m, std::int64_t n, std::complex<float> alpha,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &b, std::int64_t ldb, std::complex<float> beta,
cl::sycl::buffer<std::complex<float>, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_csymm_sycl(queue, left_right, upper_lower, m, n, alpha, a,
lda, b, ldb, beta, c, ldc);
}
void symm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
std::int64_t m, std::int64_t n, std::complex<double> alpha,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<double>, 1> &b, std::int64_t ldb, std::complex<double> beta,
cl::sycl::buffer<std::complex<double>, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_zsymm_sycl(queue, left_right, upper_lower, m, n, alpha, a,
lda, b, ldb, beta, c, ldc);
}
void syrk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, float alpha, cl::sycl::buffer<float, 1> &a,
std::int64_t lda, float beta, cl::sycl::buffer<float, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_ssyrk_sycl(queue, upper_lower, trans, n, k, alpha, a, lda,
beta, c, ldc);
}
void syrk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, double alpha, cl::sycl::buffer<double, 1> &a,
std::int64_t lda, double beta, cl::sycl::buffer<double, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_dsyrk_sycl(queue, upper_lower, trans, n, k, alpha, a, lda,
beta, c, ldc);
}
void syrk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, std::complex<float> alpha,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda, std::complex<float> beta,
cl::sycl::buffer<std::complex<float>, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_csyrk_sycl(queue, upper_lower, trans, n, k, alpha, a, lda,
beta, c, ldc);
}
void syrk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, std::complex<double> alpha,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda, std::complex<double> beta,
cl::sycl::buffer<std::complex<double>, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_zsyrk_sycl(queue, upper_lower, trans, n, k, alpha, a, lda,
beta, c, ldc);
}
void syr2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, float alpha, cl::sycl::buffer<float, 1> &a,
std::int64_t lda, cl::sycl::buffer<float, 1> &b, std::int64_t ldb, float beta,
cl::sycl::buffer<float, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_ssyr2k_sycl(queue, upper_lower, trans, n, k, alpha, a, lda,
b, ldb, beta, c, ldc);
}
void syr2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, double alpha, cl::sycl::buffer<double, 1> &a,
std::int64_t lda, cl::sycl::buffer<double, 1> &b, std::int64_t ldb, double beta,
cl::sycl::buffer<double, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_dsyr2k_sycl(queue, upper_lower, trans, n, k, alpha, a, lda,
b, ldb, beta, c, ldc);
}
void syr2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, std::complex<float> alpha,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &b, std::int64_t ldb, std::complex<float> beta,
cl::sycl::buffer<std::complex<float>, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_csyr2k_sycl(queue, upper_lower, trans, n, k, alpha, a, lda,
b, ldb, beta, c, ldc);
}
void syr2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, std::complex<double> alpha,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<double>, 1> &b, std::int64_t ldb,
std::complex<double> beta, cl::sycl::buffer<std::complex<double>, 1> &c,
std::int64_t ldc) {
function_tables[libkey].column_major_zsyr2k_sycl(queue, upper_lower, trans, n, k, alpha, a, lda,
b, ldb, beta, c, ldc);
}
void trmm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t m, std::int64_t n, float alpha,
cl::sycl::buffer<float, 1> &a, std::int64_t lda, cl::sycl::buffer<float, 1> &b,
std::int64_t ldb) {
function_tables[libkey].column_major_strmm_sycl(queue, left_right, upper_lower, trans,
unit_diag, m, n, alpha, a, lda, b, ldb);
}
void trmm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t m, std::int64_t n, double alpha,
cl::sycl::buffer<double, 1> &a, std::int64_t lda, cl::sycl::buffer<double, 1> &b,
std::int64_t ldb) {
function_tables[libkey].column_major_dtrmm_sycl(queue, left_right, upper_lower, trans,
unit_diag, m, n, alpha, a, lda, b, ldb);
}
void trmm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t m, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &b, std::int64_t ldb) {
function_tables[libkey].column_major_ctrmm_sycl(queue, left_right, upper_lower, trans,
unit_diag, m, n, alpha, a, lda, b, ldb);
}
void trmm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t m, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<double>, 1> &b, std::int64_t ldb) {
function_tables[libkey].column_major_ztrmm_sycl(queue, left_right, upper_lower, trans,
unit_diag, m, n, alpha, a, lda, b, ldb);
}
void trsm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t m, std::int64_t n, float alpha,
cl::sycl::buffer<float, 1> &a, std::int64_t lda, cl::sycl::buffer<float, 1> &b,
std::int64_t ldb) {
function_tables[libkey].column_major_strsm_sycl(queue, left_right, upper_lower, trans,
unit_diag, m, n, alpha, a, lda, b, ldb);
}
void trsm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t m, std::int64_t n, double alpha,
cl::sycl::buffer<double, 1> &a, std::int64_t lda, cl::sycl::buffer<double, 1> &b,
std::int64_t ldb) {
function_tables[libkey].column_major_dtrsm_sycl(queue, left_right, upper_lower, trans,
unit_diag, m, n, alpha, a, lda, b, ldb);
}
void trsm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t m, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &b, std::int64_t ldb) {
function_tables[libkey].column_major_ctrsm_sycl(queue, left_right, upper_lower, trans,
unit_diag, m, n, alpha, a, lda, b, ldb);
}
void trsm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t m, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<double>, 1> &b, std::int64_t ldb) {
function_tables[libkey].column_major_ztrsm_sycl(queue, left_right, upper_lower, trans,
unit_diag, m, n, alpha, a, lda, b, ldb);
}
void gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k, float alpha,
cl::sycl::buffer<float, 1> &a, std::int64_t lda, std::int64_t stride_a,
cl::sycl::buffer<float, 1> &b, std::int64_t ldb, std::int64_t stride_b, float beta,
cl::sycl::buffer<float, 1> &c, std::int64_t ldc, std::int64_t stride_c,
std::int64_t batch_size) {
function_tables[libkey].column_major_sgemm_batch_strided_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, stride_a, b, ldb, stride_b, beta, c, ldc,
stride_c, batch_size);
}
void gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k, double alpha,
cl::sycl::buffer<double, 1> &a, std::int64_t lda, std::int64_t stride_a,
cl::sycl::buffer<double, 1> &b, std::int64_t ldb, std::int64_t stride_b,
double beta, cl::sycl::buffer<double, 1> &c, std::int64_t ldc,
std::int64_t stride_c, std::int64_t batch_size) {
function_tables[libkey].column_major_dgemm_batch_strided_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, stride_a, b, ldb, stride_b, beta, c, ldc,
stride_c, batch_size);
}
void gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &a,
std::int64_t lda, std::int64_t stride_a,
cl::sycl::buffer<std::complex<float>, 1> &b, std::int64_t ldb,
std::int64_t stride_b, std::complex<float> beta,
cl::sycl::buffer<std::complex<float>, 1> &c, std::int64_t ldc,
std::int64_t stride_c, std::int64_t batch_size) {
function_tables[libkey].column_major_cgemm_batch_strided_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, stride_a, b, ldb, stride_b, beta, c, ldc,
stride_c, batch_size);
}
void gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &a,
std::int64_t lda, std::int64_t stride_a,
cl::sycl::buffer<std::complex<double>, 1> &b, std::int64_t ldb,
std::int64_t stride_b, std::complex<double> beta,
cl::sycl::buffer<std::complex<double>, 1> &c, std::int64_t ldc,
std::int64_t stride_c, std::int64_t batch_size) {
function_tables[libkey].column_major_zgemm_batch_strided_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, stride_a, b, ldb, stride_b, beta, c, ldc,
stride_c, batch_size);
}
void trsm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m, std::int64_t n,
float alpha, cl::sycl::buffer<float, 1> &a, std::int64_t lda, std::int64_t stride_a,
cl::sycl::buffer<float, 1> &b, std::int64_t ldb, std::int64_t stride_b,
std::int64_t batch_size) {
function_tables[libkey].column_major_strsm_batch_strided_sycl(
queue, left_right, upper_lower, trans, unit_diag, m, n, alpha, a, lda, stride_a, b, ldb,
stride_b, batch_size);
}
void trsm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m, std::int64_t n,
double alpha, cl::sycl::buffer<double, 1> &a, std::int64_t lda,
std::int64_t stride_a, cl::sycl::buffer<double, 1> &b, std::int64_t ldb,
std::int64_t stride_b, std::int64_t batch_size) {
function_tables[libkey].column_major_dtrsm_batch_strided_sycl(
queue, left_right, upper_lower, trans, unit_diag, m, n, alpha, a, lda, stride_a, b, ldb,
stride_b, batch_size);
}
void trsm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &a,
std::int64_t lda, std::int64_t stride_a,
cl::sycl::buffer<std::complex<float>, 1> &b, std::int64_t ldb,
std::int64_t stride_b, std::int64_t batch_size) {
function_tables[libkey].column_major_ctrsm_batch_strided_sycl(
queue, left_right, upper_lower, trans, unit_diag, m, n, alpha, a, lda, stride_a, b, ldb,
stride_b, batch_size);
}
void trsm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &a,
std::int64_t lda, std::int64_t stride_a,
cl::sycl::buffer<std::complex<double>, 1> &b, std::int64_t ldb,
std::int64_t stride_b, std::int64_t batch_size) {
function_tables[libkey].column_major_ztrsm_batch_strided_sycl(
queue, left_right, upper_lower, trans, unit_diag, m, n, alpha, a, lda, stride_a, b, ldb,
stride_b, batch_size);
}
void gemmt(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose transa,
transpose transb, std::int64_t n, std::int64_t k, float alpha,
cl::sycl::buffer<float, 1> &a, std::int64_t lda, cl::sycl::buffer<float, 1> &b,
std::int64_t ldb, float beta, cl::sycl::buffer<float, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_sgemmt_sycl(queue, upper_lower, transa, transb, n, k,
alpha, a, lda, b, ldb, beta, c, ldc);
}
void gemmt(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose transa,
transpose transb, std::int64_t n, std::int64_t k, double alpha,
cl::sycl::buffer<double, 1> &a, std::int64_t lda, cl::sycl::buffer<double, 1> &b,
std::int64_t ldb, double beta, cl::sycl::buffer<double, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_dgemmt_sycl(queue, upper_lower, transa, transb, n, k,
alpha, a, lda, b, ldb, beta, c, ldc);
}
void gemmt(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose transa,
transpose transb, std::int64_t n, std::int64_t k, std::complex<float> alpha,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &b, std::int64_t ldb, std::complex<float> beta,
cl::sycl::buffer<std::complex<float>, 1> &c, std::int64_t ldc) {
function_tables[libkey].column_major_cgemmt_sycl(queue, upper_lower, transa, transb, n, k,
alpha, a, lda, b, ldb, beta, c, ldc);
}
void gemmt(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose transa,
transpose transb, std::int64_t n, std::int64_t k, std::complex<double> alpha,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<double>, 1> &b, std::int64_t ldb,
std::complex<double> beta, cl::sycl::buffer<std::complex<double>, 1> &c,
std::int64_t ldc) {
function_tables[libkey].column_major_zgemmt_sycl(queue, upper_lower, transa, transb, n, k,
alpha, a, lda, b, ldb, beta, c, ldc);
}
void gemm_bias(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, offset offsetc, std::int64_t m, std::int64_t n, std::int64_t k,
float alpha, cl::sycl::buffer<int8_t, 1> &a, std::int64_t lda, int8_t ao,
cl::sycl::buffer<uint8_t, 1> &b, std::int64_t ldb, uint8_t bo, float beta,
cl::sycl::buffer<int32_t, 1> &c, std::int64_t ldc,
cl::sycl::buffer<int32_t, 1> &co) {
function_tables[libkey].column_major_gemm_s8u8s32_bias_sycl(
queue, transa, transb, offsetc, m, n, k, alpha, a, lda, ao, b, ldb, bo, beta, c, ldc, co);
}
// USM APIs
cl::sycl::event asum(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<float> *x, std::int64_t incx, float *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_scasum_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event asum(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<double> *x, std::int64_t incx, double *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dzasum_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event asum(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const float *x, std::int64_t incx, float *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_sasum_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event asum(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const double *x, std::int64_t incx, double *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dasum_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event axpy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
float alpha, const float *x, std::int64_t incx, float *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_saxpy_usm_sycl(queue, n, alpha, x, incx, y, incy,
dependencies);
}
cl::sycl::event axpy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
double alpha, const double *x, std::int64_t incx, double *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_daxpy_usm_sycl(queue, n, alpha, x, incx, y, incy,
dependencies);
}
cl::sycl::event axpy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<float> alpha, const std::complex<float> *x, std::int64_t incx,
std::complex<float> *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_caxpy_usm_sycl(queue, n, alpha, x, incx, y, incy,
dependencies);
}
cl::sycl::event axpy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<double> alpha, const std::complex<double> *x, std::int64_t incx,
std::complex<double> *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zaxpy_usm_sycl(queue, n, alpha, x, incx, y, incy,
dependencies);
}
cl::sycl::event axpy_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t *n,
float *alpha, const float **x, std::int64_t *incx, float **y,
std::int64_t *incy, std::int64_t group_count, std::int64_t *group_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_saxpy_batch_group_usm_sycl(
queue, n, alpha, x, incx, y, incy, group_count, group_size, dependencies);
}
cl::sycl::event axpy_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t *n,
double *alpha, const double **x, std::int64_t *incx, double **y,
std::int64_t *incy, std::int64_t group_count, std::int64_t *group_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_daxpy_batch_group_usm_sycl(
queue, n, alpha, x, incx, y, incy, group_count, group_size, dependencies);
}
cl::sycl::event axpy_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t *n,
std::complex<float> *alpha, const std::complex<float> **x,
std::int64_t *incx, std::complex<float> **y, std::int64_t *incy,
std::int64_t group_count, std::int64_t *group_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_caxpy_batch_group_usm_sycl(
queue, n, alpha, x, incx, y, incy, group_count, group_size, dependencies);
}
cl::sycl::event axpy_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t *n,
std::complex<double> *alpha, const std::complex<double> **x,
std::int64_t *incx, std::complex<double> **y, std::int64_t *incy,
std::int64_t group_count, std::int64_t *group_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zaxpy_batch_group_usm_sycl(
queue, n, alpha, x, incx, y, incy, group_count, group_size, dependencies);
}
cl::sycl::event copy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const float *x, std::int64_t incx, float *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_scopy_usm_sycl(queue, n, x, incx, y, incy,
dependencies);
}
cl::sycl::event copy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const double *x, std::int64_t incx, double *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dcopy_usm_sycl(queue, n, x, incx, y, incy,
dependencies);
}
cl::sycl::event copy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<float> *x, std::int64_t incx, std::complex<float> *y,
std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ccopy_usm_sycl(queue, n, x, incx, y, incy,
dependencies);
}
cl::sycl::event copy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<double> *x, std::int64_t incx, std::complex<double> *y,
std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zcopy_usm_sycl(queue, n, x, incx, y, incy,
dependencies);
}
cl::sycl::event dot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const float *x, std::int64_t incx, const float *y, std::int64_t incy,
float *result, const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_sdot_usm_sycl(queue, n, x, incx, y, incy, result,
dependencies);
}
cl::sycl::event dot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const double *x, std::int64_t incx, const double *y, std::int64_t incy,
double *result, const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ddot_usm_sycl(queue, n, x, incx, y, incy, result,
dependencies);
}
cl::sycl::event dot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const float *x, std::int64_t incx, const float *y, std::int64_t incy,
double *result, const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dsdot_usm_sycl(queue, n, x, incx, y, incy, result,
dependencies);
}
cl::sycl::event dotc(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<float> *x, std::int64_t incx, const std::complex<float> *y,
std::int64_t incy, std::complex<float> *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_cdotc_usm_sycl(queue, n, x, incx, y, incy, result,
dependencies);
}
cl::sycl::event dotc(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<double> *x, std::int64_t incx,
const std::complex<double> *y, std::int64_t incy, std::complex<double> *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zdotc_usm_sycl(queue, n, x, incx, y, incy, result,
dependencies);
}
cl::sycl::event dotu(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<float> *x, std::int64_t incx, const std::complex<float> *y,
std::int64_t incy, std::complex<float> *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_cdotu_usm_sycl(queue, n, x, incx, y, incy, result,
dependencies);
}
cl::sycl::event dotu(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<double> *x, std::int64_t incx,
const std::complex<double> *y, std::int64_t incy, std::complex<double> *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zdotu_usm_sycl(queue, n, x, incx, y, incy, result,
dependencies);
}
cl::sycl::event iamin(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const float *x, std::int64_t incx, std::int64_t *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_isamin_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event iamin(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const double *x, std::int64_t incx, std::int64_t *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_idamin_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event iamin(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<float> *x, std::int64_t incx, std::int64_t *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_icamin_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event iamin(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<double> *x, std::int64_t incx, std::int64_t *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_izamin_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event iamax(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const float *x, std::int64_t incx, std::int64_t *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_isamax_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event iamax(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const double *x, std::int64_t incx, std::int64_t *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_idamax_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event iamax(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<float> *x, std::int64_t incx, std::int64_t *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_icamax_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event iamax(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<double> *x, std::int64_t incx, std::int64_t *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_izamax_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event nrm2(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<float> *x, std::int64_t incx, float *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_scnrm2_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event nrm2(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<double> *x, std::int64_t incx, double *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dznrm2_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event nrm2(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const float *x, std::int64_t incx, float *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_snrm2_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event nrm2(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const double *x, std::int64_t incx, double *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dnrm2_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event rot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<float> *x, std::int64_t incx, std::complex<float> *y,
std::int64_t incy, float c, float s,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_srot_usm_sycl(queue, n, x, incx, y, incy, c, s,
dependencies);
}
cl::sycl::event rot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<double> *x, std::int64_t incx, std::complex<double> *y,
std::int64_t incy, double c, double s,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_drot_usm_sycl(queue, n, x, incx, y, incy, c, s,
dependencies);
}
cl::sycl::event rot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, float *x,
std::int64_t incx, float *y, std::int64_t incy, float c, float s,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_csrot_usm_sycl(queue, n, x, incx, y, incy, c, s,
dependencies);
}
cl::sycl::event rot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, double *x,
std::int64_t incx, double *y, std::int64_t incy, double c, double s,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zdrot_usm_sycl(queue, n, x, incx, y, incy, c, s,
dependencies);
}
cl::sycl::event rotg(oneapi::mkl::device libkey, cl::sycl::queue &queue, float *a, float *b,
float *c, float *s,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_srotg_usm_sycl(queue, a, b, c, s, dependencies);
}
cl::sycl::event rotg(oneapi::mkl::device libkey, cl::sycl::queue &queue, double *a, double *b,
double *c, double *s,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_drotg_usm_sycl(queue, a, b, c, s, dependencies);
}
cl::sycl::event rotg(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::complex<float> *a,
std::complex<float> *b, float *c, std::complex<float> *s,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_crotg_usm_sycl(queue, a, b, c, s, dependencies);
}
cl::sycl::event rotg(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::complex<double> *a,
std::complex<double> *b, double *c, std::complex<double> *s,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zrotg_usm_sycl(queue, a, b, c, s, dependencies);
}
cl::sycl::event rotm(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, float *x,
std::int64_t incx, float *y, std::int64_t incy, float *param,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_srotm_usm_sycl(queue, n, x, incx, y, incy, param,
dependencies);
}
cl::sycl::event rotm(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, double *x,
std::int64_t incx, double *y, std::int64_t incy, double *param,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_drotm_usm_sycl(queue, n, x, incx, y, incy, param,
dependencies);
}
cl::sycl::event rotmg(oneapi::mkl::device libkey, cl::sycl::queue &queue, float *d1, float *d2,
float *x1, float y1, float *param,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_srotmg_usm_sycl(queue, d1, d2, x1, y1, param,
dependencies);
}
cl::sycl::event rotmg(oneapi::mkl::device libkey, cl::sycl::queue &queue, double *d1, double *d2,
double *x1, double y1, double *param,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_drotmg_usm_sycl(queue, d1, d2, x1, y1, param,
dependencies);
}
cl::sycl::event scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
float alpha, float *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_sscal_usm_sycl(queue, n, alpha, x, incx,
dependencies);
}
cl::sycl::event scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
double alpha, double *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dscal_usm_sycl(queue, n, alpha, x, incx,
dependencies);
}
cl::sycl::event scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<float> alpha, std::complex<float> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_cscal_usm_sycl(queue, n, alpha, x, incx,
dependencies);
}
cl::sycl::event scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<double> alpha, std::complex<double> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_csscal_usm_sycl(queue, n, alpha, x, incx,
dependencies);
}
cl::sycl::event scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
float alpha, std::complex<float> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zscal_usm_sycl(queue, n, alpha, x, incx,
dependencies);
}
cl::sycl::event scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
double alpha, std::complex<double> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zdscal_usm_sycl(queue, n, alpha, x, incx,
dependencies);
}
cl::sycl::event sdsdot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, float sb,
const float *x, std::int64_t incx, const float *y, std::int64_t incy,
float *result, const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_sdsdot_usm_sycl(queue, n, sb, x, incx, y, incy,
result, dependencies);
}
cl::sycl::event swap(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, float *x,
std::int64_t incx, float *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_sswap_usm_sycl(queue, n, x, incx, y, incy,
dependencies);
}
cl::sycl::event swap(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, double *x,
std::int64_t incx, double *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dswap_usm_sycl(queue, n, x, incx, y, incy,
dependencies);
}
cl::sycl::event swap(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<float> *x, std::int64_t incx, std::complex<float> *y,
std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_cswap_usm_sycl(queue, n, x, incx, y, incy,
dependencies);
}
cl::sycl::event swap(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<double> *x, std::int64_t incx, std::complex<double> *y,
std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zswap_usm_sycl(queue, n, x, incx, y, incy,
dependencies);
}
cl::sycl::event gbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans,
std::int64_t m, std::int64_t n, std::int64_t kl, std::int64_t ku, float alpha,
const float *a, std::int64_t lda, const float *x, std::int64_t incx,
float beta, float *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_sgbmv_usm_sycl(
queue, trans, m, n, kl, ku, alpha, a, lda, x, incx, beta, y, incy, dependencies);
}
cl::sycl::event gbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans,
std::int64_t m, std::int64_t n, std::int64_t kl, std::int64_t ku, double alpha,
const double *a, std::int64_t lda, const double *x, std::int64_t incx,
double beta, double *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dgbmv_usm_sycl(
queue, trans, m, n, kl, ku, alpha, a, lda, x, incx, beta, y, incy, dependencies);
}
cl::sycl::event gbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans,
std::int64_t m, std::int64_t n, std::int64_t kl, std::int64_t ku,
std::complex<float> alpha, const std::complex<float> *a, std::int64_t lda,
const std::complex<float> *x, std::int64_t incx, std::complex<float> beta,
std::complex<float> *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_cgbmv_usm_sycl(
queue, trans, m, n, kl, ku, alpha, a, lda, x, incx, beta, y, incy, dependencies);
}
cl::sycl::event gbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans,
std::int64_t m, std::int64_t n, std::int64_t kl, std::int64_t ku,
std::complex<double> alpha, const std::complex<double> *a, std::int64_t lda,
const std::complex<double> *x, std::int64_t incx, std::complex<double> beta,
std::complex<double> *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zgbmv_usm_sycl(
queue, trans, m, n, kl, ku, alpha, a, lda, x, incx, beta, y, incy, dependencies);
}
cl::sycl::event gemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans,
std::int64_t m, std::int64_t n, float alpha, const float *a, std::int64_t lda,
const float *x, std::int64_t incx, float beta, float *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_sgemv_usm_sycl(queue, trans, m, n, alpha, a, lda, x,
incx, beta, y, incy, dependencies);
}
cl::sycl::event gemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans,
std::int64_t m, std::int64_t n, double alpha, const double *a,
std::int64_t lda, const double *x, std::int64_t incx, double beta, double *y,
std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dgemv_usm_sycl(queue, trans, m, n, alpha, a, lda, x,
incx, beta, y, incy, dependencies);
}
cl::sycl::event gemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans,
std::int64_t m, std::int64_t n, std::complex<float> alpha,
const std::complex<float> *a, std::int64_t lda, const std::complex<float> *x,
std::int64_t incx, std::complex<float> beta, std::complex<float> *y,
std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_cgemv_usm_sycl(queue, trans, m, n, alpha, a, lda, x,
incx, beta, y, incy, dependencies);
}
cl::sycl::event gemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans,
std::int64_t m, std::int64_t n, std::complex<double> alpha,
const std::complex<double> *a, std::int64_t lda, const std::complex<double> *x,
std::int64_t incx, std::complex<double> beta, std::complex<double> *y,
std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zgemv_usm_sycl(queue, trans, m, n, alpha, a, lda, x,
incx, beta, y, incy, dependencies);
}
cl::sycl::event ger(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m,
std::int64_t n, float alpha, const float *x, std::int64_t incx, const float *y,
std::int64_t incy, float *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_sger_usm_sycl(queue, m, n, alpha, x, incx, y, incy,
a, lda, dependencies);
}
cl::sycl::event ger(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m,
std::int64_t n, double alpha, const double *x, std::int64_t incx,
const double *y, std::int64_t incy, double *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dger_usm_sycl(queue, m, n, alpha, x, incx, y, incy,
a, lda, dependencies);
}
cl::sycl::event gerc(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m,
std::int64_t n, std::complex<float> alpha, const std::complex<float> *x,
std::int64_t incx, const std::complex<float> *y, std::int64_t incy,
std::complex<float> *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_cgerc_usm_sycl(queue, m, n, alpha, x, incx, y, incy,
a, lda, dependencies);
}
cl::sycl::event gerc(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m,
std::int64_t n, std::complex<double> alpha, const std::complex<double> *x,
std::int64_t incx, const std::complex<double> *y, std::int64_t incy,
std::complex<double> *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zgerc_usm_sycl(queue, m, n, alpha, x, incx, y, incy,
a, lda, dependencies);
}
cl::sycl::event geru(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m,
std::int64_t n, std::complex<float> alpha, const std::complex<float> *x,
std::int64_t incx, const std::complex<float> *y, std::int64_t incy,
std::complex<float> *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_cgeru_usm_sycl(queue, m, n, alpha, x, incx, y, incy,
a, lda, dependencies);
}
cl::sycl::event geru(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m,
std::int64_t n, std::complex<double> alpha, const std::complex<double> *x,
std::int64_t incx, const std::complex<double> *y, std::int64_t incy,
std::complex<double> *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zgeru_usm_sycl(queue, m, n, alpha, x, incx, y, incy,
a, lda, dependencies);
}
cl::sycl::event hbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::int64_t k, std::complex<float> alpha,
const std::complex<float> *a, std::int64_t lda, const std::complex<float> *x,
std::int64_t incx, std::complex<float> beta, std::complex<float> *y,
std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_chbmv_usm_sycl(
queue, upper_lower, n, k, alpha, a, lda, x, incx, beta, y, incy, dependencies);
}
cl::sycl::event hbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::int64_t k, std::complex<double> alpha,
const std::complex<double> *a, std::int64_t lda, const std::complex<double> *x,
std::int64_t incx, std::complex<double> beta, std::complex<double> *y,
std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zhbmv_usm_sycl(
queue, upper_lower, n, k, alpha, a, lda, x, incx, beta, y, incy, dependencies);
}
cl::sycl::event hemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::complex<float> alpha, const std::complex<float> *a,
std::int64_t lda, const std::complex<float> *x, std::int64_t incx,
std::complex<float> beta, std::complex<float> *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_chemv_usm_sycl(
queue, upper_lower, n, alpha, a, lda, x, incx, beta, y, incy, dependencies);
}
cl::sycl::event hemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::complex<double> alpha, const std::complex<double> *a,
std::int64_t lda, const std::complex<double> *x, std::int64_t incx,
std::complex<double> beta, std::complex<double> *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zhemv_usm_sycl(
queue, upper_lower, n, alpha, a, lda, x, incx, beta, y, incy, dependencies);
}
cl::sycl::event her(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, float alpha, const std::complex<float> *x, std::int64_t incx,
std::complex<float> *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_cher_usm_sycl(queue, upper_lower, n, alpha, x, incx,
a, lda, dependencies);
}
cl::sycl::event her(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, double alpha, const std::complex<double> *x, std::int64_t incx,
std::complex<double> *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zher_usm_sycl(queue, upper_lower, n, alpha, x, incx,
a, lda, dependencies);
}
cl::sycl::event her2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::complex<float> alpha, const std::complex<float> *x,
std::int64_t incx, const std::complex<float> *y, std::int64_t incy,
std::complex<float> *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_cher2_usm_sycl(queue, upper_lower, n, alpha, x,
incx, y, incy, a, lda, dependencies);
}
cl::sycl::event her2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::complex<double> alpha, const std::complex<double> *x,
std::int64_t incx, const std::complex<double> *y, std::int64_t incy,
std::complex<double> *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zher2_usm_sycl(queue, upper_lower, n, alpha, x,
incx, y, incy, a, lda, dependencies);
}
cl::sycl::event hpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::complex<float> alpha, const std::complex<float> *a,
const std::complex<float> *x, std::int64_t incx, std::complex<float> beta,
std::complex<float> *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_chpmv_usm_sycl(queue, upper_lower, n, alpha, a, x,
incx, beta, y, incy, dependencies);
}
cl::sycl::event hpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::complex<double> alpha, const std::complex<double> *a,
const std::complex<double> *x, std::int64_t incx, std::complex<double> beta,
std::complex<double> *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zhpmv_usm_sycl(queue, upper_lower, n, alpha, a, x,
incx, beta, y, incy, dependencies);
}
cl::sycl::event hpr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, float alpha, const std::complex<float> *x, std::int64_t incx,
std::complex<float> *a,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_chpr_usm_sycl(queue, upper_lower, n, alpha, x, incx,
a, dependencies);
}
cl::sycl::event hpr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, double alpha, const std::complex<double> *x, std::int64_t incx,
std::complex<double> *a,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zhpr_usm_sycl(queue, upper_lower, n, alpha, x, incx,
a, dependencies);
}
cl::sycl::event hpr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::complex<float> alpha, const std::complex<float> *x,
std::int64_t incx, const std::complex<float> *y, std::int64_t incy,
std::complex<float> *a,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_chpr2_usm_sycl(queue, upper_lower, n, alpha, x,
incx, y, incy, a, dependencies);
}
cl::sycl::event hpr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::complex<double> alpha, const std::complex<double> *x,
std::int64_t incx, const std::complex<double> *y, std::int64_t incy,
std::complex<double> *a,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zhpr2_usm_sycl(queue, upper_lower, n, alpha, x,
incx, y, incy, a, dependencies);
}
cl::sycl::event sbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::int64_t k, float alpha, const float *a, std::int64_t lda,
const float *x, std::int64_t incx, float beta, float *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ssbmv_usm_sycl(
queue, upper_lower, n, k, alpha, a, lda, x, incx, beta, y, incy, dependencies);
}
cl::sycl::event sbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::int64_t k, double alpha, const double *a,
std::int64_t lda, const double *x, std::int64_t incx, double beta, double *y,
std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dsbmv_usm_sycl(
queue, upper_lower, n, k, alpha, a, lda, x, incx, beta, y, incy, dependencies);
}
cl::sycl::event spmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, float alpha, const float *a, const float *x, std::int64_t incx,
float beta, float *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_sspmv_usm_sycl(queue, upper_lower, n, alpha, a, x,
incx, beta, y, incy, dependencies);
}
cl::sycl::event spmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, double alpha, const double *a, const double *x,
std::int64_t incx, double beta, double *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dspmv_usm_sycl(queue, upper_lower, n, alpha, a, x,
incx, beta, y, incy, dependencies);
}
cl::sycl::event spr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, float alpha, const float *x, std::int64_t incx, float *a,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_sspr_usm_sycl(queue, upper_lower, n, alpha, x, incx,
a, dependencies);
}
cl::sycl::event spr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, double alpha, const double *x, std::int64_t incx, double *a,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dspr_usm_sycl(queue, upper_lower, n, alpha, x, incx,
a, dependencies);
}
cl::sycl::event spr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, float alpha, const float *x, std::int64_t incx, const float *y,
std::int64_t incy, float *a,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_sspr2_usm_sycl(queue, upper_lower, n, alpha, x,
incx, y, incy, a, dependencies);
}
cl::sycl::event spr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, double alpha, const double *x, std::int64_t incx,
const double *y, std::int64_t incy, double *a,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dspr2_usm_sycl(queue, upper_lower, n, alpha, x,
incx, y, incy, a, dependencies);
}
cl::sycl::event symv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, float alpha, const float *a, std::int64_t lda, const float *x,
std::int64_t incx, float beta, float *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ssymv_usm_sycl(
queue, upper_lower, n, alpha, a, lda, x, incx, beta, y, incy, dependencies);
}
cl::sycl::event symv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, double alpha, const double *a, std::int64_t lda,
const double *x, std::int64_t incx, double beta, double *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dsymv_usm_sycl(
queue, upper_lower, n, alpha, a, lda, x, incx, beta, y, incy, dependencies);
}
cl::sycl::event syr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, float alpha, const float *x, std::int64_t incx, float *a,
std::int64_t lda, const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ssyr_usm_sycl(queue, upper_lower, n, alpha, x, incx,
a, lda, dependencies);
}
cl::sycl::event syr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, double alpha, const double *x, std::int64_t incx, double *a,
std::int64_t lda, const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dsyr_usm_sycl(queue, upper_lower, n, alpha, x, incx,
a, lda, dependencies);
}
cl::sycl::event syr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, float alpha, const float *x, std::int64_t incx, const float *y,
std::int64_t incy, float *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ssyr2_usm_sycl(queue, upper_lower, n, alpha, x,
incx, y, incy, a, lda, dependencies);
}
cl::sycl::event syr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, double alpha, const double *x, std::int64_t incx,
const double *y, std::int64_t incy, double *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dsyr2_usm_sycl(queue, upper_lower, n, alpha, x,
incx, y, incy, a, lda, dependencies);
}
cl::sycl::event tbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, std::int64_t k,
const float *a, std::int64_t lda, float *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_stbmv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, k, a, lda, x, incx, dependencies);
}
cl::sycl::event tbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, std::int64_t k,
const double *a, std::int64_t lda, double *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dtbmv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, k, a, lda, x, incx, dependencies);
}
cl::sycl::event tbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, std::int64_t k,
const std::complex<float> *a, std::int64_t lda, std::complex<float> *x,
std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ctbmv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, k, a, lda, x, incx, dependencies);
}
cl::sycl::event tbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, std::int64_t k,
const std::complex<double> *a, std::int64_t lda, std::complex<double> *x,
std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ztbmv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, k, a, lda, x, incx, dependencies);
}
cl::sycl::event tbsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, std::int64_t k,
const float *a, std::int64_t lda, float *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_stbsv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, k, a, lda, x, incx, dependencies);
}
cl::sycl::event tbsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, std::int64_t k,
const double *a, std::int64_t lda, double *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dtbsv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, k, a, lda, x, incx, dependencies);
}
cl::sycl::event tbsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, std::int64_t k,
const std::complex<float> *a, std::int64_t lda, std::complex<float> *x,
std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ctbsv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, k, a, lda, x, incx, dependencies);
}
cl::sycl::event tbsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, std::int64_t k,
const std::complex<double> *a, std::int64_t lda, std::complex<double> *x,
std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ztbsv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, k, a, lda, x, incx, dependencies);
}
cl::sycl::event tpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const float *a, float *x,
std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_stpmv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, a, x, incx, dependencies);
}
cl::sycl::event tpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const double *a, double *x,
std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dtpmv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, a, x, incx, dependencies);
}
cl::sycl::event tpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const std::complex<float> *a,
std::complex<float> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ctpmv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, a, x, incx, dependencies);
}
cl::sycl::event tpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const std::complex<double> *a,
std::complex<double> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ztpmv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, a, x, incx, dependencies);
}
cl::sycl::event tpsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const float *a, float *x,
std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_stpsv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, a, x, incx, dependencies);
}
cl::sycl::event tpsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const double *a, double *x,
std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dtpsv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, a, x, incx, dependencies);
}
cl::sycl::event tpsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const std::complex<float> *a,
std::complex<float> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ctpsv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, a, x, incx, dependencies);
}
cl::sycl::event tpsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const std::complex<double> *a,
std::complex<double> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ztpsv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, a, x, incx, dependencies);
}
cl::sycl::event trmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const float *a,
std::int64_t lda, float *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_strmv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, a, lda, x, incx, dependencies);
}
cl::sycl::event trmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const double *a,
std::int64_t lda, double *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dtrmv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, a, lda, x, incx, dependencies);
}
cl::sycl::event trmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const std::complex<float> *a,
std::int64_t lda, std::complex<float> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ctrmv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, a, lda, x, incx, dependencies);
}
cl::sycl::event trmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const std::complex<double> *a,
std::int64_t lda, std::complex<double> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ztrmv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, a, lda, x, incx, dependencies);
}
cl::sycl::event trsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const float *a,
std::int64_t lda, float *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_strsv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, a, lda, x, incx, dependencies);
}
cl::sycl::event trsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const double *a,
std::int64_t lda, double *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dtrsv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, a, lda, x, incx, dependencies);
}
cl::sycl::event trsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const std::complex<float> *a,
std::int64_t lda, std::complex<float> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ctrsv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, a, lda, x, incx, dependencies);
}
cl::sycl::event trsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const std::complex<double> *a,
std::int64_t lda, std::complex<double> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ztrsv_usm_sycl(queue, upper_lower, trans, unit_diag,
n, a, lda, x, incx, dependencies);
}
cl::sycl::event gemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k, float alpha,
const float *a, std::int64_t lda, const float *b, std::int64_t ldb, float beta,
float *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_sgemm_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event gemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k, double alpha,
const double *a, std::int64_t lda, const double *b, std::int64_t ldb,
double beta, double *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dgemm_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event gemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k,
std::complex<float> alpha, const std::complex<float> *a, std::int64_t lda,
const std::complex<float> *b, std::int64_t ldb, std::complex<float> beta,
std::complex<float> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_cgemm_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event gemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k,
std::complex<double> alpha, const std::complex<double> *a, std::int64_t lda,
const std::complex<double> *b, std::int64_t ldb, std::complex<double> beta,
std::complex<double> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zgemm_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event hemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, std::int64_t m, std::int64_t n, std::complex<float> alpha,
const std::complex<float> *a, std::int64_t lda, const std::complex<float> *b,
std::int64_t ldb, std::complex<float> beta, std::complex<float> *c,
std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_chemm_usm_sycl(
queue, left_right, upper_lower, m, n, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event hemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, std::int64_t m, std::int64_t n, std::complex<double> alpha,
const std::complex<double> *a, std::int64_t lda, const std::complex<double> *b,
std::int64_t ldb, std::complex<double> beta, std::complex<double> *c,
std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zhemm_usm_sycl(
queue, left_right, upper_lower, m, n, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event herk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, float alpha,
const std::complex<float> *a, std::int64_t lda, float beta,
std::complex<float> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_cherk_usm_sycl(
queue, upper_lower, trans, n, k, alpha, a, lda, beta, c, ldc, dependencies);
}
cl::sycl::event herk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, double alpha,
const std::complex<double> *a, std::int64_t lda, double beta,
std::complex<double> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zherk_usm_sycl(
queue, upper_lower, trans, n, k, alpha, a, lda, beta, c, ldc, dependencies);
}
cl::sycl::event her2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, std::complex<float> alpha,
const std::complex<float> *a, std::int64_t lda, const std::complex<float> *b,
std::int64_t ldb, float beta, std::complex<float> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_cher2k_usm_sycl(
queue, upper_lower, trans, n, k, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event her2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, std::complex<double> alpha,
const std::complex<double> *a, std::int64_t lda,
const std::complex<double> *b, std::int64_t ldb, double beta,
std::complex<double> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zher2k_usm_sycl(
queue, upper_lower, trans, n, k, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event symm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, std::int64_t m, std::int64_t n, float alpha, const float *a,
std::int64_t lda, const float *b, std::int64_t ldb, float beta, float *c,
std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ssymm_usm_sycl(
queue, left_right, upper_lower, m, n, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event symm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, std::int64_t m, std::int64_t n, double alpha,
const double *a, std::int64_t lda, const double *b, std::int64_t ldb,
double beta, double *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dsymm_usm_sycl(
queue, left_right, upper_lower, m, n, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event symm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, std::int64_t m, std::int64_t n, std::complex<float> alpha,
const std::complex<float> *a, std::int64_t lda, const std::complex<float> *b,
std::int64_t ldb, std::complex<float> beta, std::complex<float> *c,
std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_csymm_usm_sycl(
queue, left_right, upper_lower, m, n, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event symm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, std::int64_t m, std::int64_t n, std::complex<double> alpha,
const std::complex<double> *a, std::int64_t lda, const std::complex<double> *b,
std::int64_t ldb, std::complex<double> beta, std::complex<double> *c,
std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zsymm_usm_sycl(
queue, left_right, upper_lower, m, n, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event syrk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, float alpha, const float *a,
std::int64_t lda, float beta, float *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ssyrk_usm_sycl(
queue, upper_lower, trans, n, k, alpha, a, lda, beta, c, ldc, dependencies);
}
cl::sycl::event syrk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, double alpha, const double *a,
std::int64_t lda, double beta, double *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dsyrk_usm_sycl(
queue, upper_lower, trans, n, k, alpha, a, lda, beta, c, ldc, dependencies);
}
cl::sycl::event syrk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, std::complex<float> alpha,
const std::complex<float> *a, std::int64_t lda, std::complex<float> beta,
std::complex<float> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_csyrk_usm_sycl(
queue, upper_lower, trans, n, k, alpha, a, lda, beta, c, ldc, dependencies);
}
cl::sycl::event syrk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, std::complex<double> alpha,
const std::complex<double> *a, std::int64_t lda, std::complex<double> beta,
std::complex<double> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zsyrk_usm_sycl(
queue, upper_lower, trans, n, k, alpha, a, lda, beta, c, ldc, dependencies);
}
cl::sycl::event syr2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, float alpha, const float *a,
std::int64_t lda, const float *b, std::int64_t ldb, float beta, float *c,
std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ssyr2k_usm_sycl(
queue, upper_lower, trans, n, k, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event syr2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, double alpha,
const double *a, std::int64_t lda, const double *b, std::int64_t ldb,
double beta, double *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dsyr2k_usm_sycl(
queue, upper_lower, trans, n, k, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event syr2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, std::complex<float> alpha,
const std::complex<float> *a, std::int64_t lda, const std::complex<float> *b,
std::int64_t ldb, std::complex<float> beta, std::complex<float> *c,
std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_csyr2k_usm_sycl(
queue, upper_lower, trans, n, k, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event syr2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, std::complex<double> alpha,
const std::complex<double> *a, std::int64_t lda,
const std::complex<double> *b, std::int64_t ldb, std::complex<double> beta,
std::complex<double> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zsyr2k_usm_sycl(
queue, upper_lower, trans, n, k, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event trmm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m,
std::int64_t n, float alpha, const float *a, std::int64_t lda, float *b,
std::int64_t ldb,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_strmm_usm_sycl(queue, left_right, upper_lower,
trans, unit_diag, m, n, alpha, a,
lda, b, ldb, dependencies);
}
cl::sycl::event trmm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m,
std::int64_t n, double alpha, const double *a, std::int64_t lda, double *b,
std::int64_t ldb,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dtrmm_usm_sycl(queue, left_right, upper_lower,
trans, unit_diag, m, n, alpha, a,
lda, b, ldb, dependencies);
}
cl::sycl::event trmm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m,
std::int64_t n, std::complex<float> alpha, const std::complex<float> *a,
std::int64_t lda, std::complex<float> *b, std::int64_t ldb,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ctrmm_usm_sycl(queue, left_right, upper_lower,
trans, unit_diag, m, n, alpha, a,
lda, b, ldb, dependencies);
}
cl::sycl::event trmm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m,
std::int64_t n, std::complex<double> alpha, const std::complex<double> *a,
std::int64_t lda, std::complex<double> *b, std::int64_t ldb,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ztrmm_usm_sycl(queue, left_right, upper_lower,
trans, unit_diag, m, n, alpha, a,
lda, b, ldb, dependencies);
}
cl::sycl::event trsm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m,
std::int64_t n, float alpha, const float *a, std::int64_t lda, float *b,
std::int64_t ldb,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_strsm_usm_sycl(queue, left_right, upper_lower,
trans, unit_diag, m, n, alpha, a,
lda, b, ldb, dependencies);
}
cl::sycl::event trsm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m,
std::int64_t n, double alpha, const double *a, std::int64_t lda, double *b,
std::int64_t ldb,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dtrsm_usm_sycl(queue, left_right, upper_lower,
trans, unit_diag, m, n, alpha, a,
lda, b, ldb, dependencies);
}
cl::sycl::event trsm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m,
std::int64_t n, std::complex<float> alpha, const std::complex<float> *a,
std::int64_t lda, std::complex<float> *b, std::int64_t ldb,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ctrsm_usm_sycl(queue, left_right, upper_lower,
trans, unit_diag, m, n, alpha, a,
lda, b, ldb, dependencies);
}
cl::sycl::event trsm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m,
std::int64_t n, std::complex<double> alpha, const std::complex<double> *a,
std::int64_t lda, std::complex<double> *b, std::int64_t ldb,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_ztrsm_usm_sycl(queue, left_right, upper_lower,
trans, unit_diag, m, n, alpha, a,
lda, b, ldb, dependencies);
}
cl::sycl::event gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose *transa,
transpose *transb, std::int64_t *m, std::int64_t *n, std::int64_t *k,
float *alpha, const float **a, std::int64_t *lda, const float **b,
std::int64_t *ldb, float *beta, float **c, std::int64_t *ldc,
std::int64_t group_count, std::int64_t *group_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_sgemm_batch_group_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc, group_count,
group_size, dependencies);
}
cl::sycl::event gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose *transa,
transpose *transb, std::int64_t *m, std::int64_t *n, std::int64_t *k,
double *alpha, const double **a, std::int64_t *lda, const double **b,
std::int64_t *ldb, double *beta, double **c, std::int64_t *ldc,
std::int64_t group_count, std::int64_t *group_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dgemm_batch_group_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc, group_count,
group_size, dependencies);
}
cl::sycl::event gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose *transa,
transpose *transb, std::int64_t *m, std::int64_t *n, std::int64_t *k,
std::complex<float> *alpha, const std::complex<float> **a,
std::int64_t *lda, const std::complex<float> **b, std::int64_t *ldb,
std::complex<float> *beta, std::complex<float> **c, std::int64_t *ldc,
std::int64_t group_count, std::int64_t *group_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_cgemm_batch_group_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc, group_count,
group_size, dependencies);
}
cl::sycl::event gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose *transa,
transpose *transb, std::int64_t *m, std::int64_t *n, std::int64_t *k,
std::complex<double> *alpha, const std::complex<double> **a,
std::int64_t *lda, const std::complex<double> **b, std::int64_t *ldb,
std::complex<double> *beta, std::complex<double> **c, std::int64_t *ldc,
std::int64_t group_count, std::int64_t *group_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zgemm_batch_group_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc, group_count,
group_size, dependencies);
}
cl::sycl::event gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k,
float alpha, const float *a, std::int64_t lda, std::int64_t stride_a,
const float *b, std::int64_t ldb, std::int64_t stride_b, float beta,
float *c, std::int64_t ldc, std::int64_t stride_c,
std::int64_t batch_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_sgemm_batch_strided_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, stride_a, b, ldb, stride_b, beta, c, ldc,
stride_c, batch_size, dependencies);
}
cl::sycl::event gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k,
double alpha, const double *a, std::int64_t lda, std::int64_t stride_a,
const double *b, std::int64_t ldb, std::int64_t stride_b, double beta,
double *c, std::int64_t ldc, std::int64_t stride_c,
std::int64_t batch_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dgemm_batch_strided_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, stride_a, b, ldb, stride_b, beta, c, ldc,
stride_c, batch_size, dependencies);
}
cl::sycl::event gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k,
std::complex<float> alpha, const std::complex<float> *a,
std::int64_t lda, std::int64_t stride_a, const std::complex<float> *b,
std::int64_t ldb, std::int64_t stride_b, std::complex<float> beta,
std::complex<float> *c, std::int64_t ldc, std::int64_t stride_c,
std::int64_t batch_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_cgemm_batch_strided_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, stride_a, b, ldb, stride_b, beta, c, ldc,
stride_c, batch_size, dependencies);
}
cl::sycl::event gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k,
std::complex<double> alpha, const std::complex<double> *a,
std::int64_t lda, std::int64_t stride_a, const std::complex<double> *b,
std::int64_t ldb, std::int64_t stride_b, std::complex<double> beta,
std::complex<double> *c, std::int64_t ldc, std::int64_t stride_c,
std::int64_t batch_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zgemm_batch_strided_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, stride_a, b, ldb, stride_b, beta, c, ldc,
stride_c, batch_size, dependencies);
}
cl::sycl::event gemmt(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose transa, transpose transb, std::int64_t n, std::int64_t k,
float alpha, const float *a, std::int64_t lda, const float *b,
std::int64_t ldb, float beta, float *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_sgemmt_usm_sycl(queue, upper_lower, transa, transb,
n, k, alpha, a, lda, b, ldb, beta,
c, ldc, dependencies);
}
cl::sycl::event gemmt(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose transa, transpose transb, std::int64_t n, std::int64_t k,
double alpha, const double *a, std::int64_t lda, const double *b,
std::int64_t ldb, double beta, double *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_dgemmt_usm_sycl(queue, upper_lower, transa, transb,
n, k, alpha, a, lda, b, ldb, beta,
c, ldc, dependencies);
}
cl::sycl::event gemmt(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose transa, transpose transb, std::int64_t n, std::int64_t k,
std::complex<float> alpha, const std::complex<float> *a, std::int64_t lda,
const std::complex<float> *b, std::int64_t ldb, std::complex<float> beta,
std::complex<float> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_cgemmt_usm_sycl(queue, upper_lower, transa, transb,
n, k, alpha, a, lda, b, ldb, beta,
c, ldc, dependencies);
}
cl::sycl::event gemmt(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose transa, transpose transb, std::int64_t n, std::int64_t k,
std::complex<double> alpha, const std::complex<double> *a, std::int64_t lda,
const std::complex<double> *b, std::int64_t ldb, std::complex<double> beta,
std::complex<double> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].column_major_zgemmt_usm_sycl(queue, upper_lower, transa, transb,
n, k, alpha, a, lda, b, ldb, beta,
c, ldc, dependencies);
}
} //namespace detail
} //namespace column_major
namespace row_major {
namespace detail {
static oneapi::mkl::detail::table_initializer<domain::blas, blas_function_table_t> function_tables;
// Buffer APIs
void asum(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<float, 1> &result) {
function_tables[libkey].row_major_scasum_sycl(queue, n, x, incx, result);
}
void asum(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<double, 1> &result) {
function_tables[libkey].row_major_dzasum_sycl(queue, n, x, incx, result);
}
void asum(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, cl::sycl::buffer<float, 1> &result) {
function_tables[libkey].row_major_sasum_sycl(queue, n, x, incx, result);
}
void asum(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, cl::sycl::buffer<double, 1> &result) {
function_tables[libkey].row_major_dasum_sycl(queue, n, x, incx, result);
}
void axpy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, float alpha,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, cl::sycl::buffer<float, 1> &y,
std::int64_t incy) {
function_tables[libkey].row_major_saxpy_sycl(queue, n, alpha, x, incx, y, incy);
}
void axpy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, double alpha,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, cl::sycl::buffer<double, 1> &y,
std::int64_t incy) {
function_tables[libkey].row_major_daxpy_sycl(queue, n, alpha, x, incx, y, incy);
}
void axpy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy) {
function_tables[libkey].row_major_caxpy_sycl(queue, n, alpha, x, incx, y, incy);
}
void axpy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &x,
std::int64_t incx, cl::sycl::buffer<std::complex<double>, 1> &y, std::int64_t incy) {
function_tables[libkey].row_major_zaxpy_sycl(queue, n, alpha, x, incx, y, incy);
}
void copy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, cl::sycl::buffer<float, 1> &y,
std::int64_t incy) {
function_tables[libkey].row_major_scopy_sycl(queue, n, x, incx, y, incy);
}
void copy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, cl::sycl::buffer<double, 1> &y,
std::int64_t incy) {
function_tables[libkey].row_major_dcopy_sycl(queue, n, x, incx, y, incy);
}
void copy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy) {
function_tables[libkey].row_major_ccopy_sycl(queue, n, x, incx, y, incy);
}
void copy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<double>, 1> &y, std::int64_t incy) {
function_tables[libkey].row_major_zcopy_sycl(queue, n, x, incx, y, incy);
}
void dot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, cl::sycl::buffer<float, 1> &y,
std::int64_t incy, cl::sycl::buffer<float, 1> &result) {
function_tables[libkey].row_major_sdot_sycl(queue, n, x, incx, y, incy, result);
}
void dot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, cl::sycl::buffer<double, 1> &y,
std::int64_t incy, cl::sycl::buffer<double, 1> &result) {
function_tables[libkey].row_major_ddot_sycl(queue, n, x, incx, y, incy, result);
}
void dot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, cl::sycl::buffer<float, 1> &y,
std::int64_t incy, cl::sycl::buffer<double, 1> &result) {
function_tables[libkey].row_major_dsdot_sycl(queue, n, x, incx, y, incy, result);
}
void dotc(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<float>, 1> &result) {
function_tables[libkey].row_major_cdotc_sycl(queue, n, x, incx, y, incy, result);
}
void dotc(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<double>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<double>, 1> &result) {
function_tables[libkey].row_major_zdotc_sycl(queue, n, x, incx, y, incy, result);
}
void dotu(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<float>, 1> &result) {
function_tables[libkey].row_major_cdotu_sycl(queue, n, x, incx, y, incy, result);
}
void dotu(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<double>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<double>, 1> &result) {
function_tables[libkey].row_major_zdotu_sycl(queue, n, x, incx, y, incy, result);
}
void iamin(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<float, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::int64_t, 1> &result) {
function_tables[libkey].row_major_isamin_sycl(queue, n, x, incx, result);
}
void iamin(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<double, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::int64_t, 1> &result) {
function_tables[libkey].row_major_idamin_sycl(queue, n, x, incx, result);
}
void iamin(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::int64_t, 1> &result) {
function_tables[libkey].row_major_icamin_sycl(queue, n, x, incx, result);
}
void iamin(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::int64_t, 1> &result) {
function_tables[libkey].row_major_izamin_sycl(queue, n, x, incx, result);
}
void iamax(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<float, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::int64_t, 1> &result) {
function_tables[libkey].row_major_isamax_sycl(queue, n, x, incx, result);
}
void iamax(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<double, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::int64_t, 1> &result) {
function_tables[libkey].row_major_idamax_sycl(queue, n, x, incx, result);
}
void iamax(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::int64_t, 1> &result) {
function_tables[libkey].row_major_icamax_sycl(queue, n, x, incx, result);
}
void iamax(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::int64_t, 1> &result) {
function_tables[libkey].row_major_izamax_sycl(queue, n, x, incx, result);
}
void nrm2(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<float, 1> &result) {
function_tables[libkey].row_major_scnrm2_sycl(queue, n, x, incx, result);
}
void nrm2(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<double, 1> &result) {
function_tables[libkey].row_major_dznrm2_sycl(queue, n, x, incx, result);
}
void nrm2(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, cl::sycl::buffer<float, 1> &result) {
function_tables[libkey].row_major_snrm2_sycl(queue, n, x, incx, result);
}
void nrm2(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, cl::sycl::buffer<double, 1> &result) {
function_tables[libkey].row_major_dnrm2_sycl(queue, n, x, incx, result);
}
void rot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy, float c, float s) {
function_tables[libkey].row_major_srot_sycl(queue, n, x, incx, y, incy, c, s);
}
void rot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<double>, 1> &y, std::int64_t incy, double c, double s) {
function_tables[libkey].row_major_drot_sycl(queue, n, x, incx, y, incy, c, s);
}
void rot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, cl::sycl::buffer<float, 1> &y,
std::int64_t incy, float c, float s) {
function_tables[libkey].row_major_csrot_sycl(queue, n, x, incx, y, incy, c, s);
}
void rot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, cl::sycl::buffer<double, 1> &y,
std::int64_t incy, double c, double s) {
function_tables[libkey].row_major_zdrot_sycl(queue, n, x, incx, y, incy, c, s);
}
void rotg(oneapi::mkl::device libkey, cl::sycl::queue &queue, cl::sycl::buffer<float, 1> &a,
cl::sycl::buffer<float, 1> &b, cl::sycl::buffer<float, 1> &c,
cl::sycl::buffer<float, 1> &s) {
function_tables[libkey].row_major_srotg_sycl(queue, a, b, c, s);
}
void rotg(oneapi::mkl::device libkey, cl::sycl::queue &queue, cl::sycl::buffer<double, 1> &a,
cl::sycl::buffer<double, 1> &b, cl::sycl::buffer<double, 1> &c,
cl::sycl::buffer<double, 1> &s) {
function_tables[libkey].row_major_drotg_sycl(queue, a, b, c, s);
}
void rotg(oneapi::mkl::device libkey, cl::sycl::queue &queue,
cl::sycl::buffer<std::complex<float>, 1> &a, cl::sycl::buffer<std::complex<float>, 1> &b,
cl::sycl::buffer<float, 1> &c, cl::sycl::buffer<std::complex<float>, 1> &s) {
function_tables[libkey].row_major_crotg_sycl(queue, a, b, c, s);
}
void rotg(oneapi::mkl::device libkey, cl::sycl::queue &queue,
cl::sycl::buffer<std::complex<double>, 1> &a,
cl::sycl::buffer<std::complex<double>, 1> &b, cl::sycl::buffer<double, 1> &c,
cl::sycl::buffer<std::complex<double>, 1> &s) {
function_tables[libkey].row_major_zrotg_sycl(queue, a, b, c, s);
}
void rotm(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, cl::sycl::buffer<float, 1> &y,
std::int64_t incy, cl::sycl::buffer<float, 1> ¶m) {
function_tables[libkey].row_major_srotm_sycl(queue, n, x, incx, y, incy, param);
}
void rotm(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, cl::sycl::buffer<double, 1> &y,
std::int64_t incy, cl::sycl::buffer<double, 1> ¶m) {
function_tables[libkey].row_major_drotm_sycl(queue, n, x, incx, y, incy, param);
}
void rotmg(oneapi::mkl::device libkey, cl::sycl::queue &queue, cl::sycl::buffer<float, 1> &d1,
cl::sycl::buffer<float, 1> &d2, cl::sycl::buffer<float, 1> &x1, float y1,
cl::sycl::buffer<float, 1> ¶m) {
function_tables[libkey].row_major_srotmg_sycl(queue, d1, d2, x1, y1, param);
}
void rotmg(oneapi::mkl::device libkey, cl::sycl::queue &queue, cl::sycl::buffer<double, 1> &d1,
cl::sycl::buffer<double, 1> &d2, cl::sycl::buffer<double, 1> &x1, double y1,
cl::sycl::buffer<double, 1> ¶m) {
function_tables[libkey].row_major_drotmg_sycl(queue, d1, d2, x1, y1, param);
}
void scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, float alpha,
cl::sycl::buffer<float, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_sscal_sycl(queue, n, alpha, x, incx);
}
void scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, double alpha,
cl::sycl::buffer<double, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_dscal_sycl(queue, n, alpha, x, incx);
}
void scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &x,
std::int64_t incx) {
function_tables[libkey].row_major_cscal_sycl(queue, n, alpha, x, incx);
}
void scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &x,
std::int64_t incx) {
function_tables[libkey].row_major_csscal_sycl(queue, n, alpha, x, incx);
}
void scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, float alpha,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_zscal_sycl(queue, n, alpha, x, incx);
}
void scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, double alpha,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_zdscal_sycl(queue, n, alpha, x, incx);
}
void sdsdot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, float sb,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, cl::sycl::buffer<float, 1> &y,
std::int64_t incy, cl::sycl::buffer<float, 1> &result) {
function_tables[libkey].row_major_sdsdot_sycl(queue, n, sb, x, incx, y, incy, result);
}
void swap(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, cl::sycl::buffer<float, 1> &y,
std::int64_t incy) {
function_tables[libkey].row_major_sswap_sycl(queue, n, x, incx, y, incy);
}
void swap(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, cl::sycl::buffer<double, 1> &y,
std::int64_t incy) {
function_tables[libkey].row_major_dswap_sycl(queue, n, x, incx, y, incy);
}
void swap(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy) {
function_tables[libkey].row_major_cswap_sycl(queue, n, x, incx, y, incy);
}
void swap(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<double>, 1> &y, std::int64_t incy) {
function_tables[libkey].row_major_zswap_sycl(queue, n, x, incx, y, incy);
}
void gbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans, std::int64_t m,
std::int64_t n, std::int64_t kl, std::int64_t ku, float alpha,
cl::sycl::buffer<float, 1> &a, std::int64_t lda, cl::sycl::buffer<float, 1> &x,
std::int64_t incx, float beta, cl::sycl::buffer<float, 1> &y, std::int64_t incy) {
function_tables[libkey].row_major_sgbmv_sycl(queue, trans, m, n, kl, ku, alpha, a, lda, x, incx,
beta, y, incy);
}
void gbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans, std::int64_t m,
std::int64_t n, std::int64_t kl, std::int64_t ku, double alpha,
cl::sycl::buffer<double, 1> &a, std::int64_t lda, cl::sycl::buffer<double, 1> &x,
std::int64_t incx, double beta, cl::sycl::buffer<double, 1> &y, std::int64_t incy) {
function_tables[libkey].row_major_dgbmv_sycl(queue, trans, m, n, kl, ku, alpha, a, lda, x, incx,
beta, y, incy);
}
void gbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans, std::int64_t m,
std::int64_t n, std::int64_t kl, std::int64_t ku, std::complex<float> alpha,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx, std::complex<float> beta,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy) {
function_tables[libkey].row_major_cgbmv_sycl(queue, trans, m, n, kl, ku, alpha, a, lda, x, incx,
beta, y, incy);
}
void gbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans, std::int64_t m,
std::int64_t n, std::int64_t kl, std::int64_t ku, std::complex<double> alpha,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
std::complex<double> beta, cl::sycl::buffer<std::complex<double>, 1> &y,
std::int64_t incy) {
function_tables[libkey].row_major_zgbmv_sycl(queue, trans, m, n, kl, ku, alpha, a, lda, x, incx,
beta, y, incy);
}
void gemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans, std::int64_t m,
std::int64_t n, float alpha, cl::sycl::buffer<float, 1> &a, std::int64_t lda,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, float beta,
cl::sycl::buffer<float, 1> &y, std::int64_t incy) {
function_tables[libkey].row_major_sgemv_sycl(queue, trans, m, n, alpha, a, lda, x, incx, beta,
y, incy);
}
void gemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans, std::int64_t m,
std::int64_t n, double alpha, cl::sycl::buffer<double, 1> &a, std::int64_t lda,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, double beta,
cl::sycl::buffer<double, 1> &y, std::int64_t incy) {
function_tables[libkey].row_major_dgemv_sycl(queue, trans, m, n, alpha, a, lda, x, incx, beta,
y, incy);
}
void gemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans, std::int64_t m,
std::int64_t n, std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
std::complex<float> beta, cl::sycl::buffer<std::complex<float>, 1> &y,
std::int64_t incy) {
function_tables[libkey].row_major_cgemv_sycl(queue, trans, m, n, alpha, a, lda, x, incx, beta,
y, incy);
}
void gemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans, std::int64_t m,
std::int64_t n, std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
std::complex<double> beta, cl::sycl::buffer<std::complex<double>, 1> &y,
std::int64_t incy) {
function_tables[libkey].row_major_zgemv_sycl(queue, trans, m, n, alpha, a, lda, x, incx, beta,
y, incy);
}
void ger(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m, std::int64_t n,
float alpha, cl::sycl::buffer<float, 1> &x, std::int64_t incx,
cl::sycl::buffer<float, 1> &y, std::int64_t incy, cl::sycl::buffer<float, 1> &a,
std::int64_t lda) {
function_tables[libkey].row_major_sger_sycl(queue, m, n, alpha, x, incx, y, incy, a, lda);
}
void ger(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m, std::int64_t n,
double alpha, cl::sycl::buffer<double, 1> &x, std::int64_t incx,
cl::sycl::buffer<double, 1> &y, std::int64_t incy, cl::sycl::buffer<double, 1> &a,
std::int64_t lda) {
function_tables[libkey].row_major_dger_sycl(queue, m, n, alpha, x, incx, y, incy, a, lda);
}
void gerc(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda) {
function_tables[libkey].row_major_cgerc_sycl(queue, m, n, alpha, x, incx, y, incy, a, lda);
}
void gerc(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &x,
std::int64_t incx, cl::sycl::buffer<std::complex<double>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda) {
function_tables[libkey].row_major_zgerc_sycl(queue, m, n, alpha, x, incx, y, incy, a, lda);
}
void geru(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda) {
function_tables[libkey].row_major_cgeru_sycl(queue, m, n, alpha, x, incx, y, incy, a, lda);
}
void geru(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &x,
std::int64_t incx, cl::sycl::buffer<std::complex<double>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda) {
function_tables[libkey].row_major_zgeru_sycl(queue, m, n, alpha, x, incx, y, incy, a, lda);
}
void hbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::int64_t k, std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
std::complex<float> beta, cl::sycl::buffer<std::complex<float>, 1> &y,
std::int64_t incy) {
function_tables[libkey].row_major_chbmv_sycl(queue, upper_lower, n, k, alpha, a, lda, x, incx,
beta, y, incy);
}
void hbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::int64_t k, std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
std::complex<double> beta, cl::sycl::buffer<std::complex<double>, 1> &y,
std::int64_t incy) {
function_tables[libkey].row_major_zhbmv_sycl(queue, upper_lower, n, k, alpha, a, lda, x, incx,
beta, y, incy);
}
void hemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx, std::complex<float> beta,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy) {
function_tables[libkey].row_major_chemv_sycl(queue, upper_lower, n, alpha, a, lda, x, incx,
beta, y, incy);
}
void hemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
std::complex<double> beta, cl::sycl::buffer<std::complex<double>, 1> &y,
std::int64_t incy) {
function_tables[libkey].row_major_zhemv_sycl(queue, upper_lower, n, alpha, a, lda, x, incx,
beta, y, incy);
}
void her(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
float alpha, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda) {
function_tables[libkey].row_major_cher_sycl(queue, upper_lower, n, alpha, x, incx, a, lda);
}
void her(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
double alpha, cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda) {
function_tables[libkey].row_major_zher_sycl(queue, upper_lower, n, alpha, x, incx, a, lda);
}
void her2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda) {
function_tables[libkey].row_major_cher2_sycl(queue, upper_lower, n, alpha, x, incx, y, incy, a,
lda);
}
void her2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &x,
std::int64_t incx, cl::sycl::buffer<std::complex<double>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda) {
function_tables[libkey].row_major_zher2_sycl(queue, upper_lower, n, alpha, x, incx, y, incy, a,
lda);
}
void hpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &a,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx, std::complex<float> beta,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy) {
function_tables[libkey].row_major_chpmv_sycl(queue, upper_lower, n, alpha, a, x, incx, beta, y,
incy);
}
void hpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &a,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
std::complex<double> beta, cl::sycl::buffer<std::complex<double>, 1> &y,
std::int64_t incy) {
function_tables[libkey].row_major_zhpmv_sycl(queue, upper_lower, n, alpha, a, x, incx, beta, y,
incy);
}
void hpr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
float alpha, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &a) {
function_tables[libkey].row_major_chpr_sycl(queue, upper_lower, n, alpha, x, incx, a);
}
void hpr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
double alpha, cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<double>, 1> &a) {
function_tables[libkey].row_major_zhpr_sycl(queue, upper_lower, n, alpha, x, incx, a);
}
void hpr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx,
cl::sycl::buffer<std::complex<float>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<float>, 1> &a) {
function_tables[libkey].row_major_chpr2_sycl(queue, upper_lower, n, alpha, x, incx, y, incy, a);
}
void hpr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &x,
std::int64_t incx, cl::sycl::buffer<std::complex<double>, 1> &y, std::int64_t incy,
cl::sycl::buffer<std::complex<double>, 1> &a) {
function_tables[libkey].row_major_zhpr2_sycl(queue, upper_lower, n, alpha, x, incx, y, incy, a);
}
void sbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::int64_t k, float alpha, cl::sycl::buffer<float, 1> &a, std::int64_t lda,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, float beta,
cl::sycl::buffer<float, 1> &y, std::int64_t incy) {
function_tables[libkey].row_major_ssbmv_sycl(queue, upper_lower, n, k, alpha, a, lda, x, incx,
beta, y, incy);
}
void sbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
std::int64_t k, double alpha, cl::sycl::buffer<double, 1> &a, std::int64_t lda,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, double beta,
cl::sycl::buffer<double, 1> &y, std::int64_t incy) {
function_tables[libkey].row_major_dsbmv_sycl(queue, upper_lower, n, k, alpha, a, lda, x, incx,
beta, y, incy);
}
void spmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
float alpha, cl::sycl::buffer<float, 1> &a, cl::sycl::buffer<float, 1> &x,
std::int64_t incx, float beta, cl::sycl::buffer<float, 1> &y, std::int64_t incy) {
function_tables[libkey].row_major_sspmv_sycl(queue, upper_lower, n, alpha, a, x, incx, beta, y,
incy);
}
void spmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
double alpha, cl::sycl::buffer<double, 1> &a, cl::sycl::buffer<double, 1> &x,
std::int64_t incx, double beta, cl::sycl::buffer<double, 1> &y, std::int64_t incy) {
function_tables[libkey].row_major_dspmv_sycl(queue, upper_lower, n, alpha, a, x, incx, beta, y,
incy);
}
void spr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
float alpha, cl::sycl::buffer<float, 1> &x, std::int64_t incx,
cl::sycl::buffer<float, 1> &a) {
function_tables[libkey].row_major_sspr_sycl(queue, upper_lower, n, alpha, x, incx, a);
}
void spr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
double alpha, cl::sycl::buffer<double, 1> &x, std::int64_t incx,
cl::sycl::buffer<double, 1> &a) {
function_tables[libkey].row_major_dspr_sycl(queue, upper_lower, n, alpha, x, incx, a);
}
void spr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
float alpha, cl::sycl::buffer<float, 1> &x, std::int64_t incx,
cl::sycl::buffer<float, 1> &y, std::int64_t incy, cl::sycl::buffer<float, 1> &a) {
function_tables[libkey].row_major_sspr2_sycl(queue, upper_lower, n, alpha, x, incx, y, incy, a);
}
void spr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
double alpha, cl::sycl::buffer<double, 1> &x, std::int64_t incx,
cl::sycl::buffer<double, 1> &y, std::int64_t incy, cl::sycl::buffer<double, 1> &a) {
function_tables[libkey].row_major_dspr2_sycl(queue, upper_lower, n, alpha, x, incx, y, incy, a);
}
void symv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
float alpha, cl::sycl::buffer<float, 1> &a, std::int64_t lda,
cl::sycl::buffer<float, 1> &x, std::int64_t incx, float beta,
cl::sycl::buffer<float, 1> &y, std::int64_t incy) {
function_tables[libkey].row_major_ssymv_sycl(queue, upper_lower, n, alpha, a, lda, x, incx,
beta, y, incy);
}
void symv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
double alpha, cl::sycl::buffer<double, 1> &a, std::int64_t lda,
cl::sycl::buffer<double, 1> &x, std::int64_t incx, double beta,
cl::sycl::buffer<double, 1> &y, std::int64_t incy) {
function_tables[libkey].row_major_dsymv_sycl(queue, upper_lower, n, alpha, a, lda, x, incx,
beta, y, incy);
}
void syr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
float alpha, cl::sycl::buffer<float, 1> &x, std::int64_t incx,
cl::sycl::buffer<float, 1> &a, std::int64_t lda) {
function_tables[libkey].row_major_ssyr_sycl(queue, upper_lower, n, alpha, x, incx, a, lda);
}
void syr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
double alpha, cl::sycl::buffer<double, 1> &x, std::int64_t incx,
cl::sycl::buffer<double, 1> &a, std::int64_t lda) {
function_tables[libkey].row_major_dsyr_sycl(queue, upper_lower, n, alpha, x, incx, a, lda);
}
void syr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
float alpha, cl::sycl::buffer<float, 1> &x, std::int64_t incx,
cl::sycl::buffer<float, 1> &y, std::int64_t incy, cl::sycl::buffer<float, 1> &a,
std::int64_t lda) {
function_tables[libkey].row_major_ssyr2_sycl(queue, upper_lower, n, alpha, x, incx, y, incy, a,
lda);
}
void syr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, std::int64_t n,
double alpha, cl::sycl::buffer<double, 1> &x, std::int64_t incx,
cl::sycl::buffer<double, 1> &y, std::int64_t incy, cl::sycl::buffer<double, 1> &a,
std::int64_t lda) {
function_tables[libkey].row_major_dsyr2_sycl(queue, upper_lower, n, alpha, x, incx, y, incy, a,
lda);
}
void tbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, std::int64_t k, cl::sycl::buffer<float, 1> &a,
std::int64_t lda, cl::sycl::buffer<float, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_stbmv_sycl(queue, upper_lower, trans, unit_diag, n, k, a, lda,
x, incx);
}
void tbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, std::int64_t k, cl::sycl::buffer<double, 1> &a,
std::int64_t lda, cl::sycl::buffer<double, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_dtbmv_sycl(queue, upper_lower, trans, unit_diag, n, k, a, lda,
x, incx);
}
void tbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, std::int64_t k,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_ctbmv_sycl(queue, upper_lower, trans, unit_diag, n, k, a, lda,
x, incx);
}
void tbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, std::int64_t k,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_ztbmv_sycl(queue, upper_lower, trans, unit_diag, n, k, a, lda,
x, incx);
}
void tbsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, std::int64_t k, cl::sycl::buffer<float, 1> &a,
std::int64_t lda, cl::sycl::buffer<float, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_stbsv_sycl(queue, upper_lower, trans, unit_diag, n, k, a, lda,
x, incx);
}
void tbsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, std::int64_t k, cl::sycl::buffer<double, 1> &a,
std::int64_t lda, cl::sycl::buffer<double, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_dtbsv_sycl(queue, upper_lower, trans, unit_diag, n, k, a, lda,
x, incx);
}
void tbsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, std::int64_t k,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_ctbsv_sycl(queue, upper_lower, trans, unit_diag, n, k, a, lda,
x, incx);
}
void tbsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, std::int64_t k,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_ztbsv_sycl(queue, upper_lower, trans, unit_diag, n, k, a, lda,
x, incx);
}
void tpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<float, 1> &a,
cl::sycl::buffer<float, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_stpmv_sycl(queue, upper_lower, trans, unit_diag, n, a, x,
incx);
}
void tpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<double, 1> &a,
cl::sycl::buffer<double, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_dtpmv_sycl(queue, upper_lower, trans, unit_diag, n, a, x,
incx);
}
void tpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<std::complex<float>, 1> &a,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_ctpmv_sycl(queue, upper_lower, trans, unit_diag, n, a, x,
incx);
}
void tpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<std::complex<double>, 1> &a,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_ztpmv_sycl(queue, upper_lower, trans, unit_diag, n, a, x,
incx);
}
void tpsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<float, 1> &a,
cl::sycl::buffer<float, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_stpsv_sycl(queue, upper_lower, trans, unit_diag, n, a, x,
incx);
}
void tpsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<double, 1> &a,
cl::sycl::buffer<double, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_dtpsv_sycl(queue, upper_lower, trans, unit_diag, n, a, x,
incx);
}
void tpsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<std::complex<float>, 1> &a,
cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_ctpsv_sycl(queue, upper_lower, trans, unit_diag, n, a, x,
incx);
}
void tpsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<std::complex<double>, 1> &a,
cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_ztpsv_sycl(queue, upper_lower, trans, unit_diag, n, a, x,
incx);
}
void trmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<float, 1> &a, std::int64_t lda,
cl::sycl::buffer<float, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_strmv_sycl(queue, upper_lower, trans, unit_diag, n, a, lda, x,
incx);
}
void trmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<double, 1> &a, std::int64_t lda,
cl::sycl::buffer<double, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_dtrmv_sycl(queue, upper_lower, trans, unit_diag, n, a, lda, x,
incx);
}
void trmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<std::complex<float>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_ctrmv_sycl(queue, upper_lower, trans, unit_diag, n, a, lda, x,
incx);
}
void trmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<std::complex<double>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_ztrmv_sycl(queue, upper_lower, trans, unit_diag, n, a, lda, x,
incx);
}
void trsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<float, 1> &a, std::int64_t lda,
cl::sycl::buffer<float, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_strsv_sycl(queue, upper_lower, trans, unit_diag, n, a, lda, x,
incx);
}
void trsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<double, 1> &a, std::int64_t lda,
cl::sycl::buffer<double, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_dtrsv_sycl(queue, upper_lower, trans, unit_diag, n, a, lda, x,
incx);
}
void trsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<std::complex<float>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<float>, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_ctrsv_sycl(queue, upper_lower, trans, unit_diag, n, a, lda, x,
incx);
}
void trsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
diag unit_diag, std::int64_t n, cl::sycl::buffer<std::complex<double>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<double>, 1> &x, std::int64_t incx) {
function_tables[libkey].row_major_ztrsv_sycl(queue, upper_lower, trans, unit_diag, n, a, lda, x,
incx);
}
void gemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa, transpose transb,
std::int64_t m, std::int64_t n, std::int64_t k, float alpha,
cl::sycl::buffer<float, 1> &a, std::int64_t lda, cl::sycl::buffer<float, 1> &b,
std::int64_t ldb, float beta, cl::sycl::buffer<float, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_sgemm_sycl(queue, transa, transb, m, n, k, alpha, a, lda, b,
ldb, beta, c, ldc);
}
void gemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa, transpose transb,
std::int64_t m, std::int64_t n, std::int64_t k, double alpha,
cl::sycl::buffer<double, 1> &a, std::int64_t lda, cl::sycl::buffer<double, 1> &b,
std::int64_t ldb, double beta, cl::sycl::buffer<double, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_dgemm_sycl(queue, transa, transb, m, n, k, alpha, a, lda, b,
ldb, beta, c, ldc);
}
void gemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa, transpose transb,
std::int64_t m, std::int64_t n, std::int64_t k, std::complex<float> alpha,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &b, std::int64_t ldb, std::complex<float> beta,
cl::sycl::buffer<std::complex<float>, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_cgemm_sycl(queue, transa, transb, m, n, k, alpha, a, lda, b,
ldb, beta, c, ldc);
}
void gemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa, transpose transb,
std::int64_t m, std::int64_t n, std::int64_t k, std::complex<double> alpha,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<double>, 1> &b, std::int64_t ldb, std::complex<double> beta,
cl::sycl::buffer<std::complex<double>, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_zgemm_sycl(queue, transa, transb, m, n, k, alpha, a, lda, b,
ldb, beta, c, ldc);
}
void gemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa, transpose transb,
std::int64_t m, std::int64_t n, std::int64_t k, half alpha, cl::sycl::buffer<half, 1> &a,
std::int64_t lda, cl::sycl::buffer<half, 1> &b, std::int64_t ldb, half beta,
cl::sycl::buffer<half, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_hgemm_sycl(queue, transa, transb, m, n, k, alpha, a, lda, b,
ldb, beta, c, ldc);
}
void gemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa, transpose transb,
std::int64_t m, std::int64_t n, std::int64_t k, float alpha, cl::sycl::buffer<half, 1> &a,
std::int64_t lda, cl::sycl::buffer<half, 1> &b, std::int64_t ldb, float beta,
cl::sycl::buffer<float, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_gemm_f16f16f32_sycl(queue, transa, transb, m, n, k, alpha, a,
lda, b, ldb, beta, c, ldc);
}
void hemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
std::int64_t m, std::int64_t n, std::complex<float> alpha,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &b, std::int64_t ldb, std::complex<float> beta,
cl::sycl::buffer<std::complex<float>, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_chemm_sycl(queue, left_right, upper_lower, m, n, alpha, a,
lda, b, ldb, beta, c, ldc);
}
void hemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
std::int64_t m, std::int64_t n, std::complex<double> alpha,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<double>, 1> &b, std::int64_t ldb, std::complex<double> beta,
cl::sycl::buffer<std::complex<double>, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_zhemm_sycl(queue, left_right, upper_lower, m, n, alpha, a,
lda, b, ldb, beta, c, ldc);
}
void herk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, float alpha, cl::sycl::buffer<std::complex<float>, 1> &a,
std::int64_t lda, float beta, cl::sycl::buffer<std::complex<float>, 1> &c,
std::int64_t ldc) {
function_tables[libkey].row_major_cherk_sycl(queue, upper_lower, trans, n, k, alpha, a, lda,
beta, c, ldc);
}
void herk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, double alpha,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda, double beta,
cl::sycl::buffer<std::complex<double>, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_zherk_sycl(queue, upper_lower, trans, n, k, alpha, a, lda,
beta, c, ldc);
}
void her2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, std::complex<float> alpha,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &b, std::int64_t ldb, float beta,
cl::sycl::buffer<std::complex<float>, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_cher2k_sycl(queue, upper_lower, trans, n, k, alpha, a, lda, b,
ldb, beta, c, ldc);
}
void her2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, std::complex<double> alpha,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<double>, 1> &b, std::int64_t ldb, double beta,
cl::sycl::buffer<std::complex<double>, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_zher2k_sycl(queue, upper_lower, trans, n, k, alpha, a, lda, b,
ldb, beta, c, ldc);
}
void symm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
std::int64_t m, std::int64_t n, float alpha, cl::sycl::buffer<float, 1> &a,
std::int64_t lda, cl::sycl::buffer<float, 1> &b, std::int64_t ldb, float beta,
cl::sycl::buffer<float, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_ssymm_sycl(queue, left_right, upper_lower, m, n, alpha, a,
lda, b, ldb, beta, c, ldc);
}
void symm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
std::int64_t m, std::int64_t n, double alpha, cl::sycl::buffer<double, 1> &a,
std::int64_t lda, cl::sycl::buffer<double, 1> &b, std::int64_t ldb, double beta,
cl::sycl::buffer<double, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_dsymm_sycl(queue, left_right, upper_lower, m, n, alpha, a,
lda, b, ldb, beta, c, ldc);
}
void symm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
std::int64_t m, std::int64_t n, std::complex<float> alpha,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &b, std::int64_t ldb, std::complex<float> beta,
cl::sycl::buffer<std::complex<float>, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_csymm_sycl(queue, left_right, upper_lower, m, n, alpha, a,
lda, b, ldb, beta, c, ldc);
}
void symm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
std::int64_t m, std::int64_t n, std::complex<double> alpha,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<double>, 1> &b, std::int64_t ldb, std::complex<double> beta,
cl::sycl::buffer<std::complex<double>, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_zsymm_sycl(queue, left_right, upper_lower, m, n, alpha, a,
lda, b, ldb, beta, c, ldc);
}
void syrk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, float alpha, cl::sycl::buffer<float, 1> &a,
std::int64_t lda, float beta, cl::sycl::buffer<float, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_ssyrk_sycl(queue, upper_lower, trans, n, k, alpha, a, lda,
beta, c, ldc);
}
void syrk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, double alpha, cl::sycl::buffer<double, 1> &a,
std::int64_t lda, double beta, cl::sycl::buffer<double, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_dsyrk_sycl(queue, upper_lower, trans, n, k, alpha, a, lda,
beta, c, ldc);
}
void syrk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, std::complex<float> alpha,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda, std::complex<float> beta,
cl::sycl::buffer<std::complex<float>, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_csyrk_sycl(queue, upper_lower, trans, n, k, alpha, a, lda,
beta, c, ldc);
}
void syrk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, std::complex<double> alpha,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda, std::complex<double> beta,
cl::sycl::buffer<std::complex<double>, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_zsyrk_sycl(queue, upper_lower, trans, n, k, alpha, a, lda,
beta, c, ldc);
}
void syr2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, float alpha, cl::sycl::buffer<float, 1> &a,
std::int64_t lda, cl::sycl::buffer<float, 1> &b, std::int64_t ldb, float beta,
cl::sycl::buffer<float, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_ssyr2k_sycl(queue, upper_lower, trans, n, k, alpha, a, lda, b,
ldb, beta, c, ldc);
}
void syr2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, double alpha, cl::sycl::buffer<double, 1> &a,
std::int64_t lda, cl::sycl::buffer<double, 1> &b, std::int64_t ldb, double beta,
cl::sycl::buffer<double, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_dsyr2k_sycl(queue, upper_lower, trans, n, k, alpha, a, lda, b,
ldb, beta, c, ldc);
}
void syr2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, std::complex<float> alpha,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &b, std::int64_t ldb, std::complex<float> beta,
cl::sycl::buffer<std::complex<float>, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_csyr2k_sycl(queue, upper_lower, trans, n, k, alpha, a, lda, b,
ldb, beta, c, ldc);
}
void syr2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose trans,
std::int64_t n, std::int64_t k, std::complex<double> alpha,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<double>, 1> &b, std::int64_t ldb,
std::complex<double> beta, cl::sycl::buffer<std::complex<double>, 1> &c,
std::int64_t ldc) {
function_tables[libkey].row_major_zsyr2k_sycl(queue, upper_lower, trans, n, k, alpha, a, lda, b,
ldb, beta, c, ldc);
}
void trmm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t m, std::int64_t n, float alpha,
cl::sycl::buffer<float, 1> &a, std::int64_t lda, cl::sycl::buffer<float, 1> &b,
std::int64_t ldb) {
function_tables[libkey].row_major_strmm_sycl(queue, left_right, upper_lower, trans, unit_diag,
m, n, alpha, a, lda, b, ldb);
}
void trmm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t m, std::int64_t n, double alpha,
cl::sycl::buffer<double, 1> &a, std::int64_t lda, cl::sycl::buffer<double, 1> &b,
std::int64_t ldb) {
function_tables[libkey].row_major_dtrmm_sycl(queue, left_right, upper_lower, trans, unit_diag,
m, n, alpha, a, lda, b, ldb);
}
void trmm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t m, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &b, std::int64_t ldb) {
function_tables[libkey].row_major_ctrmm_sycl(queue, left_right, upper_lower, trans, unit_diag,
m, n, alpha, a, lda, b, ldb);
}
void trmm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t m, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<double>, 1> &b, std::int64_t ldb) {
function_tables[libkey].row_major_ztrmm_sycl(queue, left_right, upper_lower, trans, unit_diag,
m, n, alpha, a, lda, b, ldb);
}
void trsm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t m, std::int64_t n, float alpha,
cl::sycl::buffer<float, 1> &a, std::int64_t lda, cl::sycl::buffer<float, 1> &b,
std::int64_t ldb) {
function_tables[libkey].row_major_strsm_sycl(queue, left_right, upper_lower, trans, unit_diag,
m, n, alpha, a, lda, b, ldb);
}
void trsm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t m, std::int64_t n, double alpha,
cl::sycl::buffer<double, 1> &a, std::int64_t lda, cl::sycl::buffer<double, 1> &b,
std::int64_t ldb) {
function_tables[libkey].row_major_dtrsm_sycl(queue, left_right, upper_lower, trans, unit_diag,
m, n, alpha, a, lda, b, ldb);
}
void trsm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t m, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &b, std::int64_t ldb) {
function_tables[libkey].row_major_ctrsm_sycl(queue, left_right, upper_lower, trans, unit_diag,
m, n, alpha, a, lda, b, ldb);
}
void trsm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t m, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &a,
std::int64_t lda, cl::sycl::buffer<std::complex<double>, 1> &b, std::int64_t ldb) {
function_tables[libkey].row_major_ztrsm_sycl(queue, left_right, upper_lower, trans, unit_diag,
m, n, alpha, a, lda, b, ldb);
}
void gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k, float alpha,
cl::sycl::buffer<float, 1> &a, std::int64_t lda, std::int64_t stride_a,
cl::sycl::buffer<float, 1> &b, std::int64_t ldb, std::int64_t stride_b, float beta,
cl::sycl::buffer<float, 1> &c, std::int64_t ldc, std::int64_t stride_c,
std::int64_t batch_size) {
function_tables[libkey].row_major_sgemm_batch_strided_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, stride_a, b, ldb, stride_b, beta, c, ldc,
stride_c, batch_size);
}
void gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k, double alpha,
cl::sycl::buffer<double, 1> &a, std::int64_t lda, std::int64_t stride_a,
cl::sycl::buffer<double, 1> &b, std::int64_t ldb, std::int64_t stride_b,
double beta, cl::sycl::buffer<double, 1> &c, std::int64_t ldc,
std::int64_t stride_c, std::int64_t batch_size) {
function_tables[libkey].row_major_dgemm_batch_strided_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, stride_a, b, ldb, stride_b, beta, c, ldc,
stride_c, batch_size);
}
void gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &a,
std::int64_t lda, std::int64_t stride_a,
cl::sycl::buffer<std::complex<float>, 1> &b, std::int64_t ldb,
std::int64_t stride_b, std::complex<float> beta,
cl::sycl::buffer<std::complex<float>, 1> &c, std::int64_t ldc,
std::int64_t stride_c, std::int64_t batch_size) {
function_tables[libkey].row_major_cgemm_batch_strided_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, stride_a, b, ldb, stride_b, beta, c, ldc,
stride_c, batch_size);
}
void gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &a,
std::int64_t lda, std::int64_t stride_a,
cl::sycl::buffer<std::complex<double>, 1> &b, std::int64_t ldb,
std::int64_t stride_b, std::complex<double> beta,
cl::sycl::buffer<std::complex<double>, 1> &c, std::int64_t ldc,
std::int64_t stride_c, std::int64_t batch_size) {
function_tables[libkey].row_major_zgemm_batch_strided_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, stride_a, b, ldb, stride_b, beta, c, ldc,
stride_c, batch_size);
}
void trsm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m, std::int64_t n,
float alpha, cl::sycl::buffer<float, 1> &a, std::int64_t lda, std::int64_t stride_a,
cl::sycl::buffer<float, 1> &b, std::int64_t ldb, std::int64_t stride_b,
std::int64_t batch_size) {
function_tables[libkey].row_major_strsm_batch_strided_sycl(
queue, left_right, upper_lower, trans, unit_diag, m, n, alpha, a, lda, stride_a, b, ldb,
stride_b, batch_size);
}
void trsm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m, std::int64_t n,
double alpha, cl::sycl::buffer<double, 1> &a, std::int64_t lda,
std::int64_t stride_a, cl::sycl::buffer<double, 1> &b, std::int64_t ldb,
std::int64_t stride_b, std::int64_t batch_size) {
function_tables[libkey].row_major_dtrsm_batch_strided_sycl(
queue, left_right, upper_lower, trans, unit_diag, m, n, alpha, a, lda, stride_a, b, ldb,
stride_b, batch_size);
}
void trsm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m, std::int64_t n,
std::complex<float> alpha, cl::sycl::buffer<std::complex<float>, 1> &a,
std::int64_t lda, std::int64_t stride_a,
cl::sycl::buffer<std::complex<float>, 1> &b, std::int64_t ldb,
std::int64_t stride_b, std::int64_t batch_size) {
function_tables[libkey].row_major_ctrsm_batch_strided_sycl(
queue, left_right, upper_lower, trans, unit_diag, m, n, alpha, a, lda, stride_a, b, ldb,
stride_b, batch_size);
}
void trsm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m, std::int64_t n,
std::complex<double> alpha, cl::sycl::buffer<std::complex<double>, 1> &a,
std::int64_t lda, std::int64_t stride_a,
cl::sycl::buffer<std::complex<double>, 1> &b, std::int64_t ldb,
std::int64_t stride_b, std::int64_t batch_size) {
function_tables[libkey].row_major_ztrsm_batch_strided_sycl(
queue, left_right, upper_lower, trans, unit_diag, m, n, alpha, a, lda, stride_a, b, ldb,
stride_b, batch_size);
}
void gemmt(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose transa,
transpose transb, std::int64_t n, std::int64_t k, float alpha,
cl::sycl::buffer<float, 1> &a, std::int64_t lda, cl::sycl::buffer<float, 1> &b,
std::int64_t ldb, float beta, cl::sycl::buffer<float, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_sgemmt_sycl(queue, upper_lower, transa, transb, n, k, alpha,
a, lda, b, ldb, beta, c, ldc);
}
void gemmt(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose transa,
transpose transb, std::int64_t n, std::int64_t k, double alpha,
cl::sycl::buffer<double, 1> &a, std::int64_t lda, cl::sycl::buffer<double, 1> &b,
std::int64_t ldb, double beta, cl::sycl::buffer<double, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_dgemmt_sycl(queue, upper_lower, transa, transb, n, k, alpha,
a, lda, b, ldb, beta, c, ldc);
}
void gemmt(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose transa,
transpose transb, std::int64_t n, std::int64_t k, std::complex<float> alpha,
cl::sycl::buffer<std::complex<float>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<float>, 1> &b, std::int64_t ldb, std::complex<float> beta,
cl::sycl::buffer<std::complex<float>, 1> &c, std::int64_t ldc) {
function_tables[libkey].row_major_cgemmt_sycl(queue, upper_lower, transa, transb, n, k, alpha,
a, lda, b, ldb, beta, c, ldc);
}
void gemmt(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower, transpose transa,
transpose transb, std::int64_t n, std::int64_t k, std::complex<double> alpha,
cl::sycl::buffer<std::complex<double>, 1> &a, std::int64_t lda,
cl::sycl::buffer<std::complex<double>, 1> &b, std::int64_t ldb,
std::complex<double> beta, cl::sycl::buffer<std::complex<double>, 1> &c,
std::int64_t ldc) {
function_tables[libkey].row_major_zgemmt_sycl(queue, upper_lower, transa, transb, n, k, alpha,
a, lda, b, ldb, beta, c, ldc);
}
void gemm_bias(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, offset offsetc, std::int64_t m, std::int64_t n, std::int64_t k,
float alpha, cl::sycl::buffer<int8_t, 1> &a, std::int64_t lda, int8_t ao,
cl::sycl::buffer<uint8_t, 1> &b, std::int64_t ldb, uint8_t bo, float beta,
cl::sycl::buffer<int32_t, 1> &c, std::int64_t ldc,
cl::sycl::buffer<int32_t, 1> &co) {
function_tables[libkey].row_major_gemm_s8u8s32_bias_sycl(
queue, transa, transb, offsetc, m, n, k, alpha, a, lda, ao, b, ldb, bo, beta, c, ldc, co);
}
// USM APIs
cl::sycl::event asum(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<float> *x, std::int64_t incx, float *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_scasum_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event asum(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<double> *x, std::int64_t incx, double *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dzasum_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event asum(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const float *x, std::int64_t incx, float *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_sasum_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event asum(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const double *x, std::int64_t incx, double *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dasum_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event axpy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
float alpha, const float *x, std::int64_t incx, float *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_saxpy_usm_sycl(queue, n, alpha, x, incx, y, incy,
dependencies);
}
cl::sycl::event axpy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
double alpha, const double *x, std::int64_t incx, double *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_daxpy_usm_sycl(queue, n, alpha, x, incx, y, incy,
dependencies);
}
cl::sycl::event axpy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<float> alpha, const std::complex<float> *x, std::int64_t incx,
std::complex<float> *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_caxpy_usm_sycl(queue, n, alpha, x, incx, y, incy,
dependencies);
}
cl::sycl::event axpy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<double> alpha, const std::complex<double> *x, std::int64_t incx,
std::complex<double> *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zaxpy_usm_sycl(queue, n, alpha, x, incx, y, incy,
dependencies);
}
cl::sycl::event axpy_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t *n,
float *alpha, const float **x, std::int64_t *incx, float **y,
std::int64_t *incy, std::int64_t group_count, std::int64_t *group_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_saxpy_batch_group_usm_sycl(
queue, n, alpha, x, incx, y, incy, group_count, group_size, dependencies);
}
cl::sycl::event axpy_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t *n,
double *alpha, const double **x, std::int64_t *incx, double **y,
std::int64_t *incy, std::int64_t group_count, std::int64_t *group_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_daxpy_batch_group_usm_sycl(
queue, n, alpha, x, incx, y, incy, group_count, group_size, dependencies);
}
cl::sycl::event axpy_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t *n,
std::complex<float> *alpha, const std::complex<float> **x,
std::int64_t *incx, std::complex<float> **y, std::int64_t *incy,
std::int64_t group_count, std::int64_t *group_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_caxpy_batch_group_usm_sycl(
queue, n, alpha, x, incx, y, incy, group_count, group_size, dependencies);
}
cl::sycl::event axpy_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t *n,
std::complex<double> *alpha, const std::complex<double> **x,
std::int64_t *incx, std::complex<double> **y, std::int64_t *incy,
std::int64_t group_count, std::int64_t *group_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zaxpy_batch_group_usm_sycl(
queue, n, alpha, x, incx, y, incy, group_count, group_size, dependencies);
}
cl::sycl::event copy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const float *x, std::int64_t incx, float *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_scopy_usm_sycl(queue, n, x, incx, y, incy,
dependencies);
}
cl::sycl::event copy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const double *x, std::int64_t incx, double *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dcopy_usm_sycl(queue, n, x, incx, y, incy,
dependencies);
}
cl::sycl::event copy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<float> *x, std::int64_t incx, std::complex<float> *y,
std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ccopy_usm_sycl(queue, n, x, incx, y, incy,
dependencies);
}
cl::sycl::event copy(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<double> *x, std::int64_t incx, std::complex<double> *y,
std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zcopy_usm_sycl(queue, n, x, incx, y, incy,
dependencies);
}
cl::sycl::event dot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const float *x, std::int64_t incx, const float *y, std::int64_t incy,
float *result, const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_sdot_usm_sycl(queue, n, x, incx, y, incy, result,
dependencies);
}
cl::sycl::event dot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const double *x, std::int64_t incx, const double *y, std::int64_t incy,
double *result, const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ddot_usm_sycl(queue, n, x, incx, y, incy, result,
dependencies);
}
cl::sycl::event dot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const float *x, std::int64_t incx, const float *y, std::int64_t incy,
double *result, const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dsdot_usm_sycl(queue, n, x, incx, y, incy, result,
dependencies);
}
cl::sycl::event dotc(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<float> *x, std::int64_t incx, const std::complex<float> *y,
std::int64_t incy, std::complex<float> *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_cdotc_usm_sycl(queue, n, x, incx, y, incy, result,
dependencies);
}
cl::sycl::event dotc(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<double> *x, std::int64_t incx,
const std::complex<double> *y, std::int64_t incy, std::complex<double> *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zdotc_usm_sycl(queue, n, x, incx, y, incy, result,
dependencies);
}
cl::sycl::event dotu(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<float> *x, std::int64_t incx, const std::complex<float> *y,
std::int64_t incy, std::complex<float> *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_cdotu_usm_sycl(queue, n, x, incx, y, incy, result,
dependencies);
}
cl::sycl::event dotu(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<double> *x, std::int64_t incx,
const std::complex<double> *y, std::int64_t incy, std::complex<double> *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zdotu_usm_sycl(queue, n, x, incx, y, incy, result,
dependencies);
}
cl::sycl::event iamin(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const float *x, std::int64_t incx, std::int64_t *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_isamin_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event iamin(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const double *x, std::int64_t incx, std::int64_t *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_idamin_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event iamin(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<float> *x, std::int64_t incx, std::int64_t *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_icamin_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event iamin(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<double> *x, std::int64_t incx, std::int64_t *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_izamin_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event iamax(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const float *x, std::int64_t incx, std::int64_t *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_isamax_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event iamax(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const double *x, std::int64_t incx, std::int64_t *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_idamax_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event iamax(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<float> *x, std::int64_t incx, std::int64_t *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_icamax_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event iamax(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<double> *x, std::int64_t incx, std::int64_t *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_izamax_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event nrm2(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<float> *x, std::int64_t incx, float *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_scnrm2_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event nrm2(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const std::complex<double> *x, std::int64_t incx, double *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dznrm2_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event nrm2(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const float *x, std::int64_t incx, float *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_snrm2_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event nrm2(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
const double *x, std::int64_t incx, double *result,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dnrm2_usm_sycl(queue, n, x, incx, result,
dependencies);
}
cl::sycl::event rot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<float> *x, std::int64_t incx, std::complex<float> *y,
std::int64_t incy, float c, float s,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_srot_usm_sycl(queue, n, x, incx, y, incy, c, s,
dependencies);
}
cl::sycl::event rot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<double> *x, std::int64_t incx, std::complex<double> *y,
std::int64_t incy, double c, double s,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_drot_usm_sycl(queue, n, x, incx, y, incy, c, s,
dependencies);
}
cl::sycl::event rot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, float *x,
std::int64_t incx, float *y, std::int64_t incy, float c, float s,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_csrot_usm_sycl(queue, n, x, incx, y, incy, c, s,
dependencies);
}
cl::sycl::event rot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, double *x,
std::int64_t incx, double *y, std::int64_t incy, double c, double s,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zdrot_usm_sycl(queue, n, x, incx, y, incy, c, s,
dependencies);
}
cl::sycl::event rotg(oneapi::mkl::device libkey, cl::sycl::queue &queue, float *a, float *b,
float *c, float *s,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_srotg_usm_sycl(queue, a, b, c, s, dependencies);
}
cl::sycl::event rotg(oneapi::mkl::device libkey, cl::sycl::queue &queue, double *a, double *b,
double *c, double *s,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_drotg_usm_sycl(queue, a, b, c, s, dependencies);
}
cl::sycl::event rotg(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::complex<float> *a,
std::complex<float> *b, float *c, std::complex<float> *s,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_crotg_usm_sycl(queue, a, b, c, s, dependencies);
}
cl::sycl::event rotg(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::complex<double> *a,
std::complex<double> *b, double *c, std::complex<double> *s,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zrotg_usm_sycl(queue, a, b, c, s, dependencies);
}
cl::sycl::event rotm(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, float *x,
std::int64_t incx, float *y, std::int64_t incy, float *param,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_srotm_usm_sycl(queue, n, x, incx, y, incy, param,
dependencies);
}
cl::sycl::event rotm(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, double *x,
std::int64_t incx, double *y, std::int64_t incy, double *param,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_drotm_usm_sycl(queue, n, x, incx, y, incy, param,
dependencies);
}
cl::sycl::event rotmg(oneapi::mkl::device libkey, cl::sycl::queue &queue, float *d1, float *d2,
float *x1, float y1, float *param,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_srotmg_usm_sycl(queue, d1, d2, x1, y1, param,
dependencies);
}
cl::sycl::event rotmg(oneapi::mkl::device libkey, cl::sycl::queue &queue, double *d1, double *d2,
double *x1, double y1, double *param,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_drotmg_usm_sycl(queue, d1, d2, x1, y1, param,
dependencies);
}
cl::sycl::event scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
float alpha, float *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_sscal_usm_sycl(queue, n, alpha, x, incx, dependencies);
}
cl::sycl::event scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
double alpha, double *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dscal_usm_sycl(queue, n, alpha, x, incx, dependencies);
}
cl::sycl::event scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<float> alpha, std::complex<float> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_cscal_usm_sycl(queue, n, alpha, x, incx, dependencies);
}
cl::sycl::event scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<double> alpha, std::complex<double> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_csscal_usm_sycl(queue, n, alpha, x, incx,
dependencies);
}
cl::sycl::event scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
float alpha, std::complex<float> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zscal_usm_sycl(queue, n, alpha, x, incx, dependencies);
}
cl::sycl::event scal(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
double alpha, std::complex<double> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zdscal_usm_sycl(queue, n, alpha, x, incx,
dependencies);
}
cl::sycl::event sdsdot(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, float sb,
const float *x, std::int64_t incx, const float *y, std::int64_t incy,
float *result, const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_sdsdot_usm_sycl(queue, n, sb, x, incx, y, incy, result,
dependencies);
}
cl::sycl::event swap(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, float *x,
std::int64_t incx, float *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_sswap_usm_sycl(queue, n, x, incx, y, incy,
dependencies);
}
cl::sycl::event swap(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n, double *x,
std::int64_t incx, double *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dswap_usm_sycl(queue, n, x, incx, y, incy,
dependencies);
}
cl::sycl::event swap(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<float> *x, std::int64_t incx, std::complex<float> *y,
std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_cswap_usm_sycl(queue, n, x, incx, y, incy,
dependencies);
}
cl::sycl::event swap(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t n,
std::complex<double> *x, std::int64_t incx, std::complex<double> *y,
std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zswap_usm_sycl(queue, n, x, incx, y, incy,
dependencies);
}
cl::sycl::event gbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans,
std::int64_t m, std::int64_t n, std::int64_t kl, std::int64_t ku, float alpha,
const float *a, std::int64_t lda, const float *x, std::int64_t incx,
float beta, float *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_sgbmv_usm_sycl(
queue, trans, m, n, kl, ku, alpha, a, lda, x, incx, beta, y, incy, dependencies);
}
cl::sycl::event gbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans,
std::int64_t m, std::int64_t n, std::int64_t kl, std::int64_t ku, double alpha,
const double *a, std::int64_t lda, const double *x, std::int64_t incx,
double beta, double *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dgbmv_usm_sycl(
queue, trans, m, n, kl, ku, alpha, a, lda, x, incx, beta, y, incy, dependencies);
}
cl::sycl::event gbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans,
std::int64_t m, std::int64_t n, std::int64_t kl, std::int64_t ku,
std::complex<float> alpha, const std::complex<float> *a, std::int64_t lda,
const std::complex<float> *x, std::int64_t incx, std::complex<float> beta,
std::complex<float> *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_cgbmv_usm_sycl(
queue, trans, m, n, kl, ku, alpha, a, lda, x, incx, beta, y, incy, dependencies);
}
cl::sycl::event gbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans,
std::int64_t m, std::int64_t n, std::int64_t kl, std::int64_t ku,
std::complex<double> alpha, const std::complex<double> *a, std::int64_t lda,
const std::complex<double> *x, std::int64_t incx, std::complex<double> beta,
std::complex<double> *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zgbmv_usm_sycl(
queue, trans, m, n, kl, ku, alpha, a, lda, x, incx, beta, y, incy, dependencies);
}
cl::sycl::event gemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans,
std::int64_t m, std::int64_t n, float alpha, const float *a, std::int64_t lda,
const float *x, std::int64_t incx, float beta, float *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_sgemv_usm_sycl(queue, trans, m, n, alpha, a, lda, x,
incx, beta, y, incy, dependencies);
}
cl::sycl::event gemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans,
std::int64_t m, std::int64_t n, double alpha, const double *a,
std::int64_t lda, const double *x, std::int64_t incx, double beta, double *y,
std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dgemv_usm_sycl(queue, trans, m, n, alpha, a, lda, x,
incx, beta, y, incy, dependencies);
}
cl::sycl::event gemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans,
std::int64_t m, std::int64_t n, std::complex<float> alpha,
const std::complex<float> *a, std::int64_t lda, const std::complex<float> *x,
std::int64_t incx, std::complex<float> beta, std::complex<float> *y,
std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_cgemv_usm_sycl(queue, trans, m, n, alpha, a, lda, x,
incx, beta, y, incy, dependencies);
}
cl::sycl::event gemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose trans,
std::int64_t m, std::int64_t n, std::complex<double> alpha,
const std::complex<double> *a, std::int64_t lda, const std::complex<double> *x,
std::int64_t incx, std::complex<double> beta, std::complex<double> *y,
std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zgemv_usm_sycl(queue, trans, m, n, alpha, a, lda, x,
incx, beta, y, incy, dependencies);
}
cl::sycl::event ger(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m,
std::int64_t n, float alpha, const float *x, std::int64_t incx, const float *y,
std::int64_t incy, float *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_sger_usm_sycl(queue, m, n, alpha, x, incx, y, incy, a,
lda, dependencies);
}
cl::sycl::event ger(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m,
std::int64_t n, double alpha, const double *x, std::int64_t incx,
const double *y, std::int64_t incy, double *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dger_usm_sycl(queue, m, n, alpha, x, incx, y, incy, a,
lda, dependencies);
}
cl::sycl::event gerc(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m,
std::int64_t n, std::complex<float> alpha, const std::complex<float> *x,
std::int64_t incx, const std::complex<float> *y, std::int64_t incy,
std::complex<float> *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_cgerc_usm_sycl(queue, m, n, alpha, x, incx, y, incy, a,
lda, dependencies);
}
cl::sycl::event gerc(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m,
std::int64_t n, std::complex<double> alpha, const std::complex<double> *x,
std::int64_t incx, const std::complex<double> *y, std::int64_t incy,
std::complex<double> *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zgerc_usm_sycl(queue, m, n, alpha, x, incx, y, incy, a,
lda, dependencies);
}
cl::sycl::event geru(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m,
std::int64_t n, std::complex<float> alpha, const std::complex<float> *x,
std::int64_t incx, const std::complex<float> *y, std::int64_t incy,
std::complex<float> *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_cgeru_usm_sycl(queue, m, n, alpha, x, incx, y, incy, a,
lda, dependencies);
}
cl::sycl::event geru(oneapi::mkl::device libkey, cl::sycl::queue &queue, std::int64_t m,
std::int64_t n, std::complex<double> alpha, const std::complex<double> *x,
std::int64_t incx, const std::complex<double> *y, std::int64_t incy,
std::complex<double> *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zgeru_usm_sycl(queue, m, n, alpha, x, incx, y, incy, a,
lda, dependencies);
}
cl::sycl::event hbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::int64_t k, std::complex<float> alpha,
const std::complex<float> *a, std::int64_t lda, const std::complex<float> *x,
std::int64_t incx, std::complex<float> beta, std::complex<float> *y,
std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_chbmv_usm_sycl(queue, upper_lower, n, k, alpha, a, lda,
x, incx, beta, y, incy, dependencies);
}
cl::sycl::event hbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::int64_t k, std::complex<double> alpha,
const std::complex<double> *a, std::int64_t lda, const std::complex<double> *x,
std::int64_t incx, std::complex<double> beta, std::complex<double> *y,
std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zhbmv_usm_sycl(queue, upper_lower, n, k, alpha, a, lda,
x, incx, beta, y, incy, dependencies);
}
cl::sycl::event hemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::complex<float> alpha, const std::complex<float> *a,
std::int64_t lda, const std::complex<float> *x, std::int64_t incx,
std::complex<float> beta, std::complex<float> *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_chemv_usm_sycl(queue, upper_lower, n, alpha, a, lda, x,
incx, beta, y, incy, dependencies);
}
cl::sycl::event hemv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::complex<double> alpha, const std::complex<double> *a,
std::int64_t lda, const std::complex<double> *x, std::int64_t incx,
std::complex<double> beta, std::complex<double> *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zhemv_usm_sycl(queue, upper_lower, n, alpha, a, lda, x,
incx, beta, y, incy, dependencies);
}
cl::sycl::event her(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, float alpha, const std::complex<float> *x, std::int64_t incx,
std::complex<float> *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_cher_usm_sycl(queue, upper_lower, n, alpha, x, incx, a,
lda, dependencies);
}
cl::sycl::event her(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, double alpha, const std::complex<double> *x, std::int64_t incx,
std::complex<double> *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zher_usm_sycl(queue, upper_lower, n, alpha, x, incx, a,
lda, dependencies);
}
cl::sycl::event her2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::complex<float> alpha, const std::complex<float> *x,
std::int64_t incx, const std::complex<float> *y, std::int64_t incy,
std::complex<float> *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_cher2_usm_sycl(queue, upper_lower, n, alpha, x, incx,
y, incy, a, lda, dependencies);
}
cl::sycl::event her2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::complex<double> alpha, const std::complex<double> *x,
std::int64_t incx, const std::complex<double> *y, std::int64_t incy,
std::complex<double> *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zher2_usm_sycl(queue, upper_lower, n, alpha, x, incx,
y, incy, a, lda, dependencies);
}
cl::sycl::event hpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::complex<float> alpha, const std::complex<float> *a,
const std::complex<float> *x, std::int64_t incx, std::complex<float> beta,
std::complex<float> *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_chpmv_usm_sycl(queue, upper_lower, n, alpha, a, x,
incx, beta, y, incy, dependencies);
}
cl::sycl::event hpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::complex<double> alpha, const std::complex<double> *a,
const std::complex<double> *x, std::int64_t incx, std::complex<double> beta,
std::complex<double> *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zhpmv_usm_sycl(queue, upper_lower, n, alpha, a, x,
incx, beta, y, incy, dependencies);
}
cl::sycl::event hpr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, float alpha, const std::complex<float> *x, std::int64_t incx,
std::complex<float> *a,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_chpr_usm_sycl(queue, upper_lower, n, alpha, x, incx, a,
dependencies);
}
cl::sycl::event hpr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, double alpha, const std::complex<double> *x, std::int64_t incx,
std::complex<double> *a,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zhpr_usm_sycl(queue, upper_lower, n, alpha, x, incx, a,
dependencies);
}
cl::sycl::event hpr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::complex<float> alpha, const std::complex<float> *x,
std::int64_t incx, const std::complex<float> *y, std::int64_t incy,
std::complex<float> *a,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_chpr2_usm_sycl(queue, upper_lower, n, alpha, x, incx,
y, incy, a, dependencies);
}
cl::sycl::event hpr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::complex<double> alpha, const std::complex<double> *x,
std::int64_t incx, const std::complex<double> *y, std::int64_t incy,
std::complex<double> *a,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zhpr2_usm_sycl(queue, upper_lower, n, alpha, x, incx,
y, incy, a, dependencies);
}
cl::sycl::event sbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::int64_t k, float alpha, const float *a, std::int64_t lda,
const float *x, std::int64_t incx, float beta, float *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ssbmv_usm_sycl(queue, upper_lower, n, k, alpha, a, lda,
x, incx, beta, y, incy, dependencies);
}
cl::sycl::event sbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, std::int64_t k, double alpha, const double *a,
std::int64_t lda, const double *x, std::int64_t incx, double beta, double *y,
std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dsbmv_usm_sycl(queue, upper_lower, n, k, alpha, a, lda,
x, incx, beta, y, incy, dependencies);
}
cl::sycl::event spmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, float alpha, const float *a, const float *x, std::int64_t incx,
float beta, float *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_sspmv_usm_sycl(queue, upper_lower, n, alpha, a, x,
incx, beta, y, incy, dependencies);
}
cl::sycl::event spmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, double alpha, const double *a, const double *x,
std::int64_t incx, double beta, double *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dspmv_usm_sycl(queue, upper_lower, n, alpha, a, x,
incx, beta, y, incy, dependencies);
}
cl::sycl::event spr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, float alpha, const float *x, std::int64_t incx, float *a,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_sspr_usm_sycl(queue, upper_lower, n, alpha, x, incx, a,
dependencies);
}
cl::sycl::event spr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, double alpha, const double *x, std::int64_t incx, double *a,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dspr_usm_sycl(queue, upper_lower, n, alpha, x, incx, a,
dependencies);
}
cl::sycl::event spr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, float alpha, const float *x, std::int64_t incx, const float *y,
std::int64_t incy, float *a,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_sspr2_usm_sycl(queue, upper_lower, n, alpha, x, incx,
y, incy, a, dependencies);
}
cl::sycl::event spr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, double alpha, const double *x, std::int64_t incx,
const double *y, std::int64_t incy, double *a,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dspr2_usm_sycl(queue, upper_lower, n, alpha, x, incx,
y, incy, a, dependencies);
}
cl::sycl::event symv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, float alpha, const float *a, std::int64_t lda, const float *x,
std::int64_t incx, float beta, float *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ssymv_usm_sycl(queue, upper_lower, n, alpha, a, lda, x,
incx, beta, y, incy, dependencies);
}
cl::sycl::event symv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, double alpha, const double *a, std::int64_t lda,
const double *x, std::int64_t incx, double beta, double *y, std::int64_t incy,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dsymv_usm_sycl(queue, upper_lower, n, alpha, a, lda, x,
incx, beta, y, incy, dependencies);
}
cl::sycl::event syr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, float alpha, const float *x, std::int64_t incx, float *a,
std::int64_t lda, const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ssyr_usm_sycl(queue, upper_lower, n, alpha, x, incx, a,
lda, dependencies);
}
cl::sycl::event syr(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, double alpha, const double *x, std::int64_t incx, double *a,
std::int64_t lda, const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dsyr_usm_sycl(queue, upper_lower, n, alpha, x, incx, a,
lda, dependencies);
}
cl::sycl::event syr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, float alpha, const float *x, std::int64_t incx, const float *y,
std::int64_t incy, float *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ssyr2_usm_sycl(queue, upper_lower, n, alpha, x, incx,
y, incy, a, lda, dependencies);
}
cl::sycl::event syr2(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
std::int64_t n, double alpha, const double *x, std::int64_t incx,
const double *y, std::int64_t incy, double *a, std::int64_t lda,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dsyr2_usm_sycl(queue, upper_lower, n, alpha, x, incx,
y, incy, a, lda, dependencies);
}
cl::sycl::event tbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, std::int64_t k,
const float *a, std::int64_t lda, float *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_stbmv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
k, a, lda, x, incx, dependencies);
}
cl::sycl::event tbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, std::int64_t k,
const double *a, std::int64_t lda, double *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dtbmv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
k, a, lda, x, incx, dependencies);
}
cl::sycl::event tbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, std::int64_t k,
const std::complex<float> *a, std::int64_t lda, std::complex<float> *x,
std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ctbmv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
k, a, lda, x, incx, dependencies);
}
cl::sycl::event tbmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, std::int64_t k,
const std::complex<double> *a, std::int64_t lda, std::complex<double> *x,
std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ztbmv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
k, a, lda, x, incx, dependencies);
}
cl::sycl::event tbsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, std::int64_t k,
const float *a, std::int64_t lda, float *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_stbsv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
k, a, lda, x, incx, dependencies);
}
cl::sycl::event tbsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, std::int64_t k,
const double *a, std::int64_t lda, double *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dtbsv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
k, a, lda, x, incx, dependencies);
}
cl::sycl::event tbsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, std::int64_t k,
const std::complex<float> *a, std::int64_t lda, std::complex<float> *x,
std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ctbsv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
k, a, lda, x, incx, dependencies);
}
cl::sycl::event tbsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, std::int64_t k,
const std::complex<double> *a, std::int64_t lda, std::complex<double> *x,
std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ztbsv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
k, a, lda, x, incx, dependencies);
}
cl::sycl::event tpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const float *a, float *x,
std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_stpmv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
a, x, incx, dependencies);
}
cl::sycl::event tpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const double *a, double *x,
std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dtpmv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
a, x, incx, dependencies);
}
cl::sycl::event tpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const std::complex<float> *a,
std::complex<float> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ctpmv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
a, x, incx, dependencies);
}
cl::sycl::event tpmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const std::complex<double> *a,
std::complex<double> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ztpmv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
a, x, incx, dependencies);
}
cl::sycl::event tpsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const float *a, float *x,
std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_stpsv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
a, x, incx, dependencies);
}
cl::sycl::event tpsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const double *a, double *x,
std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dtpsv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
a, x, incx, dependencies);
}
cl::sycl::event tpsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const std::complex<float> *a,
std::complex<float> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ctpsv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
a, x, incx, dependencies);
}
cl::sycl::event tpsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const std::complex<double> *a,
std::complex<double> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ztpsv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
a, x, incx, dependencies);
}
cl::sycl::event trmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const float *a,
std::int64_t lda, float *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_strmv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
a, lda, x, incx, dependencies);
}
cl::sycl::event trmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const double *a,
std::int64_t lda, double *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dtrmv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
a, lda, x, incx, dependencies);
}
cl::sycl::event trmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const std::complex<float> *a,
std::int64_t lda, std::complex<float> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ctrmv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
a, lda, x, incx, dependencies);
}
cl::sycl::event trmv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const std::complex<double> *a,
std::int64_t lda, std::complex<double> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ztrmv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
a, lda, x, incx, dependencies);
}
cl::sycl::event trsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const float *a,
std::int64_t lda, float *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_strsv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
a, lda, x, incx, dependencies);
}
cl::sycl::event trsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const double *a,
std::int64_t lda, double *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dtrsv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
a, lda, x, incx, dependencies);
}
cl::sycl::event trsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const std::complex<float> *a,
std::int64_t lda, std::complex<float> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ctrsv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
a, lda, x, incx, dependencies);
}
cl::sycl::event trsv(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, diag unit_diag, std::int64_t n, const std::complex<double> *a,
std::int64_t lda, std::complex<double> *x, std::int64_t incx,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ztrsv_usm_sycl(queue, upper_lower, trans, unit_diag, n,
a, lda, x, incx, dependencies);
}
cl::sycl::event gemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k, float alpha,
const float *a, std::int64_t lda, const float *b, std::int64_t ldb, float beta,
float *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_sgemm_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event gemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k, double alpha,
const double *a, std::int64_t lda, const double *b, std::int64_t ldb,
double beta, double *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dgemm_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event gemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k,
std::complex<float> alpha, const std::complex<float> *a, std::int64_t lda,
const std::complex<float> *b, std::int64_t ldb, std::complex<float> beta,
std::complex<float> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_cgemm_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event gemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k,
std::complex<double> alpha, const std::complex<double> *a, std::int64_t lda,
const std::complex<double> *b, std::int64_t ldb, std::complex<double> beta,
std::complex<double> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zgemm_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event hemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, std::int64_t m, std::int64_t n, std::complex<float> alpha,
const std::complex<float> *a, std::int64_t lda, const std::complex<float> *b,
std::int64_t ldb, std::complex<float> beta, std::complex<float> *c,
std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_chemm_usm_sycl(
queue, left_right, upper_lower, m, n, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event hemm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, std::int64_t m, std::int64_t n, std::complex<double> alpha,
const std::complex<double> *a, std::int64_t lda, const std::complex<double> *b,
std::int64_t ldb, std::complex<double> beta, std::complex<double> *c,
std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zhemm_usm_sycl(
queue, left_right, upper_lower, m, n, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event herk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, float alpha,
const std::complex<float> *a, std::int64_t lda, float beta,
std::complex<float> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_cherk_usm_sycl(queue, upper_lower, trans, n, k, alpha,
a, lda, beta, c, ldc, dependencies);
}
cl::sycl::event herk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, double alpha,
const std::complex<double> *a, std::int64_t lda, double beta,
std::complex<double> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zherk_usm_sycl(queue, upper_lower, trans, n, k, alpha,
a, lda, beta, c, ldc, dependencies);
}
cl::sycl::event her2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, std::complex<float> alpha,
const std::complex<float> *a, std::int64_t lda, const std::complex<float> *b,
std::int64_t ldb, float beta, std::complex<float> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_cher2k_usm_sycl(
queue, upper_lower, trans, n, k, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event her2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, std::complex<double> alpha,
const std::complex<double> *a, std::int64_t lda,
const std::complex<double> *b, std::int64_t ldb, double beta,
std::complex<double> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zher2k_usm_sycl(
queue, upper_lower, trans, n, k, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event symm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, std::int64_t m, std::int64_t n, float alpha, const float *a,
std::int64_t lda, const float *b, std::int64_t ldb, float beta, float *c,
std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ssymm_usm_sycl(
queue, left_right, upper_lower, m, n, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event symm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, std::int64_t m, std::int64_t n, double alpha,
const double *a, std::int64_t lda, const double *b, std::int64_t ldb,
double beta, double *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dsymm_usm_sycl(
queue, left_right, upper_lower, m, n, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event symm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, std::int64_t m, std::int64_t n, std::complex<float> alpha,
const std::complex<float> *a, std::int64_t lda, const std::complex<float> *b,
std::int64_t ldb, std::complex<float> beta, std::complex<float> *c,
std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_csymm_usm_sycl(
queue, left_right, upper_lower, m, n, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event symm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, std::int64_t m, std::int64_t n, std::complex<double> alpha,
const std::complex<double> *a, std::int64_t lda, const std::complex<double> *b,
std::int64_t ldb, std::complex<double> beta, std::complex<double> *c,
std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zsymm_usm_sycl(
queue, left_right, upper_lower, m, n, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event syrk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, float alpha, const float *a,
std::int64_t lda, float beta, float *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ssyrk_usm_sycl(queue, upper_lower, trans, n, k, alpha,
a, lda, beta, c, ldc, dependencies);
}
cl::sycl::event syrk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, double alpha, const double *a,
std::int64_t lda, double beta, double *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dsyrk_usm_sycl(queue, upper_lower, trans, n, k, alpha,
a, lda, beta, c, ldc, dependencies);
}
cl::sycl::event syrk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, std::complex<float> alpha,
const std::complex<float> *a, std::int64_t lda, std::complex<float> beta,
std::complex<float> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_csyrk_usm_sycl(queue, upper_lower, trans, n, k, alpha,
a, lda, beta, c, ldc, dependencies);
}
cl::sycl::event syrk(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, std::complex<double> alpha,
const std::complex<double> *a, std::int64_t lda, std::complex<double> beta,
std::complex<double> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zsyrk_usm_sycl(queue, upper_lower, trans, n, k, alpha,
a, lda, beta, c, ldc, dependencies);
}
cl::sycl::event syr2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, float alpha, const float *a,
std::int64_t lda, const float *b, std::int64_t ldb, float beta, float *c,
std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ssyr2k_usm_sycl(
queue, upper_lower, trans, n, k, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event syr2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, double alpha,
const double *a, std::int64_t lda, const double *b, std::int64_t ldb,
double beta, double *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dsyr2k_usm_sycl(
queue, upper_lower, trans, n, k, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event syr2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, std::complex<float> alpha,
const std::complex<float> *a, std::int64_t lda, const std::complex<float> *b,
std::int64_t ldb, std::complex<float> beta, std::complex<float> *c,
std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_csyr2k_usm_sycl(
queue, upper_lower, trans, n, k, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event syr2k(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose trans, std::int64_t n, std::int64_t k, std::complex<double> alpha,
const std::complex<double> *a, std::int64_t lda,
const std::complex<double> *b, std::int64_t ldb, std::complex<double> beta,
std::complex<double> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zsyr2k_usm_sycl(
queue, upper_lower, trans, n, k, alpha, a, lda, b, ldb, beta, c, ldc, dependencies);
}
cl::sycl::event trmm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m,
std::int64_t n, float alpha, const float *a, std::int64_t lda, float *b,
std::int64_t ldb,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_strmm_usm_sycl(queue, left_right, upper_lower, trans,
unit_diag, m, n, alpha, a, lda, b, ldb,
dependencies);
}
cl::sycl::event trmm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m,
std::int64_t n, double alpha, const double *a, std::int64_t lda, double *b,
std::int64_t ldb,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dtrmm_usm_sycl(queue, left_right, upper_lower, trans,
unit_diag, m, n, alpha, a, lda, b, ldb,
dependencies);
}
cl::sycl::event trmm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m,
std::int64_t n, std::complex<float> alpha, const std::complex<float> *a,
std::int64_t lda, std::complex<float> *b, std::int64_t ldb,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ctrmm_usm_sycl(queue, left_right, upper_lower, trans,
unit_diag, m, n, alpha, a, lda, b, ldb,
dependencies);
}
cl::sycl::event trmm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m,
std::int64_t n, std::complex<double> alpha, const std::complex<double> *a,
std::int64_t lda, std::complex<double> *b, std::int64_t ldb,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ztrmm_usm_sycl(queue, left_right, upper_lower, trans,
unit_diag, m, n, alpha, a, lda, b, ldb,
dependencies);
}
cl::sycl::event trsm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m,
std::int64_t n, float alpha, const float *a, std::int64_t lda, float *b,
std::int64_t ldb,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_strsm_usm_sycl(queue, left_right, upper_lower, trans,
unit_diag, m, n, alpha, a, lda, b, ldb,
dependencies);
}
cl::sycl::event trsm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m,
std::int64_t n, double alpha, const double *a, std::int64_t lda, double *b,
std::int64_t ldb,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dtrsm_usm_sycl(queue, left_right, upper_lower, trans,
unit_diag, m, n, alpha, a, lda, b, ldb,
dependencies);
}
cl::sycl::event trsm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m,
std::int64_t n, std::complex<float> alpha, const std::complex<float> *a,
std::int64_t lda, std::complex<float> *b, std::int64_t ldb,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ctrsm_usm_sycl(queue, left_right, upper_lower, trans,
unit_diag, m, n, alpha, a, lda, b, ldb,
dependencies);
}
cl::sycl::event trsm(oneapi::mkl::device libkey, cl::sycl::queue &queue, side left_right,
uplo upper_lower, transpose trans, diag unit_diag, std::int64_t m,
std::int64_t n, std::complex<double> alpha, const std::complex<double> *a,
std::int64_t lda, std::complex<double> *b, std::int64_t ldb,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_ztrsm_usm_sycl(queue, left_right, upper_lower, trans,
unit_diag, m, n, alpha, a, lda, b, ldb,
dependencies);
}
cl::sycl::event gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose *transa,
transpose *transb, std::int64_t *m, std::int64_t *n, std::int64_t *k,
float *alpha, const float **a, std::int64_t *lda, const float **b,
std::int64_t *ldb, float *beta, float **c, std::int64_t *ldc,
std::int64_t group_count, std::int64_t *group_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_sgemm_batch_group_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc, group_count,
group_size, dependencies);
}
cl::sycl::event gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose *transa,
transpose *transb, std::int64_t *m, std::int64_t *n, std::int64_t *k,
double *alpha, const double **a, std::int64_t *lda, const double **b,
std::int64_t *ldb, double *beta, double **c, std::int64_t *ldc,
std::int64_t group_count, std::int64_t *group_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dgemm_batch_group_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc, group_count,
group_size, dependencies);
}
cl::sycl::event gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose *transa,
transpose *transb, std::int64_t *m, std::int64_t *n, std::int64_t *k,
std::complex<float> *alpha, const std::complex<float> **a,
std::int64_t *lda, const std::complex<float> **b, std::int64_t *ldb,
std::complex<float> *beta, std::complex<float> **c, std::int64_t *ldc,
std::int64_t group_count, std::int64_t *group_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_cgemm_batch_group_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc, group_count,
group_size, dependencies);
}
cl::sycl::event gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose *transa,
transpose *transb, std::int64_t *m, std::int64_t *n, std::int64_t *k,
std::complex<double> *alpha, const std::complex<double> **a,
std::int64_t *lda, const std::complex<double> **b, std::int64_t *ldb,
std::complex<double> *beta, std::complex<double> **c, std::int64_t *ldc,
std::int64_t group_count, std::int64_t *group_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zgemm_batch_group_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc, group_count,
group_size, dependencies);
}
cl::sycl::event gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k,
float alpha, const float *a, std::int64_t lda, std::int64_t stride_a,
const float *b, std::int64_t ldb, std::int64_t stride_b, float beta,
float *c, std::int64_t ldc, std::int64_t stride_c,
std::int64_t batch_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_sgemm_batch_strided_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, stride_a, b, ldb, stride_b, beta, c, ldc,
stride_c, batch_size, dependencies);
}
cl::sycl::event gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k,
double alpha, const double *a, std::int64_t lda, std::int64_t stride_a,
const double *b, std::int64_t ldb, std::int64_t stride_b, double beta,
double *c, std::int64_t ldc, std::int64_t stride_c,
std::int64_t batch_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dgemm_batch_strided_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, stride_a, b, ldb, stride_b, beta, c, ldc,
stride_c, batch_size, dependencies);
}
cl::sycl::event gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k,
std::complex<float> alpha, const std::complex<float> *a,
std::int64_t lda, std::int64_t stride_a, const std::complex<float> *b,
std::int64_t ldb, std::int64_t stride_b, std::complex<float> beta,
std::complex<float> *c, std::int64_t ldc, std::int64_t stride_c,
std::int64_t batch_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_cgemm_batch_strided_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, stride_a, b, ldb, stride_b, beta, c, ldc,
stride_c, batch_size, dependencies);
}
cl::sycl::event gemm_batch(oneapi::mkl::device libkey, cl::sycl::queue &queue, transpose transa,
transpose transb, std::int64_t m, std::int64_t n, std::int64_t k,
std::complex<double> alpha, const std::complex<double> *a,
std::int64_t lda, std::int64_t stride_a, const std::complex<double> *b,
std::int64_t ldb, std::int64_t stride_b, std::complex<double> beta,
std::complex<double> *c, std::int64_t ldc, std::int64_t stride_c,
std::int64_t batch_size,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zgemm_batch_strided_usm_sycl(
queue, transa, transb, m, n, k, alpha, a, lda, stride_a, b, ldb, stride_b, beta, c, ldc,
stride_c, batch_size, dependencies);
}
cl::sycl::event gemmt(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose transa, transpose transb, std::int64_t n, std::int64_t k,
float alpha, const float *a, std::int64_t lda, const float *b,
std::int64_t ldb, float beta, float *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_sgemmt_usm_sycl(queue, upper_lower, transa, transb, n,
k, alpha, a, lda, b, ldb, beta, c, ldc,
dependencies);
}
cl::sycl::event gemmt(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose transa, transpose transb, std::int64_t n, std::int64_t k,
double alpha, const double *a, std::int64_t lda, const double *b,
std::int64_t ldb, double beta, double *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_dgemmt_usm_sycl(queue, upper_lower, transa, transb, n,
k, alpha, a, lda, b, ldb, beta, c, ldc,
dependencies);
}
cl::sycl::event gemmt(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose transa, transpose transb, std::int64_t n, std::int64_t k,
std::complex<float> alpha, const std::complex<float> *a, std::int64_t lda,
const std::complex<float> *b, std::int64_t ldb, std::complex<float> beta,
std::complex<float> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_cgemmt_usm_sycl(queue, upper_lower, transa, transb, n,
k, alpha, a, lda, b, ldb, beta, c, ldc,
dependencies);
}
cl::sycl::event gemmt(oneapi::mkl::device libkey, cl::sycl::queue &queue, uplo upper_lower,
transpose transa, transpose transb, std::int64_t n, std::int64_t k,
std::complex<double> alpha, const std::complex<double> *a, std::int64_t lda,
const std::complex<double> *b, std::int64_t ldb, std::complex<double> beta,
std::complex<double> *c, std::int64_t ldc,
const cl::sycl::vector_class<cl::sycl::event> &dependencies) {
return function_tables[libkey].row_major_zgemmt_usm_sycl(queue, upper_lower, transa, transb, n,
k, alpha, a, lda, b, ldb, beta, c, ldc,
dependencies);
}
} //namespace detail
} //namespace row_major
} //namespace blas
} //namespace mkl
} //namespace oneapi
| 328,380 | 120,808 |
namespace boost
{
namespace filesystem
{
class path;
}
}
namespace futurehead
{
class node_flags;
}
namespace futurehead_daemon
{
class daemon
{
public:
void run (boost::filesystem::path const &, futurehead::node_flags const & flags);
};
}
| 243 | 81 |
#include "utils.h"
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
static char* mem_start_brk;
static char* mem_brk;
static char* mem_max_addr;
void mem_init() {
if ((mem_start_brk = (char*)malloc(MAX_HEAP)) == NULL) {
fprintf(stderr, "mem_init error\n");
exit(1);
}
mem_max_addr = mem_start_brk + MAX_HEAP;
mem_brk = mem_start_brk;
}
void mem_deinit() {
free(mem_start_brk);
}
void mem_reset_brk() {
mem_brk = mem_start_brk;
}
void* mem_sbrk(int incr) {
char* old_brk = mem_brk;
if ((incr < 0) || ((mem_brk + incr) > mem_max_addr)) {
errno = ENOMEM;
fprintf(stderr, "ERROR: mem_sbrk failed. Ran out of memory...\n");
return (void*)-1;
}
mem_brk += incr;
return (void*)old_brk;
}
void* mem_heap_lo() {
return (void*)mem_start_brk;
}
void* mem_heap_hi() {
return (void*)(mem_brk - 1);
}
size_t mem_heapsize() {
return (size_t)(mem_brk - mem_start_brk);
}
| 1,009 | 448 |
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>
#include <string.h>
#include <array>
#include <iterator>
#define pb push_back
#define up upper_bound
#define lp lower_bound
using namespace std;
int main() {
int cnt = 0;
string inp;
cin>>inp;
for (int i = 0 , s = inp.size() ; i < s; ++i)
if((inp[i] == '4') || inp[i] == '7')
cnt++;
if(cnt == 7 || cnt == 4)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
return 0;
}
| 457 | 207 |
#include "Sandbox2D.h"
#include "imgui/imgui.h"
#include <glm/gtc/type_ptr.hpp>
#include<sstream>
Hazel::Ref<Hazel::Texture2D> logo;
float frametime = 1.f;
Sandbox2D::Sandbox2D()
: Layer("Sandbox2D"), m_CameraController(1280.f / 720.f)
{
}
void Sandbox2D::OnAttach()
{
HZ_PROFILE_FUNCTION();
m_CheckerTexture = Hazel::Texture2D::Create("assets/Checkerboard.png");
logo = Hazel::Texture2D::Create("assets/HazelLogo.png");
}
void Sandbox2D::OnDetach()
{
}
void Sandbox2D::OnUpdate(Hazel::Timestep ts)
{
frametime = ts.GetSeconds();
HZ_PROFILE_FUNCTION();
// Update
m_CameraController.OnUpdate(ts);
if (Hazel::Input::IsMouseButtonPressed(0))
{
std::stringstream ss;
auto [x, y] = Hazel::Input::GetMousePosition();
ss << "Mouse X:" << x << ", Y: " << y << std::endl;
}
// Render
Hazel::Renderer2D::ResetStats();
{
HZ_PROFILE_SCOPE("Sandbox::Render Prep");
Hazel::RenderCommand::SetClearColor({ 0.1f, 0.1f, 0.1f, 1 });
Hazel::RenderCommand::Clear();
Hazel::Renderer2D::BeginScene(m_CameraController.GetCamera());
}
Hazel::Renderer2D::EndScene();
Hazel::Renderer2D::BeginScene(m_CameraController.GetCamera());
for (float y = -5.f; y < 5.0f; y +=1.0f)
{
for (float x = -5.f; x < 5.0f; x += 1.0f)
{
glm::vec4 col = { (x + 5.f) / 10.f, (y + 5.f) / 10.f, 0.6f, 0.7f };
Hazel::Renderer2D::DrawQuad({ x, y, 1.0f }, glm::vec2(0.95f), col);
}
}
Hazel::Renderer2D::EndScene();
}
void Sandbox2D::OnImGuiRender()
{
ImGui::Begin("Settings");
ImGui::Text("FPS : %f", 1.f / frametime);
auto stats = Hazel::Renderer2D::GetStats();
ImGui::DragFloat3("Pos", glm::value_ptr(m_SpritePos), 0.01f);
ImGui::DragFloat2("Size", glm::value_ptr(m_SpriteSize), 0.01f);
ImGui::Text("Renderer2D stats : ");
ImGui::Text("Draw calls : %d", stats.DrawCalls);
ImGui::Text("Quads : %d", stats.QuadCount);
ImGui::Text("Vertices : %d", stats.GetTotalVertexCount());
ImGui::Text("Indices : %d", stats.GetTotalIndexCount());
ImGui::ColorEdit4("Square Color", glm::value_ptr(m_SquareColor));
ImGui::End();
/// ------ DOCKSPACE
static bool dockspaceOpen = true;
static bool opt_fullscreen_persistant = true;
bool opt_fullscreen = opt_fullscreen_persistant;
static ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_None;
// We are using the ImGuiWindowFlags_NoDocking flag to make the parent window not dockable into,
// because it would be confusing to have two docking targets within each others.
ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking;
if (opt_fullscreen)
{
ImGuiViewport* viewport = ImGui::GetMainViewport();
ImGui::SetNextWindowPos(viewport->Pos);
ImGui::SetNextWindowSize(viewport->Size);
ImGui::SetNextWindowViewport(viewport->ID);
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
window_flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove;
window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus;
}
// When using ImGuiDockNodeFlags_PassthruCentralNode, DockSpace() will render our background and handle the pass-thru hole, so we ask Begin() to not render a background.
if (dockspace_flags & ImGuiDockNodeFlags_PassthruCentralNode)
window_flags |= ImGuiWindowFlags_NoBackground;
// Important: note that we proceed even if Begin() returns false (aka window is collapsed).
// This is because we want to keep our DockSpace() active. If a DockSpace() is inactive,
// all active windows docked into it will lose their parent and become undocked.
// We cannot preserve the docking relationship between an active window and an inactive docking, otherwise
// any change of dockspace/settings would lead to windows being stuck in limbo and never being visible.
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
ImGui::Begin("DockSpace Demo", &dockspaceOpen, window_flags);
ImGui::PopStyleVar();
if (opt_fullscreen)
ImGui::PopStyleVar(2);
// DockSpace
ImGuiIO& io = ImGui::GetIO();
if (io.ConfigFlags & ImGuiConfigFlags_DockingEnable)
{
ImGuiID dockspace_id = ImGui::GetID("MyDockSpace");
ImGui::DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), dockspace_flags);
}
if (ImGui::BeginMenuBar())
{
if (ImGui::BeginMenu("File"))
{
// Disabling fullscreen would allow the window to be moved to the front of other windows,
// which we can't undo at the moment without finer window depth/z control.
//ImGui::MenuItem("Fullscreen", NULL, &opt_fullscreen_persistant);
if (ImGui::MenuItem("Exit"))
{
Hazel::Application::Get().Close();
}
ImGui::EndMenu();
}
ImGui::EndMenuBar();
}
ImGui::End();
}
void Sandbox2D::OnEvent(Hazel::Event& e)
{
m_CameraController.OnEvent(e);
} | 4,827 | 1,903 |
auto desyncio = []()
{
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
return nullptr;
}();
// ALG: sort
//
bool mySort(pair<int,int> a, pair<int,int> b){
if(a.first != b.first) return a.first > b.first;
return a.second < b.second;
}
class Solution {
public:
vector<pair<int, int>> reconstructQueue(vector<pair<int, int>>& people) {
vector<pair<int, int>> ans;
sort(people.begin(), people.end(), mySort);
for(auto p : people) {
ans.insert(ans.begin() + p.second, p);
}
return ans;
}
};
| 579 | 213 |
#include "SubstractiveSynthParams.h"
SubstractiveSynthParams::SubstractiveSynthParams() : PatchParams()
{
//AddParam("SYNTH.Filter Type", 0, {"LowPass", "BandPass", "HighPass", "Notch"});
//AddParam("SYNTH.Filter Cutoff", 180.0f, 0.0f, 180.0f, 100.f); // because filter type is default to LowPass, set cutoff on higher frequencey (pitch)
//AddParam("SYNTH.Filter Reso", 0.0f, 0.0f, 1.0f);
//AddParam("SYNTH.Filter LFO WF", 0.0f, {"sine","triangle", "saw", "square"});
//AddParam("SYNTH.Filter LFO Freq", 1.0f, 0.0f, 30.0f);
//AddParam("SYNTH.Filter LFO Amp", 0.0f, 0.0f, 40.0f);
//AddParam("OSC1.Detune", 0.0f, -12.0f, 12.0f);
//AddParam("OSC1.Fine", 0.0f, -1.0f, 1.0f, 50.f, ParamDesc::Layouts::SameLine);
//AddParam("OSC1.Level", 0.5f, 0.0f, 1.0f, 50.f, ParamDesc::Layouts::SameLine);
//AddParam("OSC1.PW", 0.5f, 0.1f, 0.9f, 50.f, ParamDesc::Layouts::SameLine);
//AddParam("OSC1.Sine", 1.0f, 0.0f, 1.0f);
//AddParam("OSC1.Triangle", 0.0f, 0.0f, 1.0f, 50.f, ParamDesc::Layouts::SameLine);
//AddParam("OSC1.Saw", 0.0f, 0.0f, 1.0f, 50.f, ParamDesc::Layouts::SameLine);
//AddParam("OSC1.Pulse", 0.0f, 0.0f, 1.0f, 50.f, ParamDesc::Layouts::SameLine);
//AddParam("OSC1.Noise", 0.0f, 0.0f, 0.5f, 50.f, ParamDesc::Layouts::SameLine);
//AddParam("OSC1.A", 10.0f, 0.0f, 3000.0f);
//AddParam("OSC1.D", 200.0f, 0.0f, 3000.0f, 50.f, ParamDesc::Layouts::SameLine);
//AddParam("OSC1.S", 0.5f, 0.0f, 1.0f, 50.f, ParamDesc::Layouts::SameLine);
//AddParam("OSC1.R", 400.0f, 0.0f, 3000.0f, 50.f, ParamDesc::Layouts::SameLine);
//AddParam("OSC1.LFO Sine", 1.0f, 0.0f, 1.0f);
//AddParam("OSC1.LFO Triangle", 0.0f, 0.0f, 1.0f, 50.f, ParamDesc::Layouts::SameLine);
//AddParam("OSC1.LFO Saw", 0.0f, 0.0f, 1.0f, 50.f, ParamDesc::Layouts::SameLine);
//AddParam("OSC1.LFO Square", 0.0f, 0.0f, 1.0f, 50.f, ParamDesc::Layouts::SameLine);
//AddParam("OSC1.LFO Freq", 1.0f, 0.0f, 30.0f);
//AddParam("OSC1.LFO Pitch", 0.0f, 0.0f, 20.0f, 50.f, ParamDesc::Layouts::SameLine);
//AddParam("OSC1.LFO Level", 0.0f, 0.0f, 1.0f, 50.f, ParamDesc::Layouts::SameLine);
//AddParam("OSC1.LFO PW", 0.0f, 0.0f, 0.5f, 50.f, ParamDesc::Layouts::SameLine);
//AddParam("Voice2.Level", 0.5f, 0.0f, 1.0f);
//AddParam("Voice2.Detune", 0.0f, -12.0f, 12.0f);
//AddParam("Voice2.Fine", 0.0f, -1.0f, 1.0f);
//AddParam("Voice2.PW", 0.5f, 0.1f, 0.9f);
//AddParam("Voice2.Sine", 1.0f, 0.0f, 1.0f);
//AddParam("Voice2.Triangle", 0.0f, 0.0f, 1.0f);
//AddParam("Voice2.Saw", 0.0f, 0.0f, 1.0f);
//AddParam("Voice2.Pulse", 0.0f, 0.0f, 1.0f);
//AddParam("Voice2.Noise", 0.0f, 0.0f, 1.0f);
//AddParam("Voice2.A", 10.0f, 0.0f, 3000.0f);
//AddParam("Voice2.D", 200.0f, 0.0f, 3000.0f);
//AddParam("Voice2.S", 0.5f, 0.0f, 1.0f);
//AddParam("Voice2.R", 400.0f, 0.0f, 3000.0f);
//AddParam("Voice2.Filter.Mode", 0, { "LowPass", "BandPass", "HighPass", "Notch" });
//AddParam("Voice2.Filter.Cutoff", 180.0f, 0.0f, 180.0f);
//AddParam("Voice2.Filter.Reso", 0.0f, 0.0f, 1.0f);
//AddParam("Voice2.Filter.A", 10.0f, 0.0f, 3000.0f);
//AddParam("Voice2.Filter.D", 200.0f, 0.0f, 3000.0f);
//AddParam("Voice2.Filter.S", 0.5f, 0.0f, 1.0f);
//AddParam("Voice2.Filter.R", 400.0f, 0.0f, 3000.0f);
//AddParam("Voice2.ADSR.Level", 0.0f, 0.0f, 180.0f);
}
SubstractiveSynthParams::~SubstractiveSynthParams()
{
}
| 3,344 | 1,976 |
#ifndef NORMAL_HPP
#define NORMAL_HPP
#include <memory>
#include <vector>
#include <map>
#include <muse_smc/samples/sample_set.hpp>
namespace muse_smc {
template<typename state_space_description_t>
class NormalSampling
{
public:
using Ptr = std::shared_ptr<NormalSampling>;
using sample_t = typename state_space_description_t::sample_t;
using state_t = typename state_space_description_t::state_t;
using covariance_t = typename state_space_description_t::covariance_t;
using sample_set_t = SampleSet<state_space_description_t>;
inline NormalSampling()
{
}
virtual ~NormalSampling() = default;
virtual bool apply(const state_t &state,
const covariance_t &covariance,
sample_set_t &sample_set) = 0;
virtual bool update(const std::string &frame) = 0;
};
}
#endif // NORMAL_HPP
| 921 | 304 |
#include <string>
string gcdOfStrings(string str1, string str2) {
string s = "";
if( (str1+str2) != (str2+str1) ) {
s = "";
}
else if(str1 == str2) {
s = str1;
}
else if(str1.size() > str2.size()) {
s = gcdOfStrings(str1.substr(str2.size(), str1.size()-1), str2);
}
else if(str2.size() > str1.size()) {
s = gcdOfStrings(str2.substr(str1.size(), str2.size()-1), str1);
}
return s;
} | 454 | 187 |
//Binary search - Recursive method
#include <stdio.h>
#define MAX 1000
int binarySearch(int ar[], int l, int r, int search)
{
if (l<=r)
{
int mid = (l+r)/2;
if (ar[mid] == search) // we have found our search element
return mid;
else if (ar[mid] > search) // the element must be present in the left subarray
binarySearch(ar, l, mid-1, search);
else
binarySearch(ar, mid+1, r, search); // the element must be present in the right subarray
}
return -1;
}
int main()
{
int N, i, key;
int ar[MAX];
printf ("Enter no of integers in the array:\n");
scanf ("%d", &N);
printf ("\nEnter the elements in a sorted array:\n");
for (i=0; i<N; i++)
{
scanf ("%d", &ar[i]);
}
printf ("\nEnter the element to search:\n");
scanf ("%d", &key);
int pos = binarySearch(ar, 0, N-1, key);
if (pos == -1)
printf ("%d is not present in the array!", key);
else
printf ("%d is present at index %d", key, pos);
return 0;
}
| 974 | 387 |
#include<stdio.h>
#include<vector>
#include<iostream>
#include<algorithm>
#include<map>
#define getMin(a,b) ((a<b)?(a):(b))
#define getMax(a,b) ((a>b)?(a):(b))
#define MAX 100009
using namespace std;
typedef pair<int,int> pn;
vector<int>edge[MAX];
int dc,n,m;
int disTime[MAX+7],level[MAX+7],degree[MAX+7];
void reset();
void addEdge(int u,int v);
void dfsCont(int u,int par);
void fillUpDegree();
int getAns();
int main()
{
int t,cas=1,a,b;
for(scanf("%d",&t);cas<=t;cas++)
{
dc=1;
scanf("%d%d",&n,&m);
reset();
for(int i=0;i<m;i++)
scanf("%d%d",&a,&b),addEdge(a,b);
dfsCont(0,0);
fillUpDegree();
int res=getAns();
printf("Case %d: %d\n",cas,res);
}
return 0;
}
void reset()
{
for(int i=0;i<n+5;i++)
{
edge[i].clear(),disTime[i]=0,level[i]=0,degree[i]=0;
}
}
void addEdge(int u,int v)
{
edge[u].push_back(v);
edge[v].push_back(u);
}
void dfsCont(int u,int par) //DFS counting
{
disTime[u]=level[u]=dc++;
for(int i=0;i<edge[u].size();i++)
{
int v=edge[u][i];
if(v==par) continue;
if(disTime[v]==0)
{
dfsCont(v,u);
level[u]=getMin(level[u],level[v]);
}
else if(level[u]>level[v])
{
level[u]=level[v];
}
}
}
void fillUpDegree()
{
for(int u=0;u<n;u++)
for(int i=0;i<edge[u].size();i++)
{
int v=edge[u][i];
if(level[u]!=level[v]) // a bridge Bridge
degree[level[u]]++;
}
}
int getAns()
{
int cnt=0;
for(int i=0;i<=n;i++)
if(degree[i]==1)
cnt++;
return (cnt+1)/2;
}
| 1,817 | 798 |
//==============================================================================
///
/// File: EdLevelGroup.cpp
///
/// Copyright (C) 2000-2014 by Smells Like Donkey Software Inc. All rights reserved.
///
/// This file is subject to the terms and conditions defined in
/// file 'LICENSE.txt', which is part of this source code package.
///
//==============================================================================
// Editor include
#include "EdLevelGroup.hpp"
#include "EdLevelScriptNodeStandard.hpp"
// Qt include
#include <QtGui/QPainter>
#include <QtGui/QMouseEvent>
// Engine includes
#include "DT3Core/Types/Base/BaseInclude.hpp"
#include "DT3Core/Types/Node/Group.hpp"
#include "DT3Core/Types/Math/MoreMath.hpp"
//==============================================================================
//==============================================================================
const float EdLevelGroup::SHADOW_OFFSET_X = 5.0F;
const float EdLevelGroup::SHADOW_OFFSET_Y = 5.0F;
//==============================================================================
//==============================================================================
EdLevelGroup::EdLevelGroup(std::shared_ptr<Group> group)
: _title_font ("Arial", 15)
{
setFlag(QGraphicsItem::ItemIsSelectable);
//setFlag(QGraphicsItem::ItemIsMovable);
_group = group;
}
EdLevelGroup::~EdLevelGroup(void)
{
}
void EdLevelGroup::setBoundingRect (const QRectF &rect)
{
prepareGeometryChange();
setPos(rect.x(), rect.y());
_bounding_rect = rect;
_bounding_rect.translate(-_bounding_rect.x(), -_bounding_rect.y());
}
//QPainterPath EdLevelGroup::shape (void) const
//{
// return QPainterPath();
//}
//==============================================================================
//==============================================================================
void EdLevelGroup::paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
painter->setRenderHint(QPainter::Antialiasing, true);
const DTint TITLE_HEIGHT = 20;
Color4f c = _group->group_color();
if (isSelected()) {
painter->setPen(QPen(QColor(53,120,255,255),3,Qt::SolidLine));
} else {
painter->setPen(QPen(QColor(50,50,50,64),3,Qt::SolidLine));
}
painter->setClipping (true);
painter->setClipRect(QRectF(0,TITLE_HEIGHT,_bounding_rect.width(), _bounding_rect.height() - TITLE_HEIGHT));
painter->setBrush(QBrush(QColor( MoreMath::max(0,c.r_as_byte()-60),
MoreMath::max(0,c.g_as_byte()-60),
MoreMath::max(0,c.b_as_byte()-60),
64)));
painter->drawRoundedRect(_bounding_rect, 5, 5);
painter->setClipRect(QRectF(0,0,_bounding_rect.width(), TITLE_HEIGHT));
painter->setBrush(QBrush(QColor( MoreMath::max(0,c.r_as_byte()-30),
MoreMath::max(0,c.g_as_byte()-30),
MoreMath::max(0,c.b_as_byte()-30),
64)));
painter->drawRoundedRect(_bounding_rect, 5, 5);
painter->setPen(QPen(QColor(40,40,40,255),1));
painter->setFont ( _title_font);
painter->drawText( QRectF(10,0,_bounding_rect.width(), TITLE_HEIGHT), Qt::AlignLeft | Qt::AlignVCenter, _group->name().c_str() );
painter->setClipping (false);
}
//==============================================================================
//==============================================================================
bool EdLevelGroup::checkClick (const QPointF &scene_pos, const QPointF &global_pos)
{
if ( _bounding_rect.contains(mapFromScene(scene_pos)) )
return true;
return false;
}
bool EdLevelGroup::handleClick (const QPointF &scene_pos, const QPointF &global_pos)
{
return false;
}
//==============================================================================
//==============================================================================
//#include "moc_EdLevelScriptPlugConnection.cpp"
| 4,202 | 1,384 |
//==================================================================================================
/*!
@file
Copyright 2016 NumScale SAS
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
//==================================================================================================
#ifndef BOOST_SIMD_FUNCTION_IF_ELSE_HPP_INCLUDED
#define BOOST_SIMD_FUNCTION_IF_ELSE_HPP_INCLUDED
#if defined(DOXYGEN_ONLY)
namespace boost { namespace simd
{
/*!
@ingroup group-boolean
Function object implementing if_else capabilities
If cond is @ref True returns t else returns f
If vectors, the types involved in the call must share the same number of elements.
@par Semantic:
For every parameters @c c of type @c C, @c t and @c f of type @c T:
@code
T r = if_else(cond,t,f);
@endcode
is similar to:
@code
T r = cond ? t : f;
@endcode
@see if_else_zero, if_else_allbits, if_zero_else,
if_allbits_else, if_one_else_zero, if_zero_else_one, bitwise_select
**/
Value if_else(Value const& c, Value const& v0);
//@overload
Value if_else(LogicalValue const& c, Value const& v0);
} }
#endif
#include <boost/simd/function/scalar/if_else.hpp>
#include <boost/simd/function/simd/if_else.hpp>
#endif
| 1,365 | 466 |
//
// Game_State.cpp
// game
//
// Created by Donald Clark on 11/9/13.
//
//
#include "Game_State.h"
#include "Utility.h"
#include "Atmosphere.h"
#include "Atmosphere_Factory.h"
#include "Environment.h"
#include "Environment_Factory.h"
#include "Terrain.h"
#include "Terrain_Factory.h"
#include "Npc.h"
#include "Npc_Factory.h"
#include "Player.h"
#include "Percent_Bar.h"
#include "Player_Factory.h"
#include "Map_Manager.h"
#include "Crystal.h"
#include "Spawn_Menu.h"
#include "Heal_Circle.h"
#include <utility>
#include <fstream>
#include <map>
#include <vector>
#include <random>
#include <sstream>
using namespace Zeni;
using namespace Zeni::Collision;
using std::stringstream;
using std::make_pair;
using std::cout;
using std::string;
using std::getline;
using std::ifstream;
using std::bad_exception;
using std::to_string;
using std::map;
using std::vector;
using std::cerr;
using std::endl;
using std::to_string;
using std::random_device;
using std::mt19937;
using std::uniform_int_distribution;
using std::istringstream;
Player_Wrapper::Player_Wrapper(Player *player_, const int &uid_)
: player(player_),
uid(uid_),
select_pressed(false),
spawn_time_left("")
{}
Player_Wrapper::~Player_Wrapper() {
if (player != nullptr) delete player;
}
Player_Info::Player_Info(const Zeni::Point2f &start_position_,
const Team &team_,
Spawn_Menu * spawn_menu_)
: crystal_bar(Point2f(), Vector2f(32.0f, 2.0f)),
crystal_info("crystal"),
start_position(start_position_),
spawn_menu(spawn_menu_),
team(team_),
up_axis_released(false),
down_axis_released(false)
{}
Player_Info::~Player_Info() {
if (spawn_menu != nullptr)
delete spawn_menu;
}
Game_State::Game_State(const std::string &file_)
: crystals_in_play(0),
gameover(false),
vbo_ptr_floor(new Vertex_Buffer),
vbo_ptr_lower(new Vertex_Buffer),
vbo_ptr_middle(new Vertex_Buffer),
box("selection"),
dodge("dodge"),
dodge_button("LB"),
special_button("LT"),
divider(Point2f(), Vector2f(2.0f, 2.0f), "white_bar"),
skill_indicator(Point2f(), Vector2f(32.0f, 2.0f), "white_bar"),
health_indicator(Point2f(), Vector2f(32.0f, 2.0f)),
heal_circles(4, nullptr)
{
// set up function pointers for split screen methods
screen_coord_map.push_back(&get_top_left_screen);
screen_coord_map.push_back(&get_bottom_left_screen);
screen_coord_map.push_back(&get_top_right_screen);
screen_coord_map.push_back(&get_bottom_right_screen);
// load map from the input file
load_map(file_);
}
Game_State::~Game_State() {
for (auto it = grasss.begin(); it != grasss.end(); ++it)
if (*it != nullptr) delete *it;
for (auto it = terrains.begin(); it != terrains.end(); ++it)
if (*it != nullptr) delete *it;
for (auto it = atmospheres.begin(); it != atmospheres.end(); ++it)
if (*it != nullptr) delete *it;
for (auto it = environments.begin(); it != environments.end(); ++it)
if (*it != nullptr) delete *it;
for (auto it = collidable_environments.begin(); it != collidable_environments.end(); ++it)
if (*it != nullptr) delete *it;
for (auto it = projectiles.begin(); it != projectiles.end(); ++it)
if (*it != nullptr) delete *it;
for (auto it = player_wrappers.begin(); it != player_wrappers.end(); ++it)
if (*it != nullptr) delete *it;
for (auto it = player_infos.begin(); it != player_infos.end(); ++it)
if (*it != nullptr) delete *it;
for (auto it = npcs.begin(); it != npcs.end(); ++it)
if (*it != nullptr) delete *it;
for (auto it = crystals.begin(); it != crystals.end(); ++it)
if (*it != nullptr) delete *it;
delete vbo_ptr_floor;
delete vbo_ptr_lower;
delete vbo_ptr_middle;
}
void Game_State::perform_logic() {
// check if a team won
for (auto& score : scores) {
if (score.second >= WIN_CRYSTAL_COUNT) {
if (!game_over_timer.is_running()) game_over_timer.start();
return;
}
}
// calculate game time
const Time_HQ current_time = get_Timer_HQ().get_time();
float processing_time = float(current_time.get_seconds_since(time_passed));
time_passed = current_time;
float time_step = processing_time;
for (auto npc : npcs)
npc->set_hold_a(false);
// iterate through each player, updating its state
for (auto player_wrapper : player_wrappers) {
// get controls for each player
Controls input = player_infos[player_wrapper->uid]->controls;
player_infos[player_wrapper->uid]->controls.start = false;
// pausing logic
if (input.start) {
if (!player_infos[player_wrapper->uid]->pause_timer.is_running()) {
get_Game().push_Popup_Menu_State();
player_infos[player_wrapper->uid]->pause_timer.start();
}
}
// fix the timer for pausing
if (player_infos[player_wrapper->uid]->pause_timer.is_running()) {
if (player_infos[player_wrapper->uid]->pause_timer.seconds() > 0.25f) {
player_infos[player_wrapper->uid]->pause_timer.stop();
player_infos[player_wrapper->uid]->pause_timer.reset();
}
}
if (!player_wrapper->player->can_respawn()) {
int count_down = ceil(5.0f - player_wrapper->player->get_spawn_time());
player_wrapper->spawn_time_left = String("Respawn in " + itoa(count_down));
player_wrapper->player->update_respawn_timer(time_step);
continue;
}
if (player_wrapper->player->is_dead()) {
float move_y = input.move_y;
if (move_y > 0.7f && player_infos[player_wrapper->uid]->down_axis_released) {
player_infos[player_wrapper->uid]->down_axis_released = false;
player_infos[player_wrapper->uid]->spawn_menu->move_down();
}
if (move_y < -0.7f && player_infos[player_wrapper->uid]->up_axis_released) {
player_infos[player_wrapper->uid]->up_axis_released = false;
player_infos[player_wrapper->uid]->spawn_menu->move_up();
}
if (move_y <= 0.2)
player_infos[player_wrapper->uid]->down_axis_released = true;
if (move_y >= -0.2)
player_infos[player_wrapper->uid]->up_axis_released = true;
if (input.A)
player_infos[player_wrapper->uid]->spawn_menu->select_current_option();
// if the player is dead, we skip rest of movement logic
continue;
}
if (input.back) {
player_wrapper->select_pressed = true;
continue;
}
else {
player_wrapper->select_pressed = false;
}
// if player is stunned, don't move or anything else
if (player_wrapper->player->is_stunned()) continue;
// check collision with terrain on movement for effects
float move_x, move_y;
bool is_in_circle = false;
for(auto heal_circle : heal_circles)
{
if(heal_circle == nullptr) continue;
if(!same_team(player_wrapper->player->get_team(), heal_circle->get_team()))
{
if(heal_circle->touching(*(player_wrapper->player)))
{
is_in_circle = true;
Point2f center = heal_circle->get_center();
Vector2f vec = player_wrapper->player->get_center() - center;
vec.normalize();
vec *= 3.0f;
move_x = vec.i;
move_y = vec.j;
break;
}
}
}
if(!is_in_circle)
{
move_x = input.move_x;
move_y = input.move_y;
}
// take away dead zones of joy stick
if (fabs(move_x) < .1f && fabs(move_y) < .1f) move_y = move_x = 0.0f;
bool is_submerged = false;
for (auto terrain : terrains) {
if (terrain->slow_player_down() && player_wrapper->player->touching_feet(*terrain)) {
move_x *= 0.5f;
move_y *= 0.5f;
is_submerged = true;
break;
}
}
player_wrapper->player->set_submerged(is_submerged);
// dodge logic for player
//player_wrapper->player->stop_dodge(time_step);
player_wrapper->player->update_dodge_timer(time_step);
if (input.LB || input.RB) {
if (!player_wrapper->player->is_dodging())
player_wrapper->player->dodge();
}
if (player_wrapper->player->is_dodging()) {
move_x *= 6.0f;
move_y *= 6.0f;
}
// check collision with environment/npc/player on movement
// first check boundary collision, then env, then npc, then oppo player
bool moved_back = false;
float delta_x = player_wrapper->player->get_position().x + move_x;
float delta_y = player_wrapper->player->get_position().y + move_y;
if ((move_x > 0.0f &&
delta_x < (dimension.width*UNIT_LENGTH - (UNIT_LENGTH - 1.0f))) ||
(move_x < 0.0f &&
delta_x > 0.0f))
{
// make an initial attempt at movement
player_wrapper->player->move_x(move_x, time_step, true);
for (auto environment : collidable_environments) {
if (player_wrapper->player->touching(*environment)) {
player_wrapper->player->move_x(-move_x, time_step, false);
moved_back = true;
break;
}
}
if (!moved_back) {
for (auto npc : npcs) {
if (player_wrapper->player->touching(*npc)) {
player_wrapper->player->move_x(-move_x, time_step, false);
moved_back = true;
break;
}
}
}
if (!moved_back) {
for (auto player_check : player_wrappers) {
if (player_check->player->is_dead() ||
same_team(player_wrapper->player->get_team(), player_check->player->get_team()))
{
continue;
}
if (player_wrapper->player->touching(*(player_check->player))) {
player_wrapper->player->move_x(-move_x, time_step, false);
break;
}
}
}
}
moved_back = false;
if ((move_y > 0.0f &&
delta_y < (dimension.height*UNIT_LENGTH - (UNIT_LENGTH - 1.0f))) ||
(move_y < 0.0f &&
delta_y > 0.0f))
{
// make an initial attempt at movement
player_wrapper->player->move_y(move_y, time_step, true);
for (auto environment : collidable_environments) {
if (player_wrapper->player->touching(*environment)) {
player_wrapper->player->move_y(-move_y, time_step, false);
moved_back = true;
break;
}
}
if (!moved_back) {
for (auto npc : npcs) {
if (player_wrapper->player->touching(*npc)) {
player_wrapper->player->move_y(-move_y, time_step, false);
moved_back = true;
break;
}
}
}
if (!moved_back) {
for (auto player_check : player_wrappers) {
if (player_check->player->is_dead() ||
same_team(player_wrapper->player->get_team(), player_check->player->get_team()))
{
continue;
}
if (player_wrapper->player->touching(*(player_check->player))) {
player_wrapper->player->move_y(-move_y, time_step, false);
break;
}
}
}
}
// directional logic for player
bool delta_facing = false;
Vector2f direction_vector(input.look_x, input.look_y);
if (direction_vector.magnitude() > 0.4f) { // deadzone for right stick; magnitude : [0,1]
player_wrapper->player->turn_to_face(direction_vector.theta());
delta_facing = true;
}
// attack logic for player
Vector2f move_direction(move_x, move_y);
if (input.attack && !is_submerged) {
// warrior melee sword attack
Weapon *melee = nullptr;
if (delta_facing) melee = player_wrapper->player->melee(direction_vector.theta());
else if (move_x == 0.0f && move_y == 0.0f) melee = player_wrapper->player->melee();
else melee = player_wrapper->player->melee(move_direction.theta());
if (melee != nullptr) {
for (auto player_check : player_wrappers) {
if (player_check->player->is_dead() ||
same_team(player_wrapper->player->get_team(), player_check->player->get_team()))
{
continue;
}
if (melee->touching(*(player_check->player)))
player_check->player->take_dmg(melee->get_damage());
}
melee->animation_timer.start();
melees.push_back(melee);
}
// archer/mage ranged attack
Weapon* projectile = nullptr;
if (delta_facing) projectile = player_wrapper->player->range(direction_vector.theta());
else if (move_x == 0.0f && move_y == 0.0f) projectile = player_wrapper->player->range();
else projectile = player_wrapper->player->range(move_direction.theta());
if (projectile != nullptr) projectiles.push_back(projectile);
}
Heal_Circle* heal_circle = nullptr;
heal_circle = player_wrapper->player->mage_spc_skill(input.LT, time_step);
heal_circles[player_wrapper->uid] = heal_circle;
if (input.LT)
{
Weapon* stun_arrow = nullptr;
if (delta_facing) stun_arrow = player_wrapper->player->archer_spc_skill(direction_vector.theta());
else if (move_x == 0.0f && move_y == 0.0f) stun_arrow = player_wrapper->player->archer_spc_skill();
else stun_arrow = player_wrapper->player->archer_spc_skill(move_direction.theta());
if (stun_arrow != nullptr)
projectiles.push_back(stun_arrow);
Weapon* shield = nullptr;
shield = player_wrapper->player->warrior_spc_skill();
if (shield != nullptr)
{
shield->animation_timer.start();
melees.push_back(shield);
}
}
// crystal depositing logic
for (auto npc : npcs) {
if (!input.A && same_team(npc->get_team(), player_wrapper->player->get_team()) && player_wrapper->player->has_crystal() && player_wrapper->player->pseudo_touching(*npc)) {
// Show information
npc->set_hold_a(true);
}
else {
npc->set_hold_a(false || npc->get_hold_a());
}
// Crystal logic
if (same_team(npc->get_team(), player_wrapper->player->get_team())) {
if (input.A && player_wrapper->player->has_crystal())
{
if (player_wrapper->player->pseudo_touching(*npc)) {
if (npc->can_deposit(player_wrapper->uid)) {
//touching = true;
if (!player_infos[player_wrapper->uid]->deposit_crystal_timer.is_running()) {
player_infos[player_wrapper->uid]->deposit_crystal_timer.reset();
player_infos[player_wrapper->uid]->deposit_crystal_timer.start();
npc->set_depositing(player_wrapper->uid);
}
else {
if (player_infos[player_wrapper->uid]->deposit_crystal_timer.seconds() > DEPOSIT_TIME) {
player_wrapper->player->drop_crystal();
++scores[player_wrapper->player->get_team()];
--crystals_in_play;
player_infos[player_wrapper->uid]->deposit_crystal_timer.stop();
// Done depositing
npc->set_depositing(-1);
}
npc->set_deposit_pctg(player_infos[player_wrapper->uid]->deposit_crystal_timer.seconds() / DEPOSIT_TIME);
//npc->set_depositing(player_wrapper->uid);
}
}
}
else if (player_infos[player_wrapper->uid]->deposit_crystal_timer.is_running()) {
// Stopped depositing
player_infos[player_wrapper->uid]->deposit_crystal_timer.stop();
npc->set_depositing(-1);
}
}
else if (player_infos[player_wrapper->uid]->deposit_crystal_timer.is_running()) {
// Stopped depositing
player_infos[player_wrapper->uid]->deposit_crystal_timer.stop();
npc->set_depositing(-1);
}
}
}
// crystal pick up logic
for (auto crystal = crystals.begin(); crystal != crystals.end();) {
if (player_wrapper->player->touching(**crystal)) {
player_wrapper->player->pick_up_crystal();
delete *crystal;
crystal = crystals.erase(crystal);
} else {
++crystal;
}
}
}
// cloud movement logic
for (auto atmosphere : atmospheres) {
atmosphere->update(time_step);
if (atmosphere->get_position().x + atmosphere->get_size().x >= dimension.width*UNIT_LENGTH) {
Point2f pos = atmosphere->get_position();
pos.x = 0.0f;
atmosphere->set_position(pos);
}
}
// iterate through each melee weapon, updating it
for (auto melee = melees.begin(); melee != melees.end();) {
if ((*melee)->animation_over())
{
(*melee)->remove_from_owner();
delete *melee;
melee = melees.erase(melee);
}
else
melee++;
}
// iterate through each projectile, updating it
for (auto projectile = projectiles.begin(); projectile != projectiles.end();) {
(*projectile)->update(time_step);
bool should_remove = false;
// do shield collision checks
for (auto melee : melees) {
if ( melee->is_shield() && (*projectile)->touching(*melee)) {
should_remove = true;
break;
}
}
// do player collision checks
for (auto player_wrapper : player_wrappers) {
if (player_wrapper->player->is_dead() ||
same_team(player_wrapper->player->get_team(), (*projectile)->get_team()))
{
continue;
}
if ((*projectile)->touching(*(player_wrapper->player))) {
player_wrapper->player->take_dmg((*projectile)->get_damage());
if ((*projectile)->is_stun())
{
player_wrapper->player->start_stun_timer();
}
should_remove = true;
break;
}
}
// do environment collision checks
for (auto environment : collidable_environments) {
if ((*projectile)->touching(*environment)) {
should_remove = true;
break;
}
}
// do map boundary checks
Point2f proj_pos = (*projectile)->get_center();
if (proj_pos.x < 0.0f || proj_pos.x >= dimension.width*UNIT_LENGTH ||
proj_pos.y < 0.0f || proj_pos.y >= dimension.height*UNIT_LENGTH)
{
should_remove = true;
}
if (should_remove) {
delete *projectile;
projectile = projectiles.erase(projectile);
} else {
projectile++;
}
}
// blinking players
for (auto player_wrapper : player_wrappers) {
player_wrapper->player->update_blink_timer(time_step);
}
// respawn dead players
for (auto player_wrapper : player_wrappers) {
if (!player_wrapper->player->is_dead()) continue;
Player *dead = player_wrapper->player;
// drop one crystal where you die if they have at least one
if (dead->get_crystals_held()) {
dead->drop_crystal();
crystals.push_back(new Crystal(dead->get_position()));
while (dead->get_crystals_held()) {
dead->drop_crystal();
--crystals_in_play;
}
}
Weapon* sword = dead->get_weapon();
Weapon* shield = dead->get_shield();
if (sword != nullptr)
{
for(auto melee = melees.begin(); melee != melees.end(); melee++)
{
if (sword == *melee)
{
melees.erase(melee);
break;
}
}
}
if (shield != nullptr)
{
for(auto melee = melees.begin(); melee != melees.end(); melee++)
{
if (shield == *melee)
{
melees.erase(melee);
break;
}
}
}
heal_circles[player_wrapper->uid] = nullptr;
if(player_wrapper->player->can_respawn()) {
if (player_infos[player_wrapper->uid]->spawn_menu->is_option_selected()) {
player_infos[player_wrapper->uid]->spawn_menu->clear_menu();
player_wrapper->player = create_player(String(player_infos[player_wrapper->uid]->spawn_menu->
get_selected_option()),
player_infos[player_wrapper->uid]->start_position,
player_wrapper->uid,
player_wrapper->player->get_team());
// Once the player is alive it shouldn't make him wait.
player_wrapper->player->reset_respawn_time();
delete dead;
}
}
}
player_wrappers[0]->player->set_partner(player_wrappers[2]->player);
player_wrappers[1]->player->set_partner(player_wrappers[3]->player);
player_wrappers[2]->player->set_partner(player_wrappers[0]->player);
player_wrappers[3]->player->set_partner(player_wrappers[1]->player);
// respawn crystals
if (crystals_in_play < total_num_crystals) respawn_crystal();
}
void Game_State::respawn_crystal() {
// Set up random number generation
random_device rd;
mt19937 gen = mt19937(rd());
uniform_int_distribution<> dis = uniform_int_distribution<>(0, crystal_locations.size()-1);
while (crystals_in_play < total_num_crystals) {
bool found = true;
int index;
do {
index = dis(gen);
for (auto crystal : crystals) {
if (crystal->get_position().x == crystal_locations[index].x &&
crystal->get_position().y == crystal_locations[index].y) {
found = false;
break;
}
else {
found = true;
}
}
} while (!found);
crystals.push_back(new Crystal(crystal_locations[index]));
++crystals_in_play;
}
}
void Game_State::render_map(int screen_num) {
auto screen_coord = screen_coord_map[screen_num]();
auto bottom_corner = Point2f(32.0f * dimension.width, 32.0f * dimension.height);
get_Video().set_2d_view(std::make_pair(Point2f(0.0f, 0.0f) , bottom_corner),
screen_coord,
false);
// Render Map and Movable objects
vbo_ptr_floor->render();
vbo_ptr_lower->render();
for (auto crystal : crystals) crystal->render();
for (auto player_wrapper_ptr : player_wrappers) player_wrapper_ptr->player->render();
for (auto npc : npcs) npc->render();
for (auto projectile : projectiles) projectile->render();
for (auto melee : melees) melee->render();
vbo_ptr_middle->render();
for (auto player_wrapper_ptr : player_wrappers) {
if (!player_wrapper_ptr->player->is_dead()) {
health_indicator.set_position(player_wrapper_ptr->player->get_position() - Vector2f(0.0f, 8.0f));
health_indicator.render(player_wrapper_ptr->player->get_hp_pctg());
}
}
for (auto atmosphere : atmospheres) atmosphere->render();
// Render Player Score
get_Fonts()["godofwar_50"].render_text(String("Crystals: " + to_string(
scores[BLUE])),
Point2f(5.0f, bottom_corner.y) - Vector2f(0.0f, 105.0f),
get_Colors()["blue"]);
get_Fonts()["godofwar_50"].render_text(String("Crystals: " + to_string(
scores[RED])),
Point2f(5.0f, bottom_corner.y) - Vector2f(0.0f, 55.0f),
get_Colors()["red"]);
}
void Game_State::render_spawn_menu(Player_Wrapper * player_wrapper) {
auto screen_coord = screen_coord_map[player_wrapper->uid]();
get_Video().set_2d_view(std::make_pair(Point2f(screen_coord.first),
Point2f(screen_coord.second)),
screen_coord,
false);
player_infos[player_wrapper->uid]->spawn_menu->render();
}
void Game_State::render_all(Player_Wrapper * player_wrapper) {
auto p_pos = player_wrapper->player->get_position();
get_Video().set_2d_view(std::make_pair(p_pos - Vector2f(250.0f, 200.0f),
p_pos + Vector2f(250.0f, 200.0f)),
screen_coord_map[player_wrapper->uid](),
false);
// Render Map and Movable objects
vbo_ptr_floor->render();
vbo_ptr_lower->render();
for (auto heal_circle : heal_circles)
{
if(heal_circle != nullptr) heal_circle->render();
}
for (auto crystal : crystals) crystal->render();
// Render aiming reticle
if(!player_wrapper->player->is_submerged()) {
Player* player = player_wrapper->player;
Point2f pos = p_pos;
Vector2f size = player->get_size();
pos += 0.4f * size.get_j();
// render aiming reticle
Vector2f face_vec = Vector2f(cos(player->get_facing()), sin(player->get_facing()));
Team team = player->get_team();
String str = "";
switch(team)
{
case RED:
str = "red_";
break;
case BLUE:
str = "blue_";
break;
}
// couldn't use Game_Object::render() because need to render the reticle at a different location
render_image(str + "aiming", // which texture to use
pos, // upper-left corner
pos + size, // lower-right corner
face_vec.multiply_by(Vector2f(1.0f,-1.0f)).theta() + Global::pi_over_two, // rotation in radians
1.0f, // scaling factor
pos + 0.5f * size, // point to rotate & scale about
false, // whether or not to horizontally flip the texture
Color()); // what Color to "paint" the texture
}
for (auto player_wrapper_ptr : player_wrappers) player_wrapper_ptr->player->render();
for (auto npc : npcs) npc->render();
for (auto projectile : projectiles) projectile->render();
for (auto melee : melees) melee->render();
vbo_ptr_middle->render();
for (auto player_wrapper_ptr : player_wrappers) {
if (player_wrapper != player_wrapper_ptr) {
if (!player_wrapper_ptr->player->is_dead()) {
health_indicator.set_position(player_wrapper_ptr->player->get_position() - Vector2f(0.0f, 8.0f));
health_indicator.render(player_wrapper_ptr->player->get_hp_pctg());
}
}
}
for (auto atmosphere : atmospheres) atmosphere->render();
// Render Player health
player_infos[player_wrapper->uid]->health_bar.set_position(p_pos - Vector2f(240.0f, 190.0f));
player_infos[player_wrapper->uid]->health_bar.render(player_wrapper->player->get_hp_pctg());
// Render Player Score
get_Fonts()["godofwar_20"].render_text(String("Crystals: " + to_string(
scores[BLUE])),
p_pos - Vector2f(240.0f,-150.0f),
get_Colors()["blue"]);
get_Fonts()["godofwar_20"].render_text(String("Crystals: " + to_string(
scores[RED])),
p_pos - Vector2f(240.0f,-175.0f),
get_Colors()["red"]);
//Render Skills info
if (player_wrapper->player->can_use_dodge()) {
dodge.set_position(p_pos + Vector2f(0.0f, -190.0f));
dodge.render();
}
else {
skill_indicator.set_position(p_pos + Vector2f(0.0f, -157.0f));
skill_indicator.render(player_wrapper->player->get_dodge_percentage());
}
box.set_position(p_pos + Vector2f(0.0f, -190.0f));
box.render();
dodge_button.set_position(p_pos + Vector2f(0.0f, -168.0f));
dodge_button.render();
if (player_wrapper->player->can_use_special()) {
special_skill.set_position(p_pos + Vector2f(34.0f, -190.0f));
special_skill.render(player_wrapper->player->get_skill_str());
}
else {
auto pctg = player_wrapper->player->get_special_attck_percentage();
if (pctg <= 1.0f) {
skill_indicator.set_position(p_pos + Vector2f(34.0f, -157.0f));
skill_indicator.render(pctg);
}
}
box.set_position(p_pos + Vector2f(34.0f, -190.0f));
box.render();
special_button.set_position(p_pos + Vector2f(34.0f, -165.0f));
special_button.render();
// Render the number of crystals
player_infos[player_wrapper->uid]->crystal_info.set_position(p_pos + Vector2f(190.0f,-190.0f));
player_infos[player_wrapper->uid]->crystal_info.render(player_wrapper->player->get_crystals_held());
}
void Game_State::render(){
// render logic for when a team wins
if (game_over_timer.is_running()) {
if (game_over_timer.seconds() <= 4.0f) {
get_Video().set_2d(make_pair(Point2f(0.0f, 0.0f), Point2f(get_Window().get_width(), get_Window().get_height())), false);
if (scores[BLUE] >= WIN_CRYSTAL_COUNT) {
get_Fonts()["godofwar_80"].render_text("BLUE TEAM WINS!",
Point2f(get_Window().get_width()/2, get_Window().get_height()/2),
get_Colors()["blue"],
ZENI_CENTER);
} else {
get_Fonts()["godofwar_80"].render_text("RED TEAM WINS!",
Point2f(get_Window().get_width()/2, get_Window().get_height()/2),
get_Colors()["red"],
ZENI_CENTER);
}
} else {
game_over_timer.stop();
game_over_timer.reset();
gameover = true;
}
} else {
for (auto player_wrapper : player_wrappers) {
if (player_wrapper->player->is_dead()) {
if(player_wrapper->player->can_respawn()) {
render_spawn_menu(player_wrapper);
}
else {
render_map(player_wrapper->uid);
auto bottom_corner = Point2f(32.0f * dimension.width, 32.0f * dimension.height);
get_Fonts()["godofwar_60"].render_text(player_wrapper->spawn_time_left,
Point2f(bottom_corner.x/2, bottom_corner.y/2),
get_Colors()["black"],
ZENI_CENTER);
}
}
else {
if(player_wrapper->select_pressed) {
render_map(player_wrapper->uid);
}
else {
render_all(player_wrapper);
//player_wrapper->player->render_extras();
}
}
}
// Add splitting lines for each screen.
get_Video().set_2d(make_pair(Point2f(0.0f, 0.0f), Point2f(get_Window().get_width(), get_Window().get_height())), false);
divider.render(Point2f(0.0f, (get_Window().get_height() / 2) - 1), Vector2f(get_Window().get_width(), 2.0f));
divider.render(Point2f((get_Window().get_width() / 2) - 1, 0.0f), Vector2f(2.0f, get_Window().get_height()));
}
}
void Game_State::create_tree(const Point2f &position) {
if (position.y - UNIT_LENGTH < 0)
error_handle("Cannot place tree in the specified location");
collidable_environments.push_back(create_environment("Tree", position, BOTTOM));
environments.push_back(create_environment("Tree", position - Point2f(0, UNIT_LENGTH), TOP));
}
void Game_State::create_house(const Point2f &position) {
if ((position.y - UNIT_LENGTH*3) < 0 ||
(position.x - UNIT_LENGTH) < 0 ||
(position.x + UNIT_LENGTH) >= (dimension.width*UNIT_LENGTH))
{
error_handle("Cannot place house in the specified location");
}
collidable_environments.push_back(create_environment("House", position, DOOR));
collidable_environments.push_back(create_environment("House", position - Point2f(UNIT_LENGTH, 0), WINDOW_LEFT));
collidable_environments.push_back(create_environment("House", position + Point2f(UNIT_LENGTH, 0), WINDOW_RIGHT));
collidable_environments.push_back(create_environment("House", position - Point2f(0, UNIT_LENGTH), BLUE_ROOF_MIDDLE_EDGE));
collidable_environments.push_back(create_environment("House", position - Point2f(0, UNIT_LENGTH) + Point2f(UNIT_LENGTH, 0), BLUE_ROOF_DOWN_RIGHT_CORNER_1));
collidable_environments.push_back(create_environment("House", position - Point2f(0, UNIT_LENGTH) - Point2f(UNIT_LENGTH, 0), BLUE_ROOF_DOWN_LEFT_CORNER_1));
collidable_environments.push_back(create_environment("House", position - Point2f(0, UNIT_LENGTH*2),
BLUE_ROOF_MIDDLE));
collidable_environments.push_back(create_environment("House", position - Point2f(0, UNIT_LENGTH*2) - Point2f(UNIT_LENGTH, 0), BLUE_ROOF_LEFT_SIDE));
collidable_environments.push_back(create_environment("House", position - Point2f(0, UNIT_LENGTH*2) + Point2f(UNIT_LENGTH, 0), BLUE_ROOF_RIGHT_SIDE));
environments.push_back(create_environment("House", position - Point2f(0, UNIT_LENGTH*3),
BLUE_ROOF_UP_MIDDLE));
environments.push_back(create_environment("House", position - Point2f(0, UNIT_LENGTH*3) + Point2f(UNIT_LENGTH, 0), BLUE_ROOF_UP_RIGHT_CORNER));
environments.push_back(create_environment("House", position - Point2f(0, UNIT_LENGTH*3) - Point2f(UNIT_LENGTH, 0), BLUE_ROOF_UP_LEFT_CORNER));
}
void Game_State::load_map(const std::string &file_) {
// logging
cout << "Creating map: " << file_ << endl;
ifstream file(file_);
// Check if file exists
if (!file.is_open()) {
string s = "File does not exist: ";
error_handle(s + file_);
}
// Get dimensions of map
string line;
getline(file,line);
istringstream sstream(line);
if (line.find('#') != std::string::npos) {
getline(file,line);
istringstream temp(line);
sstream.swap(temp);
}
if (!(sstream >> dimension.height)) error_handle("Could not input height");
if (!(sstream >> dimension.width)) error_handle("Could not input width");
// logging
cout << "Map dimension (y,x): (" << dimension.height << ',' << dimension.width << ')' << endl;
// Get starting location of players
Team team;
int start_y, start_x;
for (int i = 0; i < NUM_PLAYERS && getline(file,line); ++i) {
if (line.find('#') != std::string::npos) {--i; continue;}
istringstream sstream(line);
if (!(sstream >> start_y))
error_handle("Could not input starting y for player");
if (start_y < 0 || start_y >= dimension.height)
error_handle("Invalid start y for player");
if (!(sstream >> start_x))
error_handle("Could not input starting x for player");
if (start_x < 0 || start_x >= dimension.width)
error_handle("Invalid start x for player");
Point2f pos(start_x*UNIT_LENGTH, start_y*UNIT_LENGTH);
team = (i % 2 == 0 ? BLUE : RED);
scores[team] = 0;
player_wrappers.push_back(new Player_Wrapper(create_player("Mage", pos, i, team), i));
player_wrappers.back()->player->kill();
player_infos.push_back(new Player_Info(pos, team, new Spawn_Menu(screen_coord_map[i]())));
// logging
cout << "Player " << i << " Location (y,x): (" << start_y << ',' << start_x << ')' << endl;
}
// Get starting location of npc
String npc_type;
for (int i = 0; i < NUM_PLAYERS && getline(file,line); i+=2) {
if (line.find('#') != std::string::npos) {i -= 2; continue;}
istringstream sstream(line);
if (!(sstream >> start_y))
error_handle("Could not input starting y for npc");
if (start_y < 0 || start_y >= dimension.height)
error_handle("Invalid start y for npc");
if (!(sstream >> start_x))
error_handle("Could not input starting x for npc");
if (start_x < 0 || start_x >= dimension.width)
error_handle("Invalid start x for npc");
team = (i < 2 ? BLUE : RED);
npc_type = (team == BLUE ? "Blonde_Kid" : "Girl");
npcs.push_back(create_npc(npc_type, Point2f(start_x*UNIT_LENGTH, start_y*UNIT_LENGTH), team));
// logging
cout << npc_type << " Location (y,x): (" << start_y << ',' << start_x << ')' << endl;
}
// Get locations of crystals
int number_of_crystal_locations;
{
getline(file,line);
istringstream sstream(line);
if (line.find('#') != std::string::npos) {
getline(file,line);
istringstream temp(line);
sstream.swap(temp);
}
if (!(sstream >> total_num_crystals)) error_handle("Could not input number of crystals in play");
// logging
cout << "Number of Crystals: " << total_num_crystals << endl;
getline(file,line);
istringstream temp(line);
sstream.swap(temp);
if (!(sstream >> number_of_crystal_locations)) error_handle("Could not input number of crystal locs");
// logging
cout << "Number of Crystal Locations: " << number_of_crystal_locations << endl;
}
for (int i = 0; i < number_of_crystal_locations && getline(file,line); ++i) {
if (line.find('#') != std::string::npos) {--i; continue;}
istringstream sstream(line);
if (!(sstream >> start_y))
error_handle("Could not input y for crystal location");
if (start_y < 0 || start_y >= dimension.height)
error_handle("Invalid y for crystal location");
if (!(sstream >> start_x))
error_handle("Could not input x for crystal location");
if (start_x < 0 || start_x >= dimension.width)
error_handle("Invalid x for crystal location");
crystal_locations.push_back(Point2f(start_x*UNIT_LENGTH, start_y*UNIT_LENGTH));
// logging
cout << "Crystal " << i << " Location (y,x): (" << start_y << ',' << start_x << ')' << endl;
}
// Get map information
for (int height = 0; getline(file,line) && height < dimension.height;) {
if (line.find('#') != std::string::npos) continue;
for (int width = 0; width < line.length() && width < dimension.width; ++width) {
Point2f position(UNIT_LENGTH*width, UNIT_LENGTH*height);
if (line[width] == '.') {
grasss.push_back(create_terrain("Grass", position));
}
else if (line[width] == 't') {
grasss.push_back(create_terrain("Grass", position));
create_tree(position);
} else if (line[width] == 'h') {
grasss.push_back(create_terrain("Grass", position));
create_house(position);
} else if (line[width] == 'F') {
grasss.push_back(create_terrain("Grass", position));
collidable_environments.push_back(
create_environment(Map_Manager::get_Instance().get_environment(line[width]),position));
} else if (line[width] == 'f') {
terrains.push_back(create_terrain("Dirt", position));
collidable_environments.push_back(
create_environment(Map_Manager::get_Instance().get_environment(line[width]),position));
} else if (Map_Manager::get_Instance().find_terrain(line[width])) {
grasss.push_back(create_terrain("Grass", position));
terrains.push_back(create_terrain(
Map_Manager::get_Instance().get_terrain(line[width]),position));
} else if (Map_Manager::get_Instance().find_atmosphere(line[width])) {
grasss.push_back(create_terrain("Grass", position));
atmospheres.push_back(
create_atmosphere(Map_Manager::get_Instance().get_atmosphere(line[width]),position));
} else if (Map_Manager::get_Instance().find_environment(line[width])) {
terrains.push_back(create_terrain("Dirt", position));
collidable_environments.push_back(
create_environment(Map_Manager::get_Instance().get_environment(line[width]),position));
} else {
string s = "Invalid character found in map: ";
error_handle(s);
}
}
++height;
}
// Put objects into the Vertex_Buffer
for (auto grass : grasss)
vbo_ptr_floor->give_Quadrilateral(create_quad_ptr(grass));
for (auto terrain : terrains)
vbo_ptr_lower->give_Quadrilateral(create_quad_ptr(terrain));
for (auto environment : environments)
vbo_ptr_middle->give_Quadrilateral(create_quad_ptr(environment));
for (auto environment : collidable_environments)
vbo_ptr_middle->give_Quadrilateral(create_quad_ptr(environment));
// Spawn crystals
respawn_crystal();
// Logging
cout << "Created Map!" << endl;
file.close();
}
void Game_State::execute_controller_code(const Zeni_Input_ID &id,
const float &confidence,
const int &action)
{
switch (action) {
/* player 1 */
case 101:
break;
case 102:
player_infos[0]->controls.move_x = confidence;
break;
case 103:
player_infos[0]->controls.move_y = confidence;
break;
case 104:
player_infos[0]->controls.look_x = confidence;
break;
case 105:
player_infos[0]->controls.look_y = confidence;
break;
case 106:
player_infos[0]->controls.LT = (confidence == 1.0);
break;
case 107:
player_infos[0]->controls.attack = confidence > 0.5f;
break;
case 108:
player_infos[0]->controls.A = (confidence == 1.0);
break;
case 109:
break;
case 110:
break;
case 111:
break;
case 112:
player_infos[0]->controls.LB = (confidence == 1.0);
break;
case 113:
player_infos[0]->controls.RB = (confidence == 1.0);
break;
case 114:
player_infos[0]->controls.start = (confidence == 1.0);
break;
case 115:
player_infos[0]->controls.back = (confidence == 1.0);
break;
/* player 2 */
case 201:
break;
case 202:
player_infos[1]->controls.move_x = confidence;
break;
case 203:
player_infos[1]->controls.move_y = confidence;
break;
case 204:
player_infos[1]->controls.look_x = confidence;
break;
case 205:
player_infos[1]->controls.look_y = confidence;
break;
case 206:
player_infos[1]->controls.LT = (confidence == 1.0);
break;
case 207:
player_infos[1]->controls.attack = confidence > 0.5f;
break;
case 208:
player_infos[1]->controls.A = (confidence == 1.0);
break;
case 209:
break;
case 210:
break;
case 211:
break;
case 212:
player_infos[1]->controls.LB = (confidence == 1.0);
break;
case 213:
player_infos[1]->controls.RB = (confidence == 1.0);
break;
case 214:
player_infos[1]->controls.start = (confidence == 1.0);
break;
case 215:
player_infos[1]->controls.back = (confidence == 1.0);
break;
/* player 3 */
case 301:
break;
case 302:
player_infos[2]->controls.move_x = confidence;
break;
case 303:
player_infos[2]->controls.move_y = confidence;
break;
case 304:
player_infos[2]->controls.look_x = confidence;
break;
case 305:
player_infos[2]->controls.look_y = confidence;
break;
case 306:
player_infos[2]->controls.LT = (confidence == 1.0);
break;
case 307:
player_infos[2]->controls.attack = confidence > 0.5f;
break;
case 308:
player_infos[2]->controls.A = (confidence == 1.0);
break;
case 309:
break;
case 310:
break;
case 311:
break;
case 312:
player_infos[2]->controls.LB = (confidence == 1.0);
break;
case 313:
player_infos[2]->controls.RB = (confidence == 1.0);
break;
case 314:
player_infos[2]->controls.start = (confidence == 1.0);
break;
case 315:
player_infos[2]->controls.back = (confidence == 1.0);
break;
/* player 4 */
case 401:
break;
case 402:
player_infos[3]->controls.move_x = confidence;
break;
case 403:
player_infos[3]->controls.move_y = confidence;
break;
case 404:
player_infos[3]->controls.look_x = confidence;
break;
case 405:
player_infos[3]->controls.look_y = confidence;
break;
case 406:
player_infos[3]->controls.LT = (confidence == 1.0);
break;
case 407:
player_infos[3]->controls.attack = confidence > 0.5f;
break;
case 408:
player_infos[3]->controls.A = (confidence == 1.0);
break;
case 409:
break;
case 410:
break;
case 411:
break;
case 412:
player_infos[3]->controls.LB = (confidence == 1.0);
break;
case 413:
player_infos[3]->controls.RB = (confidence == 1.0);
break;
case 414:
player_infos[3]->controls.start = (confidence == 1.0);
break;
case 415:
player_infos[3]->controls.back = (confidence == 1.0);
break;
default:
break;
}
}
| 44,017 | 15,526 |
// 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 "tools/android/forwarder2/host_controllers_manager.h"
#include "base/bind.h"
#include "base/process/launch.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "tools/android/forwarder2/util.h"
namespace forwarder2 {
HostControllersManager::HostControllersManager(
base::RepeatingCallback<int()> exit_notifier_fd_callback)
: controllers_(new HostControllerMap()),
exit_notifier_fd_callback_(exit_notifier_fd_callback),
has_failed_(false),
weak_ptr_factory_(this) {}
HostControllersManager::~HostControllersManager() {
if (!thread_.get())
return;
// Delete the controllers on the thread they were created on.
thread_->task_runner()->DeleteSoon(FROM_HERE, controllers_.release());
}
void HostControllersManager::HandleRequest(
const std::string& adb_path,
const std::string& device_serial,
int command,
int device_port,
int host_port,
std::unique_ptr<Socket> client_socket) {
// Lazy initialize so that the CLI process doesn't get this thread created.
InitOnce();
thread_->task_runner()->PostTask(
FROM_HERE,
base::BindOnce(&HostControllersManager::HandleRequestOnInternalThread,
base::Unretained(this), adb_path, device_serial, command,
device_port, host_port, std::move(client_socket)));
}
// static
std::string HostControllersManager::MakeHostControllerMapKey(int adb_port,
int device_port) {
return base::StringPrintf("%d:%d", adb_port, device_port);
}
void HostControllersManager::InitOnce() {
if (thread_.get())
return;
at_exit_manager_.reset(new base::AtExitManager());
thread_.reset(new base::Thread("HostControllersManagerThread"));
thread_->Start();
}
// static
void HostControllersManager::DeleteHostController(
const base::WeakPtr<HostControllersManager>& manager_ptr,
std::unique_ptr<HostController> host_controller) {
HostController* const controller = host_controller.release();
HostControllersManager* const manager = manager_ptr.get();
if (!manager) {
// Note that |controller| is not leaked in this case since the host
// controllers manager owns the controllers. If the manager was deleted
// then all the controllers (including |controller|) were also deleted.
return;
}
DCHECK(manager->thread_->task_runner()->RunsTasksInCurrentSequence());
// Note that this will delete |controller| which is owned by the map.
DeleteRefCountedValueInMap(
MakeHostControllerMapKey(controller->adb_port(),
controller->device_port()),
manager->controllers_.get());
}
void HostControllersManager::Map(const std::string& adb_path,
const std::string& device_serial,
int adb_port,
int device_port,
int host_port,
Socket* client_socket) {
if (host_port < 0) {
SendMessage("ERROR: missing host port\n", client_socket);
return;
}
const bool use_dynamic_port_allocation = device_port == 0;
if (!use_dynamic_port_allocation) {
const std::string controller_key =
MakeHostControllerMapKey(adb_port, device_port);
if (controllers_->find(controller_key) != controllers_->end()) {
LOG(INFO) << "Already forwarding device port " << device_port
<< " to host port " << host_port;
SendMessage(base::StringPrintf("%d:%d", device_port, host_port),
client_socket);
return;
}
}
// Create a new host controller.
std::unique_ptr<HostController> host_controller(HostController::Create(
device_serial, device_port, host_port, adb_port,
exit_notifier_fd_callback_.Run(),
base::BindOnce(&HostControllersManager::DeleteHostController,
weak_ptr_factory_.GetWeakPtr())));
if (!host_controller.get()) {
has_failed_ = true;
SendMessage("ERROR: Connection to device failed.\n", client_socket);
LogExistingControllers(client_socket);
return;
}
// Get the current allocated port.
device_port = host_controller->device_port();
LOG(INFO) << "Forwarding device port " << device_port << " to host port "
<< host_port;
const std::string msg = base::StringPrintf("%d:%d", device_port, host_port);
if (!SendMessage(msg, client_socket))
return;
host_controller->Start();
controllers_->emplace(MakeHostControllerMapKey(adb_port, device_port),
std::move(host_controller));
}
void HostControllersManager::Unmap(const std::string& adb_path,
const std::string& device_serial,
int adb_port,
int device_port,
Socket* client_socket) {
// Remove the previously created host controller.
const std::string controller_key =
MakeHostControllerMapKey(adb_port, device_port);
const bool controller_did_exist =
DeleteRefCountedValueInMap(controller_key, controllers_.get());
if (!controller_did_exist) {
SendMessage("ERROR: could not unmap port.\n", client_socket);
LogExistingControllers(client_socket);
} else {
SendMessage("OK", client_socket);
}
RemoveAdbPortForDeviceIfNeeded(adb_path, device_serial);
}
void HostControllersManager::UnmapAll(const std::string& adb_path,
const std::string& device_serial,
int adb_port,
Socket* client_socket) {
const std::string adb_port_str = base::StringPrintf("%d", adb_port);
for (auto controller_key = controllers_->begin();
controller_key != controllers_->end(); ++controller_key) {
std::vector<std::string> pieces =
base::SplitString(controller_key->first, ":", base::KEEP_WHITESPACE,
base::SPLIT_WANT_ALL);
if (pieces.size() == 2) {
if (pieces[0] == adb_port_str) {
DeleteRefCountedValueInMapFromIterator(controller_key,
controllers_.get());
}
} else {
LOG(ERROR) << "Unexpected controller key: " << controller_key->first;
}
}
RemoveAdbPortForDeviceIfNeeded(adb_path, device_serial);
SendMessage("OK", client_socket);
}
void HostControllersManager::HandleRequestOnInternalThread(
const std::string& adb_path,
const std::string& device_serial,
int command,
int device_port,
int host_port,
std::unique_ptr<Socket> client_socket) {
const int adb_port = GetAdbPortForDevice(adb_path, device_serial);
if (adb_port < 0) {
SendMessage(
"ERROR: could not get adb port for device. You might need to add "
"'adb' to your PATH or provide the device serial id.\n",
client_socket.get());
return;
}
switch (command) {
case MAP:
Map(adb_path, device_serial, adb_port, device_port, host_port,
client_socket.get());
break;
case UNMAP:
Unmap(adb_path, device_serial, adb_port, device_port,
client_socket.get());
break;
case UNMAP_ALL:
UnmapAll(adb_path, device_serial, adb_port, client_socket.get());
break;
default:
SendMessage(
base::StringPrintf("ERROR: unrecognized command %d\n", command),
client_socket.get());
break;
}
}
void HostControllersManager::LogExistingControllers(Socket* client_socket) {
SendMessage("ERROR: Existing controllers:\n", client_socket);
for (const auto& controller : *controllers_) {
SendMessage(base::StringPrintf("ERROR: %s\n", controller.first.c_str()),
client_socket);
}
}
bool HostControllersManager::Adb(const std::string& adb_path,
const std::string& device_serial,
const std::string& command,
std::string* output_and_error) {
// We use the vector version of GetAppOutputAndError rather than the
// more standard base::CommandLine version because base::CommandLine
// reorders the command s.t. switches precede arguments and doing so
// here creates an invalid adb command.
std::vector<std::string> adb_command{adb_path};
if (!device_serial.empty()) {
adb_command.push_back("-s");
adb_command.push_back(device_serial);
}
const std::vector<std::string> split_command = base::SplitString(
command, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
adb_command.insert(adb_command.end(), split_command.begin(),
split_command.end());
return GetAppOutputAndError(adb_command, output_and_error);
}
void HostControllersManager::RemoveAdbPortForDeviceIfNeeded(
const std::string& adb_path,
const std::string& device_serial) {
std::unordered_map<std::string, int>::const_iterator it =
device_serial_to_adb_port_map_.find(device_serial);
if (it == device_serial_to_adb_port_map_.end())
return;
int port = it->second;
const std::string prefix = base::StringPrintf("%d:", port);
for (auto others = controllers_->begin(); others != controllers_->end();
++others) {
if (base::StartsWith(others->first, prefix, base::CompareCase::SENSITIVE))
return;
}
// No other port is being forwarded to this device:
// - Remove it from our internal serial -> adb port map.
// - Remove from "adb forward" command.
LOG(INFO) << "Device " << device_serial << " has no more ports.";
device_serial_to_adb_port_map_.erase(device_serial);
const std::string command =
base::StringPrintf("forward --remove tcp:%d", port);
std::string output;
if (!Adb(adb_path, device_serial, command, &output)) {
LOG(ERROR) << command << " failed. output: \"" << output << "\"";
} else {
LOG(INFO) << command << " (output: \"" << output << "\")";
}
// Wait for the socket to be fully unmapped.
const std::string port_mapped_cmd = base::StringPrintf("lsof -nPi:%d", port);
const std::vector<std::string> port_mapped_split_cmd = base::SplitString(
port_mapped_cmd, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
const int poll_interval_us = 500 * 1000;
int retries = 3;
while (retries) {
// lsof failure means the port was successfully unmapped.
bool port_unmapped = !GetAppOutputAndError(port_mapped_split_cmd, &output);
LOG(INFO) << "Device " << device_serial << " port " << port
<< (port_unmapped ? "" : " not") << " unmapped";
if (port_unmapped)
break;
--retries;
usleep(poll_interval_us);
}
}
int HostControllersManager::GetAdbPortForDevice(
const std::string adb_path,
const std::string& device_serial) {
std::unordered_map<std::string, int>::const_iterator it =
device_serial_to_adb_port_map_.find(device_serial);
if (it != device_serial_to_adb_port_map_.end())
return it->second;
Socket bind_socket;
CHECK(bind_socket.BindTcp("127.0.0.1", 0));
const int port = bind_socket.GetPort();
bind_socket.Close();
const std::string command = base::StringPrintf(
"forward tcp:%d localabstract:chrome_device_forwarder", port);
std::string output;
if (!Adb(adb_path, device_serial, command, &output)) {
LOG(ERROR) << command << " failed. output: " << output;
return -1;
}
LOG(INFO) << command;
device_serial_to_adb_port_map_[device_serial] = port;
return port;
}
bool HostControllersManager::SendMessage(const std::string& msg,
Socket* client_socket) {
bool result = client_socket->WriteString(msg);
DCHECK(result);
if (!result)
has_failed_ = true;
return result;
}
bool HostControllersManager::GetAppOutputAndError(
const std::vector<std::string>& argv,
std::string* output) {
return base::GetAppOutputAndError(argv, output);
}
} // namespace forwarder2
| 12,187 | 3,686 |
/* The smooth Class Library
* Copyright (C) 1998-2014 Robert Kausch <robert.kausch@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of "The Artistic License, Version 2.0".
*
* THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */
#include <smooth/misc/binary.h>
#include <smooth/misc/math.h>
S::Binary::Binary()
{
}
S::Binary::Binary(const Binary &)
{
}
S::Bool S::Binary::GetBit(Int n, UnsignedInt bit)
{
return IsFlagSet(n, (Int) Math::Pow(2l, (Signed) bit));
}
S::Int S::Binary::SetBit(Int &n, UnsignedInt bit, Bool value)
{
if (value) return (n |= (Int) Math::Pow(2l, (Signed) bit));
else return (n = ((n | (Int) Math::Pow(2l, (Signed) bit)) ^ (Int) Math::Pow(2l, (Signed) bit)));
}
S::Int S::Binary::GetBits(Int n, UnsignedInt startBit, UnsignedInt endBit)
{
Int retVal = 0;
if (startBit >= 32 || endBit >= 32) return -1;
for (UnsignedInt i = startBit; i <= endBit; i++)
{
retVal += (Int) Math::Pow(2l, (Signed) i - (Signed) startBit) * ((n >> i) & 1);
}
return retVal;
}
S::Int S::Binary::SetBits(Int &n, UnsignedInt startBit, UnsignedInt endBit, Int value)
{
if (startBit >= 32 || endBit >= 32) return -1;
for (UnsignedInt i = startBit; i <= endBit; i++)
{
SetBit(n, i, (value >> (i - startBit)) & 1);
}
return n;
}
S::Int S::Binary::And(Int a, Int b)
{
return a & b;
}
S::Int S::Binary::Or(Int a, Int b)
{
return a | b;
}
S::Int S::Binary::Xor(Int a, Int b)
{
return a ^ b;
}
S::Int S::Binary::Not(Int a)
{
return ~a;
}
S::Int S::Binary::ShiftL(Int n, Int s)
{
return n << s;
}
S::Int S::Binary::ShiftR(Int n, Int s)
{
return n >> s;
}
S::Bool S::Binary::IsFlagSet(Int n, Int flag)
{
return ((n & flag) == flag);
}
S::Int S::Binary::SetFlag(Int &n, Int flag)
{
return (n |= flag);
}
| 1,953 | 873 |
#include <dfs_code.hpp>
#include <string>
#include <gtest/gtest.h>
#include <stdexcept>
#include <dbio.hpp>
#include <logger.hpp>
#include <cuda_graph_types.hpp>
using std::string;
using std::runtime_error;
using types::DFS;
using namespace dbio;
types::graph_database_t get_test_database()
{
std::string pbec_prefixes[] = {
"(0 1 0 0 0);(1 2 0 0 0);(2 0 0 0 0);(2 3 0 0 0);(3 0 0 0 0);(0 4 0 0 0)", // prefix 0
"(0 1 0 0 0);(1 2 0 0 0);(2 0 0 0 0);(2 3 0 0 0);(3 0 0 0 0);(1 4 0 0 0)", // prefix 0
"(0 1 0 0 0);(1 2 0 0 0);(2 0 0 0 0);(2 3 0 0 0);(3 4 0 0 0);(4 0 0 0 0)", // prefix 1
"(0 1 0 0 0);(1 2 0 0 0);(2 0 0 0 0);(2 3 0 0 0);(3 4 0 0 0);(4 1 0 0 0)", // prefix 1
"(0 1 0 0 0);(1 2 0 0 0);(2 0 0 0 0);(2 3 0 0 0);(3 4 0 0 0);(4 2 0 0 0)", // prefix 1
"(0 1 0 0 0);(1 2 0 0 0);(2 0 0 0 0);(2 3 0 0 0);(2 4 0 0 0);(4 0 0 0 0)", // prefix 2
"(0 1 0 0 0);(1 2 0 0 0);(2 0 0 0 0);(2 3 0 0 0);(2 4 0 0 0);(4 1 0 0 0)", // prefix 2
"(0 1 0 0 0);(1 2 0 0 0);(2 0 0 0 0);(2 3 0 0 0);(1 4 0 0 0);(4 5 0 0 0)", // prefix 3
"(0 1 0 0 0);(1 2 0 0 0);(2 0 0 0 0);(2 3 0 0 0);(1 4 0 0 0);(4 0 0 0 0)", // prefix 3
"(0 1 0 0 0);(1 2 0 0 0);(2 3 0 0 0);(3 0 0 0 0);(3 4 0 0 0)", // prefix 4
"(0 1 0 0 0);(1 2 0 0 0);(2 3 0 0 0);(3 0 0 0 0);(3 4 0 0 0);(4 1 0 0 0)", // prefix 4
"(0 1 0 0 0);(1 2 0 0 0);(2 3 0 0 0);(3 0 0 0 0);(3 4 0 0 0);(4 0 0 0 0)", // prefix 4
"(0 1 0 0 0);(1 2 0 0 0);(2 3 0 0 0);(3 4 0 0 0);(4 0 0 0 0)", // prefix 5
"(0 1 0 0 0);(1 2 0 0 0);(2 3 0 0 0);(3 4 0 0 0);(4 1 0 0 0)", // prefix 5
"(0 1 0 0 0);(1 2 0 0 0);(2 3 0 0 0);(3 4 0 0 0)", // prefix 5
"(0 1 0 0 0);(1 2 0 0 0);(2 3 0 0 0);(2 4 0 0 0);(4 5 0 0 0)", // prefix 6
"(0 1 0 0 0);(1 2 0 0 0);(2 3 0 0 0);(2 4 0 0 0);(4 0 0 0 0)", // prefix 6
"(0 1 0 0 0);(1 2 0 0 0);(2 3 0 0 0);(2 4 0 0 0);(4 1 0 0 0)", // prefix 6
""
};
types::graph_database_t result;
int idx = 0;
while(pbec_prefixes[idx].size() != 0) {
types::DFSCode dfs = types::DFSCode::read_from_str(pbec_prefixes[idx]);
types::Graph grph;
dfs.toGraph(grph);
result.push_back(grph);
idx++;
} // while
return result;
} // get_test_database
TEST(dbio, basic_io_bin_test)
{
types::graph_database_t db = get_test_database();
types::graph_database_t read_db;
TRACE5(*Logger::get_logger("GLOBALSTEST"), "test database size (in # of graphs): " << db.size());
write_database_bin("test.dat", db);
read_database_bin("test.dat", read_db);
ASSERT_EQ(db.size(), read_db.size());
for(int i = 0; i < read_db.size(); i++) {
std::string read_db_dfs_code = read_db[i].get_min_dfs_code().to_string();
std::string orig_db_dfs_code = db[i].get_min_dfs_code().to_string();
ASSERT_EQ(read_db_dfs_code, orig_db_dfs_code);
} // for i
} // TEST dbio.basic_io_bin_test
static void perform_basic_io_bin_part_test(const types::graph_database_t &db, int total_parts)
{
types::graph_database_t *read_db = new types::graph_database_t[total_parts];
for(int i = 0; i < total_parts; i++) {
read_database_bin("test.dat", read_db[i], total_parts, i);
}
int db_idx = 0;
for(int i = 0; i < total_parts; i++) {
for(int j = 0; j < read_db[i].size(); j++) {
//std::cout << "comparing; read: " << read_db[i][j].to_string() << "; stored: " << db[db_idx].to_string() << std::endl;
ASSERT_EQ(read_db[i][j].to_string(), db[db_idx].to_string());
db_idx++;
} // for j
} // for i
}
TEST(dbio, basic_io_bin_part_test)
{
types::graph_database_t db = get_test_database();
TRACE5(*Logger::get_logger("GLOBALSTEST"), "test database size (in # of graphs): " << db.size());
write_database_bin("test.dat", db);
for(int parts = 1; parts < db.size(); parts++) {
perform_basic_io_bin_part_test(db, parts);
}
} // TEST dbio.basic_io_bin_test
TEST(dbio, basic_io_cuda)
{
types::graph_database_t db = get_test_database();
TRACE(*Logger::get_logger("GLOBALSTEST"), "test database size (in # of graphs): " << db.size());
types::graph_database_cuda cuda_gdb = types::graph_database_cuda::create_from_host_representation(db);
types::graph_database_cuda cuda_gdb_read(true);
write_database_cudabin("test.dat", cuda_gdb);
read_database_cudabin("test.dat", cuda_gdb_read);
types::graph_database_t db_read;
cuda_gdb_read.convert_to_host_representation(db_read);
TRACE(*Logger::get_logger("GLOBALSTEST"), "read database size (in # of graphs): " << db_read.size());
ASSERT_EQ(db_read.size(), db.size());
for(int i = 0; i < db_read.size(); i++) {
if(db_read[i].get_min_dfs_code() == db[i].get_min_dfs_code()) {
ASSERT_TRUE(true);
} else {
ASSERT_TRUE(false);
}
} // for i
cuda_gdb_read.delete_from_host();
cuda_gdb.delete_from_host();
} // TEST dbio.basic_io_bin_test
| 4,815 | 2,534 |
#include <xtd/xtd>
using namespace std;
using namespace xtd;
using namespace xtd::drawing;
using namespace xtd::forms;
namespace examples {
class form1 : public form {
public:
form1() {
text("Radio button renderer example");
client_size({500, 300});
set_color(color::blue);
set_color(nullptr);
choice_theme.parent(*this);
choice_theme.location({10, 10});
choice_theme.items().push_back("default theme");
choice_theme.items().push_back_range(theme::theme_names());
choice_theme.selected_index(0);
choice_theme.selected_index_changed += [&] {
application::theme(choice_theme.selected_index() == 0 ? theme::default_theme_name() : choice_theme.selected_item().value());
color_picker_background.color(back_color());
color_picker_foreground.color(fore_color());
bcolor.reset();
fcolor.reset();
radio_button_system.back_color(nullptr);
radio_button_system.fore_color(nullptr);
radio_button_standard.back_color(nullptr);
radio_button_standard.fore_color(nullptr);
};
color_picker_background.parent(*this);
color_picker_background.location({140, 10});
color_picker_background.color(back_color());
color_picker_background.color_changed += [&] {
bcolor = color_picker_background.color();
radio_button_system.back_color(bcolor.value());
radio_button_standard.back_color(bcolor.value());
};
color_picker_foreground.parent(*this);
color_picker_foreground.location({250, 10});
color_picker_foreground.color(fore_color());
color_picker_foreground.color_changed += [&] {
fcolor = color_picker_foreground.color();
radio_button_system.fore_color(fcolor.value());
radio_button_standard.fore_color(fcolor.value());
};
radio_button_system.parent(*this);
radio_button_system.checked(true);
radio_button_system.flat_style(xtd::forms::flat_style::system);
radio_button_system.location({10, 170});
radio_button_system.text("System");
radio_button_standard.parent(*this);
radio_button_standard.location({100, 170});
radio_button_standard.text("Standard");
}
protected:
void on_paint(paint_event_args& e) override {
form::on_paint(e);
radio_button_renderer::draw_radio_button(e.graphics(), {10, 70, 104, 25}, "Normal", font(), xtd::forms::text_format_flags::vertical_center | xtd::forms::text_format_flags::left, xtd::drawing::image::empty, {0, 0, 0, 0}, false, xtd::forms::visual_styles::radio_button_state::unchecked_normal, bcolor, fcolor);
radio_button_renderer::draw_radio_button(e.graphics(), {124, 70, 104, 25}, "Hot", font(), xtd::forms::text_format_flags::vertical_center | xtd::forms::text_format_flags::left, xtd::drawing::image::empty, {0, 0, 0, 0}, false, xtd::forms::visual_styles::radio_button_state::unchecked_hot, bcolor, fcolor);
radio_button_renderer::draw_radio_button(e.graphics(), {238, 70, 104, 25}, "Pressed", font(), xtd::forms::text_format_flags::vertical_center | xtd::forms::text_format_flags::left, xtd::drawing::image::empty, {0, 0, 0, 0}, false, xtd::forms::visual_styles::radio_button_state::unchecked_pressed, bcolor, fcolor);
radio_button_renderer::draw_radio_button(e.graphics(), {352, 70, 104, 25}, "Disabled", font(), xtd::forms::text_format_flags::vertical_center | xtd::forms::text_format_flags::left, xtd::drawing::image::empty, {0, 0, 0, 0}, false, xtd::forms::visual_styles::radio_button_state::unchecked_disabled, bcolor, fcolor);
radio_button_renderer::draw_radio_button(e.graphics(), {10, 110, 104, 25}, "Normal", font(), xtd::forms::text_format_flags::vertical_center | xtd::forms::text_format_flags::left, xtd::drawing::image::empty, {0, 0, 0, 0}, false, xtd::forms::visual_styles::radio_button_state::checked_normal, bcolor, fcolor);
radio_button_renderer::draw_radio_button(e.graphics(), {124, 110, 104, 25}, "Hot", font(), xtd::forms::text_format_flags::vertical_center | xtd::forms::text_format_flags::left, xtd::drawing::image::empty, {0, 0, 0, 0}, false, xtd::forms::visual_styles::radio_button_state::checked_hot, bcolor, fcolor);
radio_button_renderer::draw_radio_button(e.graphics(), {238, 110, 104, 25}, "Pressed", font(), xtd::forms::text_format_flags::vertical_center | xtd::forms::text_format_flags::left, xtd::drawing::image::empty, {0, 0, 0, 0}, false, xtd::forms::visual_styles::radio_button_state::checked_pressed, bcolor, fcolor);
radio_button_renderer::draw_radio_button(e.graphics(), {352, 110, 104, 25}, "Disabled", font(), xtd::forms::text_format_flags::vertical_center | xtd::forms::text_format_flags::left, xtd::drawing::image::empty, {0, 0, 0, 0}, false, xtd::forms::visual_styles::radio_button_state::checked_disabled, bcolor, fcolor);
}
private:
void set_color(const color& color) {
cdebug << ustring::format("color = {}", color.to_string()) << endl;
}
void set_color(nullptr_t) {
cdebug << "color = (nullptr)" << endl;
}
optional<color> bcolor;
optional<color> fcolor;
choice choice_theme;
color_picker color_picker_background;
color_picker color_picker_foreground;
radio_button radio_button_system;
radio_button radio_button_standard;
};
}
int main() {
application::run(examples::form1());
}
| 5,420 | 1,901 |
// 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.
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
#include "content/public/browser/web_ui.h"
namespace settings {
SettingsPageUIHandler::SettingsPageUIHandler() {}
SettingsPageUIHandler::~SettingsPageUIHandler() {}
void SettingsPageUIHandler::ResolveJavascriptCallback(
const base::Value& callback_id,
const base::Value& response) {
// cr.webUIResponse is a global JS function exposed from cr.js.
CallJavascriptFunction("cr.webUIResponse", callback_id,
base::FundamentalValue(true), response);
}
void SettingsPageUIHandler::RejectJavascriptCallback(
const base::Value& callback_id,
const base::Value& response) {
// cr.webUIResponse is a global JS function exposed from cr.js.
CallJavascriptFunction("cr.webUIResponse", callback_id,
base::FundamentalValue(false), response);
}
} // namespace settings
| 1,070 | 308 |
/****************************************************************************
** Resource object code
**
** Created: Mon Feb 13 11:53:47 2012
** by: The Resource Compiler for Qt version 4.7.0
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
QT_END_NAMESPACE
int QT_MANGLE_NAMESPACE(qInitResources_cerberus)()
{
return 1;
}
Q_CONSTRUCTOR_FUNCTION(QT_MANGLE_NAMESPACE(qInitResources_cerberus))
int QT_MANGLE_NAMESPACE(qCleanupResources_cerberus)()
{
return 1;
}
Q_DESTRUCTOR_FUNCTION(QT_MANGLE_NAMESPACE(qCleanupResources_cerberus))
| 689 | 253 |
#ifndef feature_brex_h
#define feature_brex_h
#include <cmath>
#include <stdlib.h>
#include <vector>
#include <numeric>
#include <math.h>
#include "mdp.hpp"
#include "../include/unit_norm_sampling.hpp"
using namespace std;
class FeatureBREX { // B-REX with known features
protected:
double r_min, r_max, step_size;
unsigned int chain_length;
unsigned int grid_height, grid_width;
double alpha;
unsigned int iteration;
int sampling_flag;
bool mcmc_reject; //If false then it uses Yuchen's sample until accept method, if true uses normal MCMC sampling procedure
int num_steps; //how many times to change current to get proposal
unsigned int nfeatures;
double gamma;
double** stateFeatures;
vector< vector<double> > fcounts; //TODO add fcounts to this everytime a demo is added
vector<pair<unsigned int, unsigned int> > pairwise_preferences; //vector or pairwise preferences
void initializeMDP();
void modifyFeatureWeightsRandomly(FeatureGridMDP * gmdp, double step_size);
void sampleL1UnitBallRandomly(FeatureGridMDP * gmdp);
void updownL1UnitBallWalk(FeatureGridMDP * gmdp, double step);
void manifoldL1UnitBallWalk(FeatureGridMDP * gmdp, double step, int num_steps);
void manifoldL1UnitBallWalkAllSteps(FeatureGridMDP * gmdp, double step);
double* posteriors = nullptr;
FeatureGridMDP* MAPmdp = nullptr;
double MAPposterior;
public:
FeatureGridMDP* mdp = nullptr; //original MDP
FeatureGridMDP** R_chain = nullptr; //storing the rewards along the way
~FeatureBREX(){
if(R_chain != nullptr) {
for(unsigned int i=0; i<chain_length; i++) delete R_chain[i];
delete []R_chain;
}
if(posteriors != nullptr) delete []posteriors;
delete MAPmdp;
}
double getAlpha(){return alpha;}
FeatureBREX(FeatureGridMDP* init_mdp, double min_reward, double max_reward, unsigned int chain_len, double step, double conf, int samp_flag=0, bool reject=false, int num_step=1): r_min(min_reward), r_max(max_reward), step_size(step), chain_length(chain_len), alpha(conf), sampling_flag(samp_flag), mcmc_reject(reject), num_steps(num_step){
unsigned int grid_height = init_mdp -> getGridHeight();
unsigned int grid_width = init_mdp -> getGridWidth();
bool* initStates = init_mdp -> getInitialStates();
bool* termStates = init_mdp -> getTerminalStates();
nfeatures = init_mdp -> getNumFeatures();
double* fweights = init_mdp -> getFeatureWeights();
stateFeatures = init_mdp -> getStateFeatures();
bool stochastic = init_mdp -> isStochastic();
gamma = init_mdp -> getDiscount();
//copy init_mdp
mdp = new FeatureGridMDP(grid_width, grid_height, initStates, termStates, nfeatures, fweights, stateFeatures, stochastic, gamma);
mdp->setWallStates(init_mdp->getWallStates());
initializeMDP(); //set weights to (r_min+r_max)/2
MAPmdp = new FeatureGridMDP(grid_width, grid_height, initStates, termStates, nfeatures, fweights, stateFeatures, stochastic, gamma);
MAPmdp->setWallStates(init_mdp->getWallStates());
MAPmdp->setFeatureWeights(mdp->getFeatureWeights());
MAPposterior = 0;
R_chain = new FeatureGridMDP*[chain_length];
posteriors = new double[chain_length];
iteration = 0;
};
FeatureGridMDP* getMAPmdp(){return MAPmdp;}
double getMAPposterior(){return MAPposterior;}
void run(double eps=0.001);
double getMinReward(){return r_min;};
double getMaxReward(){return r_max;};
double getStepSize(){return step_size;};
unsigned int getChainLength(){return chain_length;};
FeatureGridMDP** getRewardChain(){ return R_chain; };
FeatureGridMDP* getMeanMDP(int burn, int skip);
double* getPosteriorChain(){ return posteriors; };
FeatureGridMDP* getMDP(){ return mdp;};
double calculatePosterior(FeatureGridMDP* gmdp);
double logsumexp(double* nums, unsigned int size);
//accumulate the feature counts of a vector
vector<double> computeFCounts(vector<pair<unsigned int, unsigned int> > traj);
void addTrajectories(vector<vector<pair<unsigned int,unsigned int> > > demonstrations);
void addPairwisePreferences(vector<pair<unsigned int,unsigned int> > prefs);
};
void FeatureBREX::run(double eps)
{
//cout.precision(10);
//cout << "itr: " << iteration << endl;
//clear out previous values if they exist
if(iteration > 0) for(unsigned int i=0; i<chain_length-1; i++) delete R_chain[i];
iteration++;
MAPposterior = 0;
R_chain[0] = mdp; // so that it can be deleted with R_chain!!!!
//vector<unsigned int> policy (mdp->getNumStates());
//cout << "testing" << endl;
//mdp->valueIteration(eps);//deterministicPolicyIteration(policy);
//cout << "value iter" << endl;
//mdp->calculateQValues();
mdp->displayFeatureWeights();
double posterior = calculatePosterior(mdp);
//cout << "init posterior: " << posterior << endl;
posteriors[0] = exp(posterior);
int reject_cnt = 0;
//BREX iterations
for(unsigned int itr=1; itr < chain_length; itr++)
{
//cout << "itr: " << itr << endl;
FeatureGridMDP* temp_mdp = new FeatureGridMDP (mdp->getGridWidth(),mdp->getGridHeight(), mdp->getInitialStates(), mdp->getTerminalStates(), mdp->getNumFeatures(), mdp->getFeatureWeights(), mdp->getStateFeatures(), mdp->isStochastic(), mdp->getDiscount());
//set the walls
temp_mdp->setWallStates(mdp->getWallStates());
temp_mdp->setFeatureWeights(mdp->getFeatureWeights());
if(sampling_flag == 0)
{ //random grid walk
modifyFeatureWeightsRandomly(temp_mdp,step_size);
}
else if(sampling_flag == 1)
{
//cout << "sampling randomly from L1 unit ball" << endl;
sampleL1UnitBallRandomly(temp_mdp);
}
//updown sampling on L1 ball
else if(sampling_flag == 2)
{
//cout << "before step" << endl;
//temp_mdp->displayFeatureWeights();
updownL1UnitBallWalk(temp_mdp, step_size);
//cout << "after step" << endl;
//temp_mdp->displayFeatureWeights();
//check if norm is right
assert(isEqual(l1_norm(temp_mdp->getFeatureWeights(), temp_mdp->getNumFeatures()),1.0));
}
//random manifold walk sampling
else if(sampling_flag == 3)
{
manifoldL1UnitBallWalk(temp_mdp, step_size, num_steps);
assert(isEqual(l1_norm(temp_mdp->getFeatureWeights(), temp_mdp->getNumFeatures()),1.0));
}
else if(sampling_flag == 4)
{
manifoldL1UnitBallWalkAllSteps(temp_mdp, step_size);
assert(isEqual(l1_norm(temp_mdp->getFeatureWeights(), temp_mdp->getNumFeatures()),1.0));
}
//cout << "trying out" << endl;
//temp_mdp->displayFeatureWeights();
//temp_mdp->valueIteration(eps, mdp->getValues());
//temp_mdp->deterministicPolicyIteration(policy);//valueIteration(0.05);
//temp_mdp->calculateQValues();
double new_posterior = calculatePosterior(temp_mdp);
//cout << "nwe posterior: " << new_posterior << endl;
double probability = min((double)1.0, exp(new_posterior - posterior));
//cout << "probability accept = " << probability << endl;
//transition with probability
double r = ((double) rand() / (RAND_MAX));
if ( r < probability ) //policy_changed &&
{
//temp_mdp->displayFeatureWeights();
//cout << "accept" << endl;
mdp = temp_mdp;
posterior = new_posterior;
R_chain[itr] = temp_mdp;
posteriors[itr] = exp(new_posterior);
//if (itr%100 == 0) cout << itr << ": " << posteriors[itr] << endl;
if(posteriors[itr] > MAPposterior)
{
cout << "iter " << itr << endl;
cout << "new MAP" << endl;
temp_mdp->displayFeatureWeights();
MAPposterior = posteriors[itr];
//TODO remove set terminals, right? why here in first place?
MAPmdp->setFeatureWeights(mdp->getFeatureWeights());
}
}else {
//delete temp_mdp
delete temp_mdp;
//keep previous reward in chain
//cout << "reject!!!!" << endl;
reject_cnt++;
if(mcmc_reject)
{
//TODO can I make this more efficient by adding a count variable?
//make a copy of mdp
FeatureGridMDP* mdp_copy = new FeatureGridMDP (mdp->getGridWidth(),mdp->getGridHeight(), mdp->getInitialStates(), mdp->getTerminalStates(), mdp->getNumFeatures(), mdp->getFeatureWeights(), mdp->getStateFeatures(), mdp->isStochastic(), mdp->getDiscount());
//mdp_copy->setValues(mdp->getValues());
//mdp_copy->setQValues(mdp->getQValues());
mdp_copy->setWallStates(mdp->getWallStates());
R_chain[itr] = mdp_copy;
}
//sample until you get accept and then add that -- doesn't repeat old reward in chain
else
{
assert(reject_cnt < 100000);
itr--;
//delete temp_mdp;
}
}
}
cout << "accepts / total: " << chain_length - reject_cnt << "/" << chain_length << endl;
}
//optimized version
double FeatureBREX::logsumexp(double* nums, unsigned int size) {
double max_exp = nums[0];
double sum = 0.0;
unsigned int i;
//find max exponent
for (i = 1 ; i < size ; i++)
{
if (nums[i] > max_exp)
max_exp = nums[i];
}
for (i = 0; i < size ; i++)
sum += exp(nums[i] - max_exp);
return log(sum) + max_exp;
}
//computes posterior using pairwise preference softmax likelihood fn
double FeatureBREX::calculatePosterior(FeatureGridMDP* gmdp) //assuming uniform prior
{
double posterior = 0;
//add in a zero norm (non-zero count)
double prior = 0;
// int count = 0;
// double* weights = gmdp->getFeatureWeights();
// for(int i=0; i < gmdp->getNumFeatures(); i++)
// if(abs(weights[i]) > 0.0001)
// count += 1;
// prior = -1 * alpha * log(count-1);
posterior += prior;
double* weights = gmdp->getFeatureWeights();
// "-- Ranked Demos --" each element is a pair of trajectory indices
for(unsigned int i=0; i < pairwise_preferences.size(); i++)
{
pair<unsigned int,unsigned int> trajpair = pairwise_preferences[i];
unsigned int worse_idx = trajpair.first;
unsigned int better_idx = trajpair.second;
//cout << "prefrence: " << worse_idx << " < " << better_idx << endl;
vector<double> fcounts_better = fcounts[better_idx];
vector<double> fcounts_worse = fcounts[worse_idx];
//compute dot products
double better_return = dotProduct(weights, &fcounts_better[0], nfeatures);
double worse_return = dotProduct(weights, &fcounts_worse[0], nfeatures);
//cout << "better return = " << better_return << " worse return = " << worse_return << endl;
double Z [2];
Z[0] = alpha * better_return;
Z[1] = alpha * worse_return;
//cout << Z[0] << "," << Z[1] << endl;
float pairwise_likelihood = alpha * better_return - logsumexp(Z, 2);
//cout << alpha * better_return << endl;
//cout << logsumexp(Z,2) << endl;
//cout << worse_idx << " < " << better_idx << " loglikelihood = " << pairwise_likelihood << endl;
posterior += pairwise_likelihood;
//cout << state << "," << action << ": " << posterior << endl;
}
return posterior;
}
void FeatureBREX::modifyFeatureWeightsRandomly(FeatureGridMDP * gmdp, double step)
{
unsigned int state = rand() % gmdp->getNumFeatures();
double change = pow(-1,rand()%2)*step;
//cout << "before " << gmdp->getReward(state) << endl;
//cout << "change " << change << endl;
double weight = max(min(gmdp->getWeight(state) + change, r_max), r_min);
//if(gmdp->isTerminalState(state)) reward = max(min(gmdp->getReward(state) + change, r_max), 0.0);
//else reward = max(min(gmdp->getReward(state) + change, 0.0), r_min);
//cout << "after " << reward << endl;
gmdp->setFeatureWeight(state, weight);
}
void FeatureBREX::sampleL1UnitBallRandomly(FeatureGridMDP * gmdp)
{
unsigned int numFeatures = gmdp->getNumFeatures();
double* newWeights = sample_unit_L1_norm(numFeatures);
gmdp->setFeatureWeights(newWeights);
delete [] newWeights;
}
void FeatureBREX::updownL1UnitBallWalk(FeatureGridMDP * gmdp, double step)
{
unsigned int numFeatures = gmdp->getNumFeatures();
double* newWeights = updown_l1_norm_walk(gmdp->getFeatureWeights(), numFeatures, step);
gmdp->setFeatureWeights(newWeights);
delete [] newWeights;
}
void FeatureBREX::manifoldL1UnitBallWalk(FeatureGridMDP * gmdp, double step, int num_steps)
{
unsigned int numFeatures = gmdp->getNumFeatures();
double* newWeights = random_manifold_l1_step(gmdp->getFeatureWeights(), numFeatures, step, num_steps);
gmdp->setFeatureWeights(newWeights);
delete [] newWeights;
}
void FeatureBREX::manifoldL1UnitBallWalkAllSteps(FeatureGridMDP * gmdp, double step)
{
unsigned int numFeatures = gmdp->getNumFeatures();
double* newWeights = take_all_manifold_l1_steps(gmdp->getFeatureWeights(), numFeatures, step);
gmdp->setFeatureWeights(newWeights);
delete [] newWeights;
}
//accumulate the feature counts of a vector
vector<double> FeatureBREX::computeFCounts(vector<pair<unsigned int, unsigned int> > traj)
{
vector<double> fcounts(nfeatures);
for(unsigned int t = 0; t < traj.size(); t++)
{
pair<unsigned int, unsigned int> p = traj[t];
unsigned int state = p.first;
//get feature vector for state
double* f = stateFeatures[state];
for(unsigned int i=0; i<nfeatures; i++)
fcounts[i] += pow(gamma, t) * f[i];
}
return fcounts;
}
//compute fcounts for each demo
void FeatureBREX::addTrajectories(vector<vector<pair<unsigned int,unsigned int> > > demonstrations)
{
for(vector<pair<unsigned int, unsigned int> > traj : demonstrations)
{
vector<double> fcs = computeFCounts(traj);
fcounts.push_back(fcs);
}
// for(unsigned int t = 0; t < fcounts.size(); t++)
// {
// cout << "fcounts " << t << endl;
// for(unsigned int i = 0; i < fcounts[t].size(); i++)
// cout << fcounts[t][i] << ",";
// cout << endl;
// }
}
//input is a list of pairs (i,j) where j is preferred over i.
void FeatureBREX::addPairwisePreferences(vector<pair<unsigned int,unsigned int> > prefs)
{
for(pair<unsigned int, unsigned int> p : prefs)
pairwise_preferences.push_back(p);
// cout <<"preferences" << endl;
// for(pair<unsigned int, unsigned int> p : pairwise_preferences)
// cout << "(" << p.first << ", " << p.second << ")" << endl;
}
void FeatureBREX::initializeMDP()
{
// if(sampling_flag == 0)
// {
// double* weights = new double[mdp->getNumFeatures()];
// for(unsigned int s=0; s<mdp->getNumFeatures(); s++)
// {
// weights[s] = (r_min+r_max)/2;
// }
// mdp->setFeatureWeights(weights);
// delete [] weights;
// }
// else if (sampling_flag == 1) //sample randomly from L1 unit ball
// {
// double* weights = sample_unit_L1_norm(mdp->getNumFeatures());
// mdp->setFeatureWeights(weights);
// delete [] weights;
// }
// else if(sampling_flag == 2)
// {
unsigned int numDims = mdp->getNumFeatures();
double* weights = new double[numDims];
for(unsigned int s=0; s<numDims; s++)
weights[s] = -1.0 / numDims;
// {
// if((rand() % 2) == 0)
// weights[s] = 1.0 / numDims;
// else
// weights[s] = -1.0 / numDims;
//// if(s == 0)
//// weights[s] = 1.0;
//// else
//// weights[s] = 0.0;
// }
// weights[0] = 0.2;
// weights[1] = 0.2;
// weights[2] = -0.2;
// weights[3] = 0.2;
// weights[4] = 0.2;
//weights[0] = 1.0;
mdp->setFeatureWeights(weights);
delete [] weights;
// }
// else if(sampling_flag == 3)
// {
// unsigned int numDims = mdp->getNumFeatures();
// double* weights = new double[numDims];
// for(unsigned int s=0; s<numDims; s++)
// weights[s] = 0.0;
//// {
//// if((rand() % 2) == 0)
//// weights[s] = 1.0 / numDims;
//// else
//// weights[s] = -1.0 / numDims;
////// if(s == 0)
////// weights[s] = 1.0;
////// else
////// weights[s] = 0.0;
//// }
//// weights[0] = 0.2;
//// weights[1] = 0.2;
//// weights[2] = -0.2;
//// weights[3] = 0.2;
//// weights[4] = 0.2;
// weights[0] = 1.0;
// mdp->setFeatureWeights(weights);
// delete [] weights;
// }
}
FeatureGridMDP* FeatureBREX::getMeanMDP(int burn, int skip)
{
//average rewards in chain
int nFeatures = mdp->getNumFeatures();
double aveWeights[nFeatures];
for(int i=0;i<nFeatures;i++) aveWeights[i] = 0;
int count = 0;
for(unsigned int i=burn; i<chain_length; i+=skip)
{
count++;
//(*(R_chain + i))->displayFeatureWeights();
//cout << "weights" << endl;
double* w = (*(R_chain + i))->getFeatureWeights();
for(int f=0; f < nFeatures; f++)
aveWeights[f] += w[f];
}
for(int f=0; f < nFeatures; f++)
aveWeights[f] /= count;
// //create new MDP with average weights as features
FeatureGridMDP* mean_mdp = new FeatureGridMDP(MAPmdp->getGridWidth(),MAPmdp->getGridHeight(), MAPmdp->getInitialStates(), MAPmdp->getTerminalStates(), MAPmdp->getNumFeatures(), aveWeights, MAPmdp->getStateFeatures(), MAPmdp->isStochastic(), MAPmdp->getDiscount());
mean_mdp->setWallStates(MAPmdp->getWallStates());
return mean_mdp;
}
#endif
| 18,274 | 6,272 |
// Copyright (C) 2010-2015 Conrad Sanderson
// Copyright (C) 2010-2015 NICTA (www.nicta.com.au)
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup glue_conv
//! @{
class glue_conv
{
public:
template<typename eT> inline static void apply_noalias(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B, const bool A_is_col);
template<typename T1, typename T2> inline static void apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_conv>& X);
};
//! @}
| 649 | 264 |
#include "../../include/blockchain/Chain.hpp"
#include <iostream>
using namespace std;
string Chain::say_hello() const { return "Hello, world"; }
| 148 | 46 |
/*
Config parser originally write to Guitar++ https://github.com/Fabio3rs/Guitar-PlusPlus
Write by Fabio3rs - https://github.com/Fabio3rs
*/
#include "CText.h"
#include <cctype>
#include <iostream>
void CText::Parse(){
if(fileName.length() == 0){
return;
}
if(is_open()){
file.close();
}
file.open(fileName, std::ios::in | std::ios::out | std::ios::binary);
if(!is_open()){
throw std::logic_error(std::string("Can't open file ") + fileName);
}
tables.clear();
char *content = nullptr;
file.seekg(0, std::ios::end);
fileSize = file.tellg();
file.seekg(0, std::ios::beg);
if(fileSize == -1L || fileSize == 0){
return;
}
content = new char[fileSize + 4];
memset(content, 0, fileSize + 4);
if(!content){
throw std::logic_error("Alloc space fail");
}
file.read(content, fileSize);
content[fileSize] = 0;
char bufferA[128], bufferB[2048];
integer workingInScope = 0;
table_t globalTable;
globalTable.name = "GLOBAL";
tables.push_back(globalTable);
for(size_t i = 0; i < fileSize; i++){
while(!isprint((unsigned char)content[i])) i++;
*bufferA = 0;
*bufferB = 0;
int scanResult = sscanf(&content[i], "%127s %2047[^\t\n\r]", bufferA, bufferB);
if(*bufferA == '@'){
integer tempWorkingScope = 0;
if((tempWorkingScope = getTableIDByName(&bufferA[1])) != -1){
workingInScope = tempWorkingScope;
}else if(bufferA[1]){
table_t newTable;
newTable.name = &bufferA[1];
tables.push_back(newTable);
workingInScope = tables.size() - (int64_t)1;
}else{
workingInScope = 0;
}
}
else if (*bufferA == '#'){
}
else{
field_t newField;
switch(scanResult){
case 2:
newField.content = bufferB;
case 1:
newField.name = bufferA;
tables[workingInScope].fields.push_back(newField);
break;
}
}
while(content[i] != '\n' && content[i] != '\r' && content[i] != 0) i++;
i--;
}
delete[] content;
}
void CText::open(const char *name, bool autoParse){
fileName = name;
if (autoParse) Parse();
}
CText::CText(){
fileSize = 0;
}
void CText::save(){
if (is_open()){
file.close();
}
file.open(fileName, std::ios::out | std::ios::trunc);
file.close();
file.open(fileName, std::ios::in | std::ios::out);
for (int i = 0, size = tables.size(); i < size; i++){
file << "@" << tables[i].name << "\n";
for (int j = 0, jsize = tables[i].fields.size(); j < jsize; j++){
file << tables[i].fields[j].name << " " << tables[i].fields[j].content << "\n";
}
file << "\n###### fstream bugs everywhere ######";
}
}
CText::CText(const char *name, bool autoParse){
fileName = name;
if(autoParse) Parse();
}
| 2,785 | 1,224 |
/*
* FactoryForCpp.cpp
*
* Created on: 20 janv. 2016
* Author: FrancisANDRE
*/
#include "fsmc/cpp/FactoryForCpp.h"
#include "fsmc/cpp/ActionForCpp.h"
#include "fsmc/cpp/FSMForCpp.h"
#include "fsmc/cpp/GuardForCpp.h"
#include "fsmc/cpp/MapForCpp.h"
#include "fsmc/cpp/ParameterForCpp.h"
#include "fsmc/cpp/StateForCpp.h"
#include "fsmc/cpp/EntryForCpp.h"
#include "fsmc/cpp/ExitForCpp.h"
#include "fsmc/cpp/TransitionForCpp.h"
#include "fsmc/cpp/ReferenceForCpp.h"
#include "fsmc/cpp/VariableForCpp.h"
#include "fsmc/cpp/FunctionForCpp.h"
#include "fsmc/cpp/LiteralForCpp.h"
#include "fsmc/cpp/ArgumentForCpp.h"
#include "fsmc/cpp/UnaryOperationForCpp.h"
#include "fsmc/cpp/BinaryOperationForCpp.h"
namespace ALS {
namespace SMC {
namespace PARSER {
namespace CPP {
ActionPtr FactoryForCpp::newAction(const string& name, int lineno) const {
return new ActionForCpp(name, lineno);
}
FSMPtr FactoryForCpp::newFSM(Parser* parser) const {
return new FSMForCpp(parser);
}
GuardPtr FactoryForCpp::newGuard(const string& name, int lineno) const {
return new GuardForCpp(name, lineno);
}
MapPtr FactoryForCpp::newMap(const string& name, int lineno) const {
return new MapForCpp(name, lineno);
}
ParameterPtr FactoryForCpp::newParameter(const string& name, int lineno) const{
return new ParameterForCpp(name, lineno);
}
StatePtr FactoryForCpp::newState(const string& name, int lineno) const{
return new StateForCpp(name, lineno);
}
EntryPtr FactoryForCpp::newEntry(const string& name, int lineno) const{
return new EntryForCpp(name, lineno);
}
ExitPtr FactoryForCpp::newExit(const string& name, int lineno) const {
return new ExitForCpp(name, lineno);
}
TransitionPtr FactoryForCpp::newTransition(const string& name, int lineno) const{
return new TransitionForCpp(name, lineno);
}
ReferencePtr FactoryForCpp::newReference(const VariablePtr variable, int lineno) const {
return new ReferenceForCpp(variable, lineno);
}
ReferencePtr FactoryForCpp::newReference(const FunctionPtr function, int lineno) const {
return new ReferenceForCpp(function, lineno);
}
ReferencePtr FactoryForCpp::newReference(const LiteralPtr literal, int lineno) const {
return new ReferenceForCpp(literal, lineno);
}
VariablePtr FactoryForCpp::newVariable(const string& name, int lineno) const{
return new VariableForCpp(name, lineno);
}
FunctionPtr FactoryForCpp::newFunction(const string& name, int lineno) const{
return new FunctionForCpp(name, lineno);
}
LiteralPtr FactoryForCpp::newLiteral(const string& name, int lineno) const{
return new LiteralForCpp(name, lineno);
}
ArgumentPtr FactoryForCpp::newArgument(const string& name, int lineno) const{
return new ArgumentForCpp(name, lineno);
}
UnaryOperationPtr FactoryForCpp::newUnaryOperation(ALS::SMC::MODEL::Operator op) const{
return new UnaryOperationForCpp(op);
}
BinaryOperationPtr FactoryForCpp::newBinaryOperation(ALS::SMC::MODEL::Operator op) const{
return new BinaryOperationForCpp(op);
}
}
}
}
} | 3,195 | 1,323 |
// This file is part of ViViA, and is distributed under the
// OSI-approved BSD 3-Clause License. See top-level LICENSE file or
// https://github.com/Kitware/vivia/blob/master/LICENSE for details.
#include "vtkVsTrackInfo.h"
vtkImplementMetaObject(vtkVsTrackInfo, vtkVgEventTrackInfoBase);
//-----------------------------------------------------------------------------
vtkVsTrackInfo::vtkVsTrackInfo(
vsTrackId tid, const vtkVgTimeStamp& start, const vtkVgTimeStamp& end)
: vtkVgEventTrackInfoBase(-1, start, end), LogicalId(tid)
{
}
//-----------------------------------------------------------------------------
vtkVsTrackInfo::vtkVsTrackInfo(const vtkVsTrackInfo& other)
: vtkVgEventTrackInfoBase(other), LogicalId(other.LogicalId)
{
}
//-----------------------------------------------------------------------------
vtkVsTrackInfo::~vtkVsTrackInfo()
{
}
//-----------------------------------------------------------------------------
vtkVgEventTrackInfoBase* vtkVsTrackInfo::Clone() const
{
return new vtkVsTrackInfo(*this);
}
//-----------------------------------------------------------------------------
const char* vtkVsTrackInfo::CheckValid() const
{
if (this->LogicalId.Source < 0)
{
return "Only non-negative track sources are allowed.\n";
}
if (this->LogicalId.SerialNumber < 0)
{
return "Only non-negative track serial numbers are allowed.\n";
}
return vtkVgEventTrackInfoBase::CheckBaseValid();
}
| 1,458 | 446 |
#include <iostream>
#include <climits>
#include <cstdint>
class Foo
{
public:
//Foo(int i) { std::cout << "Foo(I=" << i << ")" << std::endl; }
Foo(long i) { std::cout << "Foo(L=" << i << ")" << std::endl; }
//Foo(long long i) { std::cout << "Foo(LL=" << i << ")" << std::endl; }
Foo(unsigned int i) { std::cout << "Foo(UI=" << i << ")" << std::endl; }
//Foo(unsigned long i) { std::cout << "Foo(UL=" << i << ")" << std::endl; }
//Foo(unsigned long long i) { std::cout << "Foo(ULL=" << i << ")" << std::endl; }
};
int main(void)
{
char c = 7;
short s = 37;
int i = INT_MIN;
unsigned u = UINT_MAX;
Foo C(c);
Foo S(s);
Foo I(i);
Foo U(u);
return 0;
}
| 750 | 296 |
#include "w_system_pch.h"
#include "wolf.h"
| 44 | 23 |
// Part of the Eelbot Framework project, under the MIT License.
// Copyright (c) 2020 The Emseers.
#include "catch2/catch_test_macros.hpp"
#include "eelbot_framework/discord_bot/structs.hpp"
#include "eelbot_framework/json.hpp"
TEST_CASE("discord_bot::session_start_limit can be serialized to JSON", "[unit-test][json]") {
eelbot_framework::discord_bot::session_start_limit session_start_limit;
session_start_limit.total = 1;
session_start_limit.remaining = -2;
session_start_limit.reset_after = 0;
REQUIRE(eelbot_framework::to_json_str(session_start_limit) == "{\"remaining\":-2,\"reset_after\":0,\"total\":1}");
}
TEST_CASE("discord_bot::gateway_response can be serialized to JSON", "[unit-test][json]") {
eelbot_framework::discord_bot::gateway_response gateway_response;
gateway_response.url = "https://github.com/Emseers/eelbot-framework";
REQUIRE(
eelbot_framework::to_json_str(gateway_response) == "{\"url\":\"https://github.com/Emseers/eelbot-framework\"}");
}
TEST_CASE("discord_bot::gateway_bot_response can be serialized to JSON", "[unit-test][json]") {
eelbot_framework::discord_bot::session_start_limit session_start_limit;
session_start_limit.total = 1;
session_start_limit.remaining = -2;
session_start_limit.reset_after = 0;
eelbot_framework::discord_bot::gateway_bot_response gateway_bot_response;
gateway_bot_response.url = "https://github.com/Emseers/eelbot-framework";
gateway_bot_response.shards = 99;
gateway_bot_response.sess_start_limit = session_start_limit;
REQUIRE(eelbot_framework::to_json_str(gateway_bot_response) ==
"{\"session_start_limit\":{\"remaining\":-2,\"reset_after\":0,\"total\":1},"
"\"shards\":99,\"url\":\"https://github.com/Emseers/eelbot-framework\"}");
}
TEST_CASE("discord_bot::shard_info can be serialized to JSON", "[unit-test][json]") {
eelbot_framework::discord_bot::shard_info shard_info;
shard_info.shard_id = 1;
shard_info.num_shards = 2;
REQUIRE(eelbot_framework::to_json_str(shard_info) == "[1,2]");
}
TEST_CASE("discord_bot::party_size_info can be serialized to JSON", "[unit-test][json]") {
eelbot_framework::discord_bot::party_size_info party_size_info;
party_size_info.current_size = 3;
party_size_info.max_size = 5;
REQUIRE(eelbot_framework::to_json_str(party_size_info) == "[3,5]");
}
TEST_CASE("discord_bot::activity_timestamps can be serialized to JSON", "[unit-test][json]") {
eelbot_framework::discord_bot::activity_timestamps activity_timestamps;
SECTION("serialize all optional fields being null") {
REQUIRE(eelbot_framework::to_json_str(activity_timestamps) == "{\"end\":null,\"start\":null}");
}
SECTION("serialize some optional fields being null") {
activity_timestamps.start = 500;
REQUIRE(eelbot_framework::to_json_str(activity_timestamps) == "{\"end\":null,\"start\":500}");
}
SECTION("serialize no optional fields being null") {
activity_timestamps.start = 500;
activity_timestamps.end = 1000;
REQUIRE(eelbot_framework::to_json_str(activity_timestamps) == "{\"end\":1000,\"start\":500}");
}
}
TEST_CASE("discord_bot::activity_emoji can be serialized to JSON", "[unit-test][json]") {
eelbot_framework::discord_bot::activity_emoji activity_emoji;
activity_emoji.name = "eel";
SECTION("serialize all optional fields being null") {
REQUIRE(eelbot_framework::to_json_str(activity_emoji) == "{\"animated\":null,\"id\":null,\"name\":\"eel\"}");
}
SECTION("serialize some optional fields being null") {
activity_emoji.id = "123456789";
REQUIRE(eelbot_framework::to_json_str(activity_emoji) ==
"{\"animated\":null,\"id\":\"123456789\",\"name\":\"eel\"}");
}
SECTION("serialize no optional fields being null") {
activity_emoji.id = "123456789";
activity_emoji.animated = false;
REQUIRE(eelbot_framework::to_json_str(activity_emoji) ==
"{\"animated\":false,\"id\":\"123456789\",\"name\":\"eel\"}");
}
}
TEST_CASE("discord_bot::activity_party can be serialized to JSON", "[unit-test][json]") {
eelbot_framework::discord_bot::activity_party activity_party;
SECTION("serialize all optional fields being null") {
REQUIRE(eelbot_framework::to_json_str(activity_party) == "{\"id\":null,\"size\":null}");
}
SECTION("serialize some optional fields being null") {
activity_party.id = "123456789";
REQUIRE(eelbot_framework::to_json_str(activity_party) == "{\"id\":\"123456789\",\"size\":null}");
}
SECTION("serialize no optional fields being null") {
eelbot_framework::discord_bot::party_size_info party_size_info;
party_size_info.current_size = 3;
party_size_info.max_size = 5;
activity_party.id = "123456789";
activity_party.size = party_size_info;
REQUIRE(eelbot_framework::to_json_str(activity_party) == "{\"id\":\"123456789\",\"size\":[3,5]}");
}
}
TEST_CASE("discord_bot::activity_assets can be serialized to JSON", "[unit-test][json]") {
eelbot_framework::discord_bot::activity_assets activity_assets;
SECTION("serialize all optional fields being null") {
REQUIRE(eelbot_framework::to_json_str(activity_assets) ==
"{\"large_image\":null,\"large_text\":null,\"small_image\":null,\"small_text\":null}");
}
SECTION("serialize some optional fields being null") {
activity_assets.large_image = "123456789";
activity_assets.small_text = "tooltip";
REQUIRE(eelbot_framework::to_json_str(activity_assets) ==
"{\"large_image\":\"123456789\",\"large_text\":null,\"small_image\":null,"
"\"small_text\":\"tooltip\"}");
}
SECTION("serialize no optional fields being null") {
activity_assets.large_image = "123456789";
activity_assets.large_text = "tooltip";
activity_assets.small_image = "123456789";
activity_assets.small_text = "tooltip";
REQUIRE(eelbot_framework::to_json_str(activity_assets) ==
"{\"large_image\":\"123456789\",\"large_text\":\"tooltip\",\"small_image\":\"123456789\","
"\"small_text\":\"tooltip\"}");
}
}
TEST_CASE("discord_bot::activity_secrets can be serialized to JSON", "[unit-test][json]") {
eelbot_framework::discord_bot::activity_secrets activity_secrets;
SECTION("serialize all optional fields being null") {
REQUIRE(eelbot_framework::to_json_str(activity_secrets) == "{\"join\":null,\"match\":null,\"spectate\":null}");
}
SECTION("serialize some optional fields being null") {
activity_secrets.join = "secret one";
REQUIRE(eelbot_framework::to_json_str(activity_secrets) ==
"{\"join\":\"secret one\",\"match\":null,\"spectate\":null}");
}
SECTION("serialize no optional fields being null") {
activity_secrets.join = "secret one";
activity_secrets.spectate = "secret two";
activity_secrets.match = "secret three";
REQUIRE(eelbot_framework::to_json_str(activity_secrets) ==
"{\"join\":\"secret one\",\"match\":\"secret three\",\"spectate\":\"secret two\"}");
}
}
TEST_CASE("discord_bot::activity can be serialized to JSON", "[unit-test][json]") {
eelbot_framework::discord_bot::activity activity;
activity.name = "activity";
activity.type = 1;
activity.created_at = 500;
SECTION("serialize all optional fields being null") {
REQUIRE(eelbot_framework::to_json_str(activity) ==
"{\"application_id\":null,\"assets\":null,\"created_at\":500,\"details\":null,"
"\"emoji\":null,\"flags\":null,\"instance\":null,\"name\":\"activity\",\"party\":null,"
"\"secrets\":null,\"state\":null,\"timestamps\":null,\"type\":1,\"url\":null}");
}
SECTION("serialize some optional fields being null") {
eelbot_framework::discord_bot::activity_timestamps activity_timestamps;
activity_timestamps.start = 500;
eelbot_framework::discord_bot::activity_secrets activity_secrets;
activity.url = "https://github.com/Emseers/eelbot-framework";
activity.timestamps = activity_timestamps;
activity.secrets = activity_secrets;
REQUIRE(eelbot_framework::to_json_str(activity) ==
"{\"application_id\":null,\"assets\":null,\"created_at\":500,\"details\":null,"
"\"emoji\":null,\"flags\":null,\"instance\":null,\"name\":\"activity\",\"party\":null,"
"\"secrets\":{\"join\":null,\"match\":null,\"spectate\":null},\"state\":null,"
"\"timestamps\":{\"end\":null,\"start\":500},\"type\":1,\"url\":\"https://github.com/"
"Emseers/eelbot-framework\"}");
}
SECTION("serialize no optional fields being null") {
eelbot_framework::discord_bot::activity_timestamps activity_timestamps;
activity_timestamps.start = 500;
eelbot_framework::discord_bot::activity_emoji activity_emoji;
activity_emoji.name = "eel";
eelbot_framework::discord_bot::activity_party activity_party;
eelbot_framework::discord_bot::activity_assets activity_assets;
eelbot_framework::discord_bot::activity_secrets activity_secrets;
activity.url = "https://github.com/Emseers/eelbot-framework";
activity.timestamps = activity_timestamps;
activity.application_id = "123456789";
activity.details = "something";
activity.state = "in a match";
activity.emoji = activity_emoji;
activity.party = activity_party;
activity.assets = activity_assets;
activity.secrets = activity_secrets;
activity.instance = true;
activity.flags = 512;
REQUIRE(eelbot_framework::to_json_str(activity) ==
"{\"application_id\":\"123456789\",\"assets\":{\"large_image\":null,\"large_text\":"
"null,\"small_image\":null,\"small_text\":null},\"created_at\":500,\"details\":"
"\"something\",\"emoji\":{\"animated\":null,\"id\":null,\"name\":\"eel\"},\"flags\":512,"
"\"instance\":true,\"name\":\"activity\",\"party\":{\"id\":null,\"size\":null},\"secrets\":"
"{\"join\":null,\"match\":null,\"spectate\":null},\"state\":\"in a match\",\"timestamps\":"
"{\"end\":null,\"start\":500},\"type\":1,\"url\":\"https://github.com/Emseers/eelbot-"
"framework\"}");
}
}
TEST_CASE("discord_bot::status_type can be serialized to JSON", "[unit-test][json]") {
SECTION("serialize status_type = online") {
REQUIRE(eelbot_framework::to_json_str(eelbot_framework::discord_bot::status_type::online) == "\"online\"");
}
SECTION("serialize status_type = dnd") {
REQUIRE(eelbot_framework::to_json_str(eelbot_framework::discord_bot::status_type::dnd) == "\"dnd\"");
}
SECTION("serialize status_type = idle") {
REQUIRE(eelbot_framework::to_json_str(eelbot_framework::discord_bot::status_type::idle) == "\"idle\"");
}
SECTION("serialize status_type = invisible") {
REQUIRE(
eelbot_framework::to_json_str(eelbot_framework::discord_bot::status_type::invisible) == "\"invisible\"");
}
SECTION("serialize status_type = offline") {
REQUIRE(eelbot_framework::to_json_str(eelbot_framework::discord_bot::status_type::offline) == "\"offline\"");
}
}
TEST_CASE("discord_bot::status_update can be serialized to JSON", "[unit-test][json]") {
eelbot_framework::discord_bot::status_update status_update;
status_update.status = eelbot_framework::discord_bot::status_type::online;
status_update.afk = false;
SECTION("serialize all optional fields being null") {
REQUIRE(eelbot_framework::to_json_str(status_update) ==
"{\"activities\":null,\"afk\":false,\"since\":null,\"status\":\"online\"}");
}
SECTION("serialize some optional fields being null") {
status_update.since = 500;
REQUIRE(eelbot_framework::to_json_str(status_update) ==
"{\"activities\":null,\"afk\":false,\"since\":500,\"status\":\"online\"}");
}
SECTION("serialize no optional fields being null") {
eelbot_framework::discord_bot::activity activity_one;
activity_one.name = "activity one";
activity_one.type = 1;
activity_one.created_at = 500;
eelbot_framework::discord_bot::activity activity_two;
activity_two.name = "activity two";
activity_two.type = 0;
activity_two.created_at = 1000;
status_update.since = 500;
status_update.activities.push_back(activity_one);
status_update.activities.push_back(activity_two);
REQUIRE(eelbot_framework::to_json_str(status_update) ==
"{\"activities\":[{\"application_id\":null,\"assets\":null,\"created_at\":500,"
"\"details\":null,\"emoji\":null,\"flags\":null,\"instance\":null,\"name\":\"activity "
"one\",\"party\":null,\"secrets\":null,\"state\":null,\"timestamps\":null,\"type\":1,"
"\"url\":null},{\"application_id\":null,\"assets\":null,\"created_at\":1000,\"details\":"
"null,\"emoji\":null,\"flags\":null,\"instance\":null,\"name\":\"activity two\",\"party\":"
"null,\"secrets\":null,\"state\":null,\"timestamps\":null,\"type\":0,\"url\":null}],"
"\"afk\":false,\"since\":500,\"status\":\"online\"}");
}
}
TEST_CASE("discord_bot::user can be serialized to JSON", "[unit-test][json]") {
eelbot_framework::discord_bot::user user;
user.id = "123456789";
user.username = "eel";
user.discriminator = "1337";
SECTION("serialize all optional fields being null") {
REQUIRE(eelbot_framework::to_json_str(user) ==
"{\"avatar\":null,\"bot\":null,\"discriminator\":\"1337\",\"email\":null,\"flags\":null,"
"\"id\":\"123456789\",\"locale\":null,\"mfa_enabled\":null,\"premium_type\":null,"
"\"public_flags\":null,\"system\":null,\"username\":\"eel\",\"verified\":null}");
}
SECTION("serialize some optional fields being null") {
user.avatar = "avatar";
user.bot = true;
user.email = "eel@emseers.com";
user.flags = 64;
REQUIRE(eelbot_framework::to_json_str(user) ==
"{\"avatar\":\"avatar\",\"bot\":true,\"discriminator\":\"1337\",\"email\":\"eel@emseers."
"com\",\"flags\":64,\"id\":\"123456789\",\"locale\":null,\"mfa_enabled\":null,"
"\"premium_type\":null,\"public_flags\":null,\"system\":null,\"username\":\"eel\","
"\"verified\":null}");
}
SECTION("serialize no optional fields being null") {
user.avatar = "avatar";
user.bot = true;
user.system = false;
user.mfa_enabled = false;
user.locale = "en";
user.verified = false;
user.email = "eel@emseers.com";
user.flags = 64;
user.premium_type = 1;
user.public_flags = 64;
REQUIRE(eelbot_framework::to_json_str(user) ==
"{\"avatar\":\"avatar\",\"bot\":true,\"discriminator\":\"1337\",\"email\":\"eel@emseers."
"com\",\"flags\":64,\"id\":\"123456789\",\"locale\":\"en\",\"mfa_enabled\":false,"
"\"premium_type\":1,\"public_flags\":64,\"system\":false,\"username\":\"eel\","
"\"verified\":false}");
}
}
TEST_CASE("discord_bot::unavailable_guild can be serialized to JSON", "[unit-test][json]") {
eelbot_framework::discord_bot::unavailable_guild unavailable_guild;
unavailable_guild.id = "123456789";
unavailable_guild.unavailable = true;
REQUIRE(eelbot_framework::to_json_str(unavailable_guild) == "{\"id\":\"123456789\",\"unavailable\":true}");
}
TEST_CASE("discord_bot::partial_application can be serialized to JSON", "[unit-test][json]") {
eelbot_framework::discord_bot::partial_application partial_application;
partial_application.id = "123456789";
partial_application.flags = 64;
REQUIRE(eelbot_framework::to_json_str(partial_application) == "{\"flags\":64,\"id\":\"123456789\"}");
}
TEST_CASE("discord_bot::identify_connection_properties can be serialized to JSON", "[unit-test][json]") {
eelbot_framework::discord_bot::identify_connection_properties identify_connection_properties;
identify_connection_properties.os = "linux";
identify_connection_properties.browser = "eelbot_framework";
identify_connection_properties.device = "eelbot_framework";
REQUIRE(eelbot_framework::to_json_str(identify_connection_properties) ==
"{\"$browser\":\"eelbot_framework\",\"$device\":\"eelbot_framework\",\"$os\":\"linux\"}");
}
TEST_CASE("discord_bot::identify can be serialized to JSON", "[unit-test][json]") {
eelbot_framework::discord_bot::identify_connection_properties identify_connection_properties;
identify_connection_properties.os = "linux";
identify_connection_properties.browser = "eelbot_framework";
identify_connection_properties.device = "eelbot_framework";
eelbot_framework::discord_bot::identify identify;
identify.token = "token";
identify.properties = identify_connection_properties;
identify.intents = 7;
SECTION("serialize all optional fields being null") {
REQUIRE(eelbot_framework::to_json_str(identify) ==
"{\"compress\":null,\"guild_subscriptions\":null,\"intents\":7,\"large_treshold\":"
"null,\"presence\":null,\"properties\":{\"$browser\":\"eelbot_framework\",\"$device\":"
"\"eelbot_framework\",\"$os\":\"linux\"},\"shard\":null,\"token\":\"token\"}");
}
SECTION("serialize some optional fields being null") {
eelbot_framework::discord_bot::status_update status_update;
status_update.status = eelbot_framework::discord_bot::status_type::online;
status_update.afk = false;
identify.compress = false;
identify.presence = status_update;
REQUIRE(eelbot_framework::to_json_str(identify) ==
"{\"compress\":false,\"guild_subscriptions\":null,\"intents\":7,\"large_treshold\":"
"null,\"presence\":{\"activities\":null,\"afk\":false,\"since\":null,\"status\":"
"\"online\"},\"properties\":{\"$browser\":\"eelbot_framework\",\"$device\":"
"\"eelbot_framework\",\"$os\":\"linux\"},\"shard\":null,\"token\":\"token\"}");
}
SECTION("serialize no optional fields being null") {
eelbot_framework::discord_bot::shard_info shard_info;
shard_info.shard_id = 1;
shard_info.num_shards = 2;
eelbot_framework::discord_bot::status_update status_update;
status_update.status = eelbot_framework::discord_bot::status_type::online;
status_update.afk = false;
identify.compress = false;
identify.large_treshold = 250;
identify.shard = shard_info;
identify.presence = status_update;
identify.guild_subscriptions = false;
REQUIRE(eelbot_framework::to_json_str(identify) ==
"{\"compress\":false,\"guild_subscriptions\":false,\"intents\":7,\"large_treshold\":"
"250,\"presence\":{\"activities\":null,\"afk\":false,\"since\":null,\"status\":\"online\"}"
",\"properties\":{\"$browser\":\"eelbot_framework\",\"$device\":\"eelbot_framework\","
"\"$os\":\"linux\"},\"shard\":[1,2],\"token\":\"token\"}");
}
}
TEST_CASE("discord_bot::resume can be serialized to JSON", "[unit-test][json]") {
eelbot_framework::discord_bot::resume resume;
resume.token = "token";
resume.session_id = "123456789";
resume.seq = 5;
REQUIRE(eelbot_framework::to_json_str(resume) == "{\"seq\":5,\"session_id\":\"123456789\",\"token\":\"token\"}");
}
TEST_CASE("discord_bot::hello can be serialized to JSON", "[unit-test][json]") {
eelbot_framework::discord_bot::hello hello;
hello.heartbeat_interval = 45000;
REQUIRE(eelbot_framework::to_json_str(hello) == "{\"heartbeat_interval\":45000}");
}
TEST_CASE("discord_bot::ready can be serialized to JSON", "[unit-test][json]") {
eelbot_framework::discord_bot::user user;
user.id = "123456789";
user.username = "eel";
user.discriminator = "1337";
eelbot_framework::discord_bot::unavailable_guild unavailable_guild_1;
unavailable_guild_1.id = "123456789";
unavailable_guild_1.unavailable = true;
eelbot_framework::discord_bot::unavailable_guild unavailable_guild_2;
unavailable_guild_2.id = "987654321";
unavailable_guild_2.unavailable = true;
eelbot_framework::discord_bot::partial_application partial_application;
partial_application.id = "123456789";
partial_application.flags = 64;
eelbot_framework::discord_bot::ready ready;
ready.v = 8;
ready.user_info = user;
ready.guilds.push_back(unavailable_guild_1);
ready.guilds.push_back(unavailable_guild_2);
ready.session_id = "123456789";
ready.application = partial_application;
SECTION("serialize all optional fields being null") {
REQUIRE(eelbot_framework::to_json_str(ready) ==
"{\"application\":{\"flags\":64,\"id\":\"123456789\"},\"guilds\":[{\"id\":\"123456789\","
"\"unavailable\":true},{\"id\":\"987654321\",\"unavailable\":true}],"
"\"private_channels\":[],\"session_id\":\"123456789\",\"shard\":null,\"user\":{\"avatar\":"
"null,\"bot\":null,\"discriminator\":\"1337\",\"email\":null,\"flags\":null,\"id\":"
"\"123456789\",\"locale\":null,\"mfa_enabled\":null,\"premium_type\":null,"
"\"public_flags\":null,\"system\":null,\"username\":\"eel\",\"verified\":null},\"v\":8}");
}
SECTION("serialize no optional fields being null") {
eelbot_framework::discord_bot::shard_info shard_info;
shard_info.shard_id = 1;
shard_info.num_shards = 2;
ready.shard = shard_info;
REQUIRE(eelbot_framework::to_json_str(ready) ==
"{\"application\":{\"flags\":64,\"id\":\"123456789\"},\"guilds\":[{\"id\":\"123456789\","
"\"unavailable\":true},{\"id\":\"987654321\",\"unavailable\":true}],"
"\"private_channels\":[],\"session_id\":\"123456789\",\"shard\":[1,2],\"user\":"
"{\"avatar\":null,\"bot\":null,\"discriminator\":\"1337\",\"email\":null,\"flags\":null,"
"\"id\":\"123456789\",\"locale\":null,\"mfa_enabled\":null,\"premium_type\":null,"
"\"public_flags\":null,\"system\":null,\"username\":\"eel\",\"verified\":null},\"v\":8}");
}
}
TEST_CASE("discord_bot::payload can be serialized to JSON", "[unit-test][json]") {
SECTION("serialize ready payload") {
eelbot_framework::discord_bot::user user;
user.id = "123456789";
user.username = "eel";
user.discriminator = "1337";
eelbot_framework::discord_bot::unavailable_guild unavailable_guild_1;
unavailable_guild_1.id = "123456789";
unavailable_guild_1.unavailable = true;
eelbot_framework::discord_bot::unavailable_guild unavailable_guild_2;
unavailable_guild_2.id = "987654321";
unavailable_guild_2.unavailable = true;
eelbot_framework::discord_bot::partial_application partial_application;
partial_application.id = "123456789";
partial_application.flags = 64;
eelbot_framework::discord_bot::ready ready;
ready.v = 8;
ready.user_info = user;
ready.guilds.push_back(unavailable_guild_1);
ready.guilds.push_back(unavailable_guild_2);
ready.session_id = "123456789";
ready.application = partial_application;
eelbot_framework::discord_bot::payload payload;
payload.op = eelbot_framework::discord_bot::opcode::dispatch;
payload.t = eelbot_framework::discord_bot::event::ready;
payload.d = ready;
REQUIRE(eelbot_framework::to_json_str(payload) ==
"{\"d\":{\"application\":{\"flags\":64,\"id\":\"123456789\"},\"guilds\":[{\"id\":"
"\"123456789\",\"unavailable\":true},{\"id\":\"987654321\",\"unavailable\":true}],"
"\"private_channels\":[],\"session_id\":\"123456789\",\"shard\":null,\"user\":{\"avatar\":"
"null,\"bot\":null,\"discriminator\":\"1337\",\"email\":null,\"flags\":null,\"id\":"
"\"123456789\",\"locale\":null,\"mfa_enabled\":null,\"premium_type\":null,"
"\"public_flags\":null,\"system\":null,\"username\":\"eel\",\"verified\":null},\"v\":8},"
"\"op\":0,\"s\":null,\"t\":\"READY\"}");
}
SECTION("serialize heartbeat payload with null seq") {
eelbot_framework::discord_bot::payload payload;
payload.op = eelbot_framework::discord_bot::opcode::heartbeat;
payload.d = -1;
REQUIRE(eelbot_framework::to_json_str(payload) == "{\"d\":null,\"op\":1,\"s\":null,\"t\":null}");
}
SECTION("serialize heartbeat payload without null seq") {
eelbot_framework::discord_bot::payload payload;
payload.op = eelbot_framework::discord_bot::opcode::heartbeat;
payload.d = 3;
REQUIRE(eelbot_framework::to_json_str(payload) == "{\"d\":3,\"op\":1,\"s\":null,\"t\":null}");
}
SECTION("serialize identify payload") {
eelbot_framework::discord_bot::identify_connection_properties identify_connection_properties;
identify_connection_properties.os = "linux";
identify_connection_properties.browser = "eelbot_framework";
identify_connection_properties.device = "eelbot_framework";
eelbot_framework::discord_bot::identify identify;
identify.token = "token";
identify.properties = identify_connection_properties;
identify.intents = 7;
eelbot_framework::discord_bot::payload payload;
payload.op = eelbot_framework::discord_bot::opcode::identify;
payload.d = identify;
REQUIRE(eelbot_framework::to_json_str(payload) ==
"{\"d\":{\"compress\":null,\"guild_subscriptions\":null,\"intents\":7,"
"\"large_treshold\":null,\"presence\":null,\"properties\":{\"$browser\":"
"\"eelbot_framework\",\"$device\":\"eelbot_framework\",\"$os\":\"linux\"},\"shard\":null,"
"\"token\":\"token\"},\"op\":2,\"s\":null,\"t\":null}");
}
SECTION("serialize hello payload") {
eelbot_framework::discord_bot::hello hello;
hello.heartbeat_interval = 45000;
eelbot_framework::discord_bot::payload payload;
payload.op = eelbot_framework::discord_bot::opcode::hello;
payload.d = hello;
REQUIRE(eelbot_framework::to_json_str(payload) ==
"{\"d\":{\"heartbeat_interval\":45000},\"op\":10,\"s\":null,\"t\":null}");
}
SECTION("serialize resume payload") {
eelbot_framework::discord_bot::resume resume;
resume.token = "token";
resume.session_id = "123456789";
resume.seq = 5;
eelbot_framework::discord_bot::payload payload;
payload.op = eelbot_framework::discord_bot::opcode::resume;
payload.d = resume;
REQUIRE(eelbot_framework::to_json_str(payload) ==
"{\"d\":{\"seq\":5,\"session_id\":\"123456789\",\"token\":\"token\"},\"op\":6,\"s\":null,\"t\":"
"null}");
}
}
| 25,971 | 10,047 |
// Filename: glmisc_src.cxx
// Created by: drose (09Feb04)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#include "pandaSystem.h"
ConfigVariableInt gl_version
("gl-version", "",
PRC_DESC("Set this to get an OpenGL context with a specific version."));
ConfigVariableBool gl_support_fbo
("gl-support-fbo", true,
PRC_DESC("Configure this false if your GL's implementation of "
"EXT_framebuffer_object is broken. The system might still be "
"able to create buffers using pbuffers or the like."));
ConfigVariableBool gl_cheap_textures
("gl-cheap-textures", false,
PRC_DESC("Configure this true to glHint the textures into the cheapest "
"possible mode."));
ConfigVariableBool gl_ignore_clamp
("gl-ignore-clamp", false,
PRC_DESC("Configure this true to disable texture clamp mode (all textures "
"repeat, a little cheaper for software renderers)."));
ConfigVariableBool gl_support_clamp_to_border
("gl-support-clamp-to-border", true,
PRC_DESC("Configure this true to enable the use of the clamp_to_border "
"extension if the GL claims to support it, or false not to "
"use it even if it appears to be available. (On some OpenGL "
"drivers, enabling this mode can force software rendering.)"));
ConfigVariableBool gl_support_rescale_normal
("gl-support-rescale-normal", true,
PRC_DESC("Configure this true to enable the use of the rescale_normal "
"extension if the GL claims to support it, or false not to use "
"it even if it appears to be available. (This appears to be "
"buggy on some drivers.)"));
ConfigVariableBool gl_ignore_filters
("gl-ignore-filters", false,
PRC_DESC("Configure this true to disable any texture filters at all (forcing "
"point sampling)."));
ConfigVariableBool gl_ignore_mipmaps
("gl-ignore-mipmaps", false,
PRC_DESC("Configure this true to disable mipmapping only."));
ConfigVariableBool gl_force_mipmaps
("gl-force-mipmaps", false,
PRC_DESC("Configure this true to enable full trilinear mipmapping on every "
"texture, whether it asks for it or not."));
ConfigVariableBool gl_show_texture_usage
("gl-show-texture-usage", false,
PRC_DESC("If you set this true, the screen will flash with textures drawn "
"in a special mode that shows the mipmap detail level and texture "
"size for each texture. Textures will be drawn in blue for "
"mipmap level 0, yellow for mipmap level 1, and red for all higher "
"mipmap levels. Brighter colors represent larger textures."));
ConfigVariableInt gl_show_texture_usage_max_size
("gl-show-texture-usage-max-size", 1024,
PRC_DESC("Specifies the texture size (along one side) of the largest "
"texture expected to be loaded. This controls the assignment "
"of the texture color in gl-show-texture-usage mode; colors "
"will be fully bright for textures of this size or larger."));
ConfigVariableBool gl_color_mask
("gl-color-mask", true,
PRC_DESC("Configure this false if your GL's implementation of glColorMask() "
"is broken (some are). This will force the use of a (presumably) "
"more expensive blending operation instead."));
ConfigVariableBool gl_support_occlusion_query
("gl-support-occlusion-query", true,
PRC_DESC("Configure this true to enable the use of the occlusion_query "
"extension if the GL claims to support it, or false not to "
"use it even if it appears to be available. (On some OpenGL "
"drivers, enabling this mode can force software rendering.)"));
ConfigVariableBool gl_compile_and_execute
("gl-compile-and-execute", false,
PRC_DESC("Configure this true if you know your GL's implementation of "
"glNewList(n, GL_COMPILE_AND_EXECUTE) works. It is "
"false by default, since it is known to cause a crash with "
"Intel 855GM driver 4.14.10.3889 at least. Turning this on "
"*may* reduce the chug you get for preparing display lists "
"for the first time, by allowing the display list to be "
"rendered at the same time it is being compiled."));
ConfigVariableBool gl_interleaved_arrays
("gl-interleaved-arrays", false,
PRC_DESC("Set this true to convert OpenGL geometry such that the "
"primary data columns vertex, normal, color, and texcoord "
"are interleaved into one array when possible, or false to "
"render geometry as it appears in the GeomVertexData. See "
"also gl-parallel-arrays."));
ConfigVariableBool gl_parallel_arrays
("gl-parallel-arrays", false,
PRC_DESC("Set this true to convert OpenGL geometry such that each "
"data column is a separate array, or false to "
"render geometry as it appears in the GeomVertexData. See "
"also gl-interleaved-arrays."));
ConfigVariableInt gl_max_errors
("gl-max-errors", 20,
PRC_DESC("This is the limit on the number of OpenGL errors Panda will "
"detect and report before it shuts down rendering. Set it to "
"-1 for no limit."));
ConfigVariableEnum<GeomEnums::UsageHint> gl_min_buffer_usage_hint
("gl-min-buffer-usage-hint", GeomEnums::UH_stream,
PRC_DESC("This specifies the first usage hint value that will be "
"loaded as a vertex buffer, instead of directly from the "
"client. Normally, this should be \"stream\", which means "
"to load the vertex buffer using GL_STREAM_DRAW. If this "
"is set to \"dynamic\", or \"static\", then only usage hints "
"at that level or higher will be loaded as a vertex buffer, "
"and stream or lower will be rendered directly from the "
"client array. If changing this results in a remarkable "
"performance improvement, you may have code that is "
"creating and destroying vertex buffers every frame, instead "
"of reusing the same buffers. Consider increasing "
"released-vbuffer-cache-size instead."));
ConfigVariableBool gl_debug
("gl-debug", false,
PRC_DESC("Setting this to true will cause OpenGL to emit more useful "
"error and debug messages, at a slight runtime performance cost. "
"notify-level-glgsg controls which severity levels are shown."));
ConfigVariableBool gl_debug_synchronous
("gl-debug-synchronous", false,
PRC_DESC("Set this true to make sure that the errors generated by "
"gl-debug are reported as soon as they happen. This is "
"highly recommended if you want to attach a debugger since "
"the call stack may otherwise not point to the GL call "
"where the error originated."));
ConfigVariableEnum<NotifySeverity> gl_debug_abort_level
("gl-debug-abort-level", NS_fatal,
PRC_DESC("Set this to a setting other than 'fatal' to cause an "
"abort to be triggered when an error of the indicated "
"severity level (or a more severe one) occurs. This is "
"useful if you want to attach a debugger. If you set this, "
"it is highly recommended to also set gl-debug-synchronous, "
"since the call stack will otherwise not point to the GL call "
"that triggered the error message. "
"This feature is not available when NDEBUG has been defined."));
ConfigVariableBool gl_debug_object_labels
("gl-debug-object-labels", true,
PRC_DESC("When gl-debug is set to true, this will tell OpenGL the "
"name of textures, shaders, and other objects, so that OpenGL "
"can display those in error messages. There's usually no "
"reason to disable this."));
ConfigVariableBool gl_debug_buffers
("gl-debug-buffers", false,
PRC_DESC("Set this true, in addition to enabling debug notify for "
"glgsg, to enable debug messages about the creation and "
"destruction of OpenGL vertex buffers."));
ConfigVariableBool gl_finish
("gl-finish", false,
PRC_DESC("Set this true to force a call to glFinish() after every major "
"graphics operation. This is likely to slow down rendering "
"performance substantially, but it will make PStats graphs "
"more accurately reflect where the graphics bottlenecks are, "
"although it is better to use timer queries when available. "
"This variable is enabled only if PStats is compiled in."));
ConfigVariableBool gl_force_depth_stencil
("gl-force-depth-stencil", false,
PRC_DESC("Temporary hack variable 7x00 vs 8x00 nVidia bug. See glGraphicsStateGuardian_src.cxx."));
ConfigVariableBool gl_check_errors
("gl-check-errors", false,
PRC_DESC("Regularly call glGetError() to check for OpenGL errors. "
"This will slow down rendering significantly. If your "
"video driver supports it, you should use gl-debug instead."));
ConfigVariableBool gl_force_flush
("gl-force-flush", false,
PRC_DESC("Call this to force a call to glFlush() after rendering a "
"frame, even when using a double-buffered framebuffer. "
"This can incur a significant performance penalty."));
ConfigVariableBool gl_separate_specular_color
("gl-separate-specular-color", true,
PRC_DESC("When separate specular mode is on, the specular component "
"will be written to the secondary instead of the primary "
"color, which is added after the texturing stage. In other "
"words, the specular highlight will be unmodulated by the "
"color of the texture."));
ConfigVariableBool gl_cube_map_seamless
("gl-cube-map-seamless", true,
PRC_DESC("This configures Panda to try and enable seamless cube map "
"sampling when supported. This will help to remove seams "
"that show up at cube map edges, especially at lower "
"resolutions. On by default; disable if you suspect that "
"this is causing problems or if you simply don't need the "
"functionality."));
ConfigVariableBool gl_dump_compiled_shaders
("gl-dump-compiled-shaders", false,
PRC_DESC("This configures Panda to dump the binary content of GLSL "
"programs to disk with a filename like glsl_program0.dump "
"into the current directory."));
ConfigVariableBool gl_validate_shaders
("gl-validate-shaders", true,
PRC_DESC("Set this to true to enable glValidateShader the first time "
"a shader is bound. This may cause helpful information about "
"shaders to be printed."));
ConfigVariableBool gl_immutable_texture_storage
("gl-immutable-texture-storage", false,
PRC_DESC("This configures Panda to pre-allocate immutable storage "
"for each texture. This improves runtime performance, but "
"changing the size or type of a texture will be slower."));
ConfigVariableBool gl_use_bindless_texture
("gl-use-bindless-texture", false,
PRC_DESC("Set this to let Panda use OpenGL's bindless texture "
"extension for all textures passed to shaders, for improved "
"performance. This is an experimental feature and comes "
"with a few caveats; for one, it requires that all sampler "
"uniforms have a layout(bindless_sampler) qualifier, and "
"it also requires that the texture properties are not "
"modified after the texture handle has been initialized."));
ConfigVariableBool gl_enable_memory_barriers
("gl-enable-memory-barriers", true,
PRC_DESC("If this is set, Panda will make sure that every write "
"to an image using an image2D (et al) binding will cause "
"Panda to issue a memory barrier before the next use of "
"said texture, to ensure that all reads and writes are "
"properly synchronized. This may not be strictly necessary "
"when using the 'coherent' qualifier, but Panda has no "
"way to detect whether you are using those. Turning "
"this off may give a slight performance increase, but you "
"have to know what you're doing."));
ConfigVariableBool gl_vertex_array_objects
("gl-vertex-array-objects", true,
PRC_DESC("Setting this causes Panda to make use of vertex array "
"objects to more efficiently switch between sets of "
"vertex arrays. This only has effect when vertex-arrays "
"and vertex-buffers are both set. This should usually be "
"true unless you suspect a bug in the implementation. "));
ConfigVariableBool gl_support_primitive_restart_index
("gl-support-primitive-restart-index", true,
PRC_DESC("Setting this causes Panda to make use of primitive "
"restart indices to more efficiently render line "
"segment primitives. Set to false if you suspect a bug "
"in the driver implementation."));
ConfigVariableBool gl_support_sampler_objects
("gl-support-sampler-objects", true,
PRC_DESC("Setting this allows Panda to make use of sampler "
"objects. Set to false if you suspect a bug in the "
"driver implementation."));
ConfigVariableBool gl_support_shadow_filter
("gl-support-shadow-filter", true,
PRC_DESC("Disable this if you suspect a bug in the driver "
"implementation of ARB_shadow. Particularly, older ATI "
"cards suffered from a broken implementation of the "
"shadow map filtering features."));
ConfigVariableEnum<CoordinateSystem> gl_coordinate_system
("gl-coordinate-system", CS_yup_right,
PRC_DESC("Which coordinate system to use as the internal "
"coordinate system for OpenGL operations. If you are "
"using features like fixed-function sphere mapping, it is "
"best to leave this to yup-right. However, if you are "
"creating a shader-only application, it may be easier and "
"more efficient to set this to default."));
extern ConfigVariableBool gl_parallel_arrays;
void CLP(init_classes)() {
CLP(GeomContext)::init_type();
CLP(GeomMunger)::init_type();
CLP(GraphicsStateGuardian)::init_type();
CLP(IndexBufferContext)::init_type();
#ifndef OPENGLES_1
CLP(ShaderContext)::init_type();
#endif
CLP(TextureContext)::init_type();
#ifndef OPENGLES
CLP(SamplerContext)::init_type();
#endif
CLP(VertexBufferContext)::init_type();
CLP(GraphicsBuffer)::init_type();
#ifndef OPENGLES
CLP(OcclusionQueryContext)::init_type();
CLP(TimerQueryContext)::init_type();
CLP(LatencyQueryContext)::init_type();
#endif
PandaSystem *ps = PandaSystem::get_global_ptr();
ps->add_system(GLSYSTEM_NAME);
// We can't add any tags defining the available OpenGL capabilities,
// since we won't know those until we create a graphics context (and
// the answer may be different for different contexts).
}
| 15,507 | 4,327 |
#include <sstream>
#include "../../../inventory.hpp"
#include "../../../position.hpp"
#include "../common.hpp"
LUA_API_OPTOUT_SOL_AUTOMAGIC(elona::Inventory)
/**
* @luadoc
*
* Represents an item inventory, a list of items.
*/
namespace elona::lua::api::classes::class_LuaInventory
{
/**
* @luadoc has_free_slot
*
* Queries whether the inventory has at least one free slot.
*
* @treturn True if the inventory has at least one free slot; false if not.
*/
bool LuaInventory_has_free_slot(Inventory* self)
{
return self->has_free_slot();
}
// no doc
sol::table LuaInventory_as_table(Inventory* self, sol::this_state this_state)
{
sol::state_view L{this_state};
sol::table t = L.create_table();
for (const auto& item : *self)
{
t.add(item);
}
return t;
}
/**
* @luadoc stack
*
* Stacks an item in the inventory indicated. The item will no longer be valid
* for use.
*
* @tparam LuaItem item
* @treturn[1] LuaItem The modified item stack on success
* @treturn[2] nil
*/
sol::optional<ItemRef> LuaInventory_stack(
Inventory* self,
const ItemRef& item,
sol::optional<bool> show_message)
{
const auto stack_result =
inv_stack(self, item, show_message.value_or(false));
if (stack_result.stacked)
{
return stack_result.stacked_item;
}
else
{
return sol::nullopt;
}
}
void bind(sol::state& lua)
{
auto LuaInventory =
lua.new_usertype<Inventory>("LuaInventory", sol::no_constructor);
// Methods
LuaInventory.set("has_free_slot", &LuaInventory_has_free_slot);
LuaInventory.set("stack", &LuaInventory_stack);
LuaInventory.set("as_table", &LuaInventory_as_table);
}
} // namespace elona::lua::api::classes::class_LuaInventory
| 1,777 | 653 |
#include "GIComposeNode.h"
#include "SceneNode.h"
#include "geometry/Frustum.h"
#include "utility/Logging.h"
#include "utility/Profiling.h"
#include <imgui.h>
GIComposeNode::GIComposeNode(Scene& scene)
: m_scene(scene)
{
}
RenderPipelineNode::ExecuteCallback GIComposeNode::constructFrame(Registry& reg) const
{
SCOPED_PROFILE_ZONE();
Texture& sceneColorBeforeGI = *reg.getTexture("SceneColor");
Texture& baseColorTex = *reg.getTexture("SceneBaseColor");
Texture& ambientOcclusionTex = *reg.getTexture("AmbientOcclusion");
Texture& diffuseGiTex = *reg.getTexture("DiffuseGI");
Texture& sceneColorWithGI = reg.createTexture2D(reg.windowRenderTarget().extent(), sceneColorBeforeGI.format(), Texture::Filters::nearest());
BindingSet& composeBindingSet = reg.createBindingSet({ { 0, ShaderStageCompute, &sceneColorWithGI, ShaderBindingType::StorageImage },
{ 1, ShaderStageCompute, &sceneColorBeforeGI, ShaderBindingType::TextureSampler },
{ 2, ShaderStageCompute, &baseColorTex, ShaderBindingType::TextureSampler },
{ 3, ShaderStageCompute, &ambientOcclusionTex, ShaderBindingType::TextureSampler },
{ 4, ShaderStageCompute, &diffuseGiTex, ShaderBindingType::TextureSampler } });
ComputeState& giComposeState = reg.createComputeState(Shader::createCompute("compose/compose-gi.comp"), { &composeBindingSet });
return [&](const AppState& appState, CommandList& cmdList) {
cmdList.setComputeState(giComposeState);
cmdList.bindSet(composeBindingSet, 0);
cmdList.setNamedUniform("targetSize", sceneColorWithGI.extent());
static bool includeSceneColor = true;
static bool includeDiffuseGI = true;
static bool withMaterialColor = true;
static bool withAmbientOcclusion = true;
#if 0
ImGui::Checkbox("Include scene color", &includeSceneColor);
ImGui::Checkbox("Include diffuse GI", &includeDiffuseGI);
if (includeDiffuseGI) {
ImGui::Checkbox("... with material color", &withMaterialColor);
ImGui::Checkbox("... with ambient occlusion", &withAmbientOcclusion);
}
#else
enum class ComposeMode {
FullCompose,
DirectOnly,
IndirectOnly,
IndirectOnlyNoBaseColor,
};
static ComposeMode composeMode = ComposeMode::FullCompose;
if (ImGui::RadioButton("Full compose", composeMode == ComposeMode::FullCompose)) {
composeMode = ComposeMode::FullCompose;
includeSceneColor = true;
includeDiffuseGI = true;
withMaterialColor = true;
}
if (ImGui::RadioButton("Direct light only", composeMode == ComposeMode::DirectOnly)) {
composeMode = ComposeMode::DirectOnly;
includeSceneColor = true;
includeDiffuseGI = false;
}
if (ImGui::RadioButton("Diffuse indirect only", composeMode == ComposeMode::IndirectOnly)) {
composeMode = ComposeMode::IndirectOnly;
includeSceneColor = false;
includeDiffuseGI = true;
withMaterialColor = true;
}
if (ImGui::RadioButton("Diffuse indirect only (ignore material color)", composeMode == ComposeMode::IndirectOnlyNoBaseColor)) {
composeMode = ComposeMode::IndirectOnlyNoBaseColor;
includeSceneColor = false;
includeDiffuseGI = true;
withMaterialColor = false;
}
ImGui::Separator();
ImGui::Checkbox("Include ambient occlusion (for diffuse indirect)", &withAmbientOcclusion);
#endif
cmdList.setNamedUniform("includeSceneColor", includeSceneColor);
cmdList.setNamedUniform("includeDiffuseGI", includeDiffuseGI);
cmdList.setNamedUniform("withMaterialColor", withMaterialColor);
cmdList.setNamedUniform("withAmbientOcclusion", withAmbientOcclusion);
cmdList.dispatch({ sceneColorWithGI.extent(), 1 }, { 32, 32, 1 });
// TODO: Figure out a good way of actually chaining these calls & reusing textures etc.
cmdList.textureWriteBarrier(sceneColorWithGI);
cmdList.copyTexture(sceneColorWithGI, sceneColorBeforeGI);
cmdList.textureWriteBarrier(sceneColorBeforeGI);
};
}
| 4,482 | 1,264 |
#include <gtest/gtest.h>
#include <iostream>
using namespace std;
/**
* This file is generated by leetcode_add.py v1.0
*
* 258.
* Add Digits
*
* βββββββββββββββββββββββββββββ Description βββββββββββββββββββββββββββββ
*
* Given an integer βnumβ , repeatedly add all its digits until the
* result has only one digit, and return it.
*
* βββββββββββββββββββββββββββββ Constraints βββββββββββββββββββββββββββββ
*
* β’ β0 β€ num β€ 2Β³ΒΉ - 1β
*
*/
struct q258 : public ::testing::Test {
// Leetcode answer here
class Solution {
public:
int addDigits(int num) {
return num == 0 ? 0 : 1 + (num - 1) % 9;
}
};
class Solution *solution;
};
TEST_F(q258, sample_input01) {
solution = new Solution();
int num = 38;
int exp = 2;
EXPECT_EQ(solution->addDigits(num), exp);
delete solution;
}
TEST_F(q258, sample_input02) {
solution = new Solution();
int num = 0;
int exp = 0;
EXPECT_EQ(solution->addDigits(num), exp);
delete solution;
} | 992 | 463 |
#include "scenes/PlaygroundScene.h"
#include "cameras/FreelookCamera.h"
#include "GalaxyGenerator.h"
#include "prngs/xorshf96.h"
#include <algorithm>
void PlaygroundScene::onCreate(const DrawableFactory & drawableFactory)
{
Timer timer;
m_fullscreen = false;
m_fullscreenCooldown = 0.f;
m_lineRenderer.init(400,1.f);
m_textRenderer.init();
m_textRenderer.loadFont("resources/fonts/roboto.ttf");
GalaxyGenerator generator;
generator.m_xMax = 11.f * 12.f;
generator.m_zMax = -7.f * 12.f;
//constexpr float xMax = 11.f * 12.f;
//constexpr float zMax = -7.f * 12.f;
generator.generate(
m_planets,
m_vessels,
m_clickableSelector,
m_textRenderer,
m_lineRenderer,
drawableFactory,
std::make_unique<Xorshf96>(0xDEADBEEF));
// Comment this out if you are prototyping, it takes a long time to boot the game but
// saves on lag during runtime
//Timer t2;
//std::cout << "Calculating planets contained in SOIs...\n";
//for (size_t i = 0; i < m_planets.size(); i++)
//{
// m_planets[i]->fillPlanetsInSOI();
// if (t2.elapsedTime() > 3.f)
// {
// t2.restart();
// std::printf("%i/%i (%.2f) elapsed: %.2f seconds\n", i, m_planets.size(), float(i) / float(m_planets.size()) * 100.f, t2.totalTime());
// }
//}
//std::cout << "Finished filling SOIs in " << t2.totalTime() << " seconds\n";
m_camera = std::make_unique<FreelookCamera>(50.f, 25.f);
m_camera->setNearFar(glm::vec2(0.1f, 10000.f));
m_camera->setPos(glm::vec3(m_planets.back()->pos().x * 0.5f, 50, -9 * 12));
//m_camera->setTarget(glm::vec3(96, 20, -60));
m_cursor = drawableFactory.createDrawable<Cursor>("cursor");
m_cursor->setScale(0.025f);
m_skybox = drawableFactory.createDrawable<Skybox>("skybox");
m_skybox->setColor(glm::vec4(0, 0, 0, 1));
m_empire.setColor(glm::vec3(0.25f, 1.f, 0.25f));
m_empire.setName("Good dictator");
m_empire.setHomePlanet(*m_planets[0].get());
m_planets.front()->setEmpire(m_empire);
m_empire.markAsPlayer();
m_empire2.setColor(glm::vec3(1.f, 0.25f, 0.25f));
m_empire2.setName("Bad dictator");
m_empire2.setHomePlanet(*m_planets.back());
m_planets.back()->setEmpire(m_empire2);
m_map = drawableFactory.createDrawable<Map>("map");
m_map->setClickableSelector(m_clickableSelector);
//m_map->setLevelBounds(glm::vec3(16 * 12, 9 * 12, 1));
m_map->setLevelBounds(glm::vec3(generator.m_xMax, -generator.m_zMax, 1));
m_map->setViewportHeight(800);
m_map->generateMap(m_planets);
m_map->generateMarkers(4); // 4 represents 4 empires although this should be seen as a capacity (like vector)
m_planetRenderer.fillPlanetsVBO(m_planets);
m_camera->setPos(m_empire.homePlanet()->pos() + glm::vec3(0, 0, 10.f));
std::printf("Initialized scene in %f seconds\n", timer.elapsedTime());
}
Scene * PlaygroundScene::run(const DrawableFactory & drawableFactory, const Input & input, float elapsedTime)
{
// Input phase
// ------------------
if (input.Keys[KEY_ESC])
m_wantToPop = true;
if (input.Keys[KEY_M] && m_fullscreenCooldown == 0.f)
{
m_fullscreen = !m_fullscreen;
m_map->setFullscreen(m_fullscreen);
m_fullscreenCooldown = 1.f;
m_map->updatePlanetsSOI(m_planets);
}
m_fullscreenCooldown -= elapsedTime;
if (m_fullscreenCooldown < 0.f)
m_fullscreenCooldown = 0.f;
// Update map zoom
if (input.Keys[KEY_MINUS])
{
m_map->zoom(1.f - 0.5f * elapsedTime);
m_map->updatePlanetsSOI(m_planets);
}
if (input.Keys[KEY_EQUAL])
{
m_map->zoom(1.f + 0.5f * elapsedTime);
m_map->updatePlanetsSOI(m_planets);
}
if (input.Keys[KEY_BACKSPACE])
{
m_map->setZoom(1);
m_map->updatePlanetsSOI(m_planets);
}
// Update fase
// -----------------
m_camera->handleInput(input, elapsedTime);
//elapsedTime *= 500.f;
m_clickableSelector.updateIntersection(drawableFactory, input, elapsedTime, *m_camera);
if (m_updateVBOs.elapsedTime() > 2.5f)
{
m_map->updatePlanetsSOI(m_planets);
m_planetRenderer.fillPlanetsVBO(m_planets);
m_updateVBOs.restart();
}
m_map->setFocus(glm::vec2(m_camera->pos().x,m_camera->pos().z));
// Draw/semi update fase
// -----------------
glDisable(GL_BLEND);
m_skybox->draw(*m_camera);
for (std::vector<std::unique_ptr<Planet>>::iterator planet = m_planets.begin(); planet != m_planets.end(); planet++)
{
(*planet)->update(elapsedTime);
}
for (std::vector<std::unique_ptr<Vessel>>::iterator vessel = m_vessels.begin(); vessel != m_vessels.end(); vessel++)
{
(*vessel)->update(elapsedTime);
}
// Because vessels and planets are not in the same data structure, I don't have to worry about moving over stuff from the vectors
// Brian's object files don't work
// or I don't understand OpenGL
if (!m_vessels.empty() && !m_vesselsToRemove.empty())
{
m_vessels.erase(std::remove_if(m_vessels.begin(), m_vessels.end(), [this](const std::unique_ptr<Vessel> &vessel)
{
for (Vessel * address : m_vesselsToRemove)
if (vessel.get() == address)
return true;
return false;
}));
m_vesselsToRemove.clear();
}
glDisable(GL_CULL_FACE);
for (std::vector<std::unique_ptr<Vessel>>::iterator vessel = m_vessels.begin(); vessel != m_vessels.end(); vessel++)
{
if ((*vessel)->isDead())
m_vesselsToRemove.push_back(&(**vessel));
(*vessel)->draw(*m_camera);
}
glEnable(GL_CULL_FACE);
// Don't render all the other stuff if fullscreen map
glEnable(GL_BLEND);
m_map->addMarker(m_map->createMarker(m_camera->pos(), glm::vec4(m_empire.color(), 1.f), 1));
if (m_fullscreen)
{
m_map->displayMarkers();
m_map->drawTransparent(*m_camera);
m_lineRenderer.display(*m_camera);
}
else
{
m_planetRenderer.display(*m_camera);
m_empire.emitLine(m_lineRenderer);
m_empire2.emitLine(m_lineRenderer);
m_lineRenderer.display(*m_camera);
for (std::vector<std::unique_ptr<Planet>>::iterator planet = m_planets.begin(); planet != m_planets.end(); planet++)
(*planet)->drawTransparent(*m_camera);
for (std::vector<std::unique_ptr<Vessel>>::iterator vessel = m_vessels.begin(); vessel != m_vessels.end(); vessel++)
(*vessel)->drawTransparent(*m_camera);
m_textRenderer.render(*m_camera);
m_map->displayMarkers();
m_map->drawTransparent(*m_camera);
m_cursor->setPos(glm::vec3(input.GetMousePos(), -0.1f));
m_cursor->drawTransparent(*m_camera);
}
return nullptr;
} | 6,244 | 2,706 |
/***************************************************************************
databasetool.cpp
-------------------
Database editor for QBrew
-------------------
Copyright 2005-2008, David Johnson
Please see the header file for copyright and license information
***************************************************************************/
#include <QDir>
#include <QFile>
#include <QHeaderView>
#include <QMessageBox>
#include <QTableView>
#include "data.h"
#include "resource.h"
#include "graindelegate.h"
#include "grainmodel.h"
#include "hopdelegate.h"
#include "hopmodel.h"
#include "miscdelegate.h"
#include "miscmodel.h"
#include "styledelegate.h"
#include "stylemodel.h"
#include "databasetool.h"
//////////////////////////////////////////////////////////////////////////////
// Construction, Destruction //
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// DatabaseTool()
// --------------
// Constructor
DatabaseTool::DatabaseTool(QWidget* parent)
: QMainWindow(parent), grainmodel_(0), hopmodel_(0), miscmodel_(0),
modified_(false)
{
ui.setupUi(this);
statusBar()->hide();
// setup actions
QIcon icon = QIcon(":/icons/22x22/document-save.png");
icon.addFile(":/icons/16x16/document-save.png");
ui.actionsave->setIcon(icon);
ui.actionsave->setEnabled(false);
connect(ui.actionsave, SIGNAL(triggered()), this, SLOT(fileSave()));
icon = QIcon(":/icons/22x22/application-exit.png");
icon.addFile(":/icons/16x16/application-exit.png");
ui.actionquit->setIcon(icon);
connect(ui.actionquit, SIGNAL(triggered()), this, SLOT(close()));
// get current font information, for sizing
QFontMetrics fm(font());
unsigned mh = (unsigned)(fm.lineSpacing() * 1.5);
unsigned mw = fm.width('M');
// grain page
QWidget *widget = new QWidget();
grainpage.setupUi(widget);
ui.ingredients->addTab(widget, tr("&Grains"));
grains_ = Data::instance()->grainmap_.values();
grainmodel_ = new GrainModel(this, &grains_);
grainpage.view->setModel(grainmodel_);
QItemDelegate *delegate = new GrainDelegate(this);
grainpage.view->setItemDelegate(delegate);
grainpage.view->verticalHeader()->setDefaultSectionSize(mh);
grainpage.view->verticalHeader()->hide();
//grainpage.view->horizontalHeader()->setClickable(true);
grainpage.view->horizontalHeader()->setHighlightSections(false);
grainpage.view->setColumnWidth(GrainModel::NAME, 20*mw);
grainpage.view->setColumnHidden(GrainModel::WEIGHT, true);
grainpage.view->setColumnWidth(GrainModel::EXTRACT, 8*mw);
grainpage.view->setColumnWidth(GrainModel::COLOR, 8*mw);
grainpage.view->setColumnWidth(GrainModel::TYPE, 8*mw);
grainpage.view->setColumnWidth(GrainModel::USE, 8*mw);
// hop page
widget = new QWidget();
hoppage.setupUi(widget);
ui.ingredients->addTab(widget, tr("&Hops"));
hops_ = Data::instance()->hopmap_.values();
hopmodel_ = new HopModel(this, &hops_);
hoppage.view->setModel(hopmodel_);
delegate = new HopDelegate(this);
hoppage.view->setItemDelegate(delegate);
hoppage.view->verticalHeader()->setDefaultSectionSize(mh);
hoppage.view->verticalHeader()->hide();
//hoppage.view->horizontalHeader()->setClickable(true);
hoppage.view->horizontalHeader()->setHighlightSections(false);
hoppage.view->setColumnHidden(HopModel::WEIGHT, true);
hoppage.view->setColumnHidden(HopModel::TIME, true);
hoppage.view->setColumnHidden(HopModel::TYPE, true);
hoppage.view->setColumnWidth(HopModel::NAME, 20*mw);
hoppage.view->setColumnWidth(HopModel::ALPHA, 8*mw);
// misc page
widget = new QWidget();
miscpage.setupUi(widget);
ui.ingredients->addTab(widget, tr("&Miscellaneous"));
miscs_ = Data::instance()->miscmap_.values();
miscmodel_ = new MiscModel(this, &miscs_);
miscpage.view->setModel(miscmodel_);
delegate = new MiscDelegate(this);
miscpage.view->setItemDelegate(delegate);
miscpage.view->verticalHeader()->setDefaultSectionSize(mh);
miscpage.view->verticalHeader()->hide();
//miscpage.view->horizontalHeader()->setClickable(true);
miscpage.view->horizontalHeader()->setHighlightSections(false);
miscpage.view->setColumnHidden(MiscModel::QUANTITY, true);
miscpage.view->setColumnWidth(MiscModel::NAME, 20*mw);
miscpage.view->setColumnWidth(MiscModel::TYPE, 8*mw);
miscpage.view->horizontalHeader()->setStretchLastSection(true);
// style page
widget = new QWidget();
stylepage.setupUi(widget);
ui.ingredients->addTab(widget, tr("&Styles"));
styles_ = Data::instance()->stylemap_.values();
stylemodel_ = new StyleModel(this, &styles_);
stylepage.view->setModel(stylemodel_);
delegate = new StyleDelegate(this);
stylepage.view->setItemDelegate(delegate);
stylepage.view->verticalHeader()->setDefaultSectionSize(mh);
stylepage.view->verticalHeader()->hide();
//stylepage.view->horizontalHeader()->setClickable(true);
stylepage.view->horizontalHeader()->setHighlightSections(false);
stylepage.view->setColumnWidth(StyleModel::NAME, 20*mw);
stylepage.view->setColumnWidth(StyleModel::OGLOW, 8*mw);
stylepage.view->setColumnWidth(StyleModel::OGHI, 8*mw);
stylepage.view->setColumnWidth(StyleModel::FGLOW, 8*mw);
stylepage.view->setColumnWidth(StyleModel::FGHI, 8*mw);
stylepage.view->setColumnWidth(StyleModel::IBULOW, 8*mw);
stylepage.view->setColumnWidth(StyleModel::IBUHI, 8*mw);
stylepage.view->setColumnWidth(StyleModel::SRMLOW, 8*mw);
stylepage.view->setColumnWidth(StyleModel::SRMHI, 8*mw);
// setup connections
connect(grainmodel_, SIGNAL(modified()),
this, SLOT(dataModified()));
connect(grainpage.addbutton, SIGNAL(clicked()),
grainpage.view, SLOT(addIngredient()));
connect(grainpage.removebutton, SIGNAL(clicked()),
grainpage.view, SLOT(removeIngredient()));
connect(hopmodel_, SIGNAL(modified()),
this, SLOT(dataModified()));
connect(hoppage.addbutton, SIGNAL(clicked()),
hoppage.view, SLOT(addIngredient()));
connect(hoppage.removebutton, SIGNAL(clicked()),
hoppage.view, SLOT(removeIngredient()));
connect(miscmodel_, SIGNAL(modified()),
this, SLOT(dataModified()));
connect(miscpage.addbutton, SIGNAL(clicked()),
miscpage.view, SLOT(addIngredient()));
connect(miscpage.removebutton, SIGNAL(clicked()),
miscpage.view, SLOT(removeIngredient()));
connect(stylemodel_, SIGNAL(modified()),
this, SLOT(dataModified()));
connect(stylepage.addbutton, SIGNAL(clicked()),
stylepage.view, SLOT(addIngredient()));
connect(stylepage.removebutton, SIGNAL(clicked()),
stylepage.view, SLOT(removeIngredient()));
grainmodel_->flush();
hopmodel_->flush();
miscmodel_->flush();
stylemodel_->flush();
}
DatabaseTool::~DatabaseTool() {}
void DatabaseTool::fileSave()
{
// TODO: use QDesktopServices in next non-bugfix release (0.5.0)
QString localbase = QDIR_HOME + "/." + Resource::DATA_FILE;
QFileInfo finfo(localbase);
if (finfo.exists() && !finfo.isWritable()) {
// no write permission
QMessageBox::warning(this, Resource::TITLE,
tr("<p>Unable to save the database."
"You do not have permission "
"to write to %1").arg(localbase));
} else {
// sync with Data...
Data::instance()->clearGrains();
foreach(Grain grain, grains_) {
Data::instance()->insertGrain(grain);
}
Data::instance()->clearHops();
foreach(Hop hop, hops_) {
Data::instance()->insertHop(hop);
}
Data::instance()->clearMiscs();
foreach(Misc misc, miscs_) {
Data::instance()->insertMisc(misc);
}
Data::instance()->clearStyles();
foreach(Style style, styles_) {
Data::instance()->insertStyle(style);
}
if (!Data::instance()->saveData(localbase)) {
// error in saving file
QMessageBox::warning(this, Resource::TITLE,
tr("<p>Unable to save the database."
"Error in saving %1").arg(localbase));
}
ui.actionsave->setEnabled(false);
modified_ = false;
}
}
void DatabaseTool::dataModified()
{
ui.actionsave->setEnabled(true);
modified_ = true;
}
| 8,738 | 2,774 |
#include "stdafx.hpp"
#include "OrcLevel.hpp"
OrcLevel::OrcLevel(sf::RenderWindow * window, std::stack<Level*>* level) : Level(window, level)
{
this->initLevel();
this->spawnOrcs();
}
OrcLevel::~OrcLevel()
{
}
void OrcLevel::update(const float & deltaTime)
{
this->pPlayer.update(deltaTime);
this->playerInput(deltaTime);
for (size_t i = 0; i < this->mOrcs.size(); i++)
this->mOrcs[i]->update(deltaTime);
}
void OrcLevel::render(sf::RenderTarget & target)
{
target.draw(this->mBackgroundSprite);
this->pPlayer.render(target);
this->renderOrcs();
}
void OrcLevel::initLevel()
{
if (!this->mBackgroundTexture.loadFromFile("Resources/Textures/Backgrounds/bitmap.png"))
{
std::cerr << "Level failed to fucking load" << "\n";
EXIT_FAILURE;
}
this->mBackgroundSprite.setTexture(this->mBackgroundTexture);
}
void OrcLevel::spawnOrcs()
{
sf::Texture temp;
if (!temp.loadFromFile("Resources/Textures/Orcs/Combined.png"))
std::cerr << "Orcs not found" << "\n";
this->mOrcTextures.push_back(temp);
this->mOrcs.push_back(new Orcs(this->mOrcTextures, sf::Vector2f(1700.F, 800.F), this->pWindow->getSize()));
}
void OrcLevel::renderOrcs()
{
for (size_t i = 0; i < this->mOrcs.size(); i++)
this->mOrcs[i]->render(*this->pWindow);
}
| 1,321 | 552 |
// opticalFlow.cpp, jake deery, 2020
#include "opticalFlow.h"
opticalFlow::opticalFlow(VideoCapture inputVideo) {
// init - load vars into object
capSource = inputVideo;
// Check for failure
if(capSource.isOpened() == false) {
cout << "[E] Could not open or find the webcam . . . " << "\n";
delete this;
}
// recalculate the fps value
if((fps / 1000) < 1) fps = 1;
else fps = ceil(fps / 1000);
cout << "[I] Class created successfully . . . " << "\n";
}
opticalFlow::~opticalFlow() {
// destructor - delete windows
cout << "[I] Deleting all windows . . . " << "\n";
destroyAllWindows();
cout << "[I] Class deleted successfully . . . " << "\n";
}
int opticalFlow::doDenseProcess() {
// vars
Mat frame1;
Mat prvs;
char checkForEscKey;
// intro
cout << "[I] Calling on method doDenseProcess . . . " << "\n";
// copy webcam frame to Mat & make it grey
capSource >> frame1;
if (frame1.empty()) {
cout << "[E] Could not open or find the webcam . . . " << "\n";
return -1;
}
// get the material ready for processing
flip(frame1, frame1, 1);
cvtColor(frame1, prvs, COLOR_BGR2GRAY);
// create blank window
namedWindow("doDenseProcess");
// begin process
cout << "[W] Entering program loop . . . " << "\n";
while (checkForEscKey != 27) {
// vars
Mat frame2;
Mat next;
Mat flow_parts[2];
Mat magnitude;
Mat angle;
Mat magn_norm;
Mat flow(prvs.size(), CV_32FC2);
Mat _hsv[3];
Mat hsv;
Mat hsv8;
Mat bgr;
// copy webcam frame to Mat & make it grey
capSource >> frame2;
if (frame2.empty()) {
cout << "[E] Could not open or find the webcam . . . " << "\n";
return -1;
break;
}
// get the material ready for processing
flip(frame2, frame2, 1);
cvtColor(frame2, next, COLOR_BGR2GRAY);
// calculate the flow
calcOpticalFlowFarneback(prvs, next, flow, 0.5, 3, 15, 3, 5, 1.2, 0);
// visualise the flow
split(flow, flow_parts);
cartToPolar(flow_parts[0], flow_parts[1], magnitude, angle, true);
normalize(magnitude, magn_norm, 0.0f, 1.0f, NORM_MINMAX);
angle *= ((1.f / 360.f) * (180.f / 255.f));
//build hsv image
_hsv[0] = angle;
_hsv[1] = Mat::ones(angle.size(), CV_32F);
_hsv[2] = magn_norm;
merge(_hsv, 3, hsv);
hsv.convertTo(hsv8, CV_8U, 255.0);
cvtColor(hsv8, bgr, COLOR_HSV2BGR);
// display the image
imshow("doDenseProcess", bgr);
// detect exit
checkForEscKey = waitKey(fps);
// blit
prvs = next;
}
return 0;
}
int opticalFlow::doSparseProcess() {
// vars
Mat oldFrame;
Mat oldGrey;
Mat mask;
RNG rng;
vector<Scalar> colors;
vector<Point2f> p0;
vector<Point2f> p1;
char checkForEscKey;
// intro
cout << "[I] Calling on method doSparseProcess . . . " << "\n";
// create some random colours
for(int i = 0; i < 100; i++) {
int r = rng.uniform(0, 256);
int g = rng.uniform(0, 256);
int b = rng.uniform(0, 256);
colors.push_back(Scalar(r,g,b));
}
// take first frame
capSource >> oldFrame;
if (oldFrame.empty()) {
cout << "[E] Could not open or find the webcam . . . " << "\n";
return -1;
}
// flip the frame for natural movement
flip(oldFrame, oldFrame, 1);
// find corners in the mat
cvtColor(oldFrame, oldGrey, COLOR_BGR2GRAY);
goodFeaturesToTrack(oldGrey, p0, 100, 0.3, 7, Mat(), 7, false, 0.04);
// create a mask image for drawing purposes
mask = Mat::zeros(oldFrame.size(), oldFrame.type());
// create blank window
namedWindow("doSparseProcess");
cout << "[W] Entering program loop . . . " << "\n";
while(checkForEscKey != 27) {
// vars
Mat frame;
Mat frameGrey;
Mat img;
vector<Point2f> goodNew;
vector<uchar> status;
vector<float> err;
// copy frame to mat
capSource >> frame;
if (frame.empty()) {
cout << "[E] Could not open or find the webcam . . . " << "\n";
return -1;
break;
}
// flip the frame for natural movement
flip(frame, frame, 1);
// prep the mat
cvtColor(frame, frameGrey, COLOR_BGR2GRAY);
// do the special stuff (optical flow)
TermCriteria criteria = TermCriteria((TermCriteria::COUNT) + (TermCriteria::EPS), 10, 0.03);
calcOpticalFlowPyrLK(oldGrey, frameGrey, p0, p1, status, err, Size(15,15), 2, criteria);
for(uint i = 0; i < p0.size(); i++) {
// select good points
if(status[i] == 1) {
goodNew.push_back(p1[i]);
// draw the tracks
line(mask,p1[i], p0[i], colors[i], 2);
circle(frame, p1[i], 5, colors[i], -1);
}
}
add(frame, mask, img);
imshow("doSparseProcess", img);
// detect exit
checkForEscKey = waitKey(fps);
// now update the previous frame and previous points
oldGrey = frameGrey.clone();
p0 = goodNew;
}
return 0;
}
| 4,644 | 2,025 |
#include "collector/eventCollector.h"
#include "avatar/avatarManager.h"
#include "database/database.h"
#include "collector/statCollectorManager.h"
#include "net/rpcServer.h"
#include <iostream>
void usage(const std::string& error = "")
{
std::cerr << "tlopostats [options]" << std::endl;
std::cerr << "options:" << std::endl;
std::cerr << std::endl;
std::cerr << "--listen addr: address to listen on (default: 127.0.0.1:8963)" << std::endl;
std::cerr << "--rpc addr: address to listen on (default: 127.0.0.1:8964)" << std::endl;
std::cerr << "--dummy-db: use DummyDatabase backend instead of MongoDatabase" << std::endl;
std::cerr << "--redis-db addr: Redis IP, port prefix (default: 127.0.0.1, 6379, tlopo_stats_test)" << std::endl;
if (error.size()) {
std::cerr << std::endl;
std::cerr << error << std::endl;
}
exit(1);
}
int main(int argc, char** argv)
{
boost::asio::io_service io_service;
// Parse argv
bool use_dummy_db = false;
std::string addr = "127.0.0.1";
std::string rpc_addr = "127.0.0.1";
std::string db_addr = "127.0.0.1";
std::string db_prefix = "tlopo_stats_test";
int db_port = 6379;
for (int i = 1; i < argc; ++i) {
if (strcmp(argv[i], "--dummy-db") == 0) {
use_dummy_db = true;
} else if (strcmp(argv[i], "--listen") == 0) {
if (i == argc - 1) {
usage("--listen takes 1 argument");
return 1;
}
addr = std::string(argv[++i]);
}
else if (strcmp(argv[i], "--rpc") == 0) {
if (i == argc - 1) {
usage("--rpc takes 1 argument");
return 1;
}
rpc_addr = std::string(argv[++i]);
}
else if (strcmp(argv[i], "--redis-db") == 0) {
if (i == argc - 3) {
usage("--db-addr takes 3 arguments");
return 1;
}
db_addr = std::string(argv[++i]);
db_port = atoi(argv[++i]);
db_prefix = std::string(argv[++i]);
} else {
usage();
return 1;
}
}
// Create the DB
Database* db;
if (use_dummy_db) {
std::cout << "Using DummyDatabase backend" << std::endl;
db = get_dummy_db();
} else {
std::cout << "Using Redis backend, db_addr = " << db_addr << ":" << db_port << std::endl;
db = get_redis_db(db_addr, db_port, db_prefix);
}
// Init AvatarManager
AvatarManager::get_global_ptr()->init(db);
// Init StatCollectorManager
StatCollectorManager::get_global_ptr()->init(db, io_service);
// Start EventCollector
std::cout << "Listening on " << addr << std::endl;
EventCollector evcoll(io_service, addr);
// Start the RPC server
std::cout << "RPC: Listening on " << rpc_addr << std::endl;
RPCServer rpc(io_service, rpc_addr);
// Run
io_service.run();
return 0;
}
| 2,993 | 1,092 |