Scalar
Objective-C
@interface Scalar : NSObject
Swift
class Scalar : NSObject
Represents a four element vector
-
Declaration
Objective-C
@property(readonly) NSArray<NSNumber*>* val
Swift
var val: [NSNumber] { get }
-
Declaration
Objective-C
- (instancetype)initWithVals:(NSArray<NSNumber*>*)vals;
Swift
init(vals: [NSNumber])
-
Declaration
Objective-C
- (instancetype)initWithV0:(double)v0 v1:(double)v1 v2:(double)v2 v3:(double)v3 NS_SWIFT_NAME(init(_:_:_:_:));
Swift
init(_ v0: Double, _ v1: Double, _ v2: Double, _ v3: Double)
-
Declaration
Objective-C
- (instancetype)initWithV0:(double)v0 v1:(double)v1 v2:(double)v2 NS_SWIFT_NAME(init(_:_:_:));
Swift
init(_ v0: Double, _ v1: Double, _ v2: Double)
-
Declaration
Objective-C
- (instancetype)initWithV0:(double)v0 v1:(double)v1 NS_SWIFT_NAME(init(_:_:));
Swift
init(_ v0: Double, _ v1: Double)
-
Declaration
Objective-C
- (instancetype)initWithV0:(double)v0 NS_SWIFT_NAME(init(_:));
Swift
init(_ v0: Double)
-
Creates a scalar with all elements of the same value
Declaration
Objective-C
+ (nonnull Scalar *)all:(double)v;
Swift
class func all(_ v: Double) -> Scalar
Parameters
v
The value to set each element to
-
Calculates per-element product with another Scalar and a scale factor
Declaration
Objective-C
- (nonnull Scalar *)mul:(nonnull Scalar *)it scale:(double)scale;
Swift
func mul(_ it: Scalar, scale: Double) -> Scalar
Parameters
it
The other Scalar
scale
The scale factor
-
Calculates per-element product with another Scalar
Declaration
Objective-C
- (nonnull Scalar *)mul:(nonnull Scalar *)it;
Swift
func mul(_ it: Scalar) -> Scalar
Parameters
it
The other Scalar
-
Returns (v0, -v1, -v2, -v3)
Declaration
Objective-C
- (nonnull Scalar *)conj;
Swift
func conj() -> Scalar
-
Returns true iff v1 == v2 == v3 == 0
Declaration
Objective-C
- (BOOL)isReal;
Swift
func isReal() -> Bool
-
Clone object
Declaration
Objective-C
- (nonnull Scalar *)clone;
Swift
func clone() -> Scalar
-
Compare for equality
Declaration
Objective-C
- (BOOL)isEqual:(nullable id)object;
Swift
func isEqual(_ object: Any?) -> Bool
Parameters
other
Object to compare
-
Calculate hash value for this object
Declaration
Objective-C
- (NSUInteger)hash;
Swift
func hash() -> UInt
-
Returns a string that describes the contents of the object
Declaration
Objective-C
- (nonnull NSString *)description;
Swift
func description() -> String