Recent

Author Topic: LMath and Components 0.6.0 released  (Read 744 times)

glorfin

  • Full Member
  • ***
  • Posts: 130
  • LMath supporter
LMath and Components 0.6.0 released
« on: April 17, 2021, 09:56:45 pm »
  • Package lmDSP created, which contains functions for digital signal processing. It includes uFFT unit for fast Fourier transform, moved from lmOptimum package, and new units: uConvolutions, for convolution of two arrays of Float, uDFT unit, for digital Fourier transform of signals with length other then degrees of two. Importantly, this unit is distributed under GPL license, not LGPL, as the rest of the library. Unit uFilters contains procedures for various data filtering: low pass, high pass, bandstop and bandpass.
  • Call convention of many functions and procedures working with arrays is revisited. Mostly for historical reasons, related in part to Fortran inheritance, in part to limitations of old Pascal implementations, standard API of DMath/LMath includes passing of a dynamic array (TVector, TIntVector, etc) and bounds of a slice which is actually processed by a function (Lb, Ub).

    Function Apply(V:TVector; Lb, Ub:integer; Func:TFunc)

    is an example of such call. This approach has an important limitation that only dynamic, but not static, arrays may be used with LMath. Besides, mandatory passing of bounds, even if the whole array must be processed, makes the call too complicated. Modern Pascal implementations have open array parameter mechanism and even allow to pass slices of arrays, both static and dynamic. Therefore, as an experimental feature, LMath 0.6 introduced new form of function calls where instead of V:TVector, Lb, Ub:integer, open array is passed. Apply in this new form looks like:

    Apply(var V:array of Float, Func:TFunc);

    In most cases, old forms are kept for backward compatibility as overloaded functions. Operators over arrays defined in uMatrix unit were also redefined for open arrays. This makes them much more flexible. For example, it is possible now to write:

    V := MyArr[4..9]+AnotherArr[7..12];

    which will create V:TVector with length 6, containing sums of elements MyArr[4]+AnotherArr[7], etc.
    Work with new call conventions is still in progress and this feature is considered experimental. For now, functions and procedures from uMatrix, uVecUtils, uCompVecUtils, uMedian, uMeanSD, uFFT got these new forms. New units have only form with open arrays. Unfortunately, there is now way to define open two-dimentional arrays, therefore all operations with TMatrix keep old form only.
    It must be noted, that in some cases subtle differences in implementation of functions in these two forms exist. For example,

    function Median(V:TVector,Lb,Ub:integer);

    gets V by reference, as always with dynamic arrays and rearranges it in the process of median search. In contrast,

    function Median(V:array of Float);
    gets it by value, hence, old array remains unchanged. This is done deliberately to avoid unwanted side effect. In most other cases open arrays are passed by reference, either as var or constref parameters.
  • In uTypes unit, Euler constant defined (base if natural logarithms).
  • In uComplex unit, in one of the previous releases function CReal was erroneously renamed to CFloat. Now it is corrected.
  • In uComplex unit, functions CToPolar and CToRect added, for conversions between polar and rectangular representations of complex numbers.
  • New unit uCompVecUtils in lmMathUtil package. The unit implements several utility routines for work with arrays of Complex numbers, somewhat similar to uVecUtils for Float.
  • Unit uEval now initializes variables Pi and Euler with the values of corresponding constants, so they can be used in expressions. In principle, a user can modify them, but it is of course is not advisable.
Official site for download:
https://sourceforge.net/projects/lmath-library/

« Last Edit: April 17, 2021, 10:49:46 pm by glorfin »

VTwin

  • Hero Member
  • *****
  • Posts: 990
  • Former Turbo Pascal 3 user
Re: LMath and Components 0.6.0 released
« Reply #1 on: April 17, 2021, 10:15:02 pm »
Very nice, I am glad to see continued work on LMath.

So the new uConvolutions and uDFT are GPL? I use uFFT in a project that I anticipate to go GPL, but it is not currently open.

Any particular reason to choose GPL over LGPL?
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.0
macOS 10.13.6: Lazarus 2.0.12 (64 bit Cocoa)
Ubuntu 18.04.3: Lazarus 2.0.12 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.0.12 (64 bit on VBox)

glorfin

  • Full Member
  • ***
  • Posts: 130
  • LMath supporter
Re: LMath and Components 0.6.0 released
« Reply #2 on: April 17, 2021, 10:37:08 pm »
Only uDFT is GPL. Because it is translation-adaptation of the code, distributed under GPL.
uFilters and uConvolutions are LGPL, as everything else in the library.

VTwin

  • Hero Member
  • *****
  • Posts: 990
  • Former Turbo Pascal 3 user
Re: LMath and Components 0.6.0 released
« Reply #3 on: April 17, 2021, 10:39:47 pm »
Only uDFT is GPL. Because it is translation-adaptation of the code, distributed under GPL.
uFilters and uConvolutions are LGPL, as everything else in the library.

Got it, thanks. I thought perhaps that was the case.
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.0
macOS 10.13.6: Lazarus 2.0.12 (64 bit Cocoa)
Ubuntu 18.04.3: Lazarus 2.0.12 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.0.12 (64 bit on VBox)

ChrisR

  • Full Member
  • ***
  • Posts: 202
Re: LMath and Components 0.6.0 released
« Reply #4 on: April 22, 2021, 08:42:17 pm »
I do not believe the provided files can be compiled.  The documentation "LMath0_6.pdf" describes that I need to load a whole series of packages in a specific order. It might be nice if all these packages could be somehow combined to a single package. Regardless, when I try to install lmgenmath.lpk, it reports that the unit utypes.pas can not find the file types.inc. The file "types.inc" seems important, as without it the type of "Float" is unknown (e.g. the unit refers to "Float" not "Double").

Looks like a lot of great potential.

VTwin

  • Hero Member
  • *****
  • Posts: 990
  • Former Turbo Pascal 3 user
Re: LMath and Components 0.6.0 released
« Reply #5 on: April 22, 2021, 10:41:40 pm »
I did not yet compile the new version, but I had similar issues previously. Trying to use one package lead to many unresolved dependencies.

I noted this to glorfin, and he provided a single package "lmath.pkg". Try adding this instead of individual packages.
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.0
macOS 10.13.6: Lazarus 2.0.12 (64 bit Cocoa)
Ubuntu 18.04.3: Lazarus 2.0.12 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.0.12 (64 bit on VBox)

glorfin

  • Full Member
  • ***
  • Posts: 130
  • LMath supporter
Re: LMath and Components 0.6.0 released
« Reply #6 on: April 23, 2021, 01:34:54 am »
Hi! One file, uTypes.inc, was missing in lmath_06_components_05.zip (thanks to Jean SUZINEA for pointing out). Now I included it into the archive. So, please, download it once more and everything will work.

Sorry for inconvenience!

VTwin

  • Hero Member
  • *****
  • Posts: 990
  • Former Turbo Pascal 3 user
Re: LMath and Components 0.6.0 released
« Reply #7 on: April 23, 2021, 04:06:45 am »
Thanks!
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.0
macOS 10.13.6: Lazarus 2.0.12 (64 bit Cocoa)
Ubuntu 18.04.3: Lazarus 2.0.12 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.0.12 (64 bit on VBox)

glorfin

  • Full Member
  • ***
  • Posts: 130
  • LMath supporter
Re: LMath and Components 0.6.0 released
« Reply #8 on: April 23, 2021, 04:08:53 am »
Well, thank you for the hint. I am really embarrassed...

 

TinyPortal © 2005-2018