<< mps_diag mpscilab mps_erf >>

mpscilab >> mpscilab > mps_div

mps_div

Element-wise division operation

Calling Sequence

mps_div( rop, op1, op2 )
rop = mps_div( op1, op2 )

Overloaded usage:

rop = op1 ./ op2
rop = op1 / op2 //With op1 or op2 a scalar.

Arguments

rop

multi-precision matrix

op1, op2

multi-precision or Scilab matrices or scalars

Description

Divide element-wise op1 and op2 and put the result in rop. op1 and op2 can be any combinations of Scilab or multi-precision matrix. In case of division between a matrix and a scalar, element-wise division of every elements of the non-scalar operand will be performed.

mps_div( rop, op1, op2 )

Divide op1 by op2 and put the result in rop.

rop = mps_div( op1, op2 )

Creates a multi-precision matrix the same size and precision as op containing the result.

rop = op1 ./ op2

Overloaded Scilab element-wise division operation.

rop = op1 / op2

Exceptionally, when one of the input operands is a scalar the right matrix division symbol / can be used. This behavior is consistant with the one found in Scilab matrix operations.

Usage notes

Like most mps functions the mps_div( rop, op1, op2 ) form is faster and can reuse the space of an existing matrix but requires an already initialized operand. Also, the same form can be used to perform an in-place operation when rop and op are the same.

Examples

// Division between two MPS matrix.
A = [1 2; 3 4]
B = [4 3; 2 1]
mpsA = mps_init2(A,100)
mpsB = mps_init2(B,100)
rop = mps_init(2,2,100)
eop = mps_div(mpsA,mpsB)

// Division between an MPS matrix and a Scilab double scalar.
A = [1 2; 3 4]
mpsA = mps_init2(A,100)
rop = mps_init(2,2,100)
mps_mul(rop,mpsA,2)

// In-place division mpsA = mpsA ./ mpsB. This is done without any intermediary
// variable or storage.
A = [1 2; 3 4]
B = [4 3; 2 1]
mpsA = mps_init2(A,100)
mpsB = mps_init2(B,100)
mps_div(mpsA,mpsA,mpsB)

//Overloaded usage
A = [1 2; 3 4]
B = [4 3; 2 1]
mpsA = mps_init2(A,100)
mpsB = mps_init2(B,100)
rop = mpsA ./ mpsB

//Overloaded usage with a scalar
A = [1 2; 3 4]
mpsA = mps_init2(A,100)
rop = mpsA / 2

See Also

<< mps_diag mpscilab mps_erf >>