new cuda functions
new cuda functions
gpu version seems to work
more asserts
bugfix
preparig to simplify arguments of kernels
cleanup the code