RIDITUnit: Usual refactoring. Some improvements in report layout. Less hints/warnings.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7358 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-04-05 17:25:38 +00:00
parent eac8c9b0a4
commit 8b0581017d
6 changed files with 588 additions and 592 deletions

View File

@ -166,7 +166,7 @@ var
MatInput : boolean;
Title : string;
filename : string;
Save_Cursor : TCursor;
// Save_Cursor : TCursor;
errorcode : boolean = false;
begin
MaxRoot := 0.0;
@ -525,7 +525,7 @@ again:
FACTORS(Eigenvector, d2, ainverse, k, factorchoice);
factREORDER(Eigenvector, ainverse, RowLabels, k);
end;
Screen.Cursor := Save_Cursor; // restore regular cursor
// Screen.Cursor := Save_Cursor; // restore regular cursor
for i := 1 to k do
for j := 1 to k do

View File

@ -1,11 +1,11 @@
object RIDITFrm: TRIDITFrm
Left = 520
Height = 369
Top = 238
Left = 1022
Height = 364
Top = 285
Width = 665
AutoSize = True
Caption = 'Relative to an Identified Distribution Analysis'
ClientHeight = 369
ClientHeight = 364
ClientWidth = 665
OnActivate = FormActivate
OnCreate = FormCreate
@ -104,12 +104,12 @@ object RIDITFrm: TRIDITFrm
AnchorSideRight.Side = asrBottom
Left = 400
Height = 72
Top = 180
Top = 176
Width = 257
Anchors = [akTop, akRight]
AutoFill = True
AutoSize = True
BorderSpacing.Top = 16
BorderSpacing.Top = 12
BorderSpacing.Right = 8
Caption = 'Reference Variable'
ChildSizing.LeftRightSpacing = 12
@ -141,7 +141,7 @@ object RIDITFrm: TRIDITFrm
Top = 260
Width = 167
BorderSpacing.Left = 12
BorderSpacing.Top = 8
BorderSpacing.Top = 12
BorderSpacing.Right = 8
Caption = 'Use Bonferroni for contrasts'
TabOrder = 3
@ -164,92 +164,74 @@ object RIDITFrm: TRIDITFrm
Text = 'AlphaEdit'
end
object ResetBtn: TButton
AnchorSideRight.Control = CancelBtn
AnchorSideRight.Control = ComputeBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 364
Left = 452
Height = 25
Top = 336
Top = 331
Width = 54
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 12
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 6
end
object CancelBtn: TButton
AnchorSideRight.Control = ComputeBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 430
Height = 25
Top = 336
Width = 62
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 12
BorderSpacing.Bottom = 8
Caption = 'Cancel'
ModalResult = 2
TabOrder = 7
end
object ReturnBtn: TButton
object CloseBtn: TButton
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 592
Left = 598
Height = 25
Top = 336
Width = 61
Top = 331
Width = 55
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 12
BorderSpacing.Bottom = 8
Caption = 'Return'
ModalResult = 1
TabOrder = 8
Caption = 'Close'
ModalResult = 11
TabOrder = 7
end
object ComputeBtn: TButton
AnchorSideRight.Control = ReturnBtn
AnchorSideRight.Control = CloseBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 504
Left = 514
Height = 25
Top = 336
Top = 331
Width = 76
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 12
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 9
TabOrder = 8
end
object HelpBtn: TButton
Tag = 143
AnchorSideRight.Control = ResetBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 301
Left = 393
Height = 25
Top = 336
Top = 331
Width = 51
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 12
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Help'
OnClick = HelpBtnClick
@ -259,10 +241,10 @@ object RIDITFrm: TRIDITFrm
AnchorSideLeft.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ReturnBtn
AnchorSideBottom.Control = CloseBtn
Left = 0
Height = 8
Top = 320
Height = 6
Top = 317
Width = 665
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
@ -273,13 +255,13 @@ object RIDITFrm: TRIDITFrm
AnchorSideRight.Control = RefGrp
AnchorSideBottom.Control = Bevel1
Left = 0
Height = 312
Height = 309
Top = 0
Width = 400
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Bottom = 8
BevelOuter = bvNone
ClientHeight = 312
ClientHeight = 309
ClientWidth = 400
TabOrder = 0
object Label1: TLabel
@ -321,7 +303,7 @@ object RIDITFrm: TRIDITFrm
AnchorSideBottom.Control = RefEdit
Left = 222
Height = 15
Top = 272
Top = 269
Width = 96
Anchors = [akLeft, akBottom]
BorderSpacing.Top = 8
@ -337,7 +319,7 @@ object RIDITFrm: TRIDITFrm
AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom
Left = 8
Height = 287
Height = 284
Top = 25
Width = 170
Anchors = [akTop, akLeft, akRight, akBottom]
@ -346,6 +328,7 @@ object RIDITFrm: TRIDITFrm
BorderSpacing.Right = 8
ItemHeight = 0
MultiSelect = True
OnSelectionChange = VarListSelectionChange
TabOrder = 0
end
object RowIn: TBitBtn
@ -424,6 +407,7 @@ object RIDITFrm: TRIDITFrm
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 3
Text = 'RowEdit'
end
@ -436,7 +420,7 @@ object RIDITFrm: TRIDITFrm
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Label4
Left = 222
Height = 130
Height = 127
Top = 134
Width = 170
Anchors = [akTop, akLeft, akRight, akBottom]
@ -445,6 +429,7 @@ object RIDITFrm: TRIDITFrm
BorderSpacing.Right = 8
ItemHeight = 0
OnClick = ColListClick
OnSelectionChange = VarListSelectionChange
TabOrder = 6
end
object RefEdit: TEdit
@ -456,11 +441,12 @@ object RIDITFrm: TRIDITFrm
AnchorSideBottom.Side = asrBottom
Left = 222
Height = 23
Top = 289
Top = 286
Width = 170
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Right = 8
ReadOnly = True
TabOrder = 7
Text = 'RefEdit'
end

View File

@ -8,7 +8,7 @@ uses
Classes, SysUtils, Globals, DictionaryUnit, OutputUnit, Dialogs,
FunctionsLib, DataProcs, MainUnit;
procedure GridDotProd(col1, col2: integer; var Product: double; var Ngood: integer);
procedure GridDotProd(col1, col2: integer; out Product: double; var Ngood: integer);
procedure GridXProd(NoSelected : integer;
{VAR} Selected : IntDyneVec;
@ -199,9 +199,13 @@ procedure DynIntMatPrint(Mat: IntDyneMat; Rows, Cols: integer; YTitle: string;
procedure SymMatRoots(A : DblDyneMat; M : integer; VAR E : DblDyneVec; VAR V : DblDyneMat);
procedure matinv(a, vtimesw, v, w: DblDyneMat; n: integer);
implementation
procedure GridDotProd(col1, col2: integer; var Product: double; var Ngood: integer);
uses
StrUtils;
procedure GridDotProd(col1, col2: integer; out Product: double; var Ngood: integer);
// Get the cross-product of two vectors
// col1 and col2 are grid columns of the main form's DataGrid
// Product is the vector product
@ -1540,11 +1544,11 @@ begin
while not done do
begin
AReport.Add('');
// AReport.Add('');
AReport.Add(' ' + ytitle);;
AReport.Add('Variables');
outline := ' ';
outline := DupeString(' ', 12+1);
last := first + nflds;
if last >= cols then
begin
@ -1552,21 +1556,21 @@ begin
last := cols
end;
for i := first to last do
outline := outline + Format('%13s', [ColLabels[i-1]]);
outline := outline + Format('%12s ', [ColLabels[i-1]]);
AReport.Add(outline);
for i := 1 to rows do
begin
outline := format('%10s', [RowLabels[i-1]]);
outline := Format('%12s ', [RowLabels[i-1]]);
for j := first to last do
outline := outline + Format('%12d ',[mat[i-1,j-1]]);
AReport.Add(outline);
end;
AReport.Add('');
first := last + 1
first := last + 1;
end;
AReport.Add('');
AReport.Add('');
// AReport.Add('');
end;
//---------------------------------------------------------------------------
@ -1860,7 +1864,7 @@ begin
while not done do
begin
AReport.Add('Variables');
outline := ' ';
outline := DupeString(' ', 12+1); //' ';
last := first + nflds;
if last >= cols then
begin
@ -1873,7 +1877,7 @@ begin
for i := 1 to rows do
begin
outline := format('%10s',[RowLabels[i-1]]);
outline := format('%12s ',[RowLabels[i-1]]);
for j := first to last do
begin
valstring := format('%12.3f ',[xmat[i-1,j-1]]);
@ -1921,18 +1925,19 @@ begin
while not done do
begin
AReport.Add('');
outline := 'Variables';
last := first + nflds;
if last >= NoVars -1 then
begin
done := true;
last := NoVars-1;
end;
outline := 'Variables '; // 12+1 long
for i := first to last do
outline := outline + Format('%13s', [Labels[i]]);
outline := outline + Format('%12s ', [Labels[i]]);
AReport.Add(outline);
outline := ' ';
outline := DupeString(' ', 12+1); //' ';
for j := first to last do
begin
valstring := Format('%12.3f ', [AVector[j]]);
@ -1955,10 +1960,11 @@ procedure scatplot(var x : DblDyneVec;
var
i, j, l, row, xslot : integer;
xdelta, maxy: double;
//xdelta: Double;
maxy: double;
incrementx, incrementy, rangex, rangey, swap : double;
plotstring : array[0..51,0..61] of char;
ymed, xmed : double;
//ymed, xmed : double;
height : integer;
overlap : boolean;
valuestring : string[2];
@ -1973,11 +1979,11 @@ begin
height := 40;
rangex := x_max - x_min ;
incrementx := rangex / 15.0;
xdelta := rangex / 60;
xmed := rangex / 2;
// xdelta := rangex / 60;
// xmed := rangex / 2;
rangey := y_max - y_min;
incrementy := rangey / height;
ymed := rangey / 2;
// ymed := rangey / 2;
{ sort in descending order }
for i := 1 to (nocases - 1) do