Hey guys!

Hey guys!

In my math library I encountered a problem in macosx while compiling the release version (Delphi 10.2.3):

dccosx throws an internal error C2489.


Anyone has a clue how to circumvent that error?

The code involved is:

procedure InitAndLeftQFromQR(A : PDouble; const LineWidthA : TASMNativeInt; width, height, k : TASMNativeInt; tau : PDouble;
work : PDouble; const svdData : TMtxSVDDecompData); //; const LineWidthWork : TASMNativeInt);
var pA : PDouble;
i : Integer;
j : Integer;
pAij, PAi1j : PConstDoubleArr;
begin
// Shift the vectors which define the elementary reflectors one
// row downward, and set the first row and column of P**T to
// those of the unit matrix
pA := A;
pA^ := 1;
inc(PByte(pA), LineWidthA);

for i := 1 to width - 1 do
begin
pA^ := 0;
inc(PByte(pA), LineWidthA);
end;

for j := width - 1 downto 1 do // rows
begin
pAij := PConstDoubleArr(GenPtr(A, 0, j, LineWidthA));
pAi1j := PConstDoubleArr(GenPtr(A, 0, j - 1, LineWidthA));

for i := j to width - 1 do // cols
pAij^[i] := pAi1j^[i];
end;

pAij := PConstDoubleArr(A);
for i := 1 to width - 1 do
pAij^[i] := 0;


if width > 1 then
begin
pA := GenPtr(A, 1, 1, LineWidthA);

// form P_Transposed
svdData.LeftQFromQRDecomp(pA, LineWidthA, width - 1, height - 1, tau, QRBlockSize, work, svdData.QRProgress);
end;
end;



TQRProgressObj = class;
TMtxSVDDecompData = record
pWorkMem : PByte;
Progress : TLinEquProgress;
QrProgressObj : TQRProgressObj;
QRProgress : TLinEquProgress;
SVDPnlSize : TASMNativeInt;
QRPnlSize : TASMNativeInt;
BlkMltSize : TASMNativeInt;
SVDMultSize : TASMNativeInt;
qrDecomp : TQRDecompFunc;
qFromQRDecomp : TQFromQRFunc;
LeftQFromQRDecomp : TQFromQRFunc;

MatrixMultEx : TMatrixBlockedMultfunc;
MatrixMultT1 : TMatrixBlockedMultfunc;
MatrixMultT2 : TMatrixBlockedMultfunc;

MatrixRotateUpdB : TMatrixSingularVecUpd;
MatrixRotateUpdF : TMatrixSingularVecUpd;
MatrixRotate : TMatrixSingularVecRotate;
end;
PMtxSVDDecompData = ^TMtxSVDDecompData;

Comments

  1. Michael Rabatscher Looks like the compiler trips over some pointer assignments :(

    ReplyDelete
  2. David Heffernan It is Michaels repo - so it is reasonable to assume that he could make sure it does not go away - or one can indeed zip the repo and attach it to the reported issue - I should know, I have done that before myself.

    ReplyDelete
  3. Thanks to Stefan Glienke! I'm now at least able to compile the package without the internal error.

    The error was resolved by getting rid of the nested loop and replacing it by a move call.

    procedure InitAndLeftQFromQR(A : PDouble; const LineWidthA : TASMNativeInt; width, height, k : TASMNativeInt; tau : PDouble;
    work : PDouble; const svdData : TMtxSVDDecompData); //; const LineWidthWork : TASMNativeInt);
    var pA : PDouble;
    i : Integer;
    j : Integer;
    pAij, PAi1j : PConstDoubleArr;
    begin
    // Shift the vectors which define the elementary reflectors one
    // row downward, and set the first row and column of P**T to
    // those of the unit matrix
    pA := A;
    pA^ := 1;
    inc(PByte(pA), LineWidthA);

    for i := 1 to width - 1 do
    begin
    pA^ := 0;
    inc(PByte(pA), LineWidthA);
    end;

    for j := width - 1 downto 1 do // rows
    begin
    pAij := PConstDoubleArr(GenPtr(A, 0, j, LineWidthA));
    pAi1j := PConstDoubleArr(GenPtr(A, 0, j - 1, LineWidthA));

    Move( pAi1j^[j], pAij^[j], (width - j)*sizeof(double));

    //for i := j to width - 1 do // cols
    // pAij^[i] := pAi1j^[i];
    end;

    pAij := PConstDoubleArr(A);
    for i := 1 to width - 1 do
    pAij^[i] := 0;


    if width > 1 then
    begin
    pA := GenPtr(A, 1, 1, LineWidthA);

    // form P_Transposed
    svdData.LeftQFromQRDecomp(pA, LineWidthA, width - 1, height - 1, tau, QRBlockSize, work, svdData.QRProgress);
    end;
    end;

    ReplyDelete

Post a Comment