Skip to content

Instantly share code, notes, and snippets.

View MrPanch's full-sized avatar
🎯
Focusing

MrPanch

🎯
Focusing
View GitHub Profile
import matplotlib.pyplot as plt
import numpy as np
import time
norm = np.linalg.norm
def calculate_baricenter(points):
mid_result = 0
points.append(points[0])
у тебя спина белая)))
source_file = open('tmp.txt', 'r')
n, s, f = map(int, source_file.readline().strip().split())
s, f = s-1, f-1
adjacency_matrix = []
for line in source_file:
cur_line = line.strip().split()
cur_line = list(map(int, cur_line))
adjacency_matrix.append(cur_line)
def hough_transform(
img: np.ndarray, theta: float, rho: float
) -> (np.ndarray, list, list):
thetas = np.deg2rad(np.linspace(0, 180, int(180 / theta + 1)))
width, height = img.shape
diag_len = int(np.ceil(np.sqrt(width * width + height * height))) # max_dist
rhos = np.linspace(-diag_len, diag_len, int(diag_len / rho + 1))
# Cache some resuable values
import timm
import torch
import numpy as np
import onnx
import pycuda.driver as cuda
import pycuda.autoinit
import tensorrt as trt
def torch2onnx(model_name, onnx_file_path, batch_size, img_size=224):
n = int(input())
k = int(input())
direction = input()
a = []
for i in range(n):
a.append(int(input()))
result = [0] * n
k %= n
import cv2
import numpy as np
import matplotlib.pyplot as plt
def plot_one_image(image: np.ndarray) -> None:
"""
Отобразить изображение с помощью matplotlib.
Вспомогательная функция.
:param image: изображение для отображения
import cv2
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import math
def plot_one_image(image: np.ndarray) -> None:
"""
Отобразить изображение с помощью matplotlib.
Вспомогательная функция.
void ThomasAlgorithm_P(int mynode, int numnodes,
int N, double *b, double *a, double *c, double *x, double *q){
int i;
int rows_local,local_offset;
double S[2][2],T[2][2],s1tmp,s2tmp;
double *l,*d,*y;
MPI_Status status;
l = new double[N];
d = new double[N];
#include <iostream>
#include <fstream>
#include <sstream>
#include <math.h>
#include <thread>
#include <future>
#include "parallel_thread.h"
#include "Sole.hpp"
#include "file_write.h"