You are here: Symbol Reference > Dew Namespace > Dew.Math Namespace > Classes > MatrixInt Structure
Dew Math for .NET
ContentsIndexHome
PreviousUpNext
MatrixInt Structure

Integer vector class for operator overloading (Delphi 2006 and later).

Syntax
C#
Visual Basic
public struct MatrixInt : IDeserializationCallback, IDisposable, IXmlSerializable { public TInt32Access IValues1D; public TInt16Access SValues1D; public TByteAccess BValues1D; public TInt32Access2D IValues; public TInt16Access2D SValues; public TByteAccess2D BValues; public TBits32Access2D Bits; }

MtxExprInt.cs

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.

var b, c: VectorInt; bv: TVecInt; begin b := VectorInt(TIntegerArray.Create(1,1,1,1)); //b = [1,1,1,1]; bv := b; //b and bv point to same data object bv.Multiply(2); bv.Bits[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. end;
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!