R/tensor.R

Defines functions tensor

Documented in tensor

#' @export
tensor <- function(...){
	#as.matrix(outer(k1,k2))
	input <- list(...)
	k <- input[[1]]
	for( j in 2:length(input))
		k <- kronecker(k,input[[j]])
	if(length(input[[1]][1,]) == 1)			#if vectors, not matrices
		k <- k/sqrt(sum(abs(k)^2))		#if original kets not normalized
	k								#normalize
}

Try the QuantumOps package in your browser

Any scripts or data that you put into this service are public.

QuantumOps documentation built on Feb. 3, 2020, 5:07 p.m.