rfa 0.5.9

A port ERFA to Rust.
Documentation

///  Multiply a p-vector by an r-matrix.
///
///  Given:
///   *r r-matrix
///   *p  p-vector
///
///  Returned:
///   *rp r * p
///  This revision:  2021 May 11

pub fn rxp(r: &[[f64; 3]; 3], p: &[f64; 3], rp: &mut [f64; 3])
{

    for j in 0..3 {
        let mut w = 0.0;
        for i in 0..3 {
            w += r[j][i] * p[i];
        }
        rp[j] = w;
    }
 
 
 /* Finished. */
 
}

///  Multiply a pv-vector by an r-matrix.
///
///  Given:
///   *  r  r-matrix
///   *  pv pv-vector
///
///  Returned:
///   * rpv r * pv
///
/// # Notes:
///
///  1) The algorithm is for the simple case where the r-matrix r is not
///     a function of time.  The case where r is a function of time leads
///     to an additional velocity component equal to the product of the
///     derivative of r and the position vector.
///
/// # Called:
///    * rxp       product of r-matrix and p-vector
///
///  This revision:  2021 May 11

pub fn rxpv(r: &[[f64; 3]; 3], pv: &[[f64; 3]; 2], rpv: &mut [[f64; 3]; 2])
{
    rxp(r, &pv[0], &mut rpv[0]);
    rxp(r, &pv[1], &mut rpv[1]);
 
 /* Finished. */
 
}



///  Multiply a p-vector by the transpose of an r-matrix.
///
///  Given:
///   * r r-matrix
///   * p p-vector
///
///  Returned:
///   * trp r^T * p
///
/// # Called:
///   * tr        transpose r-matrix
///   * rxp       product of r-matrix and p-vector
///
///  This revision:  2021 May 11
pub fn trxp(r: &[[f64; 3]; 3], p: &[f64; 3], trp: &mut [f64; 3])
{
    let mut trm = [[0.0; 3];3];
 
 
 /* Transpose of matrix r. */
    super::matrix_ops::tr::tr(r, &mut trm);
 
 /* Matrix tr * vector p -> vector trp. */
    rxp(&trm, p, trp);
 
 /* Finished. */
 
 }

///  Multiply a pv-vector by the transpose of an r-matrix.
///
///  Given:
///   * r    r-matrix
///   * pv   pv-vector
///
///  Returned:
///   * trpv r^T * pv
///
/// # Notes:
///
///  1) The algorithm is for the simple case where the r-matrix r is not
///     a function of time.  The case where r is a function of time leads
///     to an additional velocity component equal to the product of the
///     derivative of the transpose of r and the position vector.
///
/// # Called:
///    * tr        transpose r-matrix
///    * rxpv      product of r-matrix and pv-vector
///
///  This revision:  2021 May 11
pub fn trxpv(r: &[[f64; 3]; 3], pv: &[[f64; 3]; 2], trpv: &mut [[f64; 3]; 2])
{
    let mut trm = [[0.0; 3];3];
 
 
/* Transpose of matrix r. */
    super::matrix_ops::tr::tr(r, &mut trm);
 
 /* Matrix tr * vector pv -> vector trpv. */
    rxpv(&trm, pv, trpv);
 
 /* Finished. */
 
 }