9il on v3.2.2
9il on master
update gitignore (compare)
mtimes()
now that works like the one in lubeck but uses mir-glas and also expects an allocator to be passed
Random gen
is not initialized.{
"name": "compute-messing-around",
"authors": [
"Francis Nixon"
],
"description": "A minimal D application.",
"license": "proprietary",
"dependencies": {
"dcompute": "~>0.1.0"
},
"dflags": ["-mdcompute-targets=ocl-210,cuda-350","-oq"]
}
../../.dub/packages/dcompute-0.1.0/dcompute/source/dcompute/driver/error.d(143,13): Error: undefined identifier `fprintf`
../../.dub/packages/dcompute-0.1.0/dcompute/source/dcompute/driver/ocl/context.d(144,19): Error: undefined identifier `clCreateProgramWithIL`
clCreateProgramWithIL
can't be found. Are you using an up to date DerelictCL?
clCreateProgramWithIL
error went away after manually selecting the most recent version of DerelictCL. I then got an error in the same place as the fprintf error, except for toStringz
. Adding an import fixed that, but now I'm getting the following: ../../.dub/packages/dcompute-0.1.0/dcompute/source/dcompute/driver/error.d(139,32): Error: cannot implicitly convert expression `__lambda1` of type `void delegate(Status _status) @system` to `immutable(void delegate(Status) nothrow @nogc)`
../../.dub/packages/dcompute-0.1.0/dcompute/source/dcompute/driver/error.d(139,32): Error: cannot implicitly convert expression `__lambda1` of type `void delegate(Status _status) @system` to `immutable(void delegate(Status) nothrow @nogc)`
Invalid bitcast
%3 = bitcast float addrspace(1)* %res_arg to float*
Invalid bitcast
%5 = bitcast float addrspace(1)* %x_arg to float*
Invalid bitcast
%9 = bitcast float addrspace(1)* %y_arg to float*
LLVM ERROR: Broken function found, compilation aborted!
ldc2 --version
you posted)?
double[100] x1; // Only works if the size is only 2
Random* gen = threadLocalPtr!Random;
auto mu = [0.0, 0.0].sliced;
auto sigma = [1.0, 0.75, 0.75, 1].sliced(2,2);
auto rv = multivariateNormalVar(mu, sigma);
rv(gen, x1[]);
how about this? (3dim random normal x 10)
/+dub.sdl:
dependency "lubeck" version="~>0.0.4"
dependency "numir" version="~>0.1.0"
libs "blas"
+/
import mir.ndslice : map, sliced, slicedField, ndarray;
import mir.random : threadLocalPtr, Random;
import mir.random.variable : NormalVariable;
import mir.random.algorithm : field;
import lubeck : mtimes;
import numir : alongDim;
import std.stdio;
void main() {
Random* gen = threadLocalPtr!Random;
auto mu = [0.0, 0.0, 0.0].sliced;
auto sigma = [1.0, 0.75, 0.0,
0.75, 1.0, 0.75,
0.0, 0.75, 1].sliced(3,3);
auto xs = field(gen, NormalVariable!double(0, 1)).slicedField(10, 3);
auto x1 = xs.mtimes(sigma).alongDim!1.map!(x => x + mu).ndarray;
x1.writeln; // 10 x 3 dim
}
https://run.dlang.io/gist/bd6dd9a2f6606151c707a6bdf6d0be36?compiler=ldc&args=-release
The multi normal random value is just an affine transformation of the standard normal random values. https://en.wikipedia.org/wiki/Multivariate_normal_distribution#Affine_transformation
for creating two separated data clusters
Oh you wanna create two clusters! you can take my example in https://github.com/ShigekiKarita/d-tree/blob/master/example/plot_boundary/app.d
it looks like this