Function mosek::syrk

source ·
pub fn syrk(
    uplo_: i32,
    trans_: i32,
    n_: i32,
    k_: i32,
    alpha_: f64,
    a_: &[f64],
    beta_: f64,
    c_: &mut [f64]
) -> Result<(), String>
Expand description

Performs a rank-k update of a symmetric matrix.

§Arguments

  • uplo_ Indicates whether the upper or lower triangular part of C is used.

    See Uplo

  • trans_ Indicates whether the matrix A must be transposed.

    See Transpose

  • n_ Specifies the order of C.

  • k_ Indicates the number of rows or columns of A, and its rank.

  • alpha_ A scalar value multiplying the result of the matrix multiplication.

  • a_ The pointer to the array storing matrix A in a column-major format.

  • beta_ A scalar value that multiplies C.

  • c_ The pointer to the array storing matrix C in a column-major format.

Full documentation: https://docs.mosek.com/latest/capi/alphabetic-functionalities.html#mosek.env.syrk

Examples found in repository?
examples/blas_lapack.rs (line 66)
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
fn main() -> Result<(),String> {

    let n = 3i32;
    let m = 2i32;
    let k = 3i32;

    let alpha = 2.0;
    let beta  = 0.5;
    let x    = &[1.0, 1.0, 1.0];
    let mut y = vec![1.0, 2.0, 3.0];
    let mut z = vec![1.0, 1.0];
    let A    = &[1.0, 1.0, 2.0, 2.0, 3.0, 3.0];
    let B    = &[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0];
    let mut C = vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0];
    let mut D = vec![1.0, 1.0, 1.0, 1.0];
    let mut Q = vec![1.0, 0.0, 0.0, 2.0];
    let mut v = vec![0.0, 0.0, 0.0];

    let mut xy : f64 = 0.0;

    /* BLAS routines*/
    println!("n={} m={} k={}", m, n, k);
    println!("alpha={}", alpha);
    println!("beta={}", beta);

    mosek::dot(n,x,y.as_slice(),& mut xy)?;
    println!("dot results = {}\n", xy);

    print_matrix(x, 1, n);
    print_matrix(y.as_slice(), 1, n);

    mosek::axpy(n, alpha, x, y.as_mut_slice())?;
    println!("axpy results is:\n");
    print_matrix(y.as_slice(), 1, n);


    mosek::gemv(mosek::Transpose::NO, m, n, alpha, A, x, beta, z.as_mut_slice())?;
    println!("gemv results is:");
    print_matrix(z.as_slice(), 1, m);

    mosek::gemm(mosek::Transpose::NO, mosek::Transpose::NO, m, n, k, alpha, A, B, beta, C.as_mut_slice())?;
    println!("gemm results is");
    print_matrix(C.as_slice(), m, n);

    mosek::syrk(mosek::Uplo::LO, mosek::Transpose::NO, m, k, 1., A, beta, D.as_mut_slice())?;
    println!("syrk results is");
    print_matrix(D.as_slice(), m, m);

    /* LAPACK routines*/

    mosek::potrf(mosek::Uplo::LO, m, Q.as_mut_slice())?;
    println!("potrf results is");
    print_matrix(Q.as_slice(), m, m);

    mosek::syeig(mosek::Uplo::LO, m, Q.as_slice(), & mut v[0..m as usize])?;
    println!("syeig results is");
    print_matrix(v.as_slice(), 1, m);

    mosek::syevd(mosek::Uplo::LO, m, Q.as_mut_slice(), &mut v[0..m as usize])?;
    println!("syevd results is");
    print_matrix(v.as_slice(), 1, m);
    print_matrix(Q.as_slice(), m, m);

    Ok(())
}