Arith function

Arithmetic methods for class "frab"

Arithmetic methods for class "frab"

The frab class provides basic arithmetic methods for frab objects. Arithmetic operations are generally dispatched to one of self-describing functions in the following list:

  • frab_negative()
  • frab_reciprocal()
  • frab_plus_frab()
  • frab_multiply_frab()
  • frab_plus_numeric()
  • frab_multiply_numeric()
  • frab_power_numeric()
  • numeric_power_frab()

The most important one is, of course, frab_plus_frab() which is the sine qua non for the whole package. But these functions are not intended for user and are somewhat unfriendly. Use the arithmetic operators, as in ‘a + 2*b’ instead.

Low-level helper functions c_frab_add() and c_frab_multiply() etc. are generated by compileAttributes(). They call the routines in the src directory. Low-level helper function c_frab_pmax() is documented here for consistency; but technically c_frab_pmax() is an Extremes function. They are documented at Compare and pmax respectively.

frab_negative(x) frab_reciprocal(x) frab_plus_frab(F1,F2) frab_multiply_numeric(e1,e2) frab_power_numeric(e1,e2) numeric_power_frab(e1,e2) frab_unary(e1,e2) frab_arith_frab(e1,e2) frab_plus_numeric(e1,e2) frab_arith_numeric(e1,e2) numeric_arith_frab(e1,e2)

Arguments

  • e1,e2,x,F1,F2: Objects of class frab, coerced if needed

Methods

  • Arith: signature(e1="frab" , e2="missing"): blah blah blah
  • Arith: signature(e1="frab" , e2="frab" ): ...
  • Arith: signature(e1="frab" , e2="numeric"): ...
  • Arith: signature(e1="numeric", e2="frab" ): ...
  • Arith: signature(e1="ANY" , e2="frab" ): ...
  • Arith: signature(e1="frab" , e2="ANY" ): ...

Author(s)

Robin K. S. Hankin

Note

There are a few peculiarities in the methods. Function frab_plus_numeric(e1,e2) assumes e1 is a frab and e2 is numeric. But if e2 is a named vector, it is coerced to a frab; if not, a [simulated] list("disordR") violation is raised.

Returns

Return frab objects

See Also

Compare

Examples

(x <- frab(c(a=1,b=2,c=3))) (y <- frab(c(b=-2,d=8,x=1,y=7))) (z <- frab(c(c=2,x=5,b=1,a=6))) x+y x+y+z x*y
  • Maintainer: Robin K. S. Hankin
  • License: GPL (>= 2)
  • Last published: 2024-07-24