Plugin WindLab RPSCholeskyDecomposition

From LabRPS Documentation
Jump to navigation Jump to search

Generic plugin icon. Create your personal icon with the same name of the plugin PDF Check Tool Plugin

Description
This plugin implements a feature that allows to run the Cholesky decomposition of a matrix.

Plugin version: 1.0
Last modified: 03/12/2022
LabRPS version: All
Author: Koffi Daniel
Author
Koffi Daniel
Download
None
Features
RPS Cholesky Decomposition
Plugin Version
1.0
Date last modified
03/12/2022
LabRPS Version(s)
All
Default shortcut
None
See also
None

Introduction

This plugin implements a feature that allows to run the Cholesky decomposition d'une matrix.

Plugin WindLab RPSCholeskyDecomposition Screenshot 1.png

Plugin WindLab RPSCholeskyDecomposition Screenshot 2.png

Correlation Ergodicity Check Tool

This is the only RPS feature that the plugin implements. It belongs to the matrix tool group. The feature allows to run the Cholesky decomposition of a matrix. This feature is useful for the simulation method where for example the cross-power spectral density matrices have to be decomposed through the Cholesky decomposition.

Scripting

import WindLab
import GeneralToolsGui
import WindLabObjects
from LabRPS import Vector as vec
import LabRPS
def compute():
    installResuslt = WindLab.installPlugin("RPSCholeskyDecomposition")
    if not installResuslt:
       LabRPS.Console.PrintError("The installation the RPSCholeskyDecomposition has failed.\n")
       return None
    
    # Document
    doc = LabRPS.newDocument()

    # Simulation
    sim = WindLabObjects.makeSimulation(doc, "Simulation")
    if not sim:
       LabRPS.Console.PrintError("The simulation does not exist.\n")
       return None
  
    featureType = "RPS Cholesky Decomposition"
    featureGroup = "Matrix Tool"
  
    # create the feature
    decomposedPSD = WindLabObjects.makeFeature("MyNewFeature", sim.Name, featureType, featureGroup)
    
    # check if the created feature is good
    if not decomposedPSD :
       LabRPS.Console.PrintError("Error on creating the spectrum decomposition method.\n")
       return None
    
    # get the matrix to be decomposed 
    matrix = GeneralToolsGui.GeneralToolsPyTool.getMatrixByName("ComputeXCrossSpectrumMatrixPP_Real")

    # run the feature
    decomposedMatrix = sim.matrixToolCompute(matrix)

    GeneralToolsGui.GeneralToolsPyTool.showArrayAsMatrix(len(decomposedMatrix), len(decomposedMatrix[0]), decomposedMatrix)
    doc.recompute()

compute()