Skip to content

Instantly share code, notes, and snippets.

@Eleobert
Eleobert / agc.cpp
Created October 21, 2021 19:15
Aglomerative clustering
#include <armadillo>
#include <vector>
auto get_cluster_sim(const arma::mat& sim, const arma::uvec& cluster_a, const arma::uvec& cluster_b)
{
arma::uvec combined_clusters = arma::join_cols(cluster_a, cluster_b);
arma::mat combined_sims = sim(combined_clusters, combined_clusters);
auto exemplar = combined_clusters(arma::mean(combined_sims).index_max());
arma::vec exe_sims = sim.col(exemplar);
#include <iostream>
#include <algorithm>
#include <cassert>
#include <vector>
#include <numeric>
#include <cmath>
#include <limits>
template<typename T>
@Eleobert
Eleobert / gist:8e3d070190c9862d2442a2f5db517bd9
Created January 18, 2021 22:40
Interpolation using Neville's Algorithm in C++
class poly
{
const std::vector<double> xs;
const std::vector<double> ys;
std::vector<double> data;
auto& qs(int i, int j){return data[i * xs.size() + j];}
public:
poly(const std::vector<double> xs, const std::vector<double> ys): xs(xs), ys(ys), data(xs.size() * xs.size())
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
section .bss
buf_in: RESB 32 ;input buffer
buf_out: RESB 32 ;output buffer
section .data
str: db "Введите строку: "
str_len: equ $-str
section .text
global _start
@Eleobert
Eleobert / OpenGL-winAPI.cpp
Last active April 12, 2023 23:42
OpenGL context creation on win32 (without any extensions)
#include <Windows.h>
#include <GL\GL.h>
#include <glext.h>
#include <wglext.h>
#include <iostream>
#pragma comment(lib, "opengl32.lib")