API Reference

This section documents the customer accessible classes and functions used to interact with Aion generated object files and dynamic libraries.

The contents are organized by header file.

model_api.h

This header defines the Model::Api class.

namespace Model

Typedefs

typedef Api *(*AllocatorFunction)()

Type you can use to cast the model allocator function address to use as a function pointer.

Returns

On success, returns a pointer to your model. A null pointer is returned on error.

typedef void (*DeallocatorFunction)(Api *model)

Type you can use to cast the model deallocation function address to use as a function pointer.

Parameters

model[in] Pointer to the model to be deallocated.

Variables

static constexpr char allocatorFunctionName[] = "allocator"

The symbol name of the model allocation function. After dynamically loading your model, you should resolve a symbol with this name which you can use as a function pointer to the model allocator function.

static constexpr char deallocatorFunctionName[] = "deallocator"

The symbol name of the model deallocation function. You should resolve a symbol with this name to use as a deallocation function. Call this function to release storage used by your model.

class Api
#include <model_api.h>

Pure-virtual class you can use to access your model. Your model will be presented as a pointer to a class of this type.

Subclassed by M::Api

Public Functions

virtual ~Api() = default
virtual bool start(Model::Rng::RngType rngType, const Model::Rng::RngSeed &rngSeed, Status *status = nullptr) = 0

Method you can use to start the model or algorithm running in the background.

Parameters
  • rngType[in] The type of RNG to be used by the model.

  • rngSeed[in] A value used to seed the PRNG, ignored if a TRNG is used.

  • status[in] An instance of Model::Status you can optionally use to receive notification of events.

Returns

Returns true if the model was started. Returns false if the model is currently running.

virtual Model::State state() const = 0

Method you can use to check status of the model or algorithm.

Returns

Returns the last reported model operating status.

virtual bool abort() = 0

Method you can use to forcibly stop the model or algorithm. The method will wait until the model has actually stopped execution.

Returns

Returns true on success, returns false if the model is not active.

virtual void waitComplete() = 0

Method you can use to block until the model or algorithm completes execution.

virtual bool run(Model::Rng::RngType rngType, const Model::Rng::RngSeed &rngSeed, Status *status = nullptr) = 0

Method that can be called to run the model or algorithm, blocking until the model or algorithm finishes execution.

Parameters
  • rngType[in] The type of RNG to be used by the model.

  • rngSeed[in] A value used to seed the PRNG, ignored if a TRNG is used.

  • status[in] An instance of Model::Status you can optionally use to receive notification of events.

Returns

Returns true if the model was started. Returns false if the model is currently running.

virtual bool pause() = 0

Method you can use to pause the model immediately.

Returns

Returns true on success, returns false if the model is not active.

virtual bool singleStep() = 0

Method you can use to single step the model.

Returns

Returns true on success, returns false if the model is currently active.

virtual bool setRunToLocation(OperationHandle operationHandle) = 0

Method you can use to specify a specific location to run-to before stopping.

Parameters

operationHandle[in] The operation handle of the location to run-to. Setting the value to Model::invalidOperationHandle will clear the run-to location.

Returns

Returns true on success, returns false if the run-to location is invalid.

virtual OperationHandle runToLocation() const = 0

Method you can use to obtain the current run-to location.

Returns

Returns the current run-to location. A value of Model::invalidOperationHandle is returned if there is no run-to location set.

virtual bool setBreakAtOperation(OperationHandle operationHandle, bool nowSet) = 0

Method you can use to set a breakpoint at a specific execution point.

Parameters
  • operationHandle[in] The operation handle we wish to pause at. Note that the model will pause just before performing the operation.

  • nowSet[in] If true, the breakpoint is now set. If false, the breakpoint will be cleared.

Returns

Returns true on success, returns false if the model is not active.

virtual OperationHandle operationBreakpoints(OperationHandle *list) const = 0

Method you can use to obtain a list of pending operation breakpoints.

Parameters

list[in] The list to be populated. The list must be pre-allocated with sufficient space to store one entry per operation handle.

Returns

Returns the actual length of the list, in entries.

virtual bool resume() = 0

Method you can use to resume the model after being paused.

Returns

Returns true on success, returns false if the model is not paused.

virtual unsigned numberThreads() const = 0

Method that returns the number of threads required by the model.

Returns

Returns the number of required threads.

virtual OperationHandle numberOperationHandles() const = 0

Method that returns the total number of pausable operations in the model.

Returns

Returns the number of pausable operations. Operation handles will be numbered zero to one less than this value.

virtual IdentifierDatabase identifierDatabase() const = 0

Method that returns a database containing information about identifiers within the model.

Returns

Returns a new identifier database instance.

virtual Rng *createRng(Rng::RngType rngType, const Rng::RngSeed &rngSeed) const = 0

Method you can use to obtain an RNG tied to this model instance.

Parameters
  • rngType[in] The type of RNG to be used by the model.

  • rngSeed[in] A value used to seed the PRNG, ignored if a TRNG is used.

Returns

Returns a pointer to a newly created and configured Model::Rng instance.

virtual Rng *createRng() const = 0

Method you can use to obtain an RNG tied to this model instance. This version uses the MT19937-64 PRNG algorithm and Gcurrent system time as a seed

Returns

Returns a pointer to a newly created and configured Model::Rng instance.

virtual void deleteRng(Rng *rng) const = 0

Method you can use to delete a previously created RNG instance.

Parameters

rng[in] The random number generator instance to be deleted.

model_api_types.h

for API visible content.

This header defines various types required by the model API.

namespace Model

Typedefs

typedef unsigned long long OperationHandle

Type used to represent an operation handle.

typedef unsigned IdentifierHandle

Type used to represent an identifier handle.

Enums

enum ValueType

Enumeration of supported base types.

Values:

enumerator NONE

Indicates no underlying value type.

enumerator VARIANT

Indicates a run-time variant type. Note that this value will never be returned by methods such as Model::IdentifierData::valueType and Model::Variant::valueType that are expected to always resulve to a distinct type.

Run-time variants are only used in cases where the compiler can not identify the actual variable type.

enumerator BOOLEAN

Indicates a boolean value.

enumerator INTEGER

Indicates an integer value.

enumerator REAL

Indicates a real value.

enumerator COMPLEX

Indicates a complex value.

enumerator SET

Indicates a set.

enumerator TUPLE

Indicates a tuple.

enumerator MATRIX_BOOLEAN

Indicates a matrix of boolean values.

enumerator MATRIX_INTEGER

Indicates a matrix of integer values.

enumerator MATRIX_REAL

Indicatea a matrix of real values.

enumerator MATRIX_COMPLEX

Indicate a matrix of complex values.

enumerator NUMBER_TYPES

Enumerated value used to indicate the number of known types. This value must be placed last in the enumeration.

enum State

Enumeration of model operating states.

Values:

enumerator STOPPED

Indicates the model is not running.

enumerator ABORTED

Indicates the model is not running and successfully aborted.

enumerator ACTIVE

Indicates the model is actively running.

enumerator PAUSED_ON_USER_REQUEST

Indicates the model is paused on user request.

enumerator PAUSED_AT_OPERATION

Indicates the model is paused at an operation.

enumerator PAUSED_ON_VARIABLE_UPDATE

Indicates the model is paused just prior to writing a variable.

enumerator ABORTING

Indicates the model is in the process of aborting.

enumerator NUMBER_STATES

Value indicating the number of state codes.

enum AbortReason

Enumeration of abort reason codes.

Values:

enumerator NONE

Indicates no abort reason.

enumerator USER_REQUEST

Indicates the model was aborted on user request.

enumerator INSUFFICIENT_MEMORY

Indicates that there is insufficient memory available.

enumerator SYSTEM

Indicates an unknown system exception.

enumerator INTERNAL_ERROR

Indicates an undefined model internal error.

enumerator MEMORY_ALLOCATION_ERROR

Indicates a memory allocation error.

enumerator FILE_OPEN_ERROR

Indicates a file open error.

enumerator FILE_READ_ERROR

Indicates a file read error.

enumerator FILE_WRITE_ERROR

Indicates a file write error.

enumerator FILE_SEEK_ERROR

Indicates an error during a seek.

enumerator FILE_CLOSE_ERROR

Indicates an error during file close.

enumerator INVALID_FILE_NUMBER

Indicates an invalid file number.

enumerator UNKNOWN_FILE_TYPE

Indicates an unrecognized file type.

enumerator MALFORMED_STRING

Indicates a string was not properly encoded.

enumerator CAN_NOT_CONVERT_TO_STRING

Indicates a tuple can-not be converted into a string.

enumerator INVALID_RUNTIME_CONVERSION

Indicates an invalid run-time type conversion.

enumerator INVALID_RANGE_PARAMETER

Indicates type used as a parameter for a range is invalid.

enumerator INVALID_CONTAINER_CONTENTS

Indicates a container class holds contents of an invalid type.

enumerator INVALID_ROW_INDEX

Indicates an invalid row was specified for a matrix.

enumerator INVALID_COLUMN_INDEX

Indicates an invalid column index was specified for a matrix.

enumerator INVALID_INDEX

Indicates an invalid index was specified for a matrix or tuple.

enumerator INCOMPATIBLE_MATRIX_DIMENSIONS

Indicates matrix dimensions were incompatible for the given operation. This exception is mostly associated with matrix multiplication operations.

enumerator INVALID_MATRIX_DIMENSIONS

Indicates matrix dimensions were invalid for the given operation. This exception is mostly associated with such things as calculation of the determinant or inverse of a matrix.

enumerator MATRIX_IS_SINGULAR

Indicates an attempt to invert a singular matrix.

enumerator TYPE_DOES_NOT_SUPPORT_SUBSCRIPTS

Indicates attempt to access a subscript of a scalar type.

enumerator INVALID_NUMERIC_VALUE

Indicates an invalid value. This value is generally tied to probabilities and other values with an expected limited range.

enumerator RESULT_IS_NAN

Indicates an NaN result.

enumerator RESULT_IS_INFINITE

Indicates an infinite result.

enumerator NUMBER_ABORT_REASONS

Value indicating the number of abort reason codes.

enum ExceptionClass

Enumeration of supported exception classes.

Values:

enumerator FILE_EXCEPTIONS

Exceptions triggered by file read/write operations.

enumerator MALFORMED_STRING_EXCEPTIONS

Exceptions triggered by a malformed string.

enumerator TYPE_CONVERSION_EXCEPTIONS

Exceptions triggered by run-time type conversion issues.

enumerator INVALID_PARAMETER_VALUE_EXCEPTIONS

Exceptions triggered by an invalid function parameter value.

enumerator NAN_VALUE_EXCEPTIONS

Exceptions triggered by an unexpected NaN value.

enumerator INFINITY_VALUE_EXCEPTIONS

Exceptions triggered by an unexpected infinity value.

enum DataFileFormat

Enumeration of supported file formats.

Values:

enumerator INVALID

Value indicating an invalid/undefined file format.

enumerator CSV

Value indicating a CSV file format.

enumerator BINARY

Value indicating a binary file format.

enum Device

Enumeration of supported I/O devices.

Values:

enumerator AUDIO

Indicates an audio device.

Variables

static constexpr OperationHandle invalidOperationHandle = static_cast<OperationHandle>(-1)

Value used to represent an invalid operation handle.

static constexpr IdentifierHandle invalidIdentifierHandle = static_cast<IdentifierHandle>(-1)

Value used to represent an invalid identifier handle.

model_common.h

This header provides macros shared across the entire library API.

Defines

MODEL_PUBLIC_API

Macro used to define the interface to the container library. Resolves to __declspec(dllexport) or __declspec(dllimport) on Windows.

MODEL_PUBLIC_TEMPLATE_METHOD

Macro that circumvents limitations in the Windows DLL implementation for templated class methods. The macro expands to “__forceinline” on Windows and nothing on other platforms.

model_complex.h

This header defines the Model::Complex type.

namespace M
namespace Model

Functions

inline Complex operator+(Complex::T a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

inline Complex operator+(Boolean a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

inline Complex operator+(Integer a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

inline Complex operator+(unsigned char a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

inline Complex operator+(signed char a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

inline Complex operator+(unsigned short a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

inline Complex operator+(signed short a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

inline Complex operator+(unsigned a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

inline Complex operator+(signed a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

inline Complex operator+(unsigned long a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

inline Complex operator+(signed long a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

inline Complex operator+(unsigned long long a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

inline Complex operator-(Complex::T a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

inline Complex operator-(Boolean a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

inline Complex operator-(Integer a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

inline Complex operator-(unsigned char a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

inline Complex operator-(signed char a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

inline Complex operator-(unsigned short a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

inline Complex operator-(signed short a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

inline Complex operator-(unsigned a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

inline Complex operator-(signed a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

inline Complex operator-(unsigned long a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

inline Complex operator-(signed long a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

inline Complex operator-(unsigned long long a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

inline Complex operator*(Complex::T a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

inline Complex operator*(Boolean a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

inline Complex operator*(Integer a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

inline Complex operator*(unsigned char a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

inline Complex operator*(signed char a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

inline Complex operator*(unsigned short a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

inline Complex operator*(signed short a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

inline Complex operator*(unsigned a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

inline Complex operator*(signed a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

inline Complex operator*(unsigned long a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

inline Complex operator*(signed long a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

inline Complex operator*(unsigned long long a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

inline Complex operator/(Complex::T a, const Complex &b)

Division operator.

Parameters
  • a[in] The first value to divide.

  • b[in] The second value to divide.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(Boolean a, const Complex &b)

Division operator.

Parameters
  • a[in] The first value to divide.

  • b[in] The second value to divide.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(Integer a, const Complex &b)

Division operator.

Parameters
  • a[in] The first value to divide.

  • b[in] The second value to divide.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(unsigned char a, const Complex &b)

Division operator.

Parameters
  • a[in] The first value to divide.

  • b[in] The second value to divide.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(signed char a, const Complex &b)

Division operator.

Parameters
  • a[in] The first value to divide.

  • b[in] The second value to divide.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(unsigned short a, const Complex &b)

Division operator.

Parameters
  • a[in] The first value to divide.

  • b[in] The second value to divide.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(signed short a, const Complex &b)

Division operator.

Parameters
  • a[in] The first value to divide.

  • b[in] The second value to divide.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(unsigned a, const Complex &b)

Division operator.

Parameters
  • a[in] The first value to divide.

  • b[in] The second value to divide.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(signed a, const Complex &b)

Division operator.

Parameters
  • a[in] The first value to divide.

  • b[in] The second value to divide.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(unsigned long a, const Complex &b)

Division operator.

Parameters
  • a[in] The first value to divide.

  • b[in] The second value to divide.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(signed long a, const Complex &b)

Division operator.

Parameters
  • a[in] The first value to divide.

  • b[in] The second value to divide.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(unsigned long long a, const Complex &b)

Division operator.

Parameters
  • a[in] The first value to divide.

  • b[in] The second value to divide.

Returns

Returns a complex value representing the quotient.

inline bool operator==(Complex::T a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(Boolean a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(Integer a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(unsigned char a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(signed char a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(unsigned short a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(signed short a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(unsigned a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(signed a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(unsigned long a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(signed long a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(unsigned long long a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator!=(Complex::T a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(Boolean a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(Integer a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(unsigned char a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(signed char a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(unsigned short a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(signed short a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(unsigned a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(signed a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(unsigned long a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(signed long a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(unsigned long long a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

class Complex
#include <model_complex.h>

Complex data-type class. Class is designed to be memory footprint compatible with the C++ std::complex<Model::Real> class as well as the C99 _Complex Model::Real type.

Public Types

typedef Real T

Fundamental datatype.

Public Functions

inline constexpr Complex()
inline constexpr Complex(float real)

Constructor

Parameters

real[in] The real portion of the value.

inline constexpr Complex(double real)

Constructor

Parameters

real[in] The real portion of the value.

inline constexpr Complex(long double real)

Constructor

Parameters

real[in] The real portion of the value.

inline constexpr Complex(signed char real)

Constructor

Parameters

real[in] The real portion of the value.

inline constexpr Complex(short real)

Constructor

Parameters

real[in] The real portion of the value.

inline constexpr Complex(int real)

Constructor

Parameters

real[in] The real portion of the value.

inline constexpr Complex(long real)

Constructor

Parameters

real[in] The real portion of the value.

inline constexpr Complex(long long real)

Constructor

Parameters

real[in] The real portion of the value.

inline constexpr Complex(unsigned char real)

Constructor

Parameters

real[in] The real portion of the value.

inline constexpr Complex(unsigned short real)

Constructor

Parameters

real[in] The real portion of the value.

inline constexpr Complex(unsigned real)

Constructor

Parameters

real[in] The real portion of the value.

inline constexpr Complex(unsigned long real)

Constructor

Parameters

real[in] The real portion of the value.

inline constexpr Complex(unsigned long long real)

Constructor

Parameters

real[in] The real portion of the value.

Complex(const M::Variant &other)

Constructor

Parameters

other[in] The value to conver to a complex type.

Complex(const Variant &other)

Constructor

Parameters

other[in] The value to conver to a complex type.

inline constexpr Complex(const Complex &other)

Copy constructor

Parameters

other[in] The value to be copied.

template<typename P1, typename P2>
inline constexpr Complex(P1 p1, P2 p2)

Templated constructor

Parameters
  • p1[in] The first parameter.

  • p2[in] The second parameter.

~Complex() = default
inline T real() const

Method that returns the real portion of the value.

Returns

Returns the real portion of the complex value.

inline T imag() const

Method that returns the imaginary portion of the value.

Returns

Returns the imaginary portion of the complex value.

inline Complex conj() const

Method that returns the complex conjugate of this value.

Returns

Returns the complex conjugate of this value.

inline Complex &operator=(const Complex &other)

Assignment operator

Parameters

other[in] The instance to be copied.

Returns

Returns a reference to this instance.

inline Complex &operator=(float other)

Assignment operator

Parameters

other[in] The value to be copied.

Returns

Returns a reference to this instance.

inline Complex &operator=(double other)

Assignment operator

Parameters

other[in] The value to be copied.

Returns

Returns a reference to this instance.

inline Complex &operator=(long double other)

Assignment operator

Parameters

other[in] The value to be copied.

Returns

Returns a reference to this instance.

inline Complex &operator=(unsigned char other)

Assignment operator

Parameters

other[in] The value to be copied.

Returns

Returns a reference to this instance.

inline Complex &operator=(signed char other)

Assignment operator

Parameters

other[in] The value to be copied.

Returns

Returns a reference to this instance.

inline Complex &operator=(unsigned short other)

Assignment operator

Parameters

other[in] The value to be copied.

Returns

Returns a reference to this instance.

inline Complex &operator=(signed short other)

Assignment operator

Parameters

other[in] The value to be copied.

Returns

Returns a reference to this instance.

inline Complex &operator=(unsigned int other)

Assignment operator

Parameters

other[in] The value to be copied.

Returns

Returns a reference to this instance.

inline Complex &operator=(signed int other)

Assignment operator

Parameters

other[in] The value to be copied.

Returns

Returns a reference to this instance.

inline Complex &operator=(unsigned long other)

Assignment operator

Parameters

other[in] The value to be copied.

Returns

Returns a reference to this instance.

inline Complex &operator=(signed long other)

Assignment operator

Parameters

other[in] The value to be copied.

Returns

Returns a reference to this instance.

inline Complex &operator=(unsigned long long other)

Assignment operator

Parameters

other[in] The value to be copied.

Returns

Returns a reference to this instance.

inline Complex &operator=(signed long long other)

Assignment operator

Parameters

other[in] The value to be copied.

Returns

Returns a reference to this instance.

Complex &operator=(const Variant &other)

Assignment operator

Parameters

other[in] The value to be copied.

Returns

Returns a reference to this instance.

Complex &operator=(const M::Variant &other)

Assignment operator

Parameters

other[in] The value to be copied.

Returns

Returns a reference to this instance.

inline Complex &operator+=(const Complex &v)

Addition assignment operator

Parameters

v[in] The value to add to this value.

Returns

Returns a reference to this instance.

inline Complex &operator+=(T v)

Addition assignment operator

Parameters

v[in] The value to add to this value.

Returns

Returns a reference to this instance.

inline Complex &operator-=(const Complex &v)

Subtraction assignment operator

Parameters

v[in] The value to add to this value.

Returns

Returns a reference to this instance.

inline Complex &operator-=(T v)

Subtraction assignment operator

Parameters

v[in] The value to add to this value.

Returns

Returns a reference to this instance.

Complex &operator*=(const Complex &v)

Multiplication assignment operator

Parameters

v[in] The value to add to this value.

Returns

Returns a reference to this instance.

inline Complex &operator*=(T v)

Multiplication assignment operator

Parameters

v[in] The value to add to this value.

Returns

Returns a reference to this instance.

inline Complex &operator/=(const Complex &v)

Division assignment operator

Parameters

v[in] The value to add to this value.

Returns

Returns a reference to this instance.

inline Complex &operator/=(T v)

Division assignment operator

Parameters

v[in] The value to add to this value.

Returns

Returns a reference to this instance.

inline Complex operator+(const Complex &v) const

Addition operator.

Parameters

v[in] The value to add to this value.

Returns

Returns a complex value representing the sum.

inline Complex operator+(T v) const

Addition operator.

Parameters

v[in] The value to add to this value.

Returns

Returns a complex value representing the sum.

inline Complex operator+(Boolean v) const

Addition operator.

Parameters

v[in] The value to add to this value.

Returns

Returns a complex value representing the sum.

inline Complex operator+(Integer v) const

Addition operator.

Parameters

v[in] The value to add to this value.

Returns

Returns a complex value representing the sum.

inline Complex operator+(unsigned char v) const

Addition operator.

Parameters

v[in] The value to add to this value.

Returns

Returns a complex value representing the sum.

inline Complex operator+(signed char v) const

Addition operator.

Parameters

v[in] The value to add to this value.

Returns

Returns a complex value representing the sum.

inline Complex operator+(unsigned short v) const

Addition operator.

Parameters

v[in] The value to add to this value.

Returns

Returns a complex value representing the sum.

inline Complex operator+(signed short v) const

Addition operator.

Parameters

v[in] The value to add to this value.

Returns

Returns a complex value representing the sum.

inline Complex operator+(unsigned v) const

Addition operator.

Parameters

v[in] The value to add to this value.

Returns

Returns a complex value representing the sum.

inline Complex operator+(signed v) const

Addition operator.

Parameters

v[in] The value to add to this value.

Returns

Returns a complex value representing the sum.

inline Complex operator+(unsigned long v) const

Addition operator.

Parameters

v[in] The value to add to this value.

Returns

Returns a complex value representing the sum.

inline Complex operator+(signed long v) const

Addition operator.

Parameters

v[in] The value to add to this value.

Returns

Returns a complex value representing the sum.

inline Complex operator+(unsigned long long v) const

Addition operator.

Parameters

v[in] The value to add to this value.

Returns

Returns a complex value representing the sum.

inline Complex operator-(const Complex &v) const

Subtraction operator.

Parameters

v[in] The value to subtract from this value.

Returns

Returns a complex value representing the difference.

inline Complex operator-(T v) const

Subtraction operator.

Parameters

v[in] The value to subtract from this value.

Returns

Returns a complex value representing the difference.

inline Complex operator-(Boolean v) const

Subtraction operator.

Parameters

v[in] The value to subtract from this value.

Returns

Returns a complex value representing the difference.

inline Complex operator-(Integer v) const

Subtraction operator.

Parameters

v[in] The value to subtract from this value.

Returns

Returns a complex value representing the difference.

inline Complex operator-(unsigned char v) const

Subtraction operator.

Parameters

v[in] The value to subtract from this value.

Returns

Returns a complex value representing the difference.

inline Complex operator-(signed char v) const

Subtraction operator.

Parameters

v[in] The value to subtract from this value.

Returns

Returns a complex value representing the difference.

inline Complex operator-(unsigned short v) const

Subtraction operator.

Parameters

v[in] The value to subtract from this value.

Returns

Returns a complex value representing the difference.

inline Complex operator-(signed short v) const

Subtraction operator.

Parameters

v[in] The value to subtract from this value.

Returns

Returns a complex value representing the difference.

inline Complex operator-(unsigned v) const

Subtraction operator.

Parameters

v[in] The value to subtract from this value.

Returns

Returns a complex value representing the difference.

inline Complex operator-(signed v) const

Subtraction operator.

Parameters

v[in] The value to subtract from this value.

Returns

Returns a complex value representing the difference.

inline Complex operator-(unsigned long v) const

Subtraction operator.

Parameters

v[in] The value to subtract from this value.

Returns

Returns a complex value representing the difference.

inline Complex operator-(signed long v) const

Subtraction operator.

Parameters

v[in] The value to subtract from this value.

Returns

Returns a complex value representing the difference.

inline Complex operator-(unsigned long long v) const

Subtraction operator.

Parameters

v[in] The value to subtract from this value.

Returns

Returns a complex value representing the difference.

Complex operator*(const Complex &v) const

Multiplication operator.

Parameters

v[in] The value to multiply against to this value.

Returns

Returns a complex value representing the product.

inline Complex operator*(T v) const

Multiplication operator.

Parameters

v[in] The value to multiply against this value.

Returns

Returns a complex value representing the product.

inline Complex operator*(Boolean v) const

Multiplication operator.

Parameters

v[in] The value to multiply against this value.

Returns

Returns a complex value representing the product.

inline Complex operator*(Integer v) const

Multiplication operator.

Parameters

v[in] The value to multiply against this value.

Returns

Returns a complex value representing the product.

inline Complex operator*(unsigned char v) const

Multiplication operator.

Parameters

v[in] The value to multiply against this value.

Returns

Returns a complex value representing the product.

inline Complex operator*(signed char v) const

Multiplication operator.

Parameters

v[in] The value to multiply against this value.

Returns

Returns a complex value representing the product.

inline Complex operator*(unsigned short v) const

Multiplication operator.

Parameters

v[in] The value to multiply against this value.

Returns

Returns a complex value representing the product.

inline Complex operator*(signed short v) const

Multiplication operator.

Parameters

v[in] The value to multiply against this value.

Returns

Returns a complex value representing the product.

inline Complex operator*(unsigned v) const

Multiplication operator.

Parameters

v[in] The value to multiply against this value.

Returns

Returns a complex value representing the product.

inline Complex operator*(signed v) const

Multiplication operator.

Parameters

v[in] The value to multiply against this value.

Returns

Returns a complex value representing the product.

inline Complex operator*(unsigned long v) const

Multiplication operator.

Parameters

v[in] The value to multiply against this value.

Returns

Returns a complex value representing the product.

inline Complex operator*(signed long v) const

Multiplication operator.

Parameters

v[in] The value to multiply against this value.

Returns

Returns a complex value representing the product.

inline Complex operator*(unsigned long long v) const

Multiplication operator.

Parameters

v[in] The value to multiply against this value.

Returns

Returns a complex value representing the product.

Complex operator/(const Complex &v) const

Division operator.

Parameters

v[in] The value to divide from this value.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(T v) const

Division operator.

Parameters

v[in] The value to add to this value.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(Boolean v) const

Division operator.

Parameters

v[in] The value to divide from this value.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(Integer v) const

Division operator.

Parameters

v[in] The value to divide from this value.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(unsigned char v) const

Division operator.

Parameters

v[in] The value to divide from this value.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(signed char v) const

Division operator.

Parameters

v[in] The value to divide from this value.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(unsigned short v) const

Division operator.

Parameters

v[in] The value to divide from this value.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(signed short v) const

Division operator.

Parameters

v[in] The value to divide from this value.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(unsigned v) const

Division operator.

Parameters

v[in] The value to divide from this value.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(signed v) const

Division operator.

Parameters

v[in] The value to divide from this value.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(unsigned long v) const

Division operator.

Parameters

v[in] The value to divide from this value.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(signed long v) const

Division operator.

Parameters

v[in] The value to divide from this value.

Returns

Returns a complex value representing the quotient.

inline Complex operator/(unsigned long long v) const

Division operator.

Parameters

v[in] The value to divide from this value.

Returns

Returns a complex value representing the quotient.

inline const Complex &operator+() const

Unary plus operator.

Returns

Returns a constant reference to this instance.

inline Complex operator-() const

Unary minus operator

Returns

Returns a new complex instance representing the negative of this instance.

inline Complex &operator++()

Pre-increment operator

Returns

Returns a reference to this instance.

inline Complex operator++(int)

Post-increment operator

Returns

Returns an unmodified copy of this instance.

inline Complex &operator--()

Pre-decrement operator

Returns

Returns a reference to this instance.

inline Complex operator--(int)

Post-decrement operator

Returns

Returns an unmodified copy of this instance.

explicit operator Model::Boolean() const

Casting operator.

Returns

Returns true if the complex value is non-zero. Returns false if the complex value is zero.

inline bool operator==(const Complex &other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(T other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(Boolean other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(Integer other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(unsigned char other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(signed char other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(unsigned short other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(signed short other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(unsigned other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(signed other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(unsigned long other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(signed long other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator==(unsigned long long other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

inline bool operator!=(const Complex &other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(T other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(Boolean other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(Integer other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(unsigned char other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(signed char other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(unsigned short other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(signed short other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(unsigned other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(signed other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(unsigned long other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(signed long other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline bool operator!=(unsigned long long other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

Private Members

T r

Real value.

T i

Imaginary value.

Friends

friend Complex operator+(Complex::T a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

friend Complex operator+(Boolean a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

friend Complex operator+(Integer a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

friend Complex operator+(unsigned char a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

friend Complex operator+(signed char a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

friend Complex operator+(unsigned short a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

friend Complex operator+(signed short a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

friend Complex operator+(unsigned a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

friend Complex operator+(signed a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

friend Complex operator+(unsigned long a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

friend Complex operator+(signed long a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

friend Complex operator+(unsigned long long a, const Complex &b)

Addition operator.

Parameters
  • a[in] The first value to add.

  • b[in] The second value to add.

Returns

Returns a complex value representing the sum.

friend Complex operator-(Complex::T a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

friend Complex operator-(Boolean a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

friend Complex operator-(Integer a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

friend Complex operator-(unsigned char a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

friend Complex operator-(signed char a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

friend Complex operator-(unsigned short a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

friend Complex operator-(signed short a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

friend Complex operator-(unsigned a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

friend Complex operator-(signed a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

friend Complex operator-(unsigned long a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

friend Complex operator-(signed long a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

friend Complex operator-(unsigned long long a, const Complex &b)

Subtraction operator.

Parameters
  • a[in] The first value to subtract.

  • b[in] The second value to subtract.

Returns

Returns a complex value representing the difference.

friend Complex operator*(Complex::T a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

friend Complex operator*(Boolean a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

friend Complex operator*(Integer a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

friend Complex operator*(unsigned char a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

friend Complex operator*(signed char a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

friend Complex operator*(unsigned short a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

friend Complex operator*(signed short a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

friend Complex operator*(unsigned a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

friend Complex operator*(signed a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

friend Complex operator*(unsigned long a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

friend Complex operator*(signed long a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

friend Complex operator*(unsigned long long a, const Complex &b)

Multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex value representing the product.

friend bool operator==(Complex::T a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

friend bool operator!=(Complex::T a, const Complex &b)

Comparison operator

Parameters
  • a[in] The first value to compare.

  • b[in] The second value to compare.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

model_identifier_database.h

This header defines the Model::IdentifierDatabase class.

namespace M
namespace Model
class IdentifierDatabase
#include <model_identifier_database.h>

Class you can use to identify variables and functions within your model or algorithm. This class uses copy-on-write semantics allowing you to rapidly assign one database to another within your own code.

Subclassed by M::IdentifierDatabase

Public Types

typedef IdentifierDatabaseIterator Iterator

Type used to represent a constant iterator.

typedef IdentifierDatabaseIterator ConstIterator

Type used to represent a constant iterator.

typedef IdentifierDatabaseIterator iterator

Type provided for STL compatibility.

typedef IdentifierDatabaseIterator const_iterator

Type provided for STL compatibility.

Public Functions

IdentifierDatabase()
IdentifierDatabase(const IdentifierDatabase &other)

Copy constructor

Parameters

other[in] The instance to be copied.

IdentifierDatabase(IdentifierDatabase &&other)

Move constructor

Parameters

other[in] The instance to be copied.

~IdentifierDatabase()
bool isEmpty() const

Method you can use to determine if the list is empty.

Returns

Returns true if the list is empty. Returns false if the list is not empty.

unsigned size() const

Method you can use to determine the size of the list, in identifiers.

Returns

Returns the current size of the list, in identifiers.

const IdentifierData &identifierDataByName(const char *text1, const char *text2 = nullptr) const

Method you can use to obtain identifier data by identifier name.

Parameters
  • text1[in] The UTF-8 encoded identifier’s name.

  • text2[in] The UTF-8 encoded identifier’s subscript. You can either provide an empty string or a null pointer if the desired identifier does not have a subscript.

Returns

Returns the identifier data associated with the requested identifier name. An invalid identifier data entry is returned if the name is invalid.

const IdentifierData &identifierDataByHandle(IdentifierHandle handle) const

Method you can use to obtain identifier data by identifier handle.

Parameters

handle[in] The handle to obtain the variable name of.

Returns

Returns the identifier data associated with the specified handle. An invalid identifier data instance is returned if the supplied handle is invalid.

ConstIterator constBegin() const

Method you can use to obtain a constant iterator to the first entry in the database.

Returns

Returns a constant iterator to the first entry in the database.

ConstIterator constEnd() const

Method you can use to obtain a constant iterator just past the last entry in the database.

Returns

Returns a constant iterator just past the last entry in the database.

const_iterator cbegin() const

Method you can use to obtain a constant iterator to the first entry in the database. This version is provided for STL compatibility.

Returns

Returns a constant iterator to the first entry in the database.

const_iterator cend() const

Method you can use to obtain a constant iterator just past the last entry in the database. This version is provided for STL compatibility.

Returns

Returns a constant iterator just past the last entry in the database.

Iterator begin() const

Method you can use to obtain an iterator to the first entry in the database.

Returns

Returns an iterator to the first entry in the database.

Iterator end() const

Method you can use to obtain an iterator just past the last entry in the database.

Returns

Returns an iterator just past the last entry in the database.

IdentifierDatabase &operator=(const IdentifierDatabase &other)

Copy assignment operator.

Parameters

other[in] The instance to be copied.

Returns

Returns a reference to this instance.

IdentifierDatabase &operator=(IdentifierDatabase &&other)

Move assignment operator.

Parameters

other[in] The instance to be copied.

Returns

Returns a reference to this instance.

Private Functions

inline IdentifierDatabase(Private *newImplementation)

Private constructor

Parameters

newImplementation[in] The new private implementation to assign to this class.

Private Members

Private *impl

Friends

friend class M::IdentifierDatabase
friend class IdentifierDatabaseIterator

model_identifier_database_iterator.h

This header defines the Model::IdentifierDatabaseIterator class.

namespace Model
class IdentifierDatabaseIterator
#include <model_identifier_database_iterator.h>

Iterator you can use to traverse an identifier database.

Public Functions

IdentifierDatabaseIterator()
IdentifierDatabaseIterator(const IdentifierDatabaseIterator &other)

Copy constructor

Parameters

other – The instance to be copied.

IdentifierDatabaseIterator(IdentifierDatabaseIterator &&other)

Move constructor

Parameters

other[in] The instance to apply to this instance.

~IdentifierDatabaseIterator()
IdentifierData value() const

Method you can use to obtain the current value pointed to by the iterator. Note that the Model::IdentifierDatabaseIterator::constReference method may prove to be slightly faster.

Returns

Returns a reference to the current value.

const IdentifierData &constReference() const

Method you can use to obtain a reference to the current value pointed to by the iterator.

Returns

Returns a reference to the current value.

const IdentifierData *constPointer() const

Method you can use to obtain a pointer to the current value.

Returns

Returns a pointer to the current value.

IdentifierHandle identifierHandle() const

Convenience method you can use to obtain the handle for a current identifier.

Returns

Returns the handle for the variable.

const char *text1() const

Convenience method you can use to obtain the UTF-8 encoded primary name of the identifier. This value will match the name of the identifier, less the subscript.

Returns

Returns a NUL terminated string holding the UTF-8 encoded identifier name as seen in the document view of the program.

const char *text2() const

Convenience method you can use to obtain the UTF-8 encoded subscript of the identifier. This value will match the subscript of the identifier.

Returns

Returns a NUL terminated string holding the UTF-8 encoded variable subscript. An empty string is returned if there is no subscript.

bool isFunction() const

Convenience method you can use to determine if this identifier points to a function.

Returns

Returns true if this identifier points to a function.

bool isVariable() const

Convenience method you can use to determine if this identifier points to an identifier.

Returns

Returns true if this identifier points to a variable.

ValueType valueType() const

Convenience method you can use to determine the value type of the identifier pointed to by the iterator.

Returns

Returns the value type of the identifier pointed to by the iterator.

void advance()

Method you can use to advance the iterator by one position.

void advance(unsigned long distance)

Method you can use to advance the iterator by a specified distance.

Parameters

distance[in] The distance to advance the iterator.

bool isValid() const

Method you can use to determine if this iterator is pointing to a valid entry.

Returns

Returns true if this iterator is pointing to a valid entry in the database. Returns false if the iterator is not initialized or is pointing to an invalid location.

bool isInvalid() const

Method you can use to determine if this iterator is pointing to an invalid location.

Returns

Returns true if this iterator is pointing to an invalid location or is not initialized. Returns false if this iterator is pointing to a valid location in the container.

const IdentifierData &operator*() const

Dereferencing operator.

See

Model::IdentifierDatabaseIterator::value

See

Model::IdentifierDatabaseIterator::constReference

Returns

Returns a reference to the current value pointed to by the iterator.

const IdentifierData *operator->() const

Indirection operator.

See

Model::IdentifierDatabaseIterator::constReference

See

Model::IdentifierDatabaseIterator::constPointer

Returns

Returns a pointer to the current value pointed to by the iterator.

IdentifierDatabaseIterator &operator++()

Pre-increment operator

Returns

Returns a reference to this instance.

IdentifierDatabaseIterator operator++(int)

Post-increment operator

Returns

Returns an instance representing the state of this iterator prior to being advanced.

IdentifierDatabaseIterator &operator+=(unsigned long distance)

Add assignment operator.

Parameters

distance[in] The distance to advance the iterator.

Returns

Returns a reference to this instance.

IdentifierDatabaseIterator &operator=(const IdentifierDatabaseIterator &other)

Copy assignment operator.

Parameters

other[in] The instance to assign to this instance.

Returns

Returns a reference to this instance.

IdentifierDatabaseIterator &operator=(IdentifierDatabaseIterator &&other)

Move assignment operator.

Parameters

other[in] The instance to move-assign to this iterator.

Returns

Returns a reference to this instance.

bool operator==(const IdentifierDatabaseIterator &other) const

Comparison operator

Parameters

other[in] The instance to compare against this instance.

Returns

Returns true if the instance point to the same entry in the database. Returns false if the iterator points to different entries. Comparing entries in different databases will lead to indeterminate results.

bool operator!=(const IdentifierDatabaseIterator &other) const

Comparison operator

Parameters

other[in] The instance to compare against this instance.

Returns

Returns true if the instance point to different entries in the database. Returns false if the instances point to the same entry. Comparing entries in different databases will lead to indeterminate results.

Private Functions

inline IdentifierDatabaseIterator(Private *newImplementation)

Private constructor

Parameters

newImplementation[in] The private implementation to assign to this iterator.

Private Members

Private *impl

Friends

friend class IdentifierDatabase

model_identifier_data.h

This header defines the Model::IdentifierData class.

namespace M
namespace Model
class IdentifierData
#include <model_identifier_data.h>

Class that is used to report information on identifiers within the model. You can use this class to query the various identifiers and access identifiers within a model.

Note that this class uses copy-on-write semantics allowing you to quickly assign one instance of this class to another instance.

Public Functions

IdentifierData()
IdentifierData(const IdentifierData &other)

Copy constructor

Parameters

other[in] The instance to be copied.

IdentifierData(IdentifierData &&other)

Move constructor

Parameters

other[in] The instance to move to this instance.

~IdentifierData()
bool isValid() const

Method you can use to determine if this identifier is valid.

Returns

Returns true if the identifier instance is valid. Returns false if the identifier instance is invalid.

bool isInvalid() const

Method you can use to determine if this identifier is invalid.

Returns

Returns true if the identifier instance is invalid. Returns false if the identifier instance is valid.

unsigned identifierHandle() const

Method you can use to obtain the identifier handle for this identifier.

Returns

Returns the handle for the identifier.

const char *text1() const

Method you can use to obtain the UTF-8 encoded identifier name as presented to the user within the program.

Returns

Returns a NUL terminated string holding the UTF-8 encoded identifier name as seen in the document view of the program. A null pointer is returned if the identifier data is invalid.

const char *text2() const

Method you can use to obtain the UTF-8 encoded identifier subscript text as presented to the user within the program.

Returns

Returns a NUL terminated string holding the UTF-8 encoded identifier subscript. A null pointer is returned if the identifier data is invalid.

bool isFunction() const

Method you can use to determine if this identifier points to a function.

Returns

Returns true if this identifier points to a function.

bool isVariable() const

Method you can use to determine if this identifier points to an identifier.

Returns

Returns true if this identifier points to a variable.

ValueType valueType() const

Method you can use to obtain the type of the identifier.

Returns

Returns the type of the identifier. A value of ValueType::NONE is returned if the identifier data is invalid.

Variant value() const

Method you can use to obtain a variant holding the current value of the variable.

Returns

Returns a variant holding the current value of the variable.

bool setValue(const Variant &newValue)

Method you can use to update the current value of the variable.

Parameters

newValue[in] The new value of the variable.

Returns

Returns true on success, returns false if the variant is not compatible with the variable.

const void *functionAddress() const

Method you can use to obtain the address of a function.

Returns

Returns the address of a function associated with this identifier.

IdentifierData &operator=(const IdentifierData &other)

Copy assignment operator.

Parameters

other[in] The instance to be copied.

Returns

Returns a reference to this instance.

IdentifierData &operator=(IdentifierData &&other)

Move assignment operator.

Parameters

other[in] The instance to move to this instance.

Returns

Returns a reference to this instance.

Private Functions

inline IdentifierData(Private *newImplementation)

Private constructor

Parameters

newImplementation[in] Pointer to the new implementation to assign to this Model::IdentifierData instance.

Private Members

Private *impl

Friends

friend class M::IdentifierDatabase

model_intrinsic_types.h

This header defines intrinsic types used by the model.

namespace Model

Typedefs

typedef bool Boolean

Boolean type.

typedef long long Integer

Basic integer type.

typedef double Real

Basic real type.

model_matrix.h

This header defines the Model::Matrix class.

namespace Model
class Matrix
#include <model_matrix.h>

Pure virtual base class for all matrix types. This class provides a common API you can use to access values from any matrix class in a consistent manner.

Note that you should always instantiate and use one of Model::MatrixBoolean, Model::MatrixInteger, Model::MatrixReal, or Model::MatrixComplex.

Subclassed by M::MatrixBoolean, M::MatrixComplex, M::MatrixInteger, M::MatrixReal, Model::MatrixBoolean, Model::MatrixComplex, Model::MatrixInteger, Model::MatrixReal

Public Types

enum MatrixType

Enumeration of available matrix types.

Values:

enumerator DENSE

Indicates a dense array in column-major format.

enumerator SPARSE

Indicates a sparse array. Note that, at this time, there is no support for sparse matrices.

typedef Integer Index

The type used as the index into the matrix.

Public Functions

virtual ~Matrix() = default
virtual ValueType coefficientValueType() const = 0

Pure virtual method you can use to determine the underlying coefficient type.

Returns

Returns the value type of the underlying coefficient.

virtual Index numberRows() const = 0

Pure virtual method you can use to determine number of matrix rows.

Returns

Returns the current number of rows.

virtual Index numberColumns() const = 0

Pure virtual method you can use to determine the number of matrix columns.

Returns

Returns the current number of matrix columns.

virtual Index numberCoefficients() const = 0

Pure virtual method you can use to determine the current total number of matrix coefficients.

Returns

Returns the size of the matrix, in coefficients.

virtual MatrixType matrixType() const = 0

Pure virtual method you can use to determine the underlying memory layout for the matrix.

Returns

Returns a value indicating the underlying memory layout for the matrix.

virtual Variant value(Index row, Index column) const = 0

Pure virtual method you can use to access the value at a specified row/column address. This method will throw an exception if the specified row or column is invalid.

Parameters
  • row[in] The one based row address.

  • column[in] The one based column address.

Returns

Returns a variant value holding the contents at the specified location.

virtual Variant value(Index index) const = 0

Pure virtual method you can use to access the value at a specified one based index. This method will throw an exception if the specified index is invalid.

Parameters

index[in] The one based index of the coefficient to be accessed.

Returns

Returns a variant value holding the contents at the specified location.

virtual bool setValue(Index row, Index column, const Variant &value) = 0

Pure virtual method you can use to set a value by position. If needed, the matrix will be resized to contain the provided coefficient.

Note that resizing the matrix is a potentially time-consuming operation.

Parameters
  • row[in] The one based row address.

  • column[in] The one based column address.

  • value[in] The value to assign to the specified location.

Returns

Returns true on success, returns false if the variant is not compatible with the matrix type or the row/column address is invalid.

virtual bool setValue(Index index, const Variant &value) = 0

Pure virtual method you can use to set a value by position.

Parameters
  • index[in] The one base index of the coefficient to be accessed.

  • value[in] The value to assign to the specified location.

Returns

Returns true on success, returns false if the variant is not compatible with the matrix type or the index is invalid.

virtual void resize(Index newNumberRows, Index newNumberColumns) = 0

Pure virtual method you can use to resize the matrix. Newly inserted values will be initialized to the default value for the type and existing values will be preserved.

Note that this is a potentially time-consuming operation.

Parameters
  • newNumberRows[in] The new number of matrix rows.

  • newNumberColumns[in] The new number of matrix columns.

model_matrix_boolean.h

This header defines the Model::MatrixBoolean class.

namespace M
namespace Model
class MatrixBoolean : public Model::Matrix
#include <model_matrix_boolean.h>

Matrix class holding boolean values. This class uses copy-on-write semantics to reduce memory utilization and to reduce processing overhead. Note that the class is intended for use as a storage class and does not provide traditional matrix operations such as addition, multiplication, etc. If you need a matrix class with support for matrix mathematics, consider using Model::MatrixBoolean, Model::MatrixReal, or Model::MatrixComplex.

Public Types

typedef Boolean Scalar

The type contained in this matrix.

Public Functions

MatrixBoolean()
MatrixBoolean(Integer numberRows, Integer numberColumns)

Constructor. This constructor will assert if the number of rows or number of columns is 0 or negative.

Parameters
  • numberRows[in] The desired number of matrix rows. Entries will be initialized to 0.

  • numberColumns[in] The desired number of matrix columns. Entries will be initialized to 0.

MatrixBoolean(Integer numberRows, Integer numberColumns, const Scalar *matrixData)

Constructor. This constructor will assert if the number of rows or number of columns is 0 or negative.

Parameters
  • numberRows[in] The desired number of matrix rows.

  • numberColumns[in] The desired number of matrix columns.

  • matrixData[in] Pointer to an array of value containing the matrix contents. Data should be in column major order and must have at least as many entries as there are coefficients in the matrix.

MatrixBoolean(const MatrixBoolean &other)

Copy constructor

Parameters

other[in] The instance to be copied to this instance.

MatrixBoolean(const MatrixInteger &other)

Constructor

Parameters

other[in] The instance to be copied to this instance.

MatrixBoolean(const MatrixReal &other)

Constructor

Parameters

other[in] The instance to be copied to this instance.

MatrixBoolean(const MatrixComplex &other)

Constructor

Parameters

other[in] The instance to be copied to this instance.

MatrixBoolean(MatrixBoolean &&other)

Move constructor

Parameters

other[in] The instance to be moved to this instance.

MatrixBoolean(const Variant &other)

Constructor

Parameters

other[in] The instance to copy to this instance.

~MatrixBoolean() override
virtual ValueType coefficientValueType() const override

Method you can use to determine the underlying coefficient type.

Returns

Returns the value type of the underlying coefficient.

bool toFile(const char *filename, DataFileFormat fileFormat) const

Method you can use to save this matrix to a file in binary format. This method will throw an exception if an error occurs and the associated exception is enabled.

Parameters
  • filename[in] The filename to save the file to

  • fileFormat[in] The desired file format.

Returns

Returns true on success, returns false on error.

virtual Index numberRows() const override

Method you can use to determine number of matrix rows.

Returns

Returns the current number of rows.

virtual Index numberColumns() const override

Method you can use to determine the number of matrix columns.

Returns

Returns the current number of matrix columns.

virtual Index numberCoefficients() const override

Method you can use to determine the current total number of matrix coefficients.

Returns

Returns the size of the matrix, in coefficients.

MatrixBoolean diagonalEntries() const

Method you can use to obtain the diagnonal entries from this matrix.

Returns

Returns a column matrix holding the diagnonal entries of the matrix.

MatrixBoolean diagonal() const

Method you can use construct a diagnonal matrix from a row or column matrix.

Returns

Returns a newly constructed square matrix from the supplied diagnonal entries.

virtual Variant value(Index row, Index column) const override

Method you can use to access the value at a specified row/column address.

Parameters
  • row[in] The one based row address.

  • column[in] The one based column address.

Returns

Returns a variant value holding the contents at the specified location. An empty variant is returned if the location is invalid.

virtual Variant value(Index index) const override

Method you can use to access the value at a specified one based index.

Parameters

index[in] The one based index of the coefficient to be accessed.

Returns

Returns a variant value holding the contents at the specified location. An empty variant is returned if the location is invalid.

virtual bool setValue(Index row, Index column, const Variant &value) override

Method you can use to set a value by position. If needed, the matrix will be resized to contain the provided coefficient.

Parameters
  • row[in] The one based row address.

  • column[in] The one based column address.

  • value[in] The value to assign to the specified location.

Returns

Returns true on success, returns false if the variant is not compatible with the matrix type or the row/column address is invalid.

virtual bool setValue(Index index, const Variant &value) override

Method you can use to set a value by position. If needed, the matrix will be resized to contain the provided coefficient. Now that, for empty matrices and matrices with a single row/column, matricies will be resized as a row matrix.

Parameters
  • index[in] The one base index of the coefficient to be accessed.

  • value[in] The value to assign to the specified location.

Returns

Returns true on success, returns false if the variant is not compatible with the matrix type or the index is invalid.

virtual void resize(Index newNumberRows, Index newNumberColumns) override

Method you can use to resize the matrix. Newly inserted values will be initialized to the default value for the type and existing values will be preserved.

Note that this is a potentially time-consuming operation.

Parameters
  • newNumberRows[in] The new number of matrix rows.

  • newNumberColumns[in] The new number of matrix columns.

Scalar at(Index row, Index column) const

Method you can use to obtain a value, by position. This method will throw an exception if the specified row range or column is invalid.

Parameters
  • row[in] The one based row number.

  • column[in] The one based column number.

Returns

Returns the value at the specified location.

Scalar at(Index index) const

Method you can use to obtain a value, by index. This method will throw an exception if the specified index is invalid.

Parameters

index[in] The one based index to the method. On matrices, the index will go in row/column order.

Returns

Returns the value at the specified location.

MatrixBoolean at(const Range &rowRange, Index column) const

Method you can use to obtain a submatrix of this matrix, by range values. This method will throw an exception if the specified row range or column is invalid.

Parameters
  • rowRange[in] The range to use to create the submatrix.

  • column[in] The column to use to create the submatrix.

Returns

Returns the desired submatrix.

MatrixBoolean at(Index row, const Range &columnRange) const

Method you can use to obtain a submatrix of this matrix, by range values. This method will throw an exception if the specified row range or column is invalid.

Parameters
  • row[in] The row to use to create the submatrix.

  • columnRange[in] The column range to use to create the submatrix.

Returns

Returns the desired submatrix.

MatrixBoolean at(const Range &rowRange, const Range &columnRange) const

Method you can use to obtain a submatrix of this matrix, by range values. This method will throw an exception if the specified row range or column is invalid.

Parameters
  • rowRange[in] The row range to use to create the submatrix.

  • columnRange[in] The column range to use to create the submatrix.

Returns

Returns the desired submatrix.

void update(Index row, Index column, Scalar newValue)

Method you can use to update a coefficient at a specified row and column. This method will throw an exception if the specified row or column is invalid and will resize the matrix, if needed, to include the specified coefficient.

Parameters
  • row[in] The one based row number.

  • column[in] The one based column number.

  • newValue[in] The new value at the specified location.

void update(Index index, Scalar newValue)

Method you can use to update a coefficient at a specified index. This method will throw an exception if the specified row or column is invalid and will resize the matrix, if needed, to include the specified coefficient.

Parameters
  • index[in] The one based index into the matrix.

  • newValue[in] The new value at the specified location.

MatrixBoolean combineLeftToRight() const

Method you can use to create a matrix that represents the combination of two other matrices. The matrices are combined left to right.

This method exists to simplify templatization of this operation.

Returns

Returns a copy of this matrix.

MatrixBoolean combineLeftToRight(const MatrixBoolean &other) const

Method you can use to create a matrix that represents the combination of two other matrices. The matrices are combined left to right.

Parameters

other[in] The matrix to combine to the right of this matrix.

Returns

Returns a new matrix representing the combination of the two matrices.

MatrixBoolean combineTopToBottom() const

Method you can use to create a matrix that represents the combination of two other matrices. The matrices are combined top to bottom.

This method exists to simplify templatization of this operation.

Returns

Returns a copy of this matrix.

MatrixBoolean combineTopToBottom(const MatrixBoolean &other) const

Method you can use to create a matrix that represents the combination of two other matrices. The matrices are combined top to bottom.

Parameters

other[in] The matrix to combine below this matrix.

Returns

Returns a new matrix representing the combination of the two matrices.

MatrixBoolean columnReverse() const

Method you can use to reverse the columns in this matrix.

Returns

Returns a column-reversed version of this matrix.

MatrixBoolean rowReverse() const

Method you can use to reverse the rows in this matrix.

Returns

Returns a row-reversed version of this matrix.

bool isSquare() const

Method you can use to determine if this matrix is square. That is, whether the matrix has the same number of rows as columns.

Returns

Returns true if this matrix is square. Returns false if this matrix is not square.

MatrixBoolean transpose() const

Method that returns the transpose of this matrix.

Returns

Returns the transpose of this matrix.

MatrixBoolean conj() const

Method that returns the complex conjugate of this matrix.

Returns

Returns the complex conjugate of this value.

MatrixBoolean adjoint() const

Method that returns the adjoint or conjugate transpose of the matrix.

Returns

Returns the adjoint of the matrix.

MatrixBoolean hadamard(const MatrixBoolean &other) const

Method that returns the Hadamard or Schur product of this matrix and another matrix. This method will throw an exception if the matrices do not have identical dimensions.

Parameters

other[in] The matrix to multiply against this matrix.

Returns

Returns the Hadamard product of the two matrices.

MatrixBoolean kronecker(const MatrixBoolean &other) const

Method that returns the Kronecker product of this matrix and another matrix.

Parameters

other[in] The matrix to multiply against this matrix.

Returns

Returns the Kronecker product of the two matrices.

virtual MatrixType matrixType() const override

Method you can use to determine the underlying memory layout for the matrix.

Returns

Returns a value indicating the underlying memory layout for the matrix.

MatrixBoolean &operator=(const MatrixBoolean &other)

Assignment operator

Parameters

other[in] The instance to be copied.

Returns

Returns a reference to this instance.

MatrixBoolean &operator=(const MatrixInteger &other)

Assignment operator

Parameters

other[in] The instance to be copied.

Returns

Returns a reference to this instance.

MatrixBoolean &operator=(const MatrixReal &other)

Assignment operator

Parameters

other[in] The instance to be copied.

Returns

Returns a reference to this instance.

MatrixBoolean &operator=(const MatrixComplex &other)

Assignment operator

Parameters

other[in] The instance to be copied.

Returns

Returns a reference to this instance.

MatrixBoolean &operator=(const Variant &other)

Assignment operator

Parameters

other[in] The instance to be copied.

Returns

Returns a reference to this instance.

bool operator==(const MatrixBoolean &other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

bool operator==(const MatrixInteger &other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

bool operator==(const MatrixReal &other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

bool operator==(const MatrixComplex &other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are equal. Returns false if the values are not equal.

bool operator!=(const MatrixBoolean &other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

bool operator!=(const MatrixInteger &other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

bool operator!=(const MatrixReal &other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

bool operator!=(const MatrixComplex &other) const

Comparison operator

Parameters

other[in] The value to compare against this value.

Returns

Returns true if the values are not equal. Returns false if the values are equal.

inline Scalar operator()(Index row, Index column) const

Array subscript operator.

Parameters
  • row[in] The one based row number.

  • column[in] The one based column number.

Returns

Returns the value at the specified location.

inline Scalar operator()(Index index) const

Array subscript operator.

Parameters

index[in] The one based index to the method. On matrices, the index will go in reading order.

Returns

Returns the value at the specified location.

inline MatrixBoolean operator()(const Range &rowRange, Index column) const

Array subscript operator.

Parameters
  • rowRange[in] The range to use to create the submatrix.

  • column[in] The column to use to create the submatrix.

Returns

Returns the desired submatrix.

inline MatrixBoolean operator()(Index row, const Range &columnRange) const

Array subscript operator.

Parameters
  • row[in] The row to use to create the submatrix.

  • columnRange[in] The column range to use to create the submatrix.

Returns

Returns the desired submatrix.

inline MatrixBoolean operator()(const Range &rowRange, const Range &columnRange) const

Array subscript operator.

Parameters
  • rowRange[in] The row range to use to create the submatrix.

  • columnRange[in] The column range to use to create the submatrix.

Returns

Returns the desired submatrix.

Public Static Functions

template<typename ...Coefficients>
static inline MatrixBoolean build(const Integer numberRows, const Integer numberColumns, Coefficients... coefficients)

Template method you can use to create a pre-initialized matrix.

Parameters
  • numberRows[in] The number of rows required for the matrix.

  • numberColumns[in] The number of columns required for the matrix.

  • coefficients[in] The coefficients stored in the matrix. Values must be in column major order and must have at least many entries as there are coefficients in the matrix.

Returns

Returns a newly constructed matrix.

static MatrixBoolean fromFile(const char *filename)

Method you can use to load a new matrix from a file. This method will throw an exception if an error occurs and the associated exception is enabled.

Parameters

filename[in] The filename to save the file to.

Returns

Returns a newly created matrix. Returns an empty matrix on error.

static MatrixBoolean identity(Index numberRows, Index numberColumns)

Method you can use to obtain an identity matrix of a specified size.

Parameters
  • numberRows[in] The number of rows in the matrix.

  • numberColumns[in] The number of columns in the matrix.

static MatrixBoolean identity(Index numberRowColumns)

Method you can use to obtain an identity matrix of a specified size. This version will always create a square matrix.

Parameters

numberRowColumns[in] The number of rows in the matrix.

static inline MatrixBoolean zero(Index numberRows, Index numberColumns)

Method you can use to obtain a zero matrix of a specified size.

Parameters
  • numberRows[in] The number of rows in the matrix.

  • numberColumns[in] The number of columns in the matrix.

static inline MatrixBoolean zero(Index numberRowColumns)

Method you can use to obtain a zero matrix of a specified size. This version will always create a square matrix.

Parameters

numberRowColumns[in] The number of rows in the matrix.

Private Functions

inline MatrixBoolean(Private *newImplementation)

Private constructor

Parameters

newImplementation[in] Pointer to the new implementation instance.

Private Members

Private *impl

Friends

friend class Variant
friend class M::Variant
friend class MatrixInteger
friend class MatrixReal
friend class MatrixComplex

model_matrix_complex.h

This header defines the Model::MatrixComplex class.

namespace M
namespace Model

Functions

MatrixComplex operator*(Boolean a, const MatrixComplex &b)

Scalar multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex matrix value representing the product.

MatrixComplex operator*(Integer a, const MatrixComplex &b)

Scalar multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex matrix value representing the product.

MatrixComplex operator*(Real a, const MatrixComplex &b)

Scalar multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex matrix value representing the product.

MatrixComplex operator*(const Complex &a, const MatrixComplex &b)

Scalar multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex matrix value representing the product.

inline MatrixComplex operator*(signed char a, const MatrixComplex &b)

Scalar multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex matrix value representing the product.

inline MatrixComplex operator*(unsigned char a, const MatrixComplex &b)

Scalar multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex matrix value representing the product.

inline MatrixComplex operator*(signed short a, const MatrixComplex &b)

Scalar multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex matrix value representing the product.

inline MatrixComplex operator*(unsigned short a, const MatrixComplex &b)

Scalar multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex matrix value representing the product.

inline MatrixComplex operator*(signed a, const MatrixComplex &b)

Scalar multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex matrix value representing the product.

inline MatrixComplex operator*(unsigned a, const MatrixComplex &b)

Scalar multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex matrix value representing the product.

inline MatrixComplex operator*(signed long a, const MatrixComplex &b)

Scalar multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex matrix value representing the product.

inline MatrixComplex operator*(unsigned long a, const MatrixComplex &b)

Scalar multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex matrix value representing the product.

inline MatrixComplex operator*(float a, const MatrixComplex &b)

Scalar multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex matrix value representing the product.

inline MatrixComplex operator*(long double a, const MatrixComplex &b)

Scalar multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex matrix value representing the product.

MatrixComplex operator*(const MatrixBoolean &a, const MatrixComplex &b)

Matrix multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex matrix value representing the product.

MatrixComplex operator*(const MatrixInteger &a, const MatrixComplex &b)

Matrix multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex matrix value representing the product.

MatrixComplex operator*(const MatrixReal &a, const MatrixComplex &b)

Matrix multiplication operator.

Parameters
  • a[in] The first value to multiply.

  • b[in] The second value to multiply.

Returns

Returns a complex matrix value representing the product.

MatrixComplex operator/(const MatrixBoolean &a, const Complex &b)

Scalar division operator.

Parameters
  • a[in] The dividend.

  • b[in] The divisor.

Returns

Returns a complex matrix value representing the quotient.

MatrixComplex operator/(const MatrixInteger &a, const Complex &b)

Scalar division operator.

Parameters
  • a[in] The dividend.

  • b[in] The divisor.

Returns

Returns a complex matrix value representing the quotient.

MatrixComplex operator/(const MatrixReal &a, const Complex &b)

Scalar division operator.

Parameters
  • a[in] The dividend.

  • b[in] The divisor.

Returns

Returns a complex matrix value representing the quotient.

MatrixComplex operator+(const MatrixBoolean &a, const MatrixComplex &b)

Matrix addition operator.

Parameters
  • a[in] The augend.

  • b[in] The addend.

Returns

Returns a complex matrix value representing the sum.

MatrixComplex operator+(const MatrixInteger &a, const MatrixComplex &b)

Matrix addition operator.

Parameters
  • a[in] The augend.

  • b[in] The addend.

Returns

Returns a complex matrix value representing the sum.

MatrixComplex operator+(const MatrixReal &a, const MatrixComplex &b)

Matrix addition operator.

Parameters
  • a[in] The augend.

  • b[in] The addend.

Returns

Returns a complex matrix value representing the sum.

MatrixComplex operator-(const MatrixBoolean &a, const MatrixComplex &b)

Matrix subtraction operator.

Parameters
  • a[in] The minuend.

  • b[in] The subtrahend.

Returns

Returns a complex matrix value representing the difference.

MatrixComplex operator-(const MatrixInteger &a, const MatrixComplex &b)

Matrix subtraction operator.

Parameters
  • a[in] The minuend.

  • b[in] The subtrahend.

Returns

Returns a complex matrix value representing the difference.

MatrixComplex operator-(const MatrixReal &a, const MatrixComplex &b)

Matrix subtraction operator.

Parameters
  • a[in] The minuend.

  • b[in] The subtrahend.

Returns

Returns a complex matrix value representing the difference.

class MatrixComplex : public Model::Matrix
#include <model_matrix_complex.h>

Matrix class holding complex values. This class uses copy-on-write semantics to reduce memory utilization as well as lazy evaluation of expressions to reduce processing overhead.

Public Types

typedef Complex Scalar

The type contained in this matrix.

Public Functions

MatrixComplex()
MatrixComplex(Integer numberRows, Integer numberColumns)

Constructor. This constructor will assert if the number of rows or number of columns is 0 or negative.

Parameters
  • numberRows[in] The desired number of matrix rows. Entries will be initialized to 0.

  • numberColumns[in] The desired number of matrix columns. Entries will be initialized to 0.

MatrixComplex(Integer numberRows, Integer numberColumns, const Scalar *matrixData)

Constructor. This constructor will assert if the number of rows or number of columns is 0 or negative.

Parameters
  • numberRows[in] The desired number of matrix rows.

  • numberColumns[in] The desired number of matrix columns.

  • matrixData[in] Pointer to an array of value containing the matrix contents. Data should be in column major order and must have at least as many entries as there are coefficients in the matrix.

MatrixComplex(const MatrixBoolean &other)

Constructor

Parameters

other[in] The instance to be copied to this instance.

MatrixComplex(const MatrixInteger &other)

Constructor

Parameters

other[in] The instance to be copied to this instance.

MatrixComplex(const MatrixReal &other)

Constructor

Parameters

other[in] The instance to be copied to this instance.

MatrixComplex(const MatrixComplex &other)

Copy constructor

Parameters

other[in] The instance to be copied to this instance.

MatrixComplex(MatrixComplex &&other)

Move constructor

Parameters

other[in] The instance to be moved to this instance.

MatrixComplex(const Variant &other)

Constructor

Parameters

other[in] The instance to copy to this instance.

~MatrixComplex() override
virtual ValueType coefficientValueType() const override

Method you can use to determine the underlying coefficient type.

Returns

Returns the value type of the underlying coefficient.

bool toFile(const char *filename, DataFileFormat fileFormat) const

Method you can use to save this matrix to a file in binary format. This method will throw an exception if an error occurs and the associated exception is enabled.

Parameters
  • filename[in] The filename to save the file to

  • fileFormat[in] The desired file format.

Returns

Returns true on success, returns false on error.

virtual Index numberRows() const override

Method you can use to determine number of matrix rows.

Returns

Returns the current number of rows.

virtual Index numberColumns() const override

Method you can use to determine the number of matrix columns.

Returns

Returns the current number of matrix columns.

virtual Index numberCoefficients() const override

Method you can use to determine the current total number of matrix coefficients.

Returns

Returns the size of the matrix, in coefficients.

MatrixComplex diagonalEntries() const

Method you can use to obtain the diagnonal entries from this matrix.

Returns

Returns a column matrix holding the diagnonal entries of the matrix.

MatrixComplex diagonal() const

Method you can use construct a diagnonal matrix from a row or column matrix.

Returns

Returns a newly constructed square matrix from the supplied diagnonal entries.

virtual Variant value(Index row, Index column) const override

Method you can use to access the value at a specified row/column address.

Parameters
  • row[in] The one based row address.

  • column[in] The one based column address.

Returns

Returns a variant value holding the contents at the specified location. An empty variant is returned if the location is invalid.

virtual Variant value(Index index) const override

Method you can use to access the value at a specified one based index.

Parameters

index[in] The one based index of the coefficient to be accessed.

Returns

Returns a variant value holding the contents at the specified location. An empty variant is returned if the location is invalid.

virtual bool setValue(Index row, Index column, const Variant &value) override

Method you can use to set a value by position. If needed, the matrix will be resized to contain the provided coefficient.

Parameters
  • row[in] The one based row address.

  • column[in] The one based column address.

  • value[in] The value to assign to the specified location.

Returns

Returns true on success, returns false if the variant is not compatible with the matrix type or the row/column address is invalid.

virtual bool setValue(Index index, const Variant &value) override

Method you can use to set a value by position. If needed, the matrix will be resized to contain the provided coefficient. Now that, for empty matrices and matrices with a single row/column, matricies will be resized as a row matrix.

Parameters
  • index[in] The one base index of the coefficient to be accessed.

  • value[in] The value to assign to the specified location.

Returns

Returns true on success, returns false if the variant is not compatible with the matrix type or the index is invalid.

virtual void resize(Index newNumberRows, Index newNumberColumns) override

Method you can use to resize the matrix. Newly inserted values will be initialized to the default value for the type and existing values will be preserved.

Note that this is a potentially time-consuming operation.

Parameters
  • newNumberRows[in] The new number of matrix rows.

  • newNumberColumns[in] The new number of matrix columns.

const Scalar &at(Index row, Index column) const

Method you can use to obtain a value, by position. This method will throw an exception if the specified row range or column is invalid.

Parameters
  • row[in] The one based row number.

  • column[in] The one based column number.

Returns

Returns the value at the specified location.

const Scalar &at(Index index) const

Method you can use to obtain a value, by index. This method will throw an exception if the specified index is invalid.

Parameters

index[in] The one based index to the method. On matrices, the index will go in row/column order.

Returns

Returns the value at the specified location.

MatrixComplex at(const Range &rowRange, Index column) const

Method you can use to obtain a submatrix of this matrix, by range values. This method will throw an exception if the specified row range or column is invalid.

Parameters
  • rowRange[in] The range to use to create the submatrix.

  • column[in] The column to use to create the submatrix.

Returns

Returns the desired submatrix.

MatrixComplex at(Index row, const Range &columnRange) const

Method you can use to obtain a submatrix of this matrix, by range values. This method will throw an exception if the specified row range or column is invalid.

Parameters
  • row[in] The row to use to create the submatrix.

  • columnRange[in] The column range to use to create the submatrix.

Returns

Returns the desired submatrix.

MatrixComplex at(const Range &rowRange, const Range &columnRange) const

Method you can use to obtain a submatrix of this matrix, by range values. This method will throw an exception if the specified row range or column is invalid.

Parameters
  • rowRange[in] The row range to use to create the submatrix.

  • columnRange[in] The column range to use to create the submatrix.

Returns

Returns the desired submatrix.

void update(Index row, Index column, const Scalar &newValue)

Method you can use to update a coefficient at a specified row and column. This method will throw an exception if the specified row or column is invalid and will resize the matrix, if needed, to include the specified coefficient.

Parameters
  • row[in] The one based row number.

  • column[in] The one based column number.

  • newValue[in] The new value at the specified location.

void update(Index index, const Scalar &newValue)

Method you can use to update a coefficient at a specified index. This method will throw an exception if the specified row or column is invalid and will resize the matrix, if needed, to include the specified coefficient.

Parameters
  • index[in] The one based index into the matrix.

  • newValue[in] The new value at the specified location.

MatrixComplex combineLeftToRight() const

Method you can use to create a matrix that represents the combination of two other matrices. The matrices are combined left to right.

This method exists to simplify templatization of this operation.

Returns

Returns a copy of this matrix.

MatrixComplex combineLeftToRight(const MatrixBoolean &other) const

Method you can use to create a matrix that represents the combination of two other matrices. The matrices are combined left to right.

Parameters

other[in] The matrix to combine to the right of this matrix.

Returns

Returns a new matrix representing the combination of the two matrices.

MatrixComplex combineLeftToRight(const MatrixInteger &other) const

Method you can use to create a matrix that represents the combination of two other matrices. The matrices are combined left to right.

Parameters

other[in] The matrix to combine to the right of this matrix.

Returns

Returns a new matrix representing the combination of the two matrices.

MatrixComplex combineLeftToRight(const MatrixReal &other) const

Method you can use to create a matrix that represents the combination of two other matrices. The matrices are combined left to right.

Parameters

other[in] The matrix to combine to the right of this matrix.

Returns

Returns a new matrix representing the combination of the two matrices.

MatrixComplex combineLeftToRight(const MatrixComplex &other) const

Method you can use to create a matrix that represents the combination of two other matrices. The matrices are combined left to right.

Parameters

other[in] The matrix to combine to the right of this matrix.

Returns

Returns a new matrix representing the combination of the two matrices.

MatrixComplex combineTopToBottom() const

Method you can use to create a matrix that represents the combination of two other matrices. The matrices are combined top to bottom.

This method exists to simplify templatization of this operation.

Returns

Returns a copy of this matrix.

MatrixComplex combineTopToBottom(const MatrixBoolean &other) const

Method you can use to create a matrix that represents the combination of two other matrices. The matrices are combined top to bottom.

Parameters

other[in] The matrix to combine below this matrix.

Returns

Returns a new matrix representing the combination of the two matrices.

MatrixComplex combineTopToBottom(const MatrixInteger &other) const

Method you can use to create a matrix that represents the combination of two other matrices. The matrices are combined top to bottom.

Parameters

other[in] The matrix to combine below this matrix.

Returns

Returns a new matrix representing the combination of the two matrices.

MatrixComplex combineTopToBottom(const MatrixReal &other) const

Method you can use to create a matrix that represents the combination of two other matrices. The matrices are combined top to bottom.

Parameters

other[in] The matrix to combine below this matrix.

Returns

Returns a new matrix representing the combination of the two matrices.

MatrixComplex combineTopToBottom(const MatrixComplex &other) const

Method you can use to create a matrix that represents the combination of two other matrices. The matrices are combined top to bottom.

Parameters

other[in] The matrix to combine below this matrix.

Returns

Returns a new matrix representing the combination of the two matrices.

MatrixComplex columnReverse() const

Method you can use to reverse the columns in this matrix.

Returns

Returns a column-reversed version of this matrix.

MatrixComplex rowReverse() const

Method you can use to reverse the rows in this matrix.

Returns

Returns a row-reversed version of this matrix.

bool isSquare() const

Method you can use to determine if this matrix is square. That is, whether the matrix has the same number of rows as columns.

Returns

Returns true if this matrix is square. Returns false if this matrix is not square.

bool isSymmetric(Real relativeTolerance = defaultRelativeTolerance) const

Method you can use to determine if this matrix is symmetric. That is, whether the matrix is equal to its own transpose.

Parameters

relativeTolerance[in] The relative tolerance to allow for comparison. The test will fail if the magnitude of the difference in values, divided by magnitude of the average of the two values, exceeds this threshold.

Returns

Returns true if this matrix is symmetric. Returns false if this matrix is not symmetric.

bool isHermitian(Real relativeTolerance = defaultRelativeTolerance) const

Method you can use to determine if this matrix is Hermitian. That is, whether the matrix is equal to its own conjugate transpose.

Parameters

relativeTolerance[in] The relative tolerance to allow for comparison. The test will fail if the magnitude of the difference in values, divided by magnitude of the average of the two values, exceeds this threshold.

Returns

Returns true if this matrix is Hermitian. Returns false if this matrix is not Hermitian.

bool isSkewSymmetric(Real relativeTolerance = defaultRelativeTolerance) const

Method you can use to determine if this matrix is skew symmetric. That is, whether the matrix is equal to the negative of its own transpose.

Parameters

relativeTolerance[in] The relative tolerance to allow for comparison. The test will fail if the magnitude of the difference in values, divided by magnitude of the average of the two values, exceeds this threshold.

Returns

Returns true if this matrix is skew symmetric. Returns false if this matrix is not skew symmetric.

bool isSkewHermitian(Real relativeTolerance = defaultRelativeTolerance) const

Method you can use to determine if this matrix is skew Hermitian. That is, whether the matrix is equal to the negative of its own conjugate transpose.

Parameters

relativeTolerance[in] The relative tolerance to allow for comparison. The test will fail if the magnitude of the difference in values, divided by magnitude of the average of the two values, exceeds this threshold.

Returns

Returns true if this matrix is skew Hermitian. Returns false if this matrix is not skew Hermitian.

bool isNormal(Real relativeTolerance = defaultRelativeTolerance) const

Method you can use to determine if this matrix is normal. That is, the product of the matrix and its conjugate transpose is equal to the product of the conjugate transpsoe of the matrix and the matrix.

Parameters

relativeTolerance[in] The relative tolerance to allow for comparison. The test will fail if the magnitude of the difference in values, divided by magnitude of the average of the two values, exceeds this threshold.

Returns

Returns true if the matrix is normal. Returns false if the matrix is not normal.

Integer rank(Real epsilon) const

Method you can use to determine the rank of the matrix. This method operates using SVD decomposition of the matrix.

Parameters

epsilon[in] An espilon value you can use as a threshold for a zero value. The absolute value of each diagonal value will be compared against this value. Values equal to or less than this value will be treated as zero.

Returns

Returns the estimated matrix rank.

Scalar determinant() const

Method that returns the determinant of this matrix.

Returns

Returns the complex conjugate of this value.

MatrixComplex transpose() const

Method that returns the transpose of this matrix.

Returns

Returns the transpose of this matrix.

MatrixComplex conj() const

Method that returns the complex conjugate of this matrix.

Returns

Returns the complex conjugate of this value.

MatrixComplex adjoint() const

Method that returns the adjoint or conjugate transpose of the matrix.

Returns

Returns the adjoint of the matrix.

MatrixComplex inverse() const

Method that returns the inverse of the matrix. Note that, for solving systems of linear equations, the solve method will provide better accuracy.

Returns

Returns the inverse matrix. Note that no pivot or singular indicator is provided.

Tuple plu() const

Method that perform LU decomposition with partial pivoting on this matrix.

Returns

Returns a tuple containing the pivot matrix, the lower triangular matrix, the upper triangular matrix, and a flag indicating if the upper matrix diagnonal contains one or more zero terms, indicating a singular matrix.

Tuple svd() const

Method that perform singular value decomposition on this matrix.

Returns

Returns a tuple containing the unitary matrix (U), the singular values matrix, (sigma), the conjugate transpose of the left and right singular vectors (V) of the matrix, and a boolean flag indicating success (or failure).

Tuple qr() const

Method that performs QR decomposition of this matrix.

Returns

Returns a tuple containing the Q unitary matrix, the R upper trianglular matrix representing, and a flag indicating success.

Tuple lq() const

Method that performs LQ decomposition of this matrix.

Returns

Returns a tuple containing the L lower triangular matrix, the Q unitary matrix, and a flag indicating success.

MatrixComplex cholesky() const

Method that performs Cholesky decomposition of this matrix. The matrix must be Hermitian.

Returns

Returns the lower triangular matrix representing the Cholesky decomposition of this matrix. An empty matrix will be returned on failure.

MatrixComplex upperCholesky() const

Method that performs Cholesky decomposition of this matrix, creating an upper triangular matrix. The matrix must be Hermitian.

Returns

Returns the upper triangular matrix representing the Cholesky decomposition of this matrix. An empty matrix will be returned on failure.

Tuple hessenberg() const

Method that reduces this matrix to upper Hessenberg form.

Returns

Returns a tuple containing the Q matrix and the upper Hessenberg matrix.

Tuple schur() const

Method that performs a Schur decomposition of this matrix.

Returns

Returns a tuple containing the Q unitary matrix, the U upper triangular Schur matrix that represents the Schur decomposition of this matrix, a column matrix containing just the eignenvalues of the matrix, and a flag indicating true on success, false on error.

Tuple eigenvectors() const

Method that calculates the complete set of right eigenvectors and eigenvalues for this matrix. The method also calculates and returns the Schur decomposition of this matrix.

Returns

Returns a tuple containing a column matrix holding the eigenvalues, the Q unitary matrix, the U upper triangular Schur matrix that represents the Schur decomposition of this matrix, and zero or more column matrices representing the eigenvectors corresponding to the supplied eigenvalues. If an error occurs, an empty matrix of eigenvalues will be returned.

MatrixComplex dft() const

Method that calculates the forward discrete Fourier transform (DFT) of this matrix. A matrix with a single dimension will be processed as a one-dimensional DFT. A matrix with multiple rows and columns will be processed as a two dimensional DFT.

Returns

Returns a matrix representing the complex discrete Fourier transform of the matrix.

MatrixComplex idft() const

Method that calculates the backwards or inverse discrete Fourier transform (DFT) of this matrix. A matrix with a single dimension will be processed as a one dimensional backward DFT. A matrix with multiple rows and columns will be processed as a two dimensional backward DFT.

Returns

Returns a matrix representing the complex inverse discrete Fourier transform of the matrix.

Real conditionNumber() const

Method that calculates the condition number of this matrix based on the Euclidean norm.

Returns

Returns the condition number of this matrix based on the Euclidean norm.

Real pNorm(Integer p) const

Method that calculates the entry-wise p-norm of this matrix.

Parameters

p[in] The power term to apply to the norm operation.

Returns

Returns the p-norm of this matrix.

Real euclideanNorm() const

Method that calculates the entry-wise Euclidean norm of this matrix.

Returns

Returns the Euclidean norm of this matrix.

Real oneNorm() const

Method that calculates the 1-norm of this matrix.

Returns

Returns the 1-normnorm of this matrix.

Real infinityNorm() const

Method that calculates the infinity-norm of this matrix.

Returns

Returns the infinity-norm of this matrix.

Tuple equilibrate() const

Method that calculates a set of row and column factors you can use to equilibrate a matrix.

Returns

Returns a tuple containing two diagnonal matrices plus a flag indicating success. The first matrix represents the row scale factors to apply to this matrix. The second matrix represents the column scale factors to apply to this matrix. For the tuple \( \left ( R, C \right ) \), you can fully equilibrate the matrix “M” using the relation \( R \times M \times C \).

MatrixComplex solve(const MatrixComplex &y) const

Method that solves the system of linear equations specified by this matrix. For a system of linear equations defined by:

\[ A \times X = Y \]

Where ‘A’ is represented by this matrix and Y is a column vector defining the results, this method will return approximate values for ‘X’.

Parameters

y[in] The column matrix holding the results of the product \( A \times X \).

Returns

Returns the resulting values of ‘X’. An empty matrix will be returned if A is singular.

MatrixComplex leastSquares(const MatrixComplex &b) const

Method that solves and over/under determined system using QR or LQ factorization. When provided an under-determined matrix, this method will determine the minimum Euclidean-norm solution.

For over-determined systems, this method will find the solution that exactly satisfies \( Ax = b \). For under-determined system, this method will find the solution that identifies the value of \( x \) that minimizes \( \Vert\Vert A x - b \Vert\Vert _ 2 \).

Parameters

b[in] The row matrix holding the results of the product \( A \times X \).

Returns

Returns the resulting values of ‘x’. An empty matrix will be returned if this matrix is not full rank.

MatrixComplex kernel() const

Method that returns the kernel of the matrix.

Returns

Returns the kernel of the matrix.

MatrixComplex hadamard(const MatrixComplex &other) const

Method that returns the Hadamard or Schur product of this matrix and another matrix. This method will throw an exception if the matrices do not have identical dimensions.

Parameters

other[in] The matrix to multiply against this matrix.

Returns

Returns the Hadamard product of the two matrices.

MatrixComplex kronecker(const MatrixComplex &other) const

Method that returns the Kronecker product of this matrix and another matrix.

Parameters

other[in] The matrix to multiply against this matrix.

Returns

Returns the Kronecker product of the two matrices.

virtual MatrixType matrixType() const override

Method you can use to determine the underlying memory layout for the matrix.

Returns

Returns a value indicating the underlying memory layout for the matrix.

const Scalar *data() const

Method you can use to obtain a pointer to the raw data.

Returns

Returns a pointer to the internal raw data.

MatrixReal real() const

Method that returns the real portion of this matrix.

Returns

Returns a real matrix holding the real values of each coefficient.

MatrixReal imag() const

Method that returns the imaginary portion of this matrix.

Returns

Returns a real matrix holding the imaginary values of each coefficient.

MatrixComplex &operator=(const MatrixBoolean &other)

Assignment operator

Parameters

other[in] The instance to be copied.

Returns

Returns a reference to this instance.

MatrixComplex &operator=(const MatrixInteger &other)

Assignment operator

Parameters

other[in] The instance to be copied.

Returns

Returns a reference to this instance.

MatrixComplex &operator=(const MatrixReal &other)

Assignment operator

Parameters

other[in] The instance to be copied.

Returns

Returns a reference to this instance.

MatrixComplex &operator=(const MatrixComplex &other)

Assignment operator

Parameters

other[in] The instance to be copied.

Returns

Returns a reference to this instance.

MatrixComplex &operator=(const Variant &other)

Assignment operator

Parameters

other[in] The instance to be copied.

Returns

Returns a reference to this instance.

MatrixComplex &operator+=(const MatrixBoolean &v)

Addition assignment operator

Parameters

v[in] The value to add to this value.

Returns

Returns a reference to this instance.

MatrixComplex &operator+=(const MatrixInteger &v)

Addition assignment operator

Parameters

v[in] The value to add to this value.

Returns

Returns a reference to this instance.

MatrixComplex &operator+=(const MatrixReal &v)

Addition assignment operator

Parameters

v[in] The value to add to this value.

Returns

Returns a reference to this instance.

MatrixComplex &operator+=(const MatrixComplex &v)

Addition assignment operator

Parameters

v[in] The value to add to this value.

Returns

Returns a reference to this instance.

MatrixComplex &operator-=(const MatrixBoolean &v)

Subtraction assignment operator

Parameters

v[in] The value to subtract from this value.

Returns

Returns a reference to this instance.

MatrixComplex &operator-=(const MatrixInteger &v)

Subtraction assignment operator

Parameters

v[in] The value to subtract from this value.

Returns

Returns a reference to this instance.

MatrixComplex &operator-=(const MatrixReal &v)

Subtraction assignment operator

Parameters

v[in] The value to subtract from this value.

Returns

Returns a reference to this instance.

MatrixComplex &operator-=(const MatrixComplex &v)

Subtraction assignment operator

Parameters

v[in] The value to subtract from this value.

Returns

Returns a reference to this instance.

MatrixComplex &operator*=(const MatrixBoolean &v)

Multiplication assignment operator

Parameters

v[in] The value to multiply with this value.

Returns

Returns a reference to this instance.

MatrixComplex &operator*=(const MatrixInteger &v)

Multiplication assignment operator

Parameters

v[in] The value to multiply with this value.

Returns

Returns a reference to this instance.

MatrixComplex &operator*=(const MatrixReal &v)

Multiplication assignment operator

Parameters

v[in] The value to multiply with this value.

Returns

Returns a reference to this instance.

MatrixComplex &operator*=(const MatrixComplex &v)

Multiplication assignment operator

Parameters

v[in] The value to multiply with this value.

Returns

Returns a reference to this instance.

MatrixComplex &operator*=(Boolean v)

Multiplication assignment operator

Parameters

v[in] The value to multiply with this value.

Returns

Returns a reference to this instance.

MatrixComplex &operator*=(Integer v)

Multiplication assignment operator

Parameters

v[in] The value to multiply with this value.

Returns

Returns a reference to this instance.

MatrixComplex &operator*=(Real v)

Multiplication assignment operator

Parameters

v[in] The value to multiply with this value.

Returns

Returns a reference to this instance.

MatrixComplex &operator*=(const Scalar &v)

Multiplication assignment operator

Parameters

v[in] The value to multiply with this value.

Returns

Returns a reference to this instance.

inline MatrixComplex &operator*=(signed char v)

Multiplication assignment operator

Parameters

v[in] The value to multiply with this value.

Returns

Returns a reference to this instance.

inline MatrixComplex &operator*=(unsigned char v)

Multiplication assignment operator

Parameters

v[in] The value to multiply with this value.

Returns

Returns a reference to this instance.

inline MatrixComplex &operator*=(signed short v)

Multiplication assignment operator

Parameters

v[in] The value to multiply with this value.

Returns

Returns a reference to this instance.

inline MatrixComplex &operator*=(unsigned short v)

Multiplication assignment operator

Parameters

v[in] The value to multiply with this value.

Returns

Returns a reference to this instance.

inline MatrixComplex &operator*=(signed v)

Multiplication assignment operator

Parameters

v[in] The value to multiply with this value.

Returns

Returns a reference to this instance.

inline MatrixComplex &operator*=(unsigned v)

Multiplication assignment operator

Parameters

v[in] The value to multiply with this value.

Returns

Returns a reference to this instance.

inline MatrixComplex &operator*=(signed long v)

Multiplication assignment operator

Parameters

v[in] The value to multiply with this value.

Returns

Returns a reference to this instance.

inline MatrixComplex &operator*=(unsigned long v)

Multiplication assignment operator

Parameters

v[in] The value to multiply with this value.

Returns

Returns a reference to this instance.

inline MatrixComplex &operator*=(float v)

Multiplication assignment operator

Parameters

v[in] The value to multiply with this value.

Returns

Returns a reference to this instance.

inline MatrixComplex &operator*=(long double v)

Multiplication assignment operator

Parameters

v[in] The value to multiply with this value.

Returns

Returns a reference to this instance.

MatrixComplex &operator/=(Integer v)

Division assignment operator

Parameters

v[in] The value divide each member by.

Returns

Returns a reference to this instance.

MatrixComplex &operator/=(Real v)

Division assignment operator

Parameters

v[in] The value divide each member by.

Returns

Returns a reference to this instance.

MatrixComplex &operator/=(const Scalar &v)

Division assignment operator

Parameters

v[in] The value divide each member by.

Returns

Returns a reference to this instance.

inline MatrixComplex &operator/=(signed char v)

Division assignment operator

Parameters

v[in] The value divide each member by.

Returns

Returns a reference to this instance.

inline MatrixComplex &operator/=(unsigned char v)

Division assignment operator

Parameters

v[in] The value divide each member by.

Returns

Returns a reference to this instance.

inline MatrixComplex &operator/=(signed short v)

Division assignment operator

Parameters

v[in] The value divide each member by.

Returns

Returns a reference to this instance.

inline MatrixComplex &operator/=(unsigned short v)

Division assignment operator

Parameters

v[in] The value divide each member by.

Returns

Returns a reference to this instance.

inline MatrixComplex &operator/=(signed v)

Division assignment operator

Parameters

v[in] The value divide each member by.

Returns

Returns a reference to this instance.

inline MatrixComplex &operator/=(unsigned v)

Division assignment operator

Parameters

v[in] The value divide each member by.

Returns

Returns a reference to this instance.

inline MatrixComplex &operator/=(signed long v)

Division assignment operator

Parameters

v[in] The value divide each member by.

Returns

Returns a reference to this instance.

inline MatrixComplex &operator/=(unsigned long v)

Division assignment operator

Parameters

v[in] The value divide each member by.

Returns

Returns a reference to this instance.

inline MatrixComplex &operator/=(float v)

Division assignment operator

Parameters

v[in] The value divide each member by.

Returns

Returns a reference to this instance.

inline MatrixComplex &operator/=(long double v)

Division assignment operator

Parameters

v[in] The value divide each member by.

Returns

Returns a reference to this instance.

MatrixComplex operator+(const MatrixBoolean &v) const

Addition operator.

Parameters

v[in] The value to add to this value.

Returns

Returns a matrix representing the sum.

MatrixComplex operator+(const MatrixInteger &v) const

Addition operator.

Parameters

v[in] The value to add to this value.

Returns

Returns a matrix representing the sum.

MatrixComplex operator+(const MatrixReal &v) const

Addition operator.

Parameters

v[in] The value to add to this value.

Returns

Returns a matrix representing the sum.

MatrixComplex operator+(const MatrixComplex &v) const

Addition operator.

Parameters

v[in] The value to add to this value.

Returns

Returns a matrix representing the sum.

MatrixComplex operator-(const MatrixBoolean &v) const

Subtraction operator.

Parameters

v[in] The value to subtract from this value.

Returns

Returns a matrix representing the difference.

MatrixComplex operator-(const MatrixInteger &v) const

Subtraction operator.

Parameters

v[in] The value to subtract from this value.

Returns

Returns a matrix representing the difference.

MatrixComplex operator-(const MatrixReal &v) const

Subtraction operator.

Parameters

v[in] The value to subtract from this value.

Returns

Returns a matrix representing the difference.

MatrixComplex operator-(const MatrixComplex &v) const

Subtraction operator.

Parameters

v[in] The value to subtract from this value.

Returns

Returns a matrix representing the difference.

MatrixComplex operator*(const MatrixBoolean &v) const

Multiplication operator.

Parameters

v[in] The value to multiply with this value.

Returns

Returns a matrix representing the product.

MatrixComplex operator*(const MatrixInteger &v) const

Multiplication operator.

Parameters

v[in] The value to multiply with this value.

Returns

Returns a matrix representing the product.

MatrixComplex operator*(const MatrixReal &v) const

Multiplication operator.

Parameters

v[in] The value to multiply with this value.

Returns

Returns a matrix representing the product.

MatrixComplex operator*(const MatrixComplex &v) const

Multiplication operator.

Parameters

v[in] The value to multiply with this value.

Returns

Returns a matrix representing the product.

MatrixComplex operator*(Boolean v) const

Multiplication operator.

Parameters

v[in] The value to multiply with this value.

Returns

Returns a matrix representing the product.

MatrixComplex operator*(Integer v) const

Multiplication operator.

Parameters

v[in] The value to multiply with this value.

Returns

Returns a matrix representing the product.

MatrixComplex operator*(Real v) const

Multiplication operator.

Parameters

v[in] The value to multiply with this value.

Returns

Returns a matrix representing the product.

MatrixComplex operator*(const Scalar &v) const

Multiplication operator.

Parameters

v[in] The value to multiply with this value.

Returns

Returns a matrix representing the product.

inline MatrixComplex operator*(signed char v) const

Multiplication operator.

Parameters

v[in] The value to multiply with this value.

Returns

Returns a matrix representing the product.

inline MatrixComplex operator*(unsigned char v) const

Multiplication operator.

Parameters

v[in] The value to multiply with this value.

Returns

Returns a matrix representing the product.

inline MatrixComplex operator*(signed short v) const

Multiplication operator.

Parameters

v[in] The value to multiply with this value.

Returns

Returns a matrix representing the product.

inline MatrixComplex operator*(unsigned short v) const

Multiplication operator.

Parameters

v[in] The value to multiply with this value.

Returns

Returns a matrix representing the product.

inline MatrixComplex operator*(signed v) const

Multiplication operator.

Parameters

v[in] The value to multiply with this value.

Returns

Returns a matrix representing the product.

inline MatrixComplex operator*(unsigned v) const

Multiplication operator.

Parameters

v[in] The value to multiply with this value.

Returns

Returns a matrix representing the product.

inline MatrixComplex operator*(signed long v) const

Multiplication operator.

Parameters

v[in] The value to multiply with this value.

Returns

Returns a matrix representing the product.

inline MatrixComplex operator*(unsigned long v) const

Multiplication operator.

Parameters

v[in] The value to multiply with this value.

Returns

Returns a matrix representing the product.

inline MatrixComplex operator*(float v) const

Multiplication operator.

Parameters

v[in] The value to multiply with this value.

Returns

Returns a matrix representing the product.