module Numeric.Array.Family.ArrayI8 () where
import GHC.Base (runRW#)
import GHC.Prim
import GHC.Types (Int (..), RuntimeRep (..), isTrue#)
import GHC.Int (Int8 (..))
import Numeric.Array.ElementWise
import Numeric.Array.Family
import Numeric.Commons
import Numeric.Dimensions
import Numeric.Dimensions.Traverse
#include "MachDeps.h"
#define ARR_TYPE ArrayI8
#define ARR_FROMSCALAR FromScalarI8#
#define ARR_CONSTR ArrayI8#
#define EL_TYPE_BOXED Int8
#define EL_TYPE_PRIM Int#
#define EL_RUNTIME_REP 'IntRep
#define EL_CONSTR I8#
#define EL_SIZE SIZEOF_INT8#
#define EL_ALIGNMENT ALIGNMENT_INT8#
#define EL_ZERO 0#
#define EL_ONE 1#
#define EL_MINUS_ONE -1#
#define INDEX_ARRAY indexInt8Array#
#define WRITE_ARRAY writeInt8Array#
#define OP_EQ (==#)
#define OP_NE (/=#)
#define OP_GT (>#)
#define OP_GE (>=#)
#define OP_LT (<#)
#define OP_LE (<=#)
#define OP_PLUS (+#)
#define OP_MINUS (-#)
#define OP_TIMES (*#)
#define OP_NEGATE negateInt#
#include "Array.h"
instance Num (ArrayI8 ds) where
(+) = zipV (+#)
() = zipV (-#)
(*) = zipV (*#)
negate = mapV negateInt#
abs = mapV (\x -> if isTrue# (x >=# 0#)
then x
else negateInt# x
)
signum = mapV (\x -> if isTrue# (x ># 0#)
then 1#
else if isTrue# (x <# 0#)
then 1#
else 0#
)
fromInteger = broadcastArray . fromInteger
instance Bounded (ArrayI8 ds) where
minBound = broadcastArray minBound
maxBound = broadcastArray maxBound