Rtnorm
Sampling truncated univ normal distribution
Install / Use
/learn @JonasWallin/RtnormREADME
rtnorm
Sampling truncated univ normal distribution.
This repos contains python and matlab package for simulation of truncated normal random variables based upon the codes: Vincent Mazet, and it built from the article Fast simulation of trunacted Gaussian distributions of Niclos Chopin.
Python
For python the requirements are:
-
scipy (will be removed)
-
NumPy
-
Cython
-
openmp (option can be turned off in setupy.py)
pip -e 'git+https://git@github.com/JonasWallin/rtnorm.git#egg=rtnorm&subdirectory=python/rtnorm'
To use the sampler:
import rtnorm
sampler = rtnorm.rtnorm()
X = sampler(a = 1, b = 2, mu = 3, sigma = 4)
Or with vectors:
import rtnorm
import numpy as np
X = sampler( a = np.zeros((4,)), b = np.random.rand(4) )
Matlab
For matlab:
make
should install the make mex files link to the directory with addpath. Run matlab code with:
x = rtnorm(a, b, mu, sigma);
where a,b,mu, and sigma are vectors
###TODO:
1. setup test case in python (done)
2. setup speed test in python (done)
3. modify the code so it sutiable for vector versions (done)
4. Write the probability so we can test more advanced
5. Matlab version (done)
7. test on the amzaon cluster (done)
Related Skills
node-connect
348.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
348.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
348.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
