Dataset Viewer
Auto-converted to Parquet Duplicate
lang
stringclasses
3 values
file_path
stringlengths
5
150
repo_name
stringlengths
6
110
commit
stringlengths
40
40
file_code
stringlengths
1.52k
18.9k
prefix
stringlengths
82
16.5k
suffix
stringlengths
0
15.1k
middle
stringlengths
121
8.18k
strategy
stringclasses
8 values
context_items
listlengths
0
100
C++
src/BabylonCpp/src/maths/spherical_polynomial.cpp
samdauwe/BabylonCpp
eea9f761a49bb460ff1324c20e4674ef120e94f1
#include <babylon/maths/spherical_polynomial.h> #include <babylon/maths/color3.h> #include <babylon/maths/tmp_vectors.h> namespace BABYLON { SphericalPolynomial::SphericalPolynomial() : x{Vector3::Zero()} , y{Vector3::Zero()} , z{Vector3::Zero()} , xx{Vector3::Zero()} , yy{Vector3::Zero()} , zz{Vector3::Zero()} , xy{Vector3::Zero()} , yz{Vector3::Zero()} , zx{Vector3::Zero()} , _harmonics{std::nullopt} { } SphericalPolynomial::SphericalPolynomial(const SphericalPolynomial& other) = default; SphericalPolynomial::SphericalPolynomial(SphericalPolynomial&& other) = default; SphericalPolynomial& SphericalPolynomial::operator=(const SphericalPolynomial& other) = default; SphericalPolynomial& SphericalPolynomial::operator=(SphericalPolynomial&& other) = default; SphericalPolynomial::~SphericalPolynomial() = default; SphericalPolynomial SphericalPolynomial::copy() const { return SphericalPolynomial(*this); } std::unique_ptr<SphericalPolynomial> SphericalPolynomial::clone() const { return std::make_unique<SphericalPolynomial>(*this); } SphericalHarmonics& SphericalPolynomial::preScaledHarmonics() { if (!_harmonics.has_value()) { _harmonics = SphericalHarmonics::FromPolynomial(*this); } if (!_harmonics->preScaled) { _harmonics->preScaleForRendering(); } return *_harmonics; } void SphericalPolynomial::addAmbient(const Color3& color) { TmpVectors::Vector3Array[0].copyFromFloats(color.r, color.g, color.b); auto& colorVector = TmpVectors::Vector3Array[0]; xx.addInPlace(colorVector); yy.addInPlace(colorVector); zz.addInPlace(colorVector); } void SphericalPolynomial::scaleInPlace(float scale) { x.scaleInPlace(scale); y.scaleInPlace(scale); z.scaleInPlace(scale); xx.scaleInPlace(scale); yy.scaleInPlace(scale); zz.scaleInPlace(scale); yz.scaleInPlace(scale); zx.scaleInPlace(scale); xy.scaleInPlace(scale); } SphericalPolynomial& SphericalPolynomial::updateFromHarmonics(const SphericalHarmonics& harmonics) { _harmonics = harmonics; x.copyFrom(harmonics.l11); x.scaleInPlace(1.02333f).scaleInPlace(-1.f); y.copyFrom(harmonics.l1_1); y.scaleInPlace(1.02333f).scaleInPlace(-1.f); z.copyFrom(harmonics.l10); z.scaleInPlace(1.02333f); xx.copyFrom(harmonics.l00); TmpVectors::Vector3Array[0].copyFrom(harmonics.l20).scaleInPlace(0.247708f); TmpVectors::Vector3Array[1].copyFrom(harmonics.l22).scaleInPlace(0.429043f); xx.scaleInPlace(0.886277f) .subtractInPlace(TmpVectors::Vector3Array[0]) .addInPlace(TmpVectors::Vector3Array[1]); yy.copyFrom(harmonics.l00); yy.scaleInPlace(0.886277f) .subtractInPlace(TmpVectors::Vector3Array[0]) .subtractInPlace(TmpVectors::Vector3Array[1]); zz.copyFrom(harmonics.l00); TmpVectors::Vector3Array[0].copyFrom(harmonics.l20).scaleInPlace(0.495417f); zz.scaleInPlace(0.886277f).addInPlace(TmpVectors::Vector3Array[0]); yz.copyFrom(harmonics.l2_1); yz.scaleInPlace(0.858086f).scaleInPlace(-1.f); zx.copyFrom(harmonics.l21); zx.scaleInPlace(0.858086f).scaleInPlace(-1.f); xy.copyFrom(harmonics.l2_2); xy.scaleInPlace(0.858086f); scaleInPlace(1.f / Math::PI); return *this; } SphericalPolynomial SphericalPolynomial::FromHarmonics(const SphericalHarmonics& harmonics) { SphericalPolynomial result; return result.updateFromHarmonics(harmonics); } SphericalPolynomial SphericalPolynomial::FromArray(const std::vector<Float32Array>& data) { SphericalPolynomial sp; if (data.size() < 9) { return sp; } Vector3::FromArrayToRef(data[0], 0, sp.x); Vector3::FromArrayToRef(data[1], 0, sp.y); Vector3::FromArrayToRef(data[2], 0, sp.z); Vector3::FromArrayToRef(data[3], 0, sp.xx); Vector3::FromArrayToRef(data[4], 0, sp.yy); Vector3::FromArrayToRef(data[5], 0, sp.zz); Vector3::FromArrayToRef(data[6], 0, sp.yz); Vector3::FromArrayToRef(data[7], 0, sp.zx); Vector3::FromArrayToRef(data[8], 0, sp.xy); return sp; } }
#include <babylon/maths/spherical_polynomial.h> #include <babylon/maths/color3.h> #include <babylon/maths/tmp_vectors.h> namespace BABYLON { SphericalPolynomial::SphericalPolynomial() : x{Vector3::Zero()} , y{Vector3::Zero()} , z{Vector3::Zero()} , xx{Vector3::Zero()} , yy{Vector3::Zero()} , zz{Vector3::Zero()} , xy{Vector3::Zero()} , yz{Vector3::Zero()} , zx{Vector3::Zero()} , _harmonics{std::nullopt} { } SphericalPolynomial::SphericalPolynomial(const SphericalPolynomial& other) = default; SphericalPolynomial::SphericalPolynomial(SphericalPolynomial&& other) = default; SphericalPolynomial& SphericalPolynomial::operator=(const SphericalPolynomial& other) = default; SphericalPolynomial& SphericalPolynomial::operator=(SphericalPolynomial&& other) = default; SphericalPolynomial::~SphericalPolynomial() = default; SphericalPolynomial SphericalPolynomial::copy() const { return SphericalPolynomial(*this); } std::unique_ptr<SphericalPolynomial> SphericalPolynomial::clone() const { return std::make_unique<SphericalPolynomial>(*this); } SphericalHarmonics& SphericalPolynomial::preScaledHarmonics() { if (!_harmonics.has_value()) { _harmonics = SphericalHarmonics::FromPolynomial(*this); } if (!_harmonics->preScaled) { _harmonics->preScaleForRendering(); } return *_harmonics; } void SphericalPolynomial::addAmbient(const Color3& color) { TmpVectors::Vector3Array[0].copyFromFloats(color.r, color.g, color.b); auto& colorVector = TmpVectors::Vector3Array[0]; xx.addInPlace(colorVector); yy.addInPlace(colorVector); zz.addInPlace(colorVector); } void SphericalPolynomial::scaleInPlace(float scale) { x.scaleInPlace(scale); y.scaleInPlace(scale); z.scaleInPlace(scale); xx.scaleInPlace(scale); yy.scaleInPlace(scale); zz.scaleInPlace(scale); yz.scaleInPlace(scale); zx.scaleInPlace(scale); xy.scaleInPlace(scale); } SphericalPolynomial& SphericalPolynomial::updateFromHarmonics(const SphericalHarmonics& harmonics) { _harmonics = harmonics; x.copyFrom(harmonics.l11); x.scaleInPlace(1.02333f).scaleInPlace(-1.f); y.copyFrom(harmonics.l1_1); y.scaleInPlace(1.02333f).scaleInPlace(-1.f); z.copyFrom(harmonics.l10); z.scaleInPlace(1.02333f); xx.copyFrom(harmonics.l00); TmpVectors::Vector3Array[0].copyFrom(harmonics.l20).scaleInPlace(0.247708f); TmpVectors::Vector3Array[1].copyFrom(harmonics.l22).scaleInPlace(0.429043f); xx.scaleInPlace(0.886277f) .subtractInPlace(TmpVectors::Vector3Array[0]) .addInPlace(TmpVectors::Vector3Array[1]); yy.copyFrom(harmonics.l00); yy.scaleInPlace(0.886277f) .subtractInPlace(TmpVectors::Vector3Array[0]) .subtractInPlace(TmpVectors::Vector3Array[1]); zz.copyFrom(harmonics.l00); TmpVectors::Vector3Array[0].copyFrom(harmonics.l20).scaleInPlace(0.495417f); zz.scaleInPlace(0.886277f).addInPlace(TmpVectors::Vector3Array[0]); yz.copyFrom(harmonics.l2_1); yz.scaleInPlace(0.858086f).scaleInPlace(-1.f); zx.copyFrom(harmonics.l21); zx.scaleInPlace(0.858086f).scaleInPlace(-1.f); xy.copyFrom(harmonics.l2_2); xy.scaleInPlace(0.858086f); scaleInPlace(1.f / Math::PI); return *this; } SphericalPolynomial SphericalPolynomial::FromHarmonics(const SphericalHarmonics& harmonics) { SphericalPolynomial result; return result.updateFromHarmonics(harmonics); } SphericalPolynomial SphericalPolynomial::FromArray(const std::vector<Float32Array>& data) { SphericalPolynomial sp; if (data.size() <
}
9) { return sp; } Vector3::FromArrayToRef(data[0], 0, sp.x); Vector3::FromArrayToRef(data[1], 0, sp.y); Vector3::FromArrayToRef(data[2], 0, sp.z); Vector3::FromArrayToRef(data[3], 0, sp.xx); Vector3::FromArrayToRef(data[4], 0, sp.yy); Vector3::FromArrayToRef(data[5], 0, sp.zz); Vector3::FromArrayToRef(data[6], 0, sp.yz); Vector3::FromArrayToRef(data[7], 0, sp.zx); Vector3::FromArrayToRef(data[8], 0, sp.xy); return sp; }
function_block-function_prefixed
[ { "content": "class Color3;\n", "file_path": "src/BabylonCpp/include/babylon/maths/spherical_harmonics.h", "rank": 0, "score": 282209.0951003985 }, { "content": "namespace BABYLON {\n\n\n\n/**\n\n * @brief Defines One Image in the file. It requires only the position in the\n\n * file as well...
C++
examples/UseOptiXGeometryInstancedStandalone/UseOptiXGeometryInstancedStandalone.cc
hanswenzel/opticks
b75b5929b6cf36a5eedeffb3031af2920f75f9f0
"\n\n#include <chrono>\n\n#include <iomanip>\n#include <iostream>\n#include <cstdlib>\n#include <cst(...TRUNCATED)
"\n\n#include <chrono>\n\n#include <iomanip>\n#include <iostream>\n#include <cstdlib>\n#include <cst(...TRUNCATED)
"tion( context->createAcceleration( \"Trbvh\" ) ); \n top->addChild(assembly);\n\n optix::Acce(...TRUNCATED)
"ec3(axis_angle)) ; break ; \n case 't': mat = glm::translate(mat, tlat ) ; break ; \n (...TRUNCATED)
random
[{"content":"struct DescriptorDataType<unsigned int> { static const char value = 'u'; };\n\ntemplate(...TRUNCATED)
C++
CompareContacts/main.cpp
Sioniras/MD-Tools
df408c122dfb57100bdc976dba66b47ee03622fe
"\n\n#include <iostream>\n#include <vector>\n#include <memory>\n#include <cstdlib>\n#include <algori(...TRUNCATED)
"\n\n#include <iostream>\n#include <vector>\n#include <memory>\n#include <cstdlib>\n#include <algori(...TRUNCATED)
"\t\t\t\tstr << \" \" << std::setw(columnpadding) << \"\" << \" |\";\n\t\t\t}\n\t\t\t\n\t\t\tk2++;\n(...TRUNCATED)
"<< (*i).Left << \" -\" << std::setw(columnpadding) << (*i).Right + \" |\";\n\t\tk = 0;\n\t\tk2 = 0;(...TRUNCATED)
random
[{"content":"// Contact helper struct\n\nstruct Contact\n\n{\n\n\tpublic:\n\n\t\t// Data members\n\n(...TRUNCATED)
C++
Builds/JuceLibraryCode/modules/juce_core/native/juce_android_Network.cpp
eriser/CSL
6f4646369f0c90ea90e2c113374044818ab37ded
"\r\n\r\n\n#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD) \\\r\n METHOD (constr(...TRUNCATED)
"\r\n\r\n\n#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD) \\\r\n METHOD (constr(...TRUNCATED)
"\r\n\r\n LocalRef<jobject> responseHeaderBuffer (env->NewObject (StringBuffer, StringBuffer.(...TRUNCATED)
"if (postData.getSize() > 0)\r\n {\r\n postDataArray = env->NewByteArray (postData(...TRUNCATED)
if_condition
[{"content":"class KarplusString : public UnitGenerator, public Scalable, public Phased {\n\n\n\npub(...TRUNCATED)
C++
curves/include/curves/PolynomialSpline.hpp
leggedrobotics/curves
696db3e9ecf67c143e7b48a8dd53d2c5ea1ba2fe
"\n\n#pragma once\n\n#include <Eigen/Core>\n\n#include \"curves/polynomial_splines_traits.hpp\"\n\n#(...TRUNCATED)
"\n\n#pragma once\n\n#include <Eigen/Core>\n\n#include \"curves/polynomial_splines_traits.hpp\"\n\n#(...TRUNCATED)
"\n \n static inline void getDDTimeVectorAtZero(Eigen::Ref<EigenTimeVectorType> ddtimeVec) {\n (...TRUNCATED)
" Derived>\n static inline void getTimeVector(Eigen::MatrixBase<Derived> const & timeVec, const dou(...TRUNCATED)
random
[{"content":"class LocalSupport2CoefficientManagerTest : public ::testing::Test {\n\n protected:\n\n(...TRUNCATED)
C++
DigitalHaze-Libraries/cpp/DH_BitParser.cpp
Phytress/DigitalHaze-Libraries
a94a292da302da23851cc780cfec9d4736dcf9c4
"\n\n#include \"DH_BitParser.hpp\"\n\nnamespace DigitalHaze {\n\n\tBitParser::BitParser(void* buffer(...TRUNCATED)
"\n\n#include \"DH_BitParser.hpp\"\n\nnamespace DigitalHaze {\n\n\tBitParser::BitParser(void* buffer(...TRUNCATED)
"or::operator!=(BitBufferIterator& rhs) const {\n\t\treturn pos != rhs.pos;\n\t}\n\n\tSingleBitDescr(...TRUNCATED)
"s == rhs;\n\t}\n\n\tbool SingleBitDescriptor::operator!=(bool rhs) const {\n\t\treturn !(*this == r(...TRUNCATED)
random
[{"content":"\tclass BitBufferIterator {\n\n\tpublic:\n\n\t\tBitBufferIterator(const BitParser* bptr(...TRUNCATED)
C++
qt-creator-opensource-src-4.6.1/src/plugins/qmldesigner/designercore/metainfo/itemlibraryinfo.cpp
kevinlq/Qt-Creator-Opensource-Study
b8cadff1f33f25a5d4ef33ed93f661b788b1ba0f
"\n\n#include \"itemlibraryinfo.h\"\n#include \"nodemetainfo.h\"\n\n#include <QSharedData>\n\n#inclu(...TRUNCATED)
"\n\n#include \"itemlibraryinfo.h\"\n#include \"nodemetainfo.h\"\n\n#include <QSharedData>\n\n#inclu(...TRUNCATED)
"\n\nQDataStream& operator>>(QDataStream& stream, ItemLibraryEntry &itemLibraryEntry)\n{\n stream(...TRUNCATED)
"QDataStream& operator<<(QDataStream& stream, const ItemLibraryEntry &itemLibraryEntry)\n{\n stre(...TRUNCATED)
function_block-full_function
[]
C++
code_reading/oceanbase-master/src/sql/optimizer/ob_log_table_lookup.cpp
wangcy6/weekly_read
3a8837ee9cd957787ee1785e4066dd623e02e13a
"\n\n#define USING_LOG_PREFIX SQL_OPT\n#include \"sql/optimizer/ob_log_table_lookup.h\"\n#include \"(...TRUNCATED)
"\n\n#define USING_LOG_PREFIX SQL_OPT\n#include \"sql/optimizer/ob_log_table_lookup.h\"\n#include \"(...TRUNCATED)
"\n bool is_basic = false;\n ObLogicalOperator* child = NULL;\n ObExchangeInfo exch_info;\n if ((...TRUNCATED)
"rn ret;\n}\n\nint ObLogTableLookup::transmit_op_ordering()\n{\n int ret = OB_SUCCESS;\n reset_op_(...TRUNCATED)
random
[]
C++
Servable/DlibServable/test/TestDlibServable.cpp
bzcheeseman/BatchingRPCServer
d1130720fef6e15e129fa59cc37235537f609e36
"\n\n#include <dlib/data_io.h>\n#include <sstream>\n\n#include \"BatchingRPC.pb.h\"\n#include \"Dlib(...TRUNCATED)
"\n\n#include <dlib/data_io.h>\n#include <sstream>\n\n#include \"BatchingRPC.pb.h\"\n#include \"Dlib(...TRUNCATED)
}
"TEST_F(TestDlibServable, NextBatch) {\n Serving::DlibServable<net_type, matrix<unsigned char>, uns(...TRUNCATED)
function_block-full_function
[{"content":"class DlibServable : public Servable {\n\npublic:\n\n DlibServable(const int &batch_si(...TRUNCATED)
C++
src/plugins/algorithms/lda.cpp
kmoham6/phylanx
252fa5fbb84acaf6f999410e6823b9f8d6693213
"\n\n#include <phylanx/config.hpp>\n#include <phylanx/plugins/algorithms/lda.hpp>\n\n#include <hpx/i(...TRUNCATED)
"\n\n#include <phylanx/config.hpp>\n#include <phylanx/plugins/algorithms/lda.hpp>\n\n#include <hpx/i(...TRUNCATED)
"d_doc_mat') to represent a matrix\"));\n }\n auto word_doc_mat = arg5.matrix();\n\n (...TRUNCATED)
"st of two matrices:\\n\"\n \" [word_topic, document_topic] :\\n\"\n \"\\n\(...TRUNCATED)
random
[{"content":" class matrix_column_iterator\n\n : public hpx::util::iterator_facade<matrix_co(...TRUNCATED)
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
10