The AHA Model  Revision: 12809
Reference implementation 04 (HEDG02_04)
commondata::rescale Interface Reference

Arbitrary rescales value(s) from one range (A:B) to another (A1:B1). More...

Collaboration diagram for commondata::rescale:

Public Member Functions

elemental real(srp) function rescale_1 (value_in, A1, B1)
 Rescale a real variable with the range 0:1 to have the new range A1:B1. More...
 
elemental real(srp) function rescale_full (value_in, A, B, A1, B1)
 Rescale a real variable with the range A:B to have the new range A1:B1. More...
 

Detailed Description

Arbitrary rescales value(s) from one range (A:B) to another (A1:B1).

Rescales values from A:B to A1:B1, or (if only A1:B1 are provided) from 0:1 to A1:B1.

Note
Elemental functions.

Definition at line 5341 of file m_common.f90.

Member Function/Subroutine Documentation

◆ rescale_1()

elemental real(srp) function commondata::rescale::rescale_1 ( real(srp), intent(in)  value_in,
real(srp), intent(in)  A1,
real(srp), intent(in)  B1 
)

Rescale a real variable with the range 0:1 to have the new range A1:B1.

Warning
The function does not check if value_in lies within [0:1].
Note
Code for wxMaxima equation solve:
solve( [a1=0*k+b, b1=1*k+b] ,[k,b] );

Definition at line 5734 of file m_common.f90.

◆ rescale_full()

elemental real(srp) function commondata::rescale::rescale_full ( real(srp), intent(in)  value_in,
real(srp), intent(in)  A,
real(srp), intent(in)  B,
real(srp), intent(in)  A1,
real(srp), intent(in)  B1 
)

Rescale a real variable with the range A:B to have the new range A1:B1.

Linear transformation of the input value value_in such k * value_in + beta, where the k and beta coefficients are found by solving a simple linear system: $ \left\{\begin{matrix} A_{1}= k \cdot A + \beta; \\ B_{1}= k \cdot B + \beta \end{matrix}\right. $. It has this solution: $ k=\frac{A_{1}-B_{1}}{A-B}, \beta=-\frac{A_{1} \cdot B-A \cdot B_{1}}{A-B} $

Warning
The function does not check if value_in lies within [A:B].
Note
Code for wxMaxima equation solve:
solve( [a1=a*k+b, b1=b*k+b] ,[k,b] );

Definition at line 5706 of file m_common.f90.


The documentation for this interface was generated from the following file: