public struct MatrixInt
Integer vector class for operator overloading (Delphi 2006 and later).
Declare VectorInt instead of TVecInt to take advantage ofoperator overloading. Be carefull to declare VectorInt only for local variables with short lifetime. Call the Create method for VectorInt, if the variable is a global variable or a variable with a longer life. It also makes sense to continue to use TVecInt for global vars. If the Create method (constuctor) is not called, the VectorInt record obtains TVecInt object from object cache (fastest create). If the Create mehod is called, the TVecInt object is created in the usual way (slower). Object cache has limited size.
Examples
csharp
VectorInt b;
VectorInt c;
TVecInt bv;
b = VectorInt(TIntegerArray.Create(1,1,1,1)); //b = new double[] {1,1,1,1};
bv = b; //b and bv point to same data object
bv.Multiply(2);
bv.Bitsnew double[] {76} = true; //set 76th bit in the array to 1
TVecInt(b).Multiply(2); //an alternative way to scale
c = b*2 + 3; //c = b*2 + 2 + 3i
c = b*bv; //mix VectorInt and TVecInt
bv.Add(c); //pass VectorInt type and implicitely convert to TVecInt pointer
b.PackBits(c); // store bit 1 in b for all elements in c which are different from zero. Bit 0 otherwise.
Properties
| Name | Type | Description |
|---|---|---|
| BlockEnd | Boolean | Returns true, if the currrent subrange of the vector was also the last subrange in the MatrixInt. |
| Capacity | Int64 | Sizing the object will not allocate less than Capacity samples. |
| CapacityStep | Double | Specifies increment step for the Capacity property. |
| Caption | String | Vector Caption. |
| Cols | Int32 | Defines the number of matrix columns. |
| ColsBitCount | Int32 | Defines number of bits stored in one row. |
| ConditionCheck | Boolean | Enables/disable inline condition checking. |
| First | Int32 | First element in object Values array. |
| IntegerValues | String | Returns data for inspection by the debugger. |
| IntPrecision | TIntPrecision | Defines internal storage precision which can be either 32, 16 or 8 bit. |
| IsSubRange | Boolean | Set to true after the SetSubIndex or SetSubRange call. |
| Item | Int32 | Allows setting/getting the real value at position Indx. |
| Last | Int32 | Last element in object Values array. |
| LeadingCols | Int32 | Defines the number of leading columns. |
| Length | Int32 | Defines the length in number of samples. |
| Rows | Int32 | Defines the number of matrix Rows. |
| ScaleFactor | Int32 | Specifies the power of two for the scale factor used by some methods. |
| Tag | Int32 | Stores an integer value as a part of the object. |
Methods
| Name | Description |
|---|---|
| Abs (4) | Absolute values. |
| Add (12) | Add Src elements to calling vector elements. |
| AddAndMul (26) | Compute (X + Y)*Z |
| AddScaled (10) | Compute X + Y + Z*zScale |
| AddScaledC (4) | Compute X + Y*yScale + zScalar |
| AddScaledSqr (4) | Compute sqr(X + Y*yScale) |
| Adopt (2) | Adopts TMtxInt object. |
| BinaryAnd (8) | Apply binary "and" between coresponding elements in Src and Self. |
| BinaryNot (4) | Applies binary "not" operation to elements stored in the object. |
| BinaryOr (8) | Apply binary "or" between coresponding elements in Src and Self. |
| BinarySearch (2) | Finds a match for X in object values using binary search. |
| BinaryXor (8) | Apply binary "xor" between coresponding elements in Src and Self. |
| BitPack (2) | Converts Src to packed bit storage. |
| BitShift (4) | Apply binary shift by number of Bits to the left (positive) or right (negative) to elements in Src. |
| BitShiftLeft (4) | Apply binary shift by number of Bits to the left to elements in Src. |
| BitShiftRight (4) | Apply binary shift by number of Bits to the right to elements in Src. |
| BitSize | Sizes the matrix according to bit storage required. |
| BitUnpack (2) | Converts Src to packed bit storage. |
| BlockFinish | Deinitializes block processing before the final block is processed. |
| BlockInit (4) | Initializes block processing. |
| BlockNext | Obtains the next subrange of the data. |
| Clear | Sets vector size to zero. |
| ColExchange | Exchange matrix columns. |
| ColPermute | Permute the columns of the Src matrix. |
| Concat | Concatenate an array of matrices to single matrix. |
| ConcatHorz (2) | Concenates an array of matrices horizontally. |
| ConcatVert (2) | Concenates an array of matrices vertically. |
| CondDisable | Saves the current value of ConditionCheck property and sets it to false. |
| CondEnable | Sets the ConditionCheck property to whatever it was before the CondDisable was used. |
| Convert (2) | Copy each of Vec elements to the calling object. |
| Copy (3) | Copy the Mtx elements [MtxRow,MtxCol]..[MtxRow+NrRows-1,MtxCol+NrCols-1] to the calling matrix elements [Row,Col],,[Row+NrRows-1,Col+NrCols-1]. |
| CopyFromArray (17) | Copies values from a real Src array. |
| CopyToArray (17) | Copies values from the calling object to the Dst array and converts data to double precision numbers. |
| CopyVec (2) | Copies values from vector to a matrix. |
| CountInRange (2) | Returns number of values within the interval. |
| ctor (4) | Uses TMtxInt object as internal storage. |
| CumSum (4) | Cumulative sum for each of the matrix columns. |
| Diag | Sets the matrix diagonal to values from the vector. |
| Difference | Difference. |
| DisableSelect | Prevents calls to Dew.Math.Units.MtxExprInt.Select. |
| DisableSubrange | Prevents calls to Dew.Math.MatrixInt.SetSubRange. |
| Disown (2) | Disowns a pointer to an array from calling matrix Values1D. |
| DivAndAdd (12) | Compute X/Y + Z |
| DivAndSub (12) | Compute X/Y - Z |
| Divide (12) | Divide calling object elements with Src elements. |
| DivideBy (4) | Divide Value with calling vector elements. |
| DivideC (2) | Compute X / (Y*zScale) |
| EnableSelect | Enables calls to Dew.Math.Units.MtxExprInt.Select. |
| EnableSubrange | Enables calls to Dew.Math.MatrixInt.SetSubRange. |
| Equal | Compares two matrices. |
| Eye | Constructs an eye matrix. |
| Find | Finds a match for X in object values. |
| FindAndSplit (3) | The b parameter is of Dew.Math.TCplx type. |
| FindMask (5) | Finds a vector mask. |
| FlipHor (2) | Flips the matrix elements horizontally. |
| FlipVer (2) | Flips the matrix elements vertically |
| GetSchema | Returns null. |
| IndexOf | Returns the 1D index in to the matrix. |
| IsEqual (4) | Compares two objects. |
| Kron | The Kronecker product between two vectors. |
| LoadFromFile | Reads the header information and the values array content from the file. |
| LogicalNot (4) | Applies logical "not" operation to elements stored in the object. |
| LowerTriangle | Constructs lower triangular matrix. |
| Max (4) | Maximum value. |
| MaxCols | Compute maximum of each column. |
| MaxMin (2) | Calculate minimum and maximum in one procedure call. |
| MaxMinCols | Compute maximum and minimum of each column. |
| MaxMinIdx (2) | Calculate minimum, maximum and their indices in one procedure call. |
| MaxMinRows | Compute maximum and minimum of each row. |
| MaxRows | Compute maximum of each row. |
| Median (2) | Applies median filter with size Mask to Src object elements [SrcIndex..SrcIndex+Len-1] and stores the result in the calling vector elements [Index..Index+Len-1]. |
| Min (4) | Minimum value. |
| MinCols | Compute minimum of each column. |
| MinRows | Compute minimum of each row. |
| Mul (4) | Compute X*Y*Z |
| MulAndAdd (14) | Compute X*Y + Z |
| MulAndDiv (6) | Compute X * Y / Z |
| MulAndSub (14) | Compute X*Y - Z |
| MulElem (2) | Matrix array multiplication. |
| Multiply (8) | Multiply Src elements with calling vector elements. |
| Parse | Parses string content as vector. |
| PBValues (2) | Obtains a pointer to the integer value of the vector at Index. |
| PIValues (2) | Obtains a pointer to the integer value of the vector at Index. |
| PSValues (2) | Obtains a pointer to the integer value of the vector at Index. |
| PValues1D | Obtains a pointer to the integer value of the vector at Index. |
| Ramp | Fills the calling vector elements [Index]..[Index+Len-1]. |
| ReadHeader | Reads the header information from a stream to object. |
| ReadValues | Read values content from stream to object. |
| ReadXml | Read the object from the .NET XML stream. |
| RemDiv (6) | Divide all Src elements with Value elements and store result of division in the calling object and reminder in RemDst. |
| Reset | Resets object properties to default values. |
| Resize (2) | Sizes the calling matrix to NewRows and NewCols. |
| ResizeAndTranspose | Resize and transpose. |
| Reverse (2) | Reverse vector elements. |
| Rotate (2) | A cyclic shift on vector elements in range. |
| Rotate90 (2) | Rotates matrix Rows 90 degrees clockwise. |
| RowExchange | Exchanges two matrix Rows. |
| RowPermute | Permute the Rows of the Src matrix. |
| SaveToFile | Write object header and values to a file. |
| SaveToMatrixMarketFile | Saves matrix data to MatrixMarket ASCII file format. |
| Scatter | Scatter object elements. |
| ScatterByIncr | Scatters Src elements starting at Offset and with Increment to the calling object. |
| ScatterByIndexes | Scatters Src elements defined with indices stored in Indexes to the calling object. |
| ScatterByMask | Scatters Src elements defined with the Mask to the calling object. |
| SelectAll | Resets any defined selection. |
| SetCol (2) | Copies values from vector to matrix column. |
| SetFullRange | Resets any defined subrange. |
| SetFullRangeLevel | Resets last defined subrange and pops the subrange stack. |
| SetIt (2) | Sets matrix values. |
| SetRow (2) | Copies values from vector to matrix row. |
| SetSubIndex | Defines a subarray. |
| SetSubRange (4) | Sets the subarray size to full size. |
| SetSubRangeLevel (2) | Defines a sub vector/matrix of Src and pushes any previous subranges on to a stack. |
| SetVal (3) | Set all calling object elements to Value. |
| SetZero (3) | Set all calling vector elements to zero. |
| Shift (2) | A shift on vector elements in range. |
| Size (4) | Size the object. |
| SizeFromArray (3) | Sets the size of the vector to match an array. |
| SizeToArray (10) | Sizes complex array. |
| SortAscend (4) | Sorts the elements in a matrix row(s) in ascending order. |
| SortDescend (4) | Sorts the elements in a matrix row(s) in descending order. |
| Split | Splits matrix in blocks. |
| SqrAddScaled (4) | Compute sqr(X) + sqr(Y)*yScale |
| StringsToValues (2) | Convert strings from [ListIndex]..[ListIndex+ListLen-1] in aList to integers. |
| Sub (4) | Compute X - Y - Z |
| SubAndMul (26) | Compute (X - Y)*Z |
| SubScaled (6) | Compute X - Y - Z*zScale |
| SubScaledC (4) | Compute X - Y*yScale - zScalar |
| Subtract (8) | Subtract all Src elements from calling vector elements. |
| SubtractFrom (4) | Subtract all calling vector elements from integer Value. |
| Sum (2) | Sums vector values. |
| SumCols | Calculates the sum of each of the calling matrix columns. |
| SumRows | Calculates the sum of each of the calling matrix Rows. |
| TensorProd | Calculates the tensor product of two vectors. |
| ThreshAbsGT (4) | Perform threshold operation on all Src object values. |
| ThreshAbsLT (4) | Perform threshold operation on all Src object values. |
| ThreshBottom (4) | Perform threshold operation on all Src object values. |
| ThresholdGT_LT (4) | Threshold greater than and less than operation. |
| ThreshTop (4) | Perform threshold operation on all Src object values. |
| ToString | Returns content as a string. |
| Transp (2) | Transposes matrix. |
| UpperTriangle | Constructs upper triangular matrix. |
| ValuesToStrings (2) | Convert calling matrix elements, starting with [Row,Col] and up to [Row+RowCount-1,Col+ColCount-1] elements to strings. |
| ValuesToText (2) | Converts Row..Col to Row+RowCount..Col+ColCount matrix elements to string. |
| WriteHeader | Writes the header information for the calling vector to a stream. |
| WriteValues | Writes object Values content to a stream. |
| WriteXml | Write the object to the .NET XML stream. |
Operators
| Name | Description |
|---|---|
| op_Addition (5) | Add coresponding elements in Left and Right. |
| op_BitwiseAnd (3) | Computes bitwise "and" between Left and right. |
| op_BitwiseOr (3) | Computes bitwise "or" between Left and right. |
| op_Division (5) | Divide all elements in Left with coresponding elements in Right. |
| op_Equality (7) | Returns true, if Left and Right are of equal Length and Values. |
| op_ExclusiveOr (3) | Performs logical "xor" between Left and Right. |
| op_Explicit (9) | Explicitely convert MatrixInt to array of integer. |
| op_GreaterThan (3) | Returns true, if coresponding elements in ALeft are greater than coresponding elements in ARight. |
| op_GreaterThanOrEqual (3) | Returns true, if coresponding elements in ALeft are greater or equal from coresponding elements in ARight. |
| op_Implicit (8) | Implicit type conversion from MatrixInt to TMtxInt. |
| op_Inequality (7) | Returns true, if Left and Right are not equal. |
| op_LeftShift | Performs bitwise left shift of aValue. |
| op_LessThan (3) | Returns true, if coresponding elements in ALeft are greater than coresponding elements in ARight. |
| op_LessThanOrEqual (3) | Returns true, if coresponding elements in ALeft are smaller than or equal from coresponding elements in ARight. |
| op_Multiply (5) | Multiply all elements in Left with corresponding elements in Right. |
| op_OnesComplement | Performs logical (and bitwise) "not" on the Value. |
| op_RightShift | Performs bitwise right shift of aValue. |
| op_Subtraction (5) | Subtract coresponding elements in Right from Left. |
| op_UnaryNegation | Negates all values inside AValue. |