Skip to content

Instantly share code, notes, and snippets.

View dvsseed's full-sized avatar
💭
I may be slow to respond.

曾令燊 dvsseed

💭
I may be slow to respond.
View GitHub Profile
@dvsseed
dvsseed / alglib_svd.cpp
Created June 23, 2022 07:18
To get SVD with ALGLIB
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sys/time.h>
#include "ap.h"
#include "linalg.h"
using namespace std;
using namespace alglib;
@dvsseed
dvsseed / gsl_SVD.h
Created June 23, 2022 06:40
The header is for gsl_svd.cpp
#ifndef GSLSINGULARVALUEDECOMPOSITION_H
#define GSLSINGULARVALUEDECOMPOSITION_H
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_blas.h>
#include <gsl/gsl_linalg.h>
#include <gsl/gsl_errno.h>
@dvsseed
dvsseed / gsl_svd.cpp
Created June 23, 2022 06:39
To get SVD with GSL -- GNU Scientific Library
#include <stdio.h>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <sys/time.h>
#include <gsl/gsl_vector.h>
#include "gsl_SVD.h"
@dvsseed
dvsseed / eigen_svd.cpp
Created June 23, 2022 06:33
To get the SVD with Eigen C++ template library
#define EIGEN_USE_MKL_ALL
#define EIGEN_VECTORIZE_SSE4_2
#include <bits/stdc++.h>
#include <sys/time.h>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <exception>
@dvsseed
dvsseed / Dockerfile
Created June 21, 2022 12:43
Create a docker file for Ubuntu 20.04, CUDA 10.2, MiniConda, Python 3.10, PyTorch 1.11.0
# Define base image
# FROM nvidia/cuda:11.3.0-runtime-ubuntu20.04
# FROM nvidia/cuda:11.3.0-cudnn8-runtime-ubuntu20.04
# FROM nvidia/cuda:11.3.0-cudnn8-devel-ubuntu20.04
FROM nvidia/cuda:11.0.3-cudnn8-devel-ubuntu20.04
ENV PATH="/root/miniconda3/bin:${PATH}"
ARG PATH="/root/miniconda3/bin:${PATH}"
RUN sed -i 's/http:\/\/archive.ubuntu.com\/ubuntu/http:\/\/free.nchc.org.tw\/ubuntu/g' /etc/apt/sources.list
@dvsseed
dvsseed / matlab_svd.m
Last active June 21, 2022 11:17
To calculate SVD with MATLAB.
% Clear all text from the Command Window.
clc; clear all; close all;
fprintf('SVD -- start calculating...\n');
tic % 開始計時
% data importing
% data = 'LBPhistogram_BGC_20220609.csv';
% data = 'LBPhistogram_BRGC_20220609.csv';
@dvsseed
dvsseed / calc_flatten_entropy.cpp
Created January 26, 2022 13:00
To calculate the Conditional entropy and normalized the ResNet's Flatten layer values.
#include <bits/stdc++.h>
#include <sys/time.h>
#include <iostream>
#include <ctime>
#include <fstream>
#include <vector>
#include <sstream>
#include <map>
#include <algorithm>
#include <cmath>
@dvsseed
dvsseed / tool.py
Last active October 18, 2020 15:14
drag and drop this file to the CIRCUITPY directory
# Tools
import time
import board
import neopixel
dup = 37 # hyphen
# include audio libraries
@dvsseed
dvsseed / code.py
Created October 18, 2020 15:09
drag and drop this file to the CIRCUITPY directory
""" Example for using the SGP30 and PM25 with CircuitPython
and the Adafruit library """
import digitalio
import busio
import adafruit_sgp30
import board
import adafruit_pm25
from tool import show_SGP, show_SGP_baseline # for SGP30
from tool import show_PM25 # for PMSA003
@dvsseed
dvsseed / yolov3-voc.cfg
Created March 18, 2020 09:01
yolov3-voc.cfg
[net]
# Testing
# batch=1
# subdivisions=1
# Training
batch=16
subdivisions=8
width=416
height=416
channels=3