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.

Typedefs

typedef struct _MatApi MatApi
namespace Model

Typedefs

typedef Api *(*AllocatorFunction)(const MatApi *matrixApi)

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

Param matrixApi:

[in] The matrix API library to be used.

Return:

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.

Param 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 class ValueType : unsigned char

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 class State : unsigned char

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 class AbortReason : unsigned char

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 CAN_NOT_CONVERGE

Indicates a function can not converge on a value.

enumerator NUMBER_ABORT_REASONS

Value indicating the number of abort reason codes.

enum class ExceptionClass : unsigned char

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.

enumerator CAN_NOT_CONVERGE_EXCEPTIONS

Exceptions triggered when a function can-not converge on a value.

enum class DataFileFormat : unsigned char

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 class Device : unsigned char

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.

Returns:

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

const IdentifierData *operator->() const

Indirection operator.

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 class 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.

static MatrixBoolean ones(Index numberRows, Index numberColumns)

Method you can use to obtain a one’s 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 ones(Index numberRowColumns)

Method you can use to obtain a one’s 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.

inline MatrixComplex operator*(long double 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

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

MatrixComplex operator/(Real v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

MatrixComplex operator/(const Scalar &v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline MatrixComplex operator/(signed char v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline MatrixComplex operator/(unsigned char v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline MatrixComplex operator/(signed short v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline MatrixComplex operator/(unsigned short v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline MatrixComplex operator/(signed v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline MatrixComplex operator/(unsigned v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline MatrixComplex operator/(signed long v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline MatrixComplex operator/(unsigned long v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline MatrixComplex operator/(float v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline MatrixComplex operator/(long double v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline const MatrixComplex &operator+() const

Unary plus operator.

Returns:

Returns a reference to this object.

MatrixComplex operator-() const

Unary minus operator.

Returns:

Returns this matrix multiplied by -1.

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 const 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 const 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 MatrixComplex 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 MatrixComplex 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 MatrixComplex 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 MatrixComplex 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 MatrixComplex 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 MatrixComplex identity(Index numberRows, Index numberColumns)

Method you can use to obtain a complex 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 MatrixComplex identity(Index numberRowColumns)

Method you can use to obtain a complex 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 MatrixComplex zero(Index numberRows, Index numberColumns)

Method you can use to obtain a complex 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 MatrixComplex zero(Index numberRowColumns)

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

Parameters:

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

static MatrixComplex ones(Index numberRows, Index numberColumns)

Method you can use to obtain a one’s 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 MatrixComplex ones(Index numberRowColumns)

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

Parameters:

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

Public Static Attributes

static constexpr Real defaultRelativeTolerance = 1.0E-8

The default tolerance (relative) for various tests.

Private Functions

inline MatrixComplex(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 MatrixBoolean
friend class MatrixInteger
friend class MatrixReal

model_matrix_integer.h

This header defines the Model::MatrixInteger class.

namespace M
namespace Model

Functions

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns an integer matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns an integer matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns an integer matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns an integer matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns an integer matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns an integer matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns an integer matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns an integer matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns an integer matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns an integer matrix value representing the product.

MatrixInteger operator*(Integer a, const MatrixBoolean &b)

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns an integer matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns an integer matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns an integer matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns an integer matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns an integer matrix value representing the product.

inline MatrixInteger operator*(signed a, const MatrixBoolean &b)

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns an integer matrix value representing the product.

inline MatrixInteger operator*(unsigned a, const MatrixBoolean &b)

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns an integer matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns an integer matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns an integer matrix value representing the product.

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

Matrix addition operator.

Parameters:
  • a[in] The augend.

  • b[in] The addend.

Returns:

Returns a complex matrix value representing the sum.

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

Matrix subtraction operator.

Parameters:
  • a[in] The minuend.

  • b[in] The subtrahend.

Returns:

Returns a complex matrix value representing the difference.

class MatrixInteger : public Model::Matrix
#include <model_matrix_integer.h>

Matrix class holding integer values. This class uses copy-on-write semantics to reduce memory utilization as well as lazy evaluation of expressions to reduce processing overhead. Note that the class is intended primarily for use as a storage class and provides greatly reduced functionality compared to Model::MatrixComplex and Model::MatrixReal

Public Types

typedef Integer Scalar

The type contained in this matrix.

Public Functions

MatrixInteger()
MatrixInteger(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.

MatrixInteger(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.

MatrixInteger(const MatrixBoolean &other)

Constructor

Parameters:

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

MatrixInteger(const MatrixInteger &other)

Copy constructor

Parameters:

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

MatrixInteger(MatrixInteger &&other)

Move constructor

Parameters:

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

MatrixInteger(const Variant &other)

Constructor

Parameters:

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

~MatrixInteger() 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.

MatrixInteger 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.

MatrixInteger 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.

MatrixInteger 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.

MatrixInteger 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.

MatrixInteger 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.

MatrixInteger 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.

MatrixInteger 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.

MatrixInteger 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.

MatrixInteger 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.

MatrixInteger 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.

MatrixInteger 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.

MatrixInteger columnReverse() const

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

Returns:

Returns a column-reversed version of this matrix.

MatrixInteger 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.

MatrixInteger transpose() const

Method that returns the transpose of this matrix.

Returns:

Returns the transpose of this matrix.

MatrixInteger conj() const

Method that returns the complex conjugate of this matrix.

Returns:

Returns the complex conjugate of this value.

MatrixInteger adjoint() const

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

Returns:

Returns the adjoint of the matrix.

MatrixInteger hadamard(const MatrixInteger &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.

MatrixInteger kronecker(const MatrixInteger &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 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.

MatrixInteger &operator=(const MatrixBoolean &other)

Assignment operator

Parameters:

other[in] The instance to be copied.

Returns:

Returns a reference to this instance.

MatrixInteger &operator=(const MatrixInteger &other)

Assignment operator

Parameters:

other[in] The instance to be copied.

Returns:

Returns a reference to this instance.

MatrixInteger &operator=(const Variant &other)

Assignment operator

Parameters:

other[in] The instance to be copied.

Returns:

Returns a reference to this instance.

MatrixInteger &operator+=(const MatrixBoolean &v)

Addition assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

MatrixInteger &operator+=(const MatrixInteger &v)

Addition assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

MatrixInteger &operator-=(const MatrixBoolean &v)

Subtraction assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

MatrixInteger &operator-=(const MatrixInteger &v)

Subtraction assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

MatrixInteger &operator*=(const MatrixBoolean &v)

Multiplication assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

MatrixInteger &operator*=(const MatrixInteger &v)

Multiplication assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

MatrixInteger &operator*=(Boolean v)

Multiplication assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

MatrixInteger &operator*=(Integer v)

Multiplication assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

inline MatrixInteger &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 MatrixInteger &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 MatrixInteger &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 MatrixInteger &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 MatrixInteger &operator*=(signed v)

Multiplication assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

inline MatrixInteger &operator*=(unsigned v)

Multiplication assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

inline MatrixInteger &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 MatrixInteger &operator*=(unsigned long v)

Multiplication assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

MatrixInteger operator+(const MatrixBoolean &v) const

Addition operator.

Parameters:

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

Returns:

Returns a matrix representing the sum.

MatrixInteger operator+(const MatrixInteger &v) const

Addition operator.

Parameters:

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

Returns:

Returns a matrix representing the sum.

MatrixInteger operator-(const MatrixBoolean &v) const

Subtraction operator.

Parameters:

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

Returns:

Returns a matrix representing the difference.

MatrixInteger operator-(const MatrixInteger &v) const

Subtraction operator.

Parameters:

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

Returns:

Returns a matrix representing the difference.

MatrixInteger operator*(const MatrixBoolean &v) const

Multiplication operator.

Parameters:

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

Returns:

Returns a matrix representing the product.

MatrixInteger operator*(const MatrixInteger &v) const

Multiplication operator.

Parameters:

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

Returns:

Returns a matrix representing the product.

MatrixInteger operator*(Boolean v) const

Multiplication operator.

Parameters:

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

Returns:

Returns a matrix representing the product.

MatrixInteger operator*(Integer v) const

Multiplication operator.

Parameters:

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

Returns:

Returns a matrix representing the product.

inline MatrixInteger 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 MatrixInteger 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 MatrixInteger 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 MatrixInteger 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 MatrixInteger operator*(signed v) const

Multiplication operator.

Parameters:

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

Returns:

Returns a matrix representing the product.

inline MatrixInteger operator*(unsigned v) const

Multiplication operator.

Parameters:

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

Returns:

Returns a matrix representing the product.

inline MatrixInteger 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 MatrixInteger 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 const MatrixInteger &operator+() const

Unary plus operator.

Returns:

Returns a reference to this object.

MatrixInteger operator-() const

Unary minus operator.

Returns:

Returns this matrix multiplied by -1.

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 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.

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 MatrixInteger 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 MatrixInteger 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 MatrixInteger 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 MatrixInteger 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 MatrixInteger 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 MatrixInteger 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 MatrixInteger 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 MatrixInteger 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 MatrixInteger 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.

static MatrixInteger ones(Index numberRows, Index numberColumns)

Method you can use to obtain a one’s 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 MatrixInteger ones(Index numberRowColumns)

Method you can use to obtain a one’s 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 MatrixInteger(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 MatrixBoolean
friend class MatrixReal
friend class MatrixComplex

model_matrix_real.h

This header defines the Model::MatrixReal class.

namespace M
namespace Model

Functions

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns a real matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns a real matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns a real matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns a real matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns a real matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns a real matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns a real matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns a real matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns a real matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns a real matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns a real matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns a real matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns a real matrix value representing the product.

inline MatrixReal operator*(const MatrixBoolean &a, float b)

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns a real matrix value representing the product.

inline MatrixReal operator*(const MatrixInteger &a, float b)

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns a real matrix value representing the product.

inline MatrixReal operator*(const MatrixBoolean &a, Real b)

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns a real matrix value representing the product.

inline MatrixReal operator*(const MatrixInteger &a, Real b)

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns a real matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns a real matrix value representing the product.

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

Scalar multiplication operator.

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

  • b[in] The second value to multiply.

Returns:

Returns a real matrix value representing the product.

MatrixReal operator*(const MatrixBoolean &a, const MatrixReal &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.

MatrixReal operator*(const MatrixInteger &a, const MatrixReal &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.

inline MatrixReal operator/(const MatrixBoolean &a, float b)

Scalar division operator.

Parameters:
  • a[in] The dividend.

  • b[in] The divisor.

Returns:

Returns a real matrix value representing the quotient.

inline MatrixReal operator/(const MatrixInteger &a, float b)

Scalar division operator.

Parameters:
  • a[in] The dividend.

  • b[in] The divisor.

Returns:

Returns a real matrix value representing the quotient.

inline MatrixReal operator/(const MatrixBoolean &a, Real b)

Scalar division operator.

Parameters:
  • a[in] The dividend.

  • b[in] The divisor.

Returns:

Returns a real matrix value representing the quotient.

inline MatrixReal operator/(const MatrixInteger &a, Real b)

Scalar division operator.

Parameters:
  • a[in] The dividend.

  • b[in] The divisor.

Returns:

Returns a real matrix value representing the quotient.

inline MatrixReal operator/(const MatrixBoolean &a, long double b)

Scalar division operator.

Parameters:
  • a[in] The dividend.

  • b[in] The divisor.

Returns:

Returns a real matrix value representing the quotient.

inline MatrixReal operator/(const MatrixInteger &a, long double b)

Scalar division operator.

Parameters:
  • a[in] The dividend.

  • b[in] The divisor.

Returns:

Returns a real matrix value representing the quotient.

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

Matrix addition operator.

Parameters:
  • a[in] The augend.

  • b[in] The addend.

Returns:

Returns a real matrix value representing the sum.

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

Matrix addition operator.

Parameters:
  • a[in] The augend.

  • b[in] The addend.

Returns:

Returns a real matrix value representing the sum.

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

Matrix subtraction operator.

Parameters:
  • a[in] The minuend.

  • b[in] The subtrahend.

Returns:

Returns a real matrix value representing the difference.

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

Matrix subtraction operator.

Parameters:
  • a[in] The minuend.

  • b[in] The subtrahend.

Returns:

Returns a real matrix value representing the difference.

class MatrixReal : public Model::Matrix
#include <model_matrix_real.h>

Matrix class holding real 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 Real Scalar

The type contained in this matrix.

Public Functions

MatrixReal()
MatrixReal(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.

MatrixReal(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.

MatrixReal(const MatrixBoolean &other)

Constructor

Parameters:

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

MatrixReal(const MatrixInteger &other)

Constructor

Parameters:

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

MatrixReal(const MatrixReal &other)

Copy constructor

Parameters:

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

MatrixReal(MatrixReal &&other)

Move constructor

Parameters:

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

MatrixReal(const Variant &other)

Constructor

Parameters:

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

~MatrixReal() 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.

MatrixReal 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.

MatrixReal 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.

MatrixReal 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.

MatrixReal 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.

MatrixReal 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.

MatrixReal 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.

MatrixReal 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.

MatrixReal 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.

MatrixReal 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.

MatrixReal 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.

MatrixReal 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.

MatrixReal 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.

MatrixReal 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.

MatrixReal columnReverse() const

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

Returns:

Returns a column-reversed version of this matrix.

MatrixReal 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.

MatrixReal transpose() const

Method that returns the transpose of this matrix.

Returns:

Returns the transpose of this matrix.

MatrixReal conj() const

Method that returns the complex conjugate of this matrix.

Returns:

Returns the complex conjugate of this value.

MatrixReal adjoint() const

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

Returns:

Returns the adjoint of the matrix.

MatrixReal 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.

MatrixReal 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.

MatrixReal 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.

MatrixReal dct() const

Method that calculates the forward or type 2 discrete cosine transform (DCT) of this matrix. A matrix with a single dimension will be processed as a one-dimensional DCT. A matrix with multiple rows and columns will be processed as a two dimensional DCT.

Returns:

Returns a matrix representing the complex discrete cosine transform of the matrix.

MatrixReal idct() const

Method that calculates the inverse or type 3 discrete cosine transform (DCT) of this matrix. A matrix with a single dimension will be processed as a one dimensional inverse DFT. A matrix with multiple rows and columns will be processed as a two dimensional inverse DCT.

Returns:

Returns a matrix representing the complex inverse discrete cosine transform of the matrix.

MatrixComplex hilbertTransform() const

Method that calculates the Hilbert transform of an array (1 dimensional matrix).

Returns:

Returns the Hilbert transform of this 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 \).

MatrixReal solve(const MatrixReal &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.

MatrixReal leastSquares(const MatrixReal &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.

MatrixReal hadamard(const MatrixReal &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.

MatrixReal kronecker(const MatrixReal &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 floor() const

Method you can use to obtain a matrix holding the floor of each value in the matrix.

Returns:

Returns a real matrix with each value equal to the floor of the matrix contents.

MatrixReal ceil() const

Method you can use to obtain a matrix holding the ceiling of each value in the matrix.

Returns:

Returns a real matrix with each value equal to the ceiling of the matrix contents.

MatrixReal nint() const

Method you can use to obtain a matrix holding the nearest integer to each value in the matrix.

Returns:

Returns a real matrix with each value equal to the nearest integer of each coefficeint of the matrix contents.

MatrixInteger truncateToInteger() const

Method you can use to convert this matrix to an integer matrix.

Returns:

Returns this matrix converted to an integer matrix. Values are truncated towards zero.

MatrixInteger floorToInteger() const

Method you can use to convert this matrix to an integer matrix. Integer values represent the floor of the supplied values.

Returns:

Returns this matrix converted to an integer matrix. Values are truncated towards negative infinity.

MatrixInteger ceilToInteger() const

Method you can use to convert this matrix to an integer matrix. Integer values represent the ceiling of the supplied values.

Returns:

Returns this matrix converted to an integer matrix. Values are truncated towards positive infinity.

MatrixInteger nintToInteger() const

Method you can use to convert this matrix to an integer matrix. Integer values represent the nearest integer of the supplied values.

Returns:

Returns this matrix converted to an integer matrix. Values are truncated to the closest integer value.

MatrixReal &operator=(const MatrixBoolean &other)

Assignment operator

Parameters:

other[in] The instance to be copied.

Returns:

Returns a reference to this instance.

MatrixReal &operator=(const MatrixInteger &other)

Assignment operator

Parameters:

other[in] The instance to be copied.

Returns:

Returns a reference to this instance.

MatrixReal &operator=(const MatrixReal &other)

Assignment operator

Parameters:

other[in] The instance to be copied.

Returns:

Returns a reference to this instance.

MatrixReal &operator=(const Variant &other)

Assignment operator

Parameters:

other[in] The instance to be copied.

Returns:

Returns a reference to this instance.

MatrixReal &operator+=(const MatrixBoolean &v)

Addition assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

MatrixReal &operator+=(const MatrixInteger &v)

Addition assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

MatrixReal &operator+=(const MatrixReal &v)

Addition assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

MatrixReal &operator-=(const MatrixBoolean &v)

Subtraction assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

MatrixReal &operator-=(const MatrixInteger &v)

Subtraction assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

MatrixReal &operator-=(const MatrixReal &v)

Subtraction assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

MatrixReal &operator*=(const MatrixBoolean &v)

Multiplication assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

MatrixReal &operator*=(const MatrixInteger &v)

Multiplication assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

MatrixReal &operator*=(const MatrixReal &v)

Multiplication assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

MatrixReal &operator*=(Boolean v)

Multiplication assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

MatrixReal &operator*=(Integer v)

Multiplication assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

MatrixReal &operator*=(Real v)

Multiplication assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

inline MatrixReal &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 MatrixReal &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 MatrixReal &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 MatrixReal &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 MatrixReal &operator*=(signed v)

Multiplication assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

inline MatrixReal &operator*=(unsigned v)

Multiplication assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

inline MatrixReal &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 MatrixReal &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 MatrixReal &operator*=(float v)

Multiplication assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

inline MatrixReal &operator*=(long double v)

Multiplication assignment operator

Parameters:

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

Returns:

Returns a reference to this instance.

MatrixReal &operator/=(Integer v)

Division assignment operator

Parameters:

v[in] The value divide each member by.

Returns:

Returns a reference to this instance.

MatrixReal &operator/=(Real v)

Division assignment operator

Parameters:

v[in] The value divide each member by.

Returns:

Returns a reference to this instance.

inline MatrixReal &operator/=(signed char v)

Division assignment operator

Parameters:

v[in] The value divide each member by.

Returns:

Returns a reference to this instance.

inline MatrixReal &operator/=(unsigned char v)

Division assignment operator

Parameters:

v[in] The value divide each member by.

Returns:

Returns a reference to this instance.

inline MatrixReal &operator/=(signed short v)

Division assignment operator

Parameters:

v[in] The value divide each member by.

Returns:

Returns a reference to this instance.

inline MatrixReal &operator/=(unsigned short v)

Division assignment operator

Parameters:

v[in] The value divide each member by.

Returns:

Returns a reference to this instance.

inline MatrixReal &operator/=(signed v)

Division assignment operator

Parameters:

v[in] The value divide each member by.

Returns:

Returns a reference to this instance.

inline MatrixReal &operator/=(unsigned v)

Division assignment operator

Parameters:

v[in] The value divide each member by.

Returns:

Returns a reference to this instance.

inline MatrixReal &operator/=(signed long v)

Division assignment operator

Parameters:

v[in] The value divide each member by.

Returns:

Returns a reference to this instance.

inline MatrixReal &operator/=(unsigned long v)

Division assignment operator

Parameters:

v[in] The value divide each member by.

Returns:

Returns a reference to this instance.

inline MatrixReal &operator/=(float v)

Division assignment operator

Parameters:

v[in] The value divide each member by.

Returns:

Returns a reference to this instance.

inline MatrixReal &operator/=(long double v)

Division assignment operator

Parameters:

v[in] The value divide each member by.

Returns:

Returns a reference to this instance.

MatrixReal operator+(const MatrixBoolean &v) const

Addition operator.

Parameters:

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

Returns:

Returns a matrix representing the sum.

MatrixReal operator+(const MatrixInteger &v) const

Addition operator.

Parameters:

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

Returns:

Returns a matrix representing the sum.

MatrixReal operator+(const MatrixReal &v) const

Addition operator.

Parameters:

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

Returns:

Returns a matrix representing the sum.

MatrixReal operator-(const MatrixBoolean &v) const

Subtraction operator.

Parameters:

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

Returns:

Returns a matrix representing the difference.

MatrixReal operator-(const MatrixInteger &v) const

Subtraction operator.

Parameters:

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

Returns:

Returns a matrix representing the difference.

MatrixReal operator-(const MatrixReal &v) const

Subtraction operator.

Parameters:

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

Returns:

Returns a matrix representing the difference.

MatrixReal operator*(const MatrixBoolean &v) const

Multiplication operator.

Parameters:

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

Returns:

Returns a matrix representing the product.

MatrixReal operator*(const MatrixInteger &v) const

Multiplication operator.

Parameters:

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

Returns:

Returns a matrix representing the product.

MatrixReal operator*(const MatrixReal &v) const

Multiplication operator.

Parameters:

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

Returns:

Returns a matrix representing the product.

MatrixReal operator*(Boolean v) const

Multiplication operator.

Parameters:

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

Returns:

Returns a matrix representing the product.

MatrixReal operator*(Integer v) const

Multiplication operator.

Parameters:

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

Returns:

Returns a matrix representing the product.

MatrixReal operator*(Real v) const

Multiplication operator.

Parameters:

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

Returns:

Returns a matrix representing the product.

inline MatrixReal 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 MatrixReal 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 MatrixReal 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 MatrixReal 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 MatrixReal operator*(signed v) const

Multiplication operator.

Parameters:

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

Returns:

Returns a matrix representing the product.

inline MatrixReal operator*(unsigned v) const

Multiplication operator.

Parameters:

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

Returns:

Returns a matrix representing the product.

inline MatrixReal 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 MatrixReal 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 MatrixReal operator*(float v) const

Multiplication operator.

Parameters:

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

Returns:

Returns a matrix representing the product.

inline MatrixReal operator*(long double v) const

Multiplication operator.

Parameters:

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

Returns:

Returns a matrix representing the product.

MatrixReal operator/(Integer v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

MatrixReal operator/(Real v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline MatrixReal operator/(signed char v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline MatrixReal operator/(unsigned char v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline MatrixReal operator/(signed short v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline MatrixReal operator/(unsigned short v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline MatrixReal operator/(signed v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline MatrixReal operator/(unsigned v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline MatrixReal operator/(signed long v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline MatrixReal operator/(unsigned long v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline MatrixReal operator/(float v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline MatrixReal operator/(long double v) const

Division operator.

Parameters:

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

Returns:

Returns a matrix representing the quotient.

inline const MatrixReal &operator+() const

Unary plus operator.

Returns:

Returns a reference to this object.

MatrixReal operator-() const

Unary minus operator.

Returns:

Returns this matrix multiplied by -1.

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 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.

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 MatrixReal 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 MatrixReal 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 MatrixReal 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 MatrixReal 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 MatrixReal 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 MatrixReal 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 MatrixReal 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 MatrixReal 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 MatrixReal 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.

static MatrixReal ones(Index numberRows, Index numberColumns)

Method you can use to obtain a one’s 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 MatrixReal ones(Index numberRowColumns)

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

Parameters:

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

Public Static Attributes

static constexpr Real defaultRelativeTolerance = 1.0E-8

The default tolerance (relative) for various tests.

Private Functions

inline MatrixReal(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 MatrixBoolean
friend class MatrixInteger
friend class MatrixComplex

model_range.h

This header defines the Model::Range class.

namespace M
namespace Model
class Range
#include <model_range.h>

Range class. You can use this class to specify ranges of values, test to see if values are defined in the specified range, and iterate over the range.

Subclassed by M::Range

Public Types

typedef RangeIterator ConstIterator

Type used to represent a constant iterator.

typedef RangeIterator Iterator

Type used to represent the normal iterator.

typedef RangeIterator const_iterator

Type provided for STL compatibility.

typedef RangeIterator iterator

Type provided for STL compatibility.

Public Functions

Range()
Range(const Range &other)

Copy constructor

Parameters:

other[in] The instance to be copied.

Range(Range &&other)

Move constructor

Parameters:

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

Range(const Variant &first, const Variant &last)

Constructor

Parameters:
  • first[in] The first value in the range.

  • last[in] The last value in the range.

Throws:

Model::InvalidRangeParameter

Range(const Variant &first, const Variant &second, const Variant &last)

Constructor

Parameters:
  • first[in] The first value in the range.

  • second[in] The second value in the range.

  • last[in] The last value in the range.

Throws:

Model::InvalidRangeParameter

~Range()
bool isEmpty() const

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

Returns:

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

Model::Integer size() const

Method you can use to determine the size of the range, in elements.

Returns:

Returns the current size of the range, in elements.

void clear()

Method that clears the range.

Variant first() const

Method you can use to obtain the first value in the range.

Returns:

Returns the first value in the range.

Variant second() const

Method you can use to obtain the second value in the range.

Returns:

Returns the second value in the range.

Variant last() const

Method you can use to obtain the last value in the range.

Returns:

Returns the last value in the range.

bool contains(const Variant &value) const

Method you can use to determine if a value is contained in the range.

Parameters:

value[in] The value to check for.

Returns:

Returns true if the value exists in the range. Returns false if the value does not exist in the range. Note that only values that will be returned by iterating over the range will be considered as in the range.

ConstIterator constBegin() const

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

Returns:

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

ConstIterator constEnd() const

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

Returns:

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

const_iterator cbegin() const

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

Returns:

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

const_iterator cend() const

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

Returns:

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

Iterator begin()

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

Returns:

Returns an iterator to the first entry in the range.

Iterator end()

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

Returns:

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

Private Functions

inline Range(Private *newImplementation)

Private constructor

Parameters:

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

Private Members

Private *impl

Friends

friend class RangeIterator
friend class Variant
friend class M::Range

model_range_iterator.h

This header defines the Model::RangeIterator class.

namespace Model
class RangeIterator
#include <model_range_iterator.h>

Iterator you can use to traverse a range.

Public Functions

RangeIterator()
RangeIterator(const RangeIterator &other)

Copy constructor

Parameters:

other – The instance to be copied.

RangeIterator(RangeIterator &&other)

Move constructor

Parameters:

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

~RangeIterator()
Variant value() const

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

Returns:

Returns a reference to the current value.

const Variant &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 Variant *constPointer() const

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

Returns:

Returns a pointer to the current value.

void advance()

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

void advance(signed long long distance)

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

Parameters:

distance[in] The distance to advance the iterator.

void backup()

Method you can call to backup the iterator by one location.

void backup(signed long long distance)

Method you can call to backup the iterator by a specified distance.

Parameters:

distance[in] The distance to reverse 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 range. 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.

Variant operator*() const

Dereferencing operator. Note that the constReference method may prove slightly faster than the dereferencing operator.

Returns:

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

const Variant *operator->() const

Indirection operator.

See also

Model::RangeIterator::pointer

Returns:

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

RangeIterator &operator++()

Pre-increment operator

Returns:

Returns a reference to this instance.

RangeIterator operator++(int)

Post-increment operator

Returns:

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

RangeIterator &operator--()

Pre-decrement operator

Returns:

Returns a reference to this instance.

RangeIterator operator--(int)

Post-decrement operator

Returns:

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

RangeIterator &operator+=(signed long long distance)

Add assignment operator.

Parameters:

distance[in] The distance to advance the iterator.

Returns:

Returns a reference to this instance.

RangeIterator &operator-=(signed long long distance)

Subtract assignment operator.

Parameters:

distance[in] The distance to advance the iterator.

Returns:

Returns a reference to this instance.

RangeIterator operator+(signed long long distance) const

Addition operator.

Parameters:

distance[in] The distance to add to this iterator to calculated the result.

Returns:

Returns an iterator representing the requested position.

RangeIterator operator-(signed long long distance) const

Subtraction operator.

Parameters:

distance[in] The distance to apply to this iterator to calculate the result.

Returns:

Returns an iterator representing the requested position.

signed long long operator-(const RangeIterator &other) const

Subtraction operator.

Parameters:

other[in] The iterator to subtract from this iterator to determine distance.

Returns:

Returns an iterator representing the requested position.

RangeIterator &operator=(const RangeIterator &other)

Copy assignment operator.

Parameters:

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

Returns:

Returns a reference to this instance.

RangeIterator &operator=(RangeIterator &&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 RangeIterator &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 range. Returns false if the instances point to different entries. Comparing entries in different ranges will lead to indeterminate results.

bool operator!=(const RangeIterator &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 range. Returns false if the instances point to the same entry. Comparing entries in different ranges will lead to indeterminate results.

Private Functions

inline RangeIterator(Private *newImplementation)

Private constructor

Parameters:

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

Private Members

Private *impl

Friends

friend class Range

model_rng.h

This header defines the Model::Rng class.

namespace Model
class Rng
#include <model_rng.h>

Base class you can use to access an random number generator (RNG) used by the model

Subclassed by M::PerThread

Public Types

enum class RngType

Enumeration of supported RNG types.

Values:

enumerator MT19937

Indicates the model is to use the MT19937 Mercenne Twister algorithm.

enumerator MT216091

Indicates the model is to use the MT216091 SIMD Mercenne Twister algorithm.

enumerator XORSHIRO256_PLUS

Indicates the model is to use the XOR/shift/rotate+ 256 algorithm.

enumerator XORSHIRO256_STARS

Indicates the model is to use the XOR/shift/rotate** 256 algorithm.

enumerator TRNG

Indicates the model is to use the operating system true random number generator (TRNG).

enumerator NUMBER_RNGS

Value used to determine the number of supported random number generators.

typedef unsigned long long RngSeed[rngSeedLength]

Type used to represent seeds passed to the RNG.

Public Functions

virtual ~Rng() = default
virtual void configure(RngType rngType, const RngSeed &rngSeed) = 0

Method you can use to configure the random number generation engine.

Parameters:
  • rngType[in] The desired RNG type.

  • rngSeed[in] The desired RNG initial seed. Note that the RNG seed will be interpreted differently depending on the selected RNG type. The RNG seed will be ignored for the true random number generator.

virtual void setRngType(RngType rngType) = 0

Method you can use to set the RNG type. Calling this method will select a random seed value, if needed.

Parameters:

rngType[in] The desired RNG type.

virtual void setRngSeed(const RngSeed &rngSeed) = 0

Method you can use to set the RNG seed.

Parameters:

rngSeed[in] The RNG seed to apply.

virtual RngType rngType() const = 0

Method you can use to determine the currently selected RNG type.

Returns:

Returns the currently selected RNG type.

virtual const RngSeed &rngSeed() const = 0

Method you can use to determine the last used RNG seed.

Returns:

Returns a constant reference to the last seed applied to the selected RNG.

virtual unsigned long trng() = 0

Method you can use to obtain a 32-bit true random value using the operating system cryptograph TRNG.

Returns:

Returns a 32-bit true random value.

virtual unsigned long random32() = 0

Method you can use to obtain an unsigned 32-bit random value.

Returns:

Returns an unsigned 32-bit random value with uniform distribution.

virtual unsigned long long random64() = 0

Method you can use to obtain an unsigned 64-bit random value.

Returns:

Returns an unsigned 32-bit random value with uniform distribution.

virtual Integer randomInteger() = 0

Method you can use to obtain an unsigned random integer value.

Returns:

Returns an unsigned random integer value covering the entire range of possible values.

virtual Real randomInclusive() = 0

Method you can use to obtain a random floating point value between 0 and 1, inclusive.

Returns:

Returns an floating point random value between 0 and 1, inclusive.

virtual Real randomInclusiveExclusive() = 0

Method you can use to obtain a random floating point value between 0 and 1, excluding 1.0.

Returns:

Returns an floating point random value between 0 and 1, excluding 1.0.

virtual Real randomExclusiveInclusive() = 0

Method you can use to obtain a random floating point value between 0 and 1, excluding 1.0.

Returns:

Returns an floating point random value between 0 and 1, excluding 1.0.

virtual Real randomExclusive() = 0

Method you can use to obtain a random floating point value between 0 and 1, excluding 0.0 and 1.0.

Returns:

Returns an floating point random value between 0 and 1, excluding 1.0.

virtual Real randomNormal() = 0

Method you can use to obtain values from a normal distribution.

Returns:

Returns values in a normal distribution.

virtual Real randomWeibull(Real scale, Real shape, Real delay) = 0

Method you can use to obtain values from a Weibull distribution.

Parameters:
  • scale[in] The scale term.

  • shape[in] The shape term.

  • delay[in] The delay term.

Returns:

Returns a random deviate from a Weibull distribution.

virtual Real randomExponential(Real rate) = 0

Method you can use to obtain values from an exponential distribution.

Parameters:

rate[in] The rate term.

Returns:

Returns values from an exponential distribution.

virtual Real randomGamma(Real k, Real s) = 0

Method you can use to obtain values from a gamma distribution.

Parameters:
  • k[in] The shape parameter.

  • s[in] The scale parameter.

Returns:

Returns a value from a gamma distribution.

virtual Real randomRayleigh(Real scale) = 0

Method you can use to obtain random values from a Rayleigh distribution.

Parameters:

scale[in] The scale parameter for the distribution.

Returns:

Returns random deviates in a Rayleigh distribution.

virtual Real randomChiSquared(Integer k) = 0

Method you can use to obtain random values from a Chi-sqared distribution.

Parameters:

k[in] The distribution degrees of freedom.

Returns:

Returns a random value from the requested Chi-squared distribution.

virtual Integer randomPoisson(Real rate) = 0

Method you can use to obtain random values from a Poisson distribution.

Parameters:

rate[in] The distribution rate parameter.

Returns:

Returns a count of the number of events based on the rate.

virtual Integer randomBinomial(Integer n, Real p) = 0

Method you can use to obtain random values from a binomial distribution.

Parameters:
  • n[in] The number of trials.

  • p[in] The success probability for each trial.

Returns:

Returns the number of successes.

virtual Real randomLogNormal() = 0

Method you can use to obtain random values from a log normal distribution with zero mean and unit sigma.

Returns:

Returns values from a log-normal distribution.

virtual Real randomLogNormal(Real mean, Real sigma) = 0

Method you can use to obtain random values from a log normal distribution.

Parameters:
  • mean[in] The mean value.

  • sigma[in] The standard deviation.

Returns:

Returns values from a log-normal distribution.

virtual Integer randomGeometric(Real p) = 0

Method you can use to obtain random values in a geometric distribution.

Parameters:

p[in] The success probability.

Returns:

Returns the number of trials.

virtual Real randomCauchyLorentz(Real location, Real scale) = 0

Method you can use to obtain random values in a Cauchy-Lorentz distribution

Parameters:
  • location[in] The location parameter.

  • scale[in] The scale parameter.

Returns:

Returns a random deviate in the Cauchy-Lorentz distribution.

Public Static Attributes

static constexpr unsigned rngSeedLength = 4

Value indicating the RNG seed length.

model_set.h

This header defines the Model::Set class.

namespace M
namespace Model
class Set
#include <model_set.h>

Set class. You can use this class to manage an ordered set of variant values. To reduce memory footprint, the Model::Set class uses copy-on-write semantics.

Subclassed by M::Set

Public Types

typedef SetIterator ConstIterator

Type used to represent a constant iterator.

typedef SetIterator Iterator

Type used to represent the normal iterator.

typedef SetIterator const_iterator

Type provided for STL compatibility.

typedef SetIterator iterator

Type provided for STL compatibility.

Public Functions

Set()
Set(const Variant &other)

Constructor

Parameters:

other[in] The instance to be copied from.

Set(const Set &other)

Copy constructor.

Parameters:

other[in] The instance to be copied.

Set(Set &&other)

Move constructor.

Parameters:

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

~Set()
bool isEmpty() const

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

Returns:

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

Model::Integer size() const

Method you can use to determine the current size of the set, in elements.

Returns:

Returns the current size, in elements.

void clear()

Method that clears the set destroying all elements.

inline bool insert()

Method you can use to insert no elements. This method exists to make the variadic template insert method work in all cases.

Returns:

Returns true.

bool insert(const Variant &value)

Method you can use to insert an element into the set.

Parameters:

value[in] The value to be inserted.

Returns:

Returns true if the value has been inserted into the set. Returns false if the value already exists in the set and was not inserted.

bool insert(const Range &range)

Method you can use to insert a range of values in the set. Note that this inserts the values represented by the range, not a distinct set defined by the range.

Parameters:

range[in] The range to be inserted into the set.

Returns:

Returns true if all inserted values were new to the set. Returns false if one or more values in the range already existed in the set. Note that the entire range will be inserted even if some values already reside in the set.

template<typename F, typename S, typename ...A>
inline bool insert(F first, S second, A... additional)

Template method you can use to insert multiple elements to the set.

Parameters:
  • first[in] The first element to be added to the set.

  • second[in] The second element to be added to the set.

  • additional[in] The additional elements to be added to the set.

Returns:

Returns true if all elements were inserted. Returns false if one or more elements were duplicates.

inline bool remove()

Method you can use to remove no elements. This method exists to make the variadic template remove method work in all cases.

Returns:

Returns true.

bool remove(const Variant &value)

Method you can use to remove an element from the set.

Parameters:

value[in] The value to be removed.

Returns:

Returns true if the value was removed. Returns false if the value did not exist in the set.

template<typename F, typename S, typename ...A>
inline bool remove(F first, S second, A... additional)

Template method you can use to remove multiple elements from the set.

Parameters:
  • first[in] The first element to be remove from the set.

  • second[in] The second element to be removed from the set.

  • additional[in] The additional elements to be removed from the set.

Returns:

Returns true if all elements were removed. Returns false if one or more elements were not found in the set.

bool contains(const Variant &value) const

Method you can use to determine if a value is contained in the set.

Parameters:

value[in] The value to check for.

Returns:

Returns true if the value exists in the set. Returns false if the value does not exist in the set.

void uniteWith(const Set &other)

Method that unites this set with another set.

Parameters:

other[in] The set to unite with this set.

Set unitedWith(const Set &other) const

Method that unites this set with another set, returning the union. Note that this method may be faster than the Model::Set::uniteWith method.

Parameters:

other[in] The set to unite with this set.

Returns:

Returns the union of the two sets.

void intersectWith(const Set &other)

Method that intersects this set with another set.

Parameters:

other[in] The set to intersect with this set.

Set intersectedWith(const Set &other) const

Method that calculates the intersection of this set with another set.

Parameters:

other[in] The set to unite with this set.

Returns:

Returns the union of the two sets.

void subtract(const Set &other)

Method that subtracts another set from this set.

Parameters:

other[in] The set to intersect with this set.

Set difference(const Set &other) const

Method that calculates the difference of this set and other set. The returned set will contain the elements in this set that are not found in the other set.

Parameters:

other[in] The set to subtract from this set.

Set cartesianProduct(const Set &other) const

Method that calculates the cartesian product of this set and another set.

Parameters:

other[in] The set to apply as the second parameter in the cartesian product.

Returns:

Returns a set containing the cartesian product of the two sets.

ConstIterator find(const Variant &value) const

Method you can use to locate a value in the set.

Parameters:

value[in] The value to be located.

Returns:

Returns an iterator to the desired value. An iterator to constEnd is returned if the requested value does not exist in the set.

Iterator find(const Variant &value)

Method you can use to locate a value in the set.

Parameters:

value[in] The value to be located.

Returns:

Returns an iterator to the desired value. An iterator to constEnd is returned if the requested value does not exist in the set.

ConstIterator constBegin() const

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

Returns:

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

ConstIterator constEnd() const

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

Returns:

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

const_iterator cbegin() const

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

Returns:

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

const_iterator cend() const

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

Returns:

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

Iterator begin()

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

Returns:

Returns an iterator to the first entry in the set.

Iterator end()

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

Returns:

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

explicit operator Boolean() const

Casting operator.

Returns:

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

inline Set operator-(const Set &other)

Subtraction operator

Parameters:

other[in] The instance to subtract from this instance.

Returns:

Returns a set containing the difference of the two sets.

inline Set operator*(const Set &other) const

Cartesian product operator.

Parameters:

other[in] The set to use as the second parameter of the cartesian product.

Returns:

Returns a set containing the cartesian product of the two sets. Each element in the set will be a Model::Tuple containing a pair of values.

Set &operator=(const Set &other)

Copy assignment operator.

Parameters:

other[in] The instance to be copied.

Returns:

Returns a reference to this instance.

Set &operator=(Set &&other)

Move assignment operator.

Parameters:

other[in] The instance to be copied.

Returns:

Returns a reference to this instance.

Set &operator=(const Variant &other)

Assignment operator.

Parameters:

other[in] The instance to be copied.

Returns:

Returns a reference to this instance.

bool operator==(const Set &other) const

Comparison operator.

Parameters:

other[in] The instance to be compared against this instance.

Returns:

Returns true if the sets are equivalent. Returns false if the sets are not equivalent.

bool operator!=(const Set &other) const

Comparison operator.

Parameters:

other[in] The instance to be copied.

Returns:

Returns true if the sets are not equivalent. Returns false if the sets are equivalent.

Public Static Functions

static inline Set build()

Template method you can use to build an empty set. This method exists to make the variadic template build method work in all cases.

Returns:

Returns the newly created set.

template<typename ...E>
static inline Set build(E... elements)

Template method you can use to build a new set with one or more elements.

Parameters:

elements[in] The elements to be added to the set.

Returns:

Returns the newly created set.

Private Functions

inline Set(Private *newImplementation)

Private constructor

Parameters:

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

Private Members

Private *impl

Friends

friend class Variant
friend class M::Set

model_set_iterator.h

This header defines the Model::SetIterator class.

namespace Model
class SetIterator
#include <model_set_iterator.h>

Iterator you can use to traverse a set.

Public Functions

SetIterator()
SetIterator(const SetIterator &other)

Copy constructor

Parameters:

other – The instance to be copied.

SetIterator(SetIterator &&other)

Move constructor

Parameters:

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

~SetIterator()
Variant value() const

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

Returns:

Returns a reference to the current value.

const Variant &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 Variant *constPointer() const

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

Returns:

Returns a pointer to the current value.

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 set. 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.

Variant operator*() const

Dereferencing operator. Note that the SetIterator::constReference method may prove slightly faster than the dereferencing operator.

Returns:

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

const Variant *operator->() const

Indirection operator.

Returns:

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

SetIterator &operator++()

Pre-increment operator

Returns:

Returns a reference to this instance.

SetIterator operator++(int)

Post-increment operator

Returns:

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

SetIterator &operator+=(unsigned long distance)

Add assignment operator.

Parameters:

distance[in] The distance to advance the iterator.

Returns:

Returns a reference to this instance.

SetIterator &operator=(const SetIterator &other)

Copy assignment operator.

Parameters:

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

Returns:

Returns a reference to this instance.

SetIterator &operator=(SetIterator &&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 SetIterator &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 set. Returns false if the instances point to different entries. Comparing entries in different sets will lead to indeterminate results.

bool operator!=(const SetIterator &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 set. Returns false if the instances point to the same entry. Comparing entries in different sets will lead to indeterminate results.

Private Functions

inline SetIterator(Private *newImplementation)

Private constructor

Parameters:

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

Private Members

Private *impl

Friends

friend class Set

model_status.h

This header defines the Model::Status class.

namespace Model
class Status
#include <model_status.h>

Base class you can overload to receive status information about your model. You can overload the methods in this class to receive notification of specific events.

Do note that a number of methods may be triggered from a thread other than the thread used to start the model.

Public Functions

virtual ~Status() = default
virtual void started(Api *modelApi)

Method that is called when the model has started execution.

Parameters:

modelApi[in] A pointer to the model API class.

virtual void finished(Api *modelApi)

Method that is called when the model has completed execution. Note that this method may be called from a thread other than the thread that started the model and must be thread safe.

Parameters:

modelApi[in] A pointer to the model API class.

virtual void aborted(Api *modelApi, AbortReason abortReason, OperationHandle operationHandle)

Method that is called when the model has been aborted. Note that this method may be called from a thread other than the thread that started the model and must be thread safe.

Parameters:
  • modelApi[in] A pointer to the model API class.

  • abortReason[in] The reason the model was aborted.

  • operationHandle[in] The handle to the operation where the abort occurred.

virtual void pausedOnUserRequest(Api *modelApi, OperationHandle operationHandle)

Method that is called when a thread has paused due to a call to Api::pause.

Parameters:
  • modelApi[in] A pointer to the model API class.

  • operationHandle[in] The operation handle where the model paused.

virtual void pausedAtOperation(Api *modelApi, OperationHandle operationHandle)

Method that is called when a thread has paused due to an instruction breakpoint. Note that this method may be called from a thread other than the thread that started the model and must be thread safe.

Parameters:
  • modelApi[in] A pointer to the model API class.

  • operationHandle[in] The operation handle where the model paused.

virtual void pausedOnVariableUpdate(Api *modelApi, OperationHandle operationHandle, IdentifierHandle identifierHandle)

Method that is called when a thread has paused due to a data breakpoint. Note that this method may be called from a thread other than the thread that started the model and must be thread safe.

Parameters:
  • modelApi[in] A pointer to the model API class.

  • operationHandle[in] The operation handle where the model paused.

  • identifierHandle[in] The identifier handle that triggered the pause condition.

virtual void resumed(Api *modelApi)

Method that is called when the model resumes operation.

Parameters:

modelApi[in] A pointer to the model API class.

virtual void threadStarted(Api *modelApi, unsigned threadId)

Method that is called when a thread is started. You can use this method to track when threads in the model actually launch. Note that this method is called from each thread and must be thread safe.

Parameters:
  • modelApi[in] A pointer to the model API class.

  • threadId[in] The zero based ID of the started thread.

virtual void threadFinished(Api *modelApi, unsigned threadId)

Method that is called when a thread finishes. You can use this method to determine when a portion of the model indicates it has completed.

Note that this method is called from each thread and must be thread safe.

Parameters:
  • modelApi[in] A pointer to the model API class.

  • threadId[in] The zero based ID of the thread that is now stopping.

virtual void threadPaused(Api *modelApi, unsigned threadId)

Method that is called when a thread has paused.

Note that this method is called from each thread and must be thread safe.

Parameters:
  • modelApi[in] A pointer to the model API class.

  • threadId[in] The zero based ID of the thread that is now stopping.

virtual void threadResumed(Api *modelApi, unsigned threadId)

Method that is called by the model implementation to indicate that a thread has resumed.

Parameters:
  • modelApi[in] A pointer to the model API class.

  • threadId[in] The zero based ID of the thread that is now stopping.

virtual void threadAborted(Api *modelApi, unsigned threadId)

Method that is called when a thread is aborted. You can use this method to determine when a portion of the model indicates it has been aborted.

Note that this method is called from each thread and must be thread safe.

Parameters:
  • modelApi[in] A pointer to the model API class.

  • threadId[in] The zero based ID of the thread that is now stopping.

virtual void sendToDevice(Device device, const Model::Variant &value)

Method that is called by a model to report immediate output. You can use this to stream output from the model to a given device and channel. This method is called from the same thread(s) that the model is running in and will block the thread.

Note that this method is called from each thread and must be thread safe. The default implementation simply returns.

Parameters:
  • device[in] The device to receive the data.

  • value[in] The reported value.

model_tuple.h

This header defines the Model::Tuple class.

namespace M
namespace Model
class Tuple
#include <model_tuple.h>

Tuple class. You can use this class to store ordered sets of variant types.

Subclassed by M::Tuple

Public Types

typedef Integer Index

Type used as the index into this object.

typedef TupleConstIterator ConstIterator

Type used to represent a constant iterator.

typedef TupleIterator Iterator

Type used to represent the normal iterator.

typedef TupleConstIterator const_iterator

Type provided for STL compatibility.

typedef TupleIterator iterator

Type provided for STL compatibility.

Public Functions

Tuple()
Tuple(const Variant &other)

Constructor

Parameters:

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

Tuple(const char *str)

Constructor. Creates a new tuple from a nul terminated string. Note that this constructor will throw an exception if the supplied string is not properly UTF-8 encoded.

Parameters:

str[in] The nul string to be converted to a tuple. The string is expected to be UTF-8 encoded.

Tuple(const Tuple &other)

Copy constructor

Parameters:

other[in] The instance to be copied.

Tuple(Tuple &&other)

Move constructor

Parameters:

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

~Tuple()
Variant value(Index index) const

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. An empty variant will be returned if the index is invalid.

bool setValue(Index index, const Variant &value)

Method you can use to set a value by position.

Parameters:
  • index[in] The one base index of the coefficient to be accessed. New entries will be added if the index is outside of the current length of the tuple.

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

Returns:

This method returns true if the index is valid. Returns false if the index is invalid.

bool isEmpty() const

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

Returns:

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

Index size() const

Method you can use to determine the size of the tuple, in elements.

Returns:

Returns the current size of the tuple, in elements.

void clear()

Method that clears the tuple.

inline void append()

Method you can use to append no elements. This method exists to make the variadic template append method work in all cases.

Returns:

Returns true.

void append(const Variant &newValue)

Method you can use to append a new value to the end of the tuple.

Parameters:

newValue[in] The value to be appended to the tuple.

void append(const Range &range)

Method you can use to append a new range to the end of the tuple.

Parameters:

range[in] The range to be appended to the tuple.

template<typename F, typename S, typename ...A>
inline void append(F first, S second, A... additional)

Method you can use to append multiple elements to the tuple.

Parameters:
  • first[in] The first element to be added to the tuple.

  • second[in] The second element to be added to the tuple.

  • additional[in] The additional elements to be added to the tuple.

inline void prepend()

Method you can use to prepend no elements. This method exists to make the variadic template prepend method work in all cases.

Returns:

Returns true.

void prepend(const Variant &newValue)

Method you can use to prepend a new value to the front of the tuple.

Parameters:

newValue[in] The value to be prepended to the tuple.

void prepend(const Range &range)

Method you can use to prepend a new range to the end of the tuple. The range will be prepended in reverse order. Inserting the range

\[ \left ( 1, 3, \ldots, 7 \right ) \]
will result in the first four tuple elements being assigned as: 7, 5, 3, 1.

Parameters:

range[in] The range to be prepended to the tuple.

template<typename F, typename S, typename ...A>
inline void prepend(F first, S second, A... additional)

Method you can use to prepend multiple elements to the tuple.

Parameters:
  • first[in] The first element to be added to the tuple.

  • second[in] The second element to be added to the tuple.

  • additional[in] The additional elements to be added to the tuple.

void push_back(const Variant &newValue)

Method you can use to append a new value to the end of the tuple. Supplied for STL compatibility.

Parameters:

newValue[in] The value to be appended to the tuple.

void push_front(const Variant &newValue)

Method you can use to prepend a new value to the front of the tuple. Supplied for STL compatibility.

Parameters:

newValue[in] The value to be prepended to the tuple.

void push_back(const Range &range)

Method you can use to append a new range to the end of the tuple. Supplied for STL compatibility.

Parameters:

range[in] The range to be appended to the tuple.

void push_front(const Range &range)

Method you can use to prepend a new range to the front of the tuple. Supplied for STL compatibility. The range will be prepended in reverse order. Inserting the range

\[ \left ( 1, 3, \ldots, 7 \right ) \]
will result in the first four tuple elements being assigned as: 7, 5, 3, 1.

Parameters:

range[in] The range to be prepended to the tuple.

Variant first() const

Method you can use to peek at the first element in the tuple.

Returns:

Returns the first element in the tuple.

Variant last() const

Method you can use to peek at the last element in the tuple.

Returns:

Returns the last element in the tuple.

Variant takeFirst()

Method you can use to remove the first element from the tuple, returning the element.

Returns:

Returns the removed first element of the tuple.

Variant takeLast()

Method you can use to remove the last element from the tuple, returning the element.

Returns:

Returns the removed last element of the tuple.

bool popFirst()

Method you can use to remove the first element from the tuple, returning the element.

Returns:

Returns true if the tuple was not empty. Returns false if the tuple was empty.

bool popLast()

Method you can use to remove the last element from the tuple, returning the element.

Returns:

Returns true if the tuple was not empty. Returns false if the tuple was empty.

void pop_front()

Method you can use to remove the first element from the tuple, returning the element. Supplied for STL compatibility.

void pop_back()

Method you can use to remove the last element from the tuple, returning the element. Supplied for STL compatibility.

Variant at(Index index) const

Method you can use to access a member of the tuple by index.

Parameters:

index[in] The one based index into the tuple. This method will throw an exception if the index is invalid.

Returns:

Returns the variant at the specified location.

void update(Index index, const Variant &newValue)

Method you can use to update a member of the tuple, by index.

Parameters:
  • index[in] The one based index into the tuple. If needed, the tuple will be resized to include this index. This method will throw an exception if the index is invalid.

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

ConstIterator constBegin() const

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

Returns:

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

ConstIterator constEnd() const

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

Returns:

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

const_iterator cbegin() const

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

Returns:

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

const_iterator cend() const

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

Returns:

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

Iterator begin()

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

Returns:

Returns an iterator to the first entry in the range.

Iterator end()

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

Returns:

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

char *toString() const

Method you can use to convert this tuple back into a UTF-8 compatible string.

Returns:

Returns a nul terminated character array holding the converted string. A null pointer is returned if the tuple can-not be converted to a UTF-8 compatible string. You are expected to take ownership of the string and delete it at end of scope.

explicit operator Boolean() const

Casting operator.

Returns:

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

Variant operator()(Index index) const

Array index operator.

Parameters:

index[in] The one based index into the tuple. This operator will throw an exception if the index is invalid.

Returns:

Returns the value at the specified index.

Tuple operator*(const Tuple &other) const

Multiplication operator. The multiplication operator concatenates this tuple against another tuple.

Parameters:

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

Returns:

Returns a new tuple containing a concatenation of the two tuples.

Tuple &operator*=(const Tuple &other)

Multiplication operator. The multiplication operator concatenates this tuple against another tuple.

Parameters:

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

Returns:

Returns a a reference to this tuple.

Tuple operator/(const Tuple &other) const

Division operator. The division operator performs right cancellation of elements from this tuple. This operator represents the string obelus operator.

Parameters:

other[in] The instance to right cancel from this tuple.

Returns:

Returns a new tuple containing a right cancelled version of this tuple.

Tuple &operator/=(const Tuple &other)

Division operator. The division operator performs right cancellation of elements from this tuple. This operator represents the string obelus operator.

Parameters:

other[in] The instance to right cancel from this tuple.

Returns:

Returns a a reference to this tuple.

Tuple &operator=(const Tuple &other)

Copy assignment operator.

Parameters:

other[in] The instance to be copied.

Returns:

Returns a reference to this instance.

Tuple &operator=(Tuple &&other)

Move assignment operator.

Parameters:

other[in] The instance to be copied.

Returns:

Returns a reference to this instance.

Tuple &operator=(const Variant &other)

Move assignment operator.

Parameters:

other[in] The instance to be copied.

Returns:

Returns a reference to this instance.

bool operator==(const Tuple &other) const

Comparison operator.

Parameters:

other[in] The instance to be compared against this instance.

Returns:

Returns true if the tuples are equivalent. Returns false if the tuples are not equivalent.

bool operator!=(const Tuple &other) const

Comparison operator.

Parameters:

other[in] The instance to be copied.

Returns:

Returns true if the tuples are not equivalent. Returns false if the tuples are equivalent.

Public Static Functions

static Tuple build()

Template method you can use to build an empty tuple. Exists to allow the variadic template build method work in all cases.

Returns:

Returns the newly created set.

template<typename ...E>
static inline Tuple build(E... elements)

Template method you can use to build a new tuple with one or more elements.

Parameters:

elements[in] The elements to be added to the tuple.

Returns:

Returns the newly created tuple.

Private Functions

inline Tuple(Private *newImplementation)

Private constructor

Parameters:

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

Private Members

Private *impl

Friends

friend class TupleIteratorBase
friend class Variant
friend class M::Tuple

model_tuple_const_iterator.h

This header defines the Model::TupleConstIterator class.

namespace Model
class TupleConstIterator : public Model::TupleIteratorBase
#include <model_tuple_const_iterator.h>

Iterator you can use to traverse a tuple.

Public Functions

TupleConstIterator()
TupleConstIterator(const TupleConstIterator &other)

Copy constructor

Parameters:

other – The instance to be copied.

TupleConstIterator(TupleConstIterator &&other)

Move constructor

Parameters:

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

~TupleConstIterator()
TupleConstIterator &operator++()

Pre-increment operator

Returns:

Returns a reference to this instance.

TupleConstIterator operator++(int)

Post-increment operator

Returns:

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

TupleConstIterator &operator--()

Pre-decrement operator

Returns:

Returns a reference to this instance.

TupleConstIterator operator--(int)

Post-decrement operator

Returns:

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

TupleConstIterator &operator+=(signed long long distance)

Add assignment operator.

Parameters:

distance[in] The distance to advance the iterator.

Returns:

Returns a reference to this instance.

TupleConstIterator &operator-=(signed long long distance)

Subtract assignment operator.

Parameters:

distance[in] The distance to advance the iterator.

Returns:

Returns a reference to this instance.

TupleConstIterator operator+(signed long long distance) const

Addition operator.

Parameters:

distance[in] The distance to add to this iterator to calculated the result.

Returns:

Returns an iterator representing the requested position.

TupleConstIterator operator-(signed long long distance) const

Subtraction operator.

Parameters:

distance[in] The distance to apply to this iterator to calculate the result.

Returns:

Returns an iterator representing the requested position.

TupleConstIterator &operator=(const TupleConstIterator &other)

Copy assignment operator.

Parameters:

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

Returns:

Returns a reference to this instance.

TupleConstIterator &operator=(TupleConstIterator &&other)

Move assignment operator.

Parameters:

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

Returns:

Returns a reference to this instance.

Private Functions

inline TupleConstIterator(TupleIteratorBase::Private *newImplementation)

Private constructor

Parameters:

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

Friends

friend class Tuple

model_tuple_iterator.h

This header defines the Model::TupleIterator class.

namespace Model
class TupleIterator : public Model::TupleIteratorBase
#include <model_tuple_iterator.h>

Iterator you can use to traverse a tuple.

Public Functions

TupleIterator()
TupleIterator(const TupleIterator &other)

Copy constructor

Parameters:

other – The instance to be copied.

TupleIterator(TupleIterator &&other)

Move constructor

Parameters:

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

~TupleIterator()
void setValue(const Variant &newValue)

Method you can use to update the current member of the tuple.

Parameters:

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

TupleIterator &operator++()

Pre-increment operator

Returns:

Returns a reference to this instance.

TupleIterator operator++(int)

Post-increment operator

Returns:

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

TupleIterator &operator--()

Pre-decrement operator

Returns:

Returns a reference to this instance.

TupleIterator operator--(int)

Post-decrement operator

Returns:

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

TupleIterator &operator+=(signed long long distance)

Add assignment operator.

Parameters:

distance[in] The distance to advance the iterator.

Returns:

Returns a reference to this instance.

TupleIterator &operator-=(signed long long distance)

Subtract assignment operator.

Parameters:

distance[in] The distance to advance the iterator.

Returns:

Returns a reference to this instance.

TupleIterator operator+(signed long long distance) const

Addition operator.

Parameters:

distance[in] The distance to add to this iterator to calculated the result.

Returns:

Returns an iterator representing the requested position.

TupleIterator operator-(signed long long distance) const

Subtraction operator.

Parameters:

distance[in] The distance to apply to this iterator to calculate the result.

Returns:

Returns an iterator representing the requested position.

TupleIterator &operator=(const TupleIterator &other)

Copy assignment operator.

Parameters:

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

Returns:

Returns a reference to this instance.

TupleIterator &operator=(TupleIterator &&other)

Move assignment operator.

Parameters:

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

Returns:

Returns a reference to this instance.

Private Functions

inline TupleIterator(TupleIteratorBase::Private *newImplementation)

Private constructor

Parameters:

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

Friends

friend class Tuple

model_tuple_iterator_base.h

This header defines the Model::TupleIteratorBase class.

namespace Model
class TupleIteratorBase
#include <model_tuple_iterator_base.h>

Common base class for the Model::TupleConstIterator and Model::TupleIterator classes.

Subclassed by Model::TupleConstIterator, Model::TupleIterator

Public Functions

Variant value() const

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

Returns:

Returns a reference to the current value.

const Variant &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 Variant *constPointer() const

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

Returns:

Returns a pointer to the current value.

void advance()

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

void advance(signed long long distance)

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

Parameters:

distance[in] The distance to advance the iterator.

void backup()

Method you can call to backup the iterator by one location.

void backup(signed long long distance)

Method you can call to backup the iterator by a specified distance.

Parameters:

distance[in] The distance to reverse 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 tuple. 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.

Variant operator*() const

Dereferencing operator. Note that the constReference method may prove slightly faster than the dereferencing operator.

Returns:

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

const Variant *operator->() const

Indirection operator.

Returns:

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

signed long long operator-(const TupleIteratorBase &other) const

Subtraction operator.

Parameters:

other[in] The iterator to subtract from this iterator to determine distance.

Returns:

Returns an iterator representing the requested position.

bool operator==(const TupleIteratorBase &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 tuple. Returns false if the instances point to different entries. Comparing entries in different tuples will lead to indeterminate results.

bool operator!=(const TupleIteratorBase &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 tuple. Returns false if the instances point to the same entry. Comparing entries in different tuples will lead to indeterminate results.

Protected Functions

TupleIteratorBase()
TupleIteratorBase(const TupleIteratorBase &other)

Copy constructor

Parameters:

other – The instance to be copied.

TupleIteratorBase(TupleIteratorBase &&other)

Move constructor

Parameters:

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

~TupleIteratorBase()
inline TupleIteratorBase(Private *newImplementation)

Private constructor

Parameters:

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

Protected Attributes

Private *impl

Private implementation.

Friends

friend class Tuple

model_variant.h

This header defines the Model::Variant class.

namespace M
namespace Model
class Variant
#include <model_variant.h>

Class you can use to store values of different types.

Public Functions

Variant()
Variant(Boolean value)

Constructor

Parameters:

value[in] The value to be stored.

Variant(Integer value)

Constructor

Parameters:

value[in] The value to be stored.

Variant(Real value)

Constructor

Parameters:

value[in] The value to be stored.

Variant(Complex value)

Constructor

Parameters:

value[in] The value to be stored.

Variant(const Set &value)

Constructor

Parameters:

value[in] The value to be stored.

Variant(const Tuple &value)

Constructor

Parameters:

value[in] The value to be stored.

Variant(const MatrixBoolean &value)

Constructor

Parameters:

value[in] The value to be stored.

Variant(MatrixBoolean &&value)

Constructor

Parameters:

value[in] The value to be stored.

Variant(const MatrixInteger &value)

Constructor

Parameters:

value[in] The value to be stored.

Variant(MatrixInteger &&value)

Constructor

Parameters:

value[in] The value to be stored.

Variant(const MatrixReal &value)

Constructor

Parameters:

value[in] The value to be stored.

Variant(MatrixReal &&value)

Constructor

Parameters:

value[in] The value to be stored.

Variant(const MatrixComplex &value)

Constructor

Parameters:

value[in] The value to be stored.

Variant(MatrixComplex &&value)

Constructor

Parameters:

value[in] The value to be stored.

Variant(const void *pointer, ValueType valueType)

Constructor

Parameters:
  • pointer[in] Pointer to a location containing a value of a specified type.

  • valueType[in] The type of the value at the location.

Variant(const Variant &other)

Copy constructor

Parameters:

other[in] The instance to be copied.

Variant(Variant &&other)

Move constructor

Parameters:

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

~Variant()
ValueType valueType() const

Method you can use to determine the current underlying data type.

Returns:

Returns the current underlying data type.

bool canTranslateTo(ValueType desiredType) const

Method you can use to determine if this variant can translate to a given type. Note that translation is only allowed if there will be no loss in precision so Real(5) can be translated to Integer(5) but Real(5.5) can not be translated to an integer.

Parameters:

desiredType[in] The desired data type.

Boolean toBoolean(bool *ok = nullptr) const

Method you can use to translate the value to an boolean value.

Parameters:

ok[inout] Pointer to a boolean you can use to determine if the translation was successful.

Returns:

Returns the value translated to an boolean.

Integer toInteger(bool *ok = nullptr) const

Method you can use to translate the value to an integer value.

Parameters:

ok[inout] Pointer to a boolean you can use to determine if the translation was successful.

Returns:

Returns the value translated to an integer.

Real toReal(bool *ok = nullptr) const

Method you can use to translate the value to a real value.

Parameters:

ok[inout] Pointer to a boolean you can use to determine if the translation was successful.

Returns:

Returns the value translated to a real value.

Complex toComplex(bool *ok = nullptr) const

Method you can use to translate the value to a complex value.

Parameters:

ok[inout] Pointer to a boolean you can use to determine if the translation was successful.

Returns:

Returns the value translated to a complex value.

Set toSet(bool *ok = nullptr) const

Method you can use to translate the value to a set.

Parameters:

ok[inout] Pointer to a boolean you can use to determine if the translation was successful.

Returns:

Returns the value translated to a set.

Tuple toTuple(bool *ok = nullptr) const

Method you can use to translate the value to a tuple.

Parameters:

ok[inout] Pointer to a boolean you can use to determine if the translation was successful.

Returns:

Returns the value translated to a tuple.

MatrixBoolean toMatrixBoolean(bool *ok = nullptr) const

Method you can use to translate the value to a matrix of boolean values.

Parameters:

ok[inout] Pointer to a boolean you can use to determine if the translation was successful.

Returns:

Returns the value translated to a matrix of boolean values.

MatrixInteger toMatrixInteger(bool *ok = nullptr) const

Method you can use to translate the value to a matrix of integer values.

Parameters:

ok[inout] Pointer to a boolean you can use to determine if the translation was successful.

Returns:

Returns the value translated to a matrix of integer values.

MatrixReal toMatrixReal(bool *ok = nullptr) const

Method you can use to translate the value to a matrix of real values.

Parameters:

ok[inout] Pointer to a boolean you can use to determine if the translation was successful.

Returns:

Returns the value translated to a matrix of real values.

MatrixComplex toMatrixComplex(bool *ok = nullptr) const

Method you can use to translate the value to a matrix of complex values.

Parameters:

ok[inout] Pointer to a boolean you can use to determine if the translation was successful.

Returns:

Returns the value translated to a matrix of complex values.

bool convert(void *pointer, ValueType valueType) const

Method you can use to convert the variant to a specific type, programmatically.

Parameters:
  • pointer[inout] Pointer to a location to be populated with a specified value.

  • valueType[in] The value type of the value at the requested location.

Returns:

Returns true on success, returns false on error.

operator Boolean() const

Cast to Boolean

Throws:

Model::InvalidRuntimeConversion

Returns:

Returns an boolean representation of the variant.

operator Integer() const

Cast to Integer

Throws:

Model::InvalidRuntimeConversion

Returns:

Returns an integer representation of the variant.

operator Real() const

Cast to Real

Throws:

Model::InvalidRuntimeConversion

Returns:

Returns an integer representation of the variant.

bool operator==(const Variant &other) const

Comparison operator.

Parameters:

other[in] The value to compare against.

Returns:

Returns true if the values are equal. Returns false if the values are not equal. Note that the comparisons are fuzzy. The underlying data-types do not need to be the same. This method always returns false if the types can-not be compared.

bool operator!=(const Variant &other) const

Comparison operator.

Parameters:

other[in] The value to compare against.

Returns:

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

bool operator<(const Variant &other) const

Comparison operator.

Parameters:

other[in] The value to compare against.

Returns:

Returns true if this value should precede the other value. Returns false if this value should follow the other value. This method triggers an exception or returns false if the two values can-not be compared.

bool operator>(const Variant &other) const

Comparison operator.

Parameters:

other[in] The value to compare against.

Returns:

Returns true if this value should follow the other value. Returns false if this value should precede the other value. This method triggers an exception or returns false if the two values can-not be compared.

bool operator<=(const Variant &other) const

Comparison operator.

Parameters:

other[in] The value to compare against.

Returns:

Returns true if this value should precede the other value or is equal to the other value. Returns false if this value should follow the other value. This method triggers an exception or returns false if the two values are not equal and can-not be compared.

bool operator>=(const Variant &other) const

Comparison operator.

Parameters:

other[in] The value to compare against.

Returns:

Returns true if this value should precede the other value. Returns false if this value should follow the other value. This method triggers an exception or returns false if the two values are not equal and can-not be compared.

Variant &operator=(const Variant &other)

Assignment operator

Parameters:

other[in] The instance to be copied.

Returns:

Returns a reference to this instance.

Variant &operator=(Variant &&other)

Assignment operator (move semantics).

Parameters:

other[in] The instance to be copied.

Returns:

Returns a reference to this instance.

Public Static Functions

static ValueType bestUpcast(ValueType type1, ValueType type2)

Method that determines the best type to use for comparison of variant types.

Parameters:
  • type1[in] The value type of the first variant.

  • type2[in] The value type of the second variant.

Returns:

Returns the recommended shared translation type. A value of ValueType::NONE is returned if the types are not compatible.

static ValueType bestUpcast(ValueType type1, const Variant &v2)

Method you can use to determine the best up-cast to use for a pair of variants.

Parameters:
  • type1[in] The value type of the first variant.

  • v2[in] The second value to be checked.

Returns:

Returns the recommended value type to use for comparisons and math operations between the two variant types.

static ValueType bestUpcast(const Variant &v1, ValueType type2)

Method you can use to determine the best up-cast to use for a pair of variants.

Parameters:
  • v1[in] The first value to be checked.

  • type2[in] The value type of the second variant.

Returns:

Returns the recommended value type to use for comparisons and math operations between the two variant types.

static ValueType bestUpcast(const Variant &v1, const Variant &v2)

Method you can use to determine the best up-cast to use for a pair of variants.

Parameters:
  • v1[in] The first value to be checked.

  • v2[in] The second value to be checked.

Returns:

Returns the recommended value type to use for comparisons and math operations between the two variant types.

template<typename T1, typename T2, typename ...Additional>
static inline ValueType bestUpcast(const T1 &p1, const T2 &p2, Additional... additional)

Method you can use to determine the best upcase across a range of variants.

Parameters:
  • p1[in] The first parameter.

  • p2[in] The second parameter.

  • additional[in] Additional parameters.

Returns:

Returns the recommended value type to use for comparisons and math operations between the two variant types.

Private Functions

inline Variant(Private *newImplementation)

Constructor

Parameters:

newImplementation[in] The new underlying implementation instance.

Private Members

Private *impl

Friends

friend class Range
friend class RangeIterator
friend class Tuple
friend class TupleIteratorBase
friend class Set
friend class SetIterator
friend class IdentifierData
friend class M::Variant

plug_in_data.h

This header provides key defines used to write plug-ins.

Defines

PLUG_IN_DATA

Define providing the expected name for the plug-in data instance.

Typedefs

typedef struct PlugInData PlugInData

Structure that is used to register a non-Inesonic the plug-in with the system. The system will search for an instance of this structure named “__plugInData” when the plug-in is loaded and will use its contents to properly configure the plug-in. The structure is expected to be defined statically and must persist for the entire lifetime of the plug-in.

Unless otherwise specified, all provided strings should be UTF-8 encoded.

struct PlugInData
#include <plug_in_data.h>

Structure that is used to register a non-Inesonic the plug-in with the system. The system will search for an instance of this structure named “__plugInData” when the plug-in is loaded and will use its contents to properly configure the plug-in. The structure is expected to be defined statically and must persist for the entire lifetime of the plug-in.

Unless otherwise specified, all provided strings should be UTF-8 encoded.

Public Members

const char *name

The name of the plug-in. You must include a unique name for the plug-in.

const char *author

The plug-in author or author company, e.g. “Inesonic, LLC” or “John Doe”. You must set this value to a non-empty string or the plug-in will not load.

const char *company

The company that developed this plug-in. You must set this value to a non-empty string or the plug-in will not load.

const char *license

The plug-in license. You can set this to a null pointer to cause the standard Inesonic, LLC license to be used.

const char *briefDescription

A brief description of the plug-in. You must set a brief description or the plug-in will not load.

const char *detailedDescription

A detailed description of the plug-in. You can set this to a null pointer to omit a detailed description.

const char *version

The plug-in version string. This value is informational only, you can set this to any value you wish although you must set a non-empty value.

unsigned numberFunctionDefinitions

A value specifying the number of functions to be instantiated by this plug-in.

const UserFunctionDefinition *userFunctionDefinitions

A pointer to an array of function definitions.

const RunTimeLibraryDefinition *runTimeLibraryDefinition

A pointer to an array of run-time library definitions. The field is ignored if it is a null pointer.

run_time_library_definition.h

This header provides key defines used to describe user third party run-time libraries.

Enums

enum class LibraryType

Enumeration of library types.

Values:

enumerator CUSTOMER_DYNAMIC_LIBRARY

Indicates a customer implemented dynamic library.

enumerator CUSTOMER_STATIC_LIBRARY

Indicates a customer implemented static library.

enumerator VENDOR_DYNAMIC_LIBRARY

Indicates an Inesonic dynamic library.

enumerator VENDOR_STATIC_LIBRARY

Indicates an Inesonic dynamic library.

struct RunTimeLibraryDefinition
#include <run_time_library_definition.h>

Structure that defines a single run-time library. The last entry in the list should populate all fields with null pointers.

Unless otherwise specified, all provided strings should be UTF-8 encoded.

Public Members

const char *libraryName

A pointer to a nul terminated string holding the library name. The library name should exclude the file extension, any path information, and should exclude any leading “lib” prefix.

LibraryType libraryType

A flag indicating if this library is a static library or dynamic library.

user_function_definition.h

This header provides key defines used to register a new function.

struct UserFunctionParameter
#include <user_function_definition.h>

Structure you can use to define a specific parameter for the function.

Unless otherwise specified, all provided strings should be UTF-8 encoded.

Public Members

Model::ValueType valueType

The type of the parameter.

const char *description

A short description you can assign to the parameter.

struct UserFunctionVariant
#include <user_function_definition.h>

Structure you can use to define a specific variant of a function. Function variants can have a different parameter list.

Public Members

Model::ValueType returnValueType

The function return value type.

unsigned numberParameters

The number of parameters for this function.

const UserFunctionParameter *parameters

Pointer to an array of accepted function parameter types.

struct UserFunctionDefinition
#include <user_function_definition.h>

Structure you can use to define a new function.

Unless otherwise specified, all provided strings should be UTF-8 encoded.

Public Members

const char *internalName

The runtime function name. The name will be mangled (C++ name manging) for each supported variant. The value must not be an empty string.

const char *runtimeLibraryName

The name of the run-time library supplying this function. The value must not be null or an empty string.

const char *visibleName

A UTF-8 string holding the function’s name as seen in the application. The value must not be an empty string.

const char *visibleNameSubscript

A UTF-8 string holding the function’s subscript as seen in the application. An empty string or null pointer indicates no subscript.

const char *command

A UTF-8 string holding the command to assign to the function. The command must be unique. An empty string or null pointer indicates no command will be defined for this function.

const char *description

A UTF-8 string holding a description for this function. A null pointer will cause the description “User defined function” to be used.

const char *category

A UTF-8 string holding a category to assign this function under. Category names are open-ended. An empty string or null pointer will place the function under the category “User Defined”

bool requiresRNG

A flag indicating that the first parameter to this function should be an instance of Model::Rng. Note that the Model::Rng instance is supplied as the first parameter into the function and is hidden from the user in the document view of the user’s model or program.

bool subscriptedFirstParameter

A flag indicating if the first parameter should be subscripted by default. Example functions with a subscripted parameter would be \( log _ b x \).

unsigned numberVariants

A value indicating the number of supported variants. This value must be non-zero.

const UserFunctionVariant *variants

Array of supported variants.