Jump to content

Recommended Posts

Posted (edited)

Russian EigenAutoIt Help has been updated (v.0.97). See previous messages

There is also example LeastSquares.au3 (addition for Tutorial Regression).

;===================================================
; LeastSquares test
; Valery Ivanov, October 2014
;===================================================
#include <GuiConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <GraphGDIPlus.au3>
#include "..\Eigen4AutoIt.au3"

Global Const $pi = 4*ATan(1)
Global $rows = 500, $variables = 2
Global $Groups = $rows-1
Global $X[$Groups+1], $Y[$Groups+1]
Global $XF[$Groups+1], $YF[$Groups+1]
Global $arrayA[$rows][$variables]

; Gui variables
Global $hWnd, $WinW = 600, $WinH = 400
Global $Title = "LeastSquares Modeling"
Global $Font="Times New Roman"
Global $Graph
Global $X_Min = 0, $X_Max = 0, $Y_Min = 0, $Y_Max = 0
Global $A = 0, $B = 0

_Eigen_Startup() 

; Create GUI window
$hWnd = GUICreate($Title, $WinW, $WinH)

$StartButton = GuiCtrlCreateButton("LeastSquares Fit", 10, 10, 200, 40)
GUICtrlSetFont(-1,8,600,0,$Font)

$Label1 = GuiCtrlCreateLabel("", $WinW/2, 140, 100, 20)
$Label2 = GuiCtrlCreateLabel("", $WinW/2, 160, 100, 20)

GUISetState()

While 1
  $Msg = GUIGetMsg(1)
  Switch $Msg[0]
   Case $GUI_EVENT_CLOSE
    Exit
   Case $StartButton
    CalculateResult()
   Case else
  EndSwitch
WEnd

exit

;========================
func CalculateResult()
 MakeLeastSquares() 
 CreateGraphPicture()
 GuiCtrlSetData($Label1,"A = " & $A)
 GuiCtrlSetData($Label2,"B = " & $B)
 endfunc

;========================
func MakeLeastSquares()
 populateData()
 $matA = _Eigen_CreateMatrix_FromArray ($arrayA)
 $matB = _Eigen_CreateMatrix ($rows,1)
 _Eigen_Copy_Acol_ToBcol ($matA,$matB,1,0)
 _Eigen_SetOnes_Col ($matA,1)
 $matX = _Eigen_LeastSquares ($matA, $matB)
 $A = _Eigen_ReadMatrixValue($matX,0,0)
 $B = _Eigen_ReadMatrixValue($matX,1,0)
endfunc

;===============================
func CreateGraphPicture()
local $p, $q, $dX
 For $i = 0 to $Groups
  $p = $X[$i]
  $q = $Y[$i]
  if $p > $X_Max then $X_Max = $p
  if $p < $X_Min then $X_Min = $p
  if $q > $Y_Max then $Y_Max = $q
  if $q < $Y_Min then $Y_Min = $q
 Next

 $dX = ($X_Max-$X_Min)/($Groups)
 For $i = 0 to $Groups
  $XF[$i] = $X_Min + $dX*($i-1)
  $YF[$i] = $A*$XF[$i]+$B
 Next

 ;----- Create GraphTime area -----
 if IsArray($Graph) then 
  _GraphGDIPlus_Delete($hWnd, $Graph)
  $Graph = 0
 endif

 $Graph = _GraphGDIPlus_Create($hWnd,40,100,$WinW-80,$WinH-150,0xFF000000,0xFFFFFFDD)

 ;=============================
 ; Graph
 ;----- Set Text Color -----
 ;_GraphGDIPlus_Set_TextColor($Graph, 0x0000AA)
 ;----- Set X axis range from 0 to $X_Max -----
 _GraphGDIPlus_Set_RangeX($Graph,$X_Min,$X_Max,10,1,2)

 ;----- Set Y axis range from 0 to $YT_Max -----
 _GraphGDIPlus_Set_RangeY($Graph,$Y_Min,$Y_Max,10,1,2)
 _GraphGDIPlus_Set_GridX($Graph,1,0xFF69BE93)
 _GraphGDIPlus_Set_GridY($Graph,1,0xFF69BE93)

;----- Set line color and size -----
 _GraphGDIPlus_Set_PenColor($Graph,0xFFFF3287)
 _GraphGDIPlus_Set_PenSize($Graph,8)

;=============================
;----- draw lines -----
;=============================
 $First = True
 For $i = 0 to $Groups
  $p = $X[$i]
  $q = $Y[$i]
  If $First = True Then 
    _GraphGDIPlus_Plot_Start($Graph,$p,$q)
    $First = False
  endif
  _GraphGDIPlus_Plot_Dot($Graph,$p,$q)
  _GraphGDIPlus_Refresh($Graph)
 Next

;----- Set line color and size -----
 _GraphGDIPlus_Set_PenColor($Graph,0xFF325D87)
 _GraphGDIPlus_Set_PenSize($Graph,6)

 $First = True
 For $i = 0 to $Groups
  $p = $XF[$i]
  $q = $YF[$i]
  If $First = True Then 
    _GraphGDIPlus_Plot_Start($Graph,$p,$q)
    $First = False
  endif
  _GraphGDIPlus_Plot_Line($Graph,$p,$q)
  _GraphGDIPlus_Refresh($Graph)
 Next
endfunc

;========================
Func populateData()
local $p, $Mu, $Sigma = 0.1
local $A = 0.998198
local $B = 0.103261

For $i = 0 to Round(($Groups-1)/2,0)
  $arrayA[2*$i][0] = Random (0.1, 10)
  $arrayA[2*$i+1][0] = $arrayA[2*$i][0]
Next

For $i = 0 to Round(($Groups-1)/2,0)
  $Mu = $A*$arrayA[2*$i][0] + $B
  $Sigma = 0.1*$Mu
  GaussDistribution($arrayA[2*$i][1], $arrayA[2*$i+1][1], $Mu, $Sigma)
Next

For $i = 0 to $Groups
  $X[$i] = $arrayA[$i][0]
  $Y[$i] = $arrayA[$i][1]
Next

endfunc

;========================
Func GaussDistribution(ByRef $x1, ByRef $x2, $Mu, $Sigma)
local $r1, $r2
 $r1 = Random() ; first random value
 $r2 = Random() ; second random value
 $x1 = $Mu + $Sigma*Cos(2*$pi*$r1) * Sqrt(-2*Log($r2)) ; first normal random value
 $x2 = $Mu + $Sigma*Sin(2*$pi*$r1) * Sqrt(-2*Log($r2)) ; second normal random value
 return
endfunc

It uses GraphGDIPlus UDF from here

'?do=embed' frameborder='0' data-embedContent>>

and shows how to create the normal distribution data.

------------------------------------------

And other more complicated example LeastSquares3.au3 (addition for Tutorial Regression).

;===================================================
; LeastSquaresQuad test
; Valery Ivanov, October 2014
;===================================================
#include <GuiConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <GraphGDIPlus.au3>
#include "..\Eigen4AutoIt.au3"

Global Const $pi = 4*ATan(1)
Global $rows = 512, $variables = 2
Global $Groups = $rows-1
Global $X[$Groups+1], $Y[$Groups+1]
Global $XF[$Groups+1], $YF[$Groups+1]
Global $arrayA[$rows][$variables]

; Gui variables
Global $hWnd, $WinW = 600, $WinH = 400
Global $Title = "LeastSquaresQuad Modeling"
Global $Font="Times New Roman"
Global $Graph
Global $X_Min = 0, $X_Max = 0, $Y_Min = 0, $Y_Max = 0
Global $A = 0, $B = 0, $C = 0

_Eigen_Startup() 

; Create GUI window
$hWnd = GUICreate($Title, $WinW, $WinH)

$StartButton = GuiCtrlCreateButton("LeastSquares QuadFit", 10, 10, 200, 40)
GUICtrlSetFont(-1,8,600,0,$Font)

$Label1 = GuiCtrlCreateLabel("", 100, 140, 100, 20)
$Label2 = GuiCtrlCreateLabel("", 100, 160, 100, 20)
$Label3 = GuiCtrlCreateLabel("", 100, 180, 100, 20)

GUISetState()

While 1
  $Msg = GUIGetMsg(1)
  Switch $Msg[0]
   Case $GUI_EVENT_CLOSE
    Exit
   Case $StartButton
    CalculateResult()
   Case else
  EndSwitch
WEnd

exit

;========================
func CalculateResult()
 MakeLeastSquares3() 
 CreateGraphPicture()
 GuiCtrlSetData($Label1,"A = " & $A)
 GuiCtrlSetData($Label2,"B = " & $B)
 GuiCtrlSetData($Label3,"C = " & $C)
 endfunc

;========================
func MakeLeastSquares3()
  populateData()
; For $i = 0 to $Groups
;  $X[$i] = $arrayA[$i][0]
;  $Y[$i] = $arrayA[$i][1]
; Next
 
 $matA = _Eigen_CreateMatrix_FromArray ($arrayA)
 $matB = _Eigen_CreateMatrix ($rows,1)
 _Eigen_Copy_AcolToBcol ( $matA, $matB, 1, 0 ) 
 _Eigen_SetOnes_Col ( $matA, 1 )
 $matN = _Eigen_CreateMatrix ($rows, 3 )
 $startRow_src = 0
 $startCol_src = 0
 $blockRows = $rows
 $blockCols = 2
 $startRow_dst = 0
 $startCol_dst = 1
 _Eigen_Copy_AblockToBblock ( $matA, $matN, $startRow_src, $startCol_src, $blockRows, $blockCols, $startRow_dst, $startCol_dst )
 _Eigen_Copy_AcolToBcol ( $matN, $matN, 1, 0 )
 _Eigen_CwiseUnaryOp_Col ( $matN, 0, "square" )
 ;_MatrixDisplay ( $matN, "quadratic kernel" ) 
 ;_MatrixDisplay ( $matB, "observ B" ) 
 $matX=_Eigen_LSQ_NormEq($matN, $matB)
; _MatrixDisplay($matX,"quadratic LSQ")
 $A = _Eigen_ReadMatrixValue($matX,0,0)
 $B = _Eigen_ReadMatrixValue($matX,1,0)
 $C = _Eigen_ReadMatrixValue($matX,2,0)
endfunc

;===============================
func CreateGraphPicture()
local $p, $q, $dX
 For $i = 0 to $Groups
  $p = $X[$i]
  $q = $Y[$i]
  if $p > $X_Max then $X_Max = $p
  if $p < $X_Min then $X_Min = $p
  if $q > $Y_Max then $Y_Max = $q
  if $q < $Y_Min then $Y_Min = $q
 Next

 $dX = ($X_Max-$X_Min)/($Groups)
 For $i = 0 to $Groups
  $p = $X_Min + $dX*($i-1)
  $XF[$i] = $p
  $YF[$i] = $A*$p*$p+$B*$p+$C*$p
 Next

 ;----- Create GraphTime area -----
 if IsArray($Graph) then 
  _GraphGDIPlus_Delete($hWnd, $Graph)
  $Graph = 0
 endif

 $Graph = _GraphGDIPlus_Create($hWnd,40,100,$WinW-80,$WinH-150,0xFF000000,0xFFFFFFDD)

 ;=============================
 ; Graph
 ;----- Set Text Color -----
 ;_GraphGDIPlus_Set_TextColor($Graph, 0x0000AA)
 ;----- Set X axis range from 0 to $X_Max -----
 _GraphGDIPlus_Set_RangeX($Graph,$X_Min,$X_Max,10,1,2)

 ;----- Set Y axis range from 0 to $YT_Max -----
 _GraphGDIPlus_Set_RangeY($Graph,$Y_Min,$Y_Max,10,1,2)
 _GraphGDIPlus_Set_GridX($Graph,1,0xFF69BE93)
 _GraphGDIPlus_Set_GridY($Graph,1,0xFF69BE93)

;----- Set line color and size -----
 _GraphGDIPlus_Set_PenColor($Graph,0xFFFF3287)
 _GraphGDIPlus_Set_PenSize($Graph,8)

;=============================
;----- draw lines -----
;=============================
 $First = True
 For $i = 0 to $Groups
  $p = $X[$i]
  $q = $Y[$i]
  If $First = True Then 
    _GraphGDIPlus_Plot_Start($Graph,$p,$q)
    $First = False
  endif
  _GraphGDIPlus_Plot_Dot($Graph,$p,$q)
  _GraphGDIPlus_Refresh($Graph)
 Next

;----- Set line color and size -----
 _GraphGDIPlus_Set_PenColor($Graph,0xFF325D87)
 _GraphGDIPlus_Set_PenSize($Graph,6)

 $First = True
 For $i = 0 to $Groups
  $p = $XF[$i]
  $q = $YF[$i]
  If $First = True Then 
    _GraphGDIPlus_Plot_Start($Graph,$p,$q)
    $First = False
  endif
  _GraphGDIPlus_Plot_Line($Graph,$p,$q)
  _GraphGDIPlus_Refresh($Graph)
 Next
endfunc

;========================
Func populateData()
local $p, $Mu, $Sigma = 0.1
local $A = -0.072
local $B = 1.25
local $C = -0.083

For $i = 0 to Round(($Groups-1)/2,0)
  $arrayA[2*$i][0] = Random (0.1, 10)
  $arrayA[2*$i+1][0] = $arrayA[2*$i][0]
Next

For $i = 0 to Round(($Groups-1)/2,0)
  $p = $arrayA[2*$i][0]
  $Mu = $A*$p*$p + $B*$p +$C
  $Sigma = 0.1*$Mu
  GaussDistribution($arrayA[2*$i][1], $arrayA[2*$i+1][1], $Mu, $Sigma)
Next

For $i = 0 to $Groups
  $X[$i] = $arrayA[$i][0]
  $Y[$i] = $arrayA[$i][1]
Next

endfunc

;========================
Func GaussDistribution(ByRef $x1, ByRef $x2, $Mu, $Sigma)
local $r1, $r2
 $r1 = Random() ; first random value
 $r2 = Random() ; second random value
 $x1 = $Mu + $Sigma*Cos(2*$pi*$r1) * Sqrt(-2*Log($r2)) ; first normal random value
 $x2 = $Mu + $Sigma*Sin(2*$pi*$r1) * Sqrt(-2*Log($r2)) ; second normal random value
 return
endfunc

It fits a quadratic curve to modelling data.

Edited by ValeryVal

The point of world view

Posted

:guitar: :guitar:

Beta version 2.0 released, the first version to support complex (and integer) matrices, and another 4.4 MB of content added, including 22 new Swap functions, various complex-specific functions, and a handy lookup table displayed by _Eigen_Show_Dllfunctions(), which shows which function variants are available in the dlls (integer, real float, real double, complex float, complex double, real part of complex float, imaginary part of complex float, real part of complex double, imaginary part of complex double). To act on integer, real, or complex matrices as a whole, simply select the associated work environment and call the original function. Alternatively, to act only on the real or imaginary part of a complex matrix, append suffix _Real or _Imag to the function name (while acting in a complex work environment, of course). Note that not all variants are supported for all functions (for example statistics are supported only for reals). The help file ( :whistle: sorry, ValeryVal) and the dlls have also gained significantly more mass. Furthermore, the new MatrixFileConverter has all its complex-related controls unlocked for importing from, and exporting to other file formats. Two new EigenTest scripts (Swap and Complex) have been added in the EigenTest subdirectory.

Regrettably, the complex eigensolvers are still missing. These will hopefully be added before the end of the year, once the dust from this overhaul has settled a bit. :closedeyes:

 

(!) Note: Almost every function has been edited in the wrapper library to make this new version possible, which means that you can expect more glitches than before, and not necessarily restricted to operations involving complex matrices. :( The number of function permutations to test now vastly exceeds my own endurance and patience, so it is likely you'll encounter bugs I have yet to discover myself (bug reports welcome, especially if you add a note how to fix it :D ).

 

Hope it helps.

RT B)

My Contributions and Wrappers

Posted

Thank you for complex working in concerning with v.2.

I know that you have (in shop) in English this great

The Theory of Matrices, Volume 2 by  F. R. Gantmacher:

http://www.ams.org/bookstore-getitem/item=CHEL-133-H

This treatise, by one of Russia's leading mathematicians, gives in easily accessible form a coherent account of matrix theory with a view to applications in mathematics, theoretical physics, statistics, electrical engineering, etc.

Could we plan to solve by Eigen4AutoIt any tasks from this treatise?

:-)

The point of world view

Posted (edited)

You're welcome, ValeryVal. ;)  It was partly your PMs that induced me to move this task up on my todo list.

As far as Gantmacher's treatise is concerned, I won't be taking up that challenge personally, but it is definitely an interesting project. If there are particular operations you need (and you have the time and inclination), perhaps it is possible to use Eigen4AutoIt's function building blocks to write a matrix function for it yourself. As I wrote at the bottom of the first post in this thread: if people write E4A-based scripts or functions that perform generally useful tasks, then I can provide a translation into template-optimised compiled dll code as a stand-alone new function, plus a matching E4A wrapper. I would also need some (small) example data to test my implementation. Another route would be for you to contact the Eigen developers directly via Eigen's website, and make them aware of these useful techniques (although it would probably be best to start small, with one or two specific examples you'd like to see them implement, rather than asking them to implement the entire treatise). But you have to remember that these people all have day jobs too, so progress may be slow unless you were to contribute to the (C++) code yourself. :mellow: I am myself not an Eigen developer, so unless Gantmacher's techniques can be written using existing E4A functions (or similarly basic ones), I wouldn't be able to implement them anyway.

Personally speaking, my prime concern is to establish the computational bridge between Eigen and AutoIt, by implementing most of Eigen's Dense matrix functionality through E4A. I'm trying to create a UDF foundation upon which others can build their own numerical applications, with the added benefit of not having to compile them first (which greatly speeds up the testing phase). In addition, it's supposed to be(come) a matrix computing sandbox, where students can play and discover the basic concepts in a friendlier environment than the traditional commercial maths packages.

Once the complex eigensolvers are added and the code is stable again, I can concentrate on extra stuff (if I find the time). But my first thoughts would be in the direction of simpler additions, such as FFT and more statistics (closer to my own hunting grounds; I hardly ever use complex matrices myself; E4A version 2.0 was produced mostly for the fans out there, such as yourself). :sweating:

My goal is to make matrix computing as easy and accessible as possible, for the widest possible audience. That's why my initial focus is on the basic infrastructure, the predictable function naming convention, the QuickStart manual, the ever-growing Help file, the Tutorials, and so forth (other enhancements are in the pipeline... :rambo: ). I think you are probably making a bigger contribution already by providing the Russian translations :thumbsup: than if you were to write some highly advanced complex matrix functions (but feel free to prove me wrong).

Edited by RTFC

My Contributions and Wrappers

  • 2 weeks later...
Posted

You're welcome, ValeryVal. ;)  It was partly your PMs that induced me to move this task up on my todo list.

As far as Gantmacher's treatise is concerned, I won't be taking up that challenge personally, but it is definitely an interesting project. If there are particular operations you need (and you have the time and inclination), perhaps it is possible to use Eigen4AutoIt's function building blocks to write a matrix function for it yourself.

 

Now I have a difficulty with some simple example from Gantmacher's treatise (vol.1).

Let we have the rectangular matrix $matA | (4x3) |

Global $A[3][4] = [[1,-1,2,0],[-1,2,-3,1],[0,1,-1,1]]

$matA=_Eigen_CreateMatrixFromArray($A)

How can I obtain the pseudo-inverse matrix for $matA? It's known that this pseudo-inverse unique matrix $matI | (4x3) | exists and has the following content:

$matI => {{1/3,0.1/3},{1/9,1/9,2/9},{2/9,-1/9,1/9},{4/9,1/9,5/9}}

Thank you.

The point of world view

Posted (edited)

Hi ValeryVal,

First, thanks again for the latest update of the Russian translation of the Help file, and I apologise in advance for adding a few more topics (see below). :>

Second, regarding obtaining the pseudo-inverse, this involves two steps:

1) download and install the latest version 2.1 of Eigen4AutoIt (uploaded today!)

2) Run this script:

#include "Eigen4AutoIt.au3" ; use your own path if located elsewhere

_Eigen_StartUp()

Global $A[3][4] = [[1,-1,2,0],[-1,2,-3,1],[0,1,-1,1]]

$matA = _Eigen_CreateMatrix_FromArray ( $A )
_MatrixDisplay ( $matA, "matrix A" )

_Eigen_SetActiveMatrix ( "I" )
_Eigen_Decomp_JacobiSVD ( $matA )

$matI = _Eigen_GetActiveMatrix ( "I" )
_MatrixDisplay( $matI, "pseudo-inverse of A" )

_Eigen_CleanUp()

This works for me. :whistle:

There were still some issues with the template-optimised Penrose-Moore algorithm in version 2.0 :huh2:  that should be fixed now. I also noticed none of the previous versions of JacobiSVD considered the possibility that a user might want to obtain just the pseudo-inverse I without also retrieving matrices U or V. :doh: Note that if you wish to use JacobiSVD for linear solving, it now has an extra boolean flag (the only script-breaking change, as all trailing parameters shift) to bring its response in line with those of the eigensolvers I've added in the latest version 2.1. B)

Edit:the code example is included not so much for ValeryVal's benefit (who, after translating the entire Help file, probably knows E4A better than I do), but to show people new to E4A how easy it is to perform complicated mathematical operations.

Edited by RTFC

My Contributions and Wrappers

Posted

Hi ValeryVal,

First, thanks again for the latest update of the Russian translation of the Help file, and I apologise in advance for adding a few more topics (see below). :>

Second, regarding obtaining the pseudo-inverse, this involves two steps:

1) download and install the latest version 2.1 of Eigen4AutoIt (uploaded today!)

2) Run this script:

#include "Eigen4AutoIt.au3" ; use your own path if located elsewhere

_Eigen_StartUp()

Global $A[3][4] = [[1,-1,2,0],[-1,2,-3,1],[0,1,-1,1]]

$matA = _Eigen_CreateMatrix_FromArray ( $A )
_MatrixDisplay ( $matA, "matrix A" )

_Eigen_SetActiveMatrix ( "I" )
_Eigen_Decomp_JacobiSVD ( $matA )

$matI = _Eigen_GetActiveMatrix ( "I" )
_MatrixDisplay( $matI, "pseudo-inverse of A" )

_Eigen_CleanUp()

This works for me. :whistle:

There were still some issues with the template-optimised Penrose-Moore algorithm in version 2.0 :huh2:  that should be fixed now. I also noticed none of the previous versions of JacobiSVD considered the possibility that a user might want to obtain just the pseudo-inverse I without also retrieving matrices U or V. :doh: Note that if you wish to use JacobiSVD for linear solving, it now has an extra boolean flag (the only script-breaking change, as all trailing parameters shift) to bring its response in line with those of the eigensolvers I've added in the latest version 2.1. B)

 

Your code is amazingly like my one. Though your new version (2.1) shows true solution instead of zero-matrix $matI obtained from version 2.0.

o:)

Cheers

The point of world view

Posted (edited)

As you may have gathered from my previous post for ValeryVal's benefit, dear reader, today sees the (slightly premature) birth of version 2.1. :) Full list of additions, changes, and fixes in the History/Changelog in the .chm Help file, here I'll mention only the highlights:

  • two matrix replication functions _Eigen_CreateMatrix_FromA and _Eigen_CreateMatrix_FromA_Transposed; these allow you to create and "tile" a larger matrix with multiple copies of the values of an input matrix, giving the (integer) number of horizontal and vertical duplicates (1 = do not duplicate). Faster than doing multiple block copies.
  • new section EigenSolvers, with five EigenSolvers plus two new decompositions (ComplexSchur and Tridiagonalization) with complex outputs; but caveat lector, this part of Eigen is underdeveloped, and seems a rather disjointed effort by various contributors, so there's little overarching structure to these functions: one has elaborate switches, another doesn't even return eigenvectors (which seems to me to be missing the point of an eigensolver :blink::huh:) It may also be of benefit to study the table in the new section's header page in the Help file, which list the matrix type (i.e., real or complex) for inputs and for each of the multiple optional outputs (whose type can be fixed real, fixed complex, dependent on the input's type, or dependent on the actual values in the input :x:censored: ; in short, acres of fun for the entire family! : )
  • both the EigenSolvers and JacobiSVD now support optional parameter $eigenvaluesAsVector (sorry folks, this is a script-breaking change for JacobiSVD), which allows you to obtain the eigenvalues not just as a diagonal matrix, but also as a Colvector. Statistics functions PCA and PCF are unaffected, and still always return the eigenvalues as a Rowvector, for technical reasons.
  • For High-Throughput Computing purposes, I've added flag $HideErrorMsg, controlled by _Eigen_HideErrors() and _Eigen_ShowErrors(), to prevent all non-fatal dialogs from interrupting a work flow (just remember to also switch off the warning messages, with _Eigen_HideWarnings()). Hiding errors is of course not recommended, but may be useful if a single failed computation is less important than a large batch of jobs being completed.
  • As mentioned in my previous post, the pseudo-inverse algorithm in JacobiSVD has been revised again.
  • The introduction of complex matrices plus the general overhaul that entailed created some new "instabilities", :idiot:o:)  shall we say, plus a bug so vicious, multi-tentacled, and lethal that it probably inspired the alien mimics in "Edge of Tomorrow" (now slightly killed). So even though version 2.1 is far from perfect, I would suggest you use this new one instead of 2.0. :rip:

This release more or less completes (my implementation of) the EigenDense module of Eigen. It'll probably take another bugfix release to iron out all the creases, as I've made this version available a bit sooner than I'd have liked, and more rigorous testing awaits.

Edited by RTFC

My Contributions and Wrappers

Posted (edited)

:sorcerer: As of today, the entire Help file is available online.

@ValeryVal: I'll probably implement this alternative pseudo-inverse algorithm you suggested in the next release. I already got an E4A script version to work, but I won't be able to tell whether it's actually faster than JacobiSVD's implementation until I code it in C++/Eigen. I'm a bit worried that the (real) inversion might cause a bottleneck. Those published timings don't convince me at all, as they presumably all ran within Matlab (interpreter?), which is like asking a tortoise to identify the fastest bicycle.

Edit: never mind, see next post. ;)

Edited by RTFC

My Contributions and Wrappers

Posted (edited)

:oops: Statistics fans will have noticed that the latest release (2.1) curiously seemed to have forgotten about stats functions for real float inputs. This is because this module was inadvertently still disabled when I generated the dlls yesterday. :>  In my (admittedly weak) defense, the dlls now comprise over thirty thousand lines of (very similar-looking) C++ code, and take 2 x half an hour to compile on my humble machine, so whenever I tinker with new bits I tend to switch off most other parts, and I failed to reinstate that one section before the final render. :idiot:

So apologies to those who have already downloaded it over the past 30 hrs or so. I've now uploaded a fresh package that should have everything in, including a little extra to make it up to you, courtesy of ValeryVal: function _Eigen_PseudoInverse(), using the algorithm by Courrieu he posted above (works for real inputs only for now). This technique becomes increasingly faster than JacobiSVD's pseudo-inverse for larger matrices.

Edited by RTFC

My Contributions and Wrappers

  • 2 weeks later...
Posted (edited)

:party: Xmas comes early, with the release of version 2.2!

There are two main additions in this one, one for beginners, and one for advanced users.

For beginners, there's the Function Selector tool, an Irrlicht-driven 3D-animated user-interactive lookup table (see small picture in first post), to quickly find that function you seek, survey its various options, read its description, and copy it to the clipboard without prior selection. It can also add auto-completion and tooltips for all main E4A functions to Scite, if you so desire. NB Animation may be slow/look poor on old machines/small graphics cards. The GUI contains spinning barrels, the first control I made myself. It took me about three months to get this to work. :think::shhh:

I've added both the exe (plus the Irrlicht dlls, should work out-of-the-box) and the source, but if you wish to get it to run in Scite or compile it yourself, you'll need two contributions by other forum members, to whom I owe many thanks and gratitude :thumbsup: (acknowledgements in source):

  • RESHv3.1, by Beege, thread is >here, and
  • au3Irrlicht2, by JRowe and linus, with additional contributions by ProgAndy and smashly; thread is >here. This is an AutoIt port of Frank Dodd's IrrlichtWrapper library; its website is here.

 

For advanced users, I've added about a thousand global constants (with prefix $E4AC_, in the new #include file E4Aconstants.au3) from three tables, which you can view in full (with brief descriptions by the compilers) using new functions _Eigen_Show_Nist/Sykora1/Sykora2(). Sykora1 is mathematical, Nist and Sykora2 are more physics-oriented, mostly particle physics and astrophysics (NB1: these last two have considerable overlap; NB2: Sykora's compilations were last updated in 2012, Nist's list in 2010). Both sources are copyright-free. Please let me know if you'd like me to incorporate other web-based open-access/public domain constants.

Although these data are open access, I nevertheless want to thank both Stanislav Sykora and the U.S. National Institute of Standards and Technology for providing these data. :)

For all remaining changes, fixes, and minor additions, see the Changelog in the Help file.

PS the online Help (currently v2.1) will be updated to v2.2 in the near future.

PPS the package has become quite a bit larger now, mostly due to the Irrlicht environment. The associated dlls will also be part of E4A's future (read: next year's) graphics support, so they're not just inlcuded to support the Function Selector tool; htey will be integrated more fully into the E4A environment.

Edited by RTFC

My Contributions and Wrappers

Posted

Three bullet points, FYI:

  • just discovered that Eigen4AutoIt also runs under Wine on most flavours of Linux ^_^ (see the installation page in the online Help (not yet updated in chm file). NB Irrlicht-dependent external tools (such as the Function Selector) may not work on Linux.
  • Online Help is now udated to version 2.2.
  • Many thanks once again to ValeryVal for his translation efforts! :)  Hope your new avatar pic does not reflect how you felt afterwards. :D

My Contributions and Wrappers

Posted (edited)

 

Many thanks once again to ValeryVal for his translation efforts! :)  Hope your new avatar pic does not reflect how you felt afterwards. :D

 

No.

My multivariant pdf modelling (by means decomposition of covariance matrix) promises me the way to survive during the 'crude oil price breakdown'.period according to

Multivariate Survival Models

http://data.princeton.edu/pop509/MultivariateSurvival.pdf

:D

Edited by ValeryVal

The point of world view

Posted

@RTFC:

Would you like to update unexpected behavior functions - _CwiseScalarOp... and _CwiseUnaryOp?

From Help:

 Apply [operator, scalar] to each cell of matrix A, storing the result in-place

Maybe it would be better to have two variant: - to store in-place and not (default)

These functions have tacit return by ref for passed matrix.

The point of world view

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...