R/tril.R

Defines functions tril

Documented in tril

tril <- function(M){

# preliminaries
  nr = nrow(M)
  nc = ncol(M)
  if(nr!=nc) stop("non-square matrix")
# put zeros in suitable elements
  for(i in 1:(nr-1)) M[i,(i+1):nr] = 0
# output
  N = M

}

Try the extRC package in your browser

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

extRC documentation built on Oct. 23, 2020, 7:07 p.m.