On 11/03/15 20:01, Frederic Ntirenganya wrote:
Hi All,
I need a help on a loop which can compare the each component of vector to
each component of a Matrix.
Let a vector b = {b1, b2, ...,bn} and 2x2 matrix A = Aij.
I need to compare each component of the vector with each component of a
matrix
Hi,
you didn't specify values in A, and you first wanted to compare bi
with Aij, but then also which bi is less/equal to zero.
For the first case, with
A <- matrix(0:3,2)
b <- seq(-1,5)
and a comparison function for bi less/equal to Aij like
f <- function (bi) {as.integer(bi<=A)}
you can iter
Hi All,
I need a help on a loop which can compare the each component of vector to
each component of a Matrix.
Let a vector b = {b1, b2, ...,bn} and 2x2 matrix A = Aij.
I need to compare each component of the vector with each component of a
matrix and print 1 if the component is less or equal to
3 matches
Mail list logo