rgsl/
blas.rs

1//
2// A rust binding for the GSL library by Guillaume Gomez (guillaume1.gomez@gmail.com)
3//
4
5pub mod level1 {
6    use crate::{types, Value};
7    use ffi::FFI;
8    use types::complex::CFFI;
9
10    /// This function computes the sum \alpha + x^T y for the vectors x and y, returning the result
11    /// in result.
12    ///
13    /// Returns `result`.
14    #[doc(alias = "gsl_blas_sdsdot")]
15    pub fn sdsdot(alpha: f32, x: &types::VectorF32, y: &types::VectorF32) -> Result<f32, Value> {
16        let mut result = 0.;
17        let ret = unsafe {
18            sys::gsl_blas_sdsdot(alpha, x.unwrap_shared(), y.unwrap_shared(), &mut result)
19        };
20        result_handler!(ret, result)
21    }
22
23    /// This function computes the scalar product x^T y for the vectors x and y, returning the
24    /// result in result.
25    ///
26    /// Returns `result`.
27    #[doc(alias = "gsl_blas_sdot")]
28    pub fn sdot(x: &types::VectorF32, y: &types::VectorF32) -> Result<f32, Value> {
29        let mut result = 0.;
30        let ret = unsafe { sys::gsl_blas_sdot(x.unwrap_shared(), y.unwrap_shared(), &mut result) };
31        result_handler!(ret, result)
32    }
33
34    /// This function computes the scalar product x^T y for the vectors x and y, returning the
35    /// result in result.
36    ///
37    /// Returns `result`.
38    #[doc(alias = "gsl_blas_dsdot")]
39    pub fn dsdot(x: &types::VectorF32, y: &types::VectorF32) -> Result<f64, Value> {
40        let mut result = 0.;
41        let ret = unsafe { sys::gsl_blas_dsdot(x.unwrap_shared(), y.unwrap_shared(), &mut result) };
42        result_handler!(ret, result)
43    }
44
45    /// This function computes the scalar product x^T y for the vectors x and y, returning the
46    /// result in result.
47    ///
48    /// Returns `result`.
49    #[doc(alias = "gsl_blas_ddot")]
50    pub fn ddot(x: &types::VectorF64, y: &types::VectorF64) -> Result<f64, Value> {
51        let mut result = 0.;
52        let ret = unsafe { sys::gsl_blas_ddot(x.unwrap_shared(), y.unwrap_shared(), &mut result) };
53        result_handler!(ret, result)
54    }
55
56    /// This function computes the complex scalar product x^T y for the vectors x and y, returning
57    /// the result in dotu.
58    ///
59    /// Returns `dotu`.
60    #[doc(alias = "gsl_blas_cdotu")]
61    pub fn cdotu(
62        x: &types::VectorComplexF32,
63        y: &types::VectorComplexF32,
64    ) -> Result<types::ComplexF32, Value> {
65        let mut dotu = types::ComplexF32::default().unwrap();
66        let ret = unsafe { sys::gsl_blas_cdotu(x.unwrap_shared(), y.unwrap_shared(), &mut dotu) };
67        result_handler!(ret, types::ComplexF32::wrap(dotu))
68    }
69
70    /// This function computes the complex scalar product x^T y for the vectors x and y, returning
71    /// the result in dotu.
72    ///
73    /// Returns `dotu`.
74    #[doc(alias = "gsl_blas_zdotu")]
75    pub fn zdotu(
76        x: &types::VectorComplexF64,
77        y: &types::VectorComplexF64,
78    ) -> Result<types::ComplexF64, Value> {
79        let mut dotu = types::ComplexF64::default().unwrap();
80        let ret = unsafe { sys::gsl_blas_zdotu(x.unwrap_shared(), y.unwrap_shared(), &mut dotu) };
81        result_handler!(ret, types::ComplexF64::wrap(dotu))
82    }
83
84    /// This function computes the complex conjugate scalar product x^H y for the vectors x and y,
85    /// returning the result in dotc.
86    ///
87    /// Returns `dotc`.
88    #[doc(alias = "gsl_blas_cdotc")]
89    pub fn cdotc(
90        x: &types::VectorComplexF32,
91        y: &types::VectorComplexF32,
92    ) -> Result<types::ComplexF32, Value> {
93        let mut dotc = types::ComplexF32::default().unwrap();
94        let ret = unsafe { sys::gsl_blas_cdotc(x.unwrap_shared(), y.unwrap_shared(), &mut dotc) };
95        result_handler!(ret, types::ComplexF32::wrap(dotc))
96    }
97
98    /// This function computes the complex conjugate scalar product x^H y for the vectors x and y,
99    /// returning the result in dotc.
100    ///
101    /// Returns `dotc`.
102    #[doc(alias = "gsl_blas_zdotc")]
103    pub fn zdotc(
104        x: &types::VectorComplexF64,
105        y: &types::VectorComplexF64,
106    ) -> Result<types::ComplexF64, Value> {
107        let mut dotc = types::ComplexF64::default().unwrap();
108        let ret = unsafe { sys::gsl_blas_zdotc(x.unwrap_shared(), y.unwrap_shared(), &mut dotc) };
109        result_handler!(ret, types::ComplexF64::wrap(dotc))
110    }
111
112    /// This function computes the Euclidean norm ||x||_2 = \sqrt {\sum x_i^2} of the vector x.
113    #[doc(alias = "gsl_blas_snrm2")]
114    pub fn snrm2(x: &types::VectorF32) -> f32 {
115        unsafe { sys::gsl_blas_snrm2(x.unwrap_shared()) }
116    }
117
118    /// This function computes the Euclidean norm ||x||_2 = \sqrt {\sum x_i^2} of the vector x.
119    #[doc(alias = "gsl_blas_dnrm2")]
120    pub fn dnrm2(x: &types::VectorF64) -> f64 {
121        unsafe { sys::gsl_blas_dnrm2(x.unwrap_shared()) }
122    }
123
124    /// This function computes the Euclidean norm of the complex vector x,
125    ///
126    /// ||x||_2 = \sqrt {\sum (\Re(x_i)^2 + \Im(x_i)^2)}.
127    #[doc(alias = "gsl_blas_scnrm2")]
128    pub fn scnrm2(x: &types::VectorComplexF32) -> f32 {
129        unsafe { sys::gsl_blas_scnrm2(x.unwrap_shared()) }
130    }
131
132    /// This function computes the Euclidean norm of the complex vector x,
133    ///
134    /// ||x||_2 = \sqrt {\sum (\Re(x_i)^2 + \Im(x_i)^2)}.
135    #[doc(alias = "gsl_blas_dznrm2")]
136    pub fn dznrm2(x: &types::VectorComplexF64) -> f64 {
137        unsafe { sys::gsl_blas_dznrm2(x.unwrap_shared()) }
138    }
139
140    /// This function computes the absolute sum \sum |x_i| of the elements of the vector x.
141    #[doc(alias = "gsl_blas_sasum")]
142    pub fn sasum(x: &types::VectorF32) -> f32 {
143        unsafe { sys::gsl_blas_sasum(x.unwrap_shared()) }
144    }
145
146    /// This function computes the absolute sum \sum |x_i| of the elements of the vector x.
147    #[doc(alias = "gsl_blas_dasum")]
148    pub fn dasum(x: &types::VectorF64) -> f64 {
149        unsafe { sys::gsl_blas_dasum(x.unwrap_shared()) }
150    }
151
152    /// This function computes the sum of the magnitudes of the real and imaginary parts of the complex vector x, \sum |\Re(x_i)| + |\Im(x_i)|.
153    #[doc(alias = "gsl_blas_scasum")]
154    pub fn scasum(x: &types::VectorComplexF32) -> f32 {
155        unsafe { sys::gsl_blas_scasum(x.unwrap_shared()) }
156    }
157
158    /// This function computes the sum of the magnitudes of the real and imaginary parts of the complex vector x, \sum |\Re(x_i)| + |\Im(x_i)|.
159    #[doc(alias = "gsl_blas_dzasum")]
160    pub fn dzasum(x: &types::VectorComplexF64) -> f64 {
161        unsafe { sys::gsl_blas_dzasum(x.unwrap_shared()) }
162    }
163
164    /// This function returns the index of the largest element of the vector x.
165    /// The largest element is determined by its absolute magnitude for real vectors and by the sum of the magnitudes of the real and imaginary parts |\Re(x_i)| + |\Im(x_i)| for complex vectors.
166    /// If the largest value occurs several times then the index of the first occurrence is returned.
167    #[doc(alias = "gsl_blas_isamax")]
168    pub fn isamax(x: &types::VectorF32) -> usize {
169        unsafe { sys::gsl_blas_isamax(x.unwrap_shared()) }
170    }
171
172    /// This function returns the index of the largest element of the vector x.
173    /// The largest element is determined by its absolute magnitude for real vectors and by the sum of the magnitudes of the real and imaginary parts |\Re(x_i)| + |\Im(x_i)| for complex vectors.
174    /// If the largest value occurs several times then the index of the first occurrence is returned.
175    #[doc(alias = "gsl_blas_idamax")]
176    pub fn idamax(x: &types::VectorF64) -> usize {
177        unsafe { sys::gsl_blas_idamax(x.unwrap_shared()) }
178    }
179
180    /// This function returns the index of the largest element of the vector x.
181    /// The largest element is determined by its absolute magnitude for real vectors and by the sum of the magnitudes of the real and imaginary parts |\Re(x_i)| + |\Im(x_i)| for complex vectors.
182    /// If the largest value occurs several times then the index of the first occurrence is returned.
183    #[doc(alias = "gsl_blas_icamax")]
184    pub fn icamax(x: &types::VectorComplexF32) -> usize {
185        unsafe { sys::gsl_blas_icamax(x.unwrap_shared()) }
186    }
187
188    /// This function returns the index of the largest element of the vector x.
189    /// The largest element is determined by its absolute magnitude for real vectors and by the sum of the magnitudes of the real and imaginary parts |\Re(x_i)| + |\Im(x_i)| for complex vectors.
190    /// If the largest value occurs several times then the index of the first occurrence is returned.
191    #[doc(alias = "gsl_blas_izamax")]
192    pub fn izamax(x: &types::VectorComplexF64) -> usize {
193        unsafe { sys::gsl_blas_izamax(x.unwrap_shared()) }
194    }
195
196    /// This function exchanges the elements of the vectors x and y.
197    #[doc(alias = "gsl_blas_sswap")]
198    pub fn sswap(x: &mut types::VectorF32, y: &mut types::VectorF32) -> Result<(), Value> {
199        let ret = unsafe { sys::gsl_blas_sswap(x.unwrap_unique(), y.unwrap_unique()) };
200        result_handler!(ret, ())
201    }
202
203    /// This function exchanges the elements of the vectors x and y.
204    #[doc(alias = "gsl_blas_dswap")]
205    pub fn dswap(x: &mut types::VectorF64, y: &mut types::VectorF64) -> Result<(), Value> {
206        let ret = unsafe { sys::gsl_blas_dswap(x.unwrap_unique(), y.unwrap_unique()) };
207        result_handler!(ret, ())
208    }
209
210    /// This function exchanges the elements of the vectors x and y.
211    #[doc(alias = "gsl_blas_cswap")]
212    pub fn cswap(
213        x: &mut types::VectorComplexF32,
214        y: &mut types::VectorComplexF32,
215    ) -> Result<(), Value> {
216        let ret = unsafe { sys::gsl_blas_cswap(x.unwrap_unique(), y.unwrap_unique()) };
217        result_handler!(ret, ())
218    }
219
220    /// This function exchanges the elements of the vectors x and y.
221    #[doc(alias = "gsl_blas_zswap")]
222    pub fn zswap(
223        x: &mut types::VectorComplexF64,
224        y: &mut types::VectorComplexF64,
225    ) -> Result<(), Value> {
226        let ret = unsafe { sys::gsl_blas_zswap(x.unwrap_unique(), y.unwrap_unique()) };
227        result_handler!(ret, ())
228    }
229
230    /// This function copy the elements of the vector x into the vector y.
231    #[doc(alias = "gsl_blas_scopy")]
232    pub fn scopy(x: &mut types::VectorF32, y: &mut types::VectorF32) -> Result<(), Value> {
233        let ret = unsafe { sys::gsl_blas_scopy(x.unwrap_unique(), y.unwrap_unique()) };
234        result_handler!(ret, ())
235    }
236
237    /// This function copy the elements of the vector x into the vector y.
238    #[doc(alias = "gsl_blas_dcopy")]
239    pub fn dcopy(x: &mut types::VectorF64, y: &mut types::VectorF64) -> Result<(), Value> {
240        let ret = unsafe { sys::gsl_blas_dcopy(x.unwrap_unique(), y.unwrap_unique()) };
241        result_handler!(ret, ())
242    }
243
244    /// This function copy the elements of the vector x into the vector y.
245    #[doc(alias = "gsl_blas_ccopy")]
246    pub fn ccopy(
247        x: &mut types::VectorComplexF32,
248        y: &mut types::VectorComplexF32,
249    ) -> Result<(), Value> {
250        let ret = unsafe { sys::gsl_blas_ccopy(x.unwrap_unique(), y.unwrap_unique()) };
251        result_handler!(ret, ())
252    }
253
254    /// This function copy the elements of the vector x into the vector y.
255    #[doc(alias = "gsl_blas_zcopy")]
256    pub fn zcopy(
257        x: &mut types::VectorComplexF64,
258        y: &mut types::VectorComplexF64,
259    ) -> Result<(), Value> {
260        let ret = unsafe { sys::gsl_blas_zcopy(x.unwrap_unique(), y.unwrap_unique()) };
261        result_handler!(ret, ())
262    }
263
264    /// This function computes the sum y = \alpha x + y for the vectors x and y.
265    #[doc(alias = "gsl_blas_saxpy")]
266    pub fn saxpy(alpha: f32, x: &types::VectorF32, y: &mut types::VectorF32) -> Result<(), Value> {
267        let ret = unsafe { sys::gsl_blas_saxpy(alpha, x.unwrap_shared(), y.unwrap_unique()) };
268        result_handler!(ret, ())
269    }
270
271    /// This function computes the sum y = \alpha x + y for the vectors x and y.
272    #[doc(alias = "gsl_blas_daxpy")]
273    pub fn daxpy(alpha: f64, x: &types::VectorF64, y: &mut types::VectorF64) -> Result<(), Value> {
274        let ret = unsafe { sys::gsl_blas_daxpy(alpha, x.unwrap_shared(), y.unwrap_unique()) };
275        result_handler!(ret, ())
276    }
277
278    /// This function computes the sum y = \alpha x + y for the vectors x and y.
279    #[doc(alias = "gsl_blas_caxpy")]
280    pub fn caxpy(
281        alpha: &types::ComplexF32,
282        x: &types::VectorComplexF32,
283        y: &mut types::VectorComplexF32,
284    ) -> Result<(), Value> {
285        let ret = unsafe {
286            sys::gsl_blas_caxpy(
287                std::mem::transmute(*alpha),
288                x.unwrap_shared(),
289                y.unwrap_unique(),
290            )
291        };
292        result_handler!(ret, ())
293    }
294
295    /// This function computes the sum y = \alpha x + y for the vectors x and y.
296    #[doc(alias = "gsl_blas_zaxpy")]
297    pub fn zaxpy(
298        alpha: &types::ComplexF64,
299        x: &types::VectorComplexF64,
300        y: &mut types::VectorComplexF64,
301    ) -> Result<(), Value> {
302        let ret = unsafe {
303            sys::gsl_blas_zaxpy(
304                std::mem::transmute(*alpha),
305                x.unwrap_shared(),
306                y.unwrap_unique(),
307            )
308        };
309        result_handler!(ret, ())
310    }
311
312    /// This function rescales the vector x by the multiplicative factor alpha.
313    #[doc(alias = "gsl_blas_sscal")]
314    pub fn sscal(alpha: f32, x: &mut types::VectorF32) {
315        unsafe { sys::gsl_blas_sscal(alpha, x.unwrap_unique()) }
316    }
317
318    /// This function rescales the vector x by the multiplicative factor alpha.
319    #[doc(alias = "gsl_blas_dscal")]
320    pub fn dscal(alpha: f64, x: &mut types::VectorF64) {
321        unsafe { sys::gsl_blas_dscal(alpha, x.unwrap_unique()) }
322    }
323
324    /// This function rescales the vector x by the multiplicative factor alpha.
325    #[doc(alias = "gsl_blas_cscal")]
326    pub fn cscal(alpha: &types::ComplexF32, x: &mut types::VectorComplexF32) {
327        unsafe { sys::gsl_blas_cscal(::std::mem::transmute(*alpha), x.unwrap_unique()) }
328    }
329
330    /// This function rescales the vector x by the multiplicative factor alpha.
331    #[doc(alias = "gsl_blas_zscal")]
332    pub fn zscal(alpha: &types::ComplexF64, x: &mut types::VectorComplexF64) {
333        unsafe { sys::gsl_blas_zscal(::std::mem::transmute(*alpha), x.unwrap_unique()) }
334    }
335
336    /// This function rescales the vector x by the multiplicative factor alpha.
337    #[doc(alias = "gsl_blas_csscal")]
338    pub fn csscal(alpha: f32, x: &mut types::VectorComplexF32) {
339        unsafe { sys::gsl_blas_csscal(alpha, x.unwrap_unique()) }
340    }
341
342    /// This function rescales the vector x by the multiplicative factor alpha.
343    #[doc(alias = "gsl_blas_zdscal")]
344    pub fn zdscal(alpha: f64, x: &mut types::VectorComplexF64) {
345        unsafe { sys::gsl_blas_zdscal(alpha, x.unwrap_unique()) }
346    }
347
348    /// This function computes a Givens rotation (c,s) which zeroes the vector (a,b),
349    ///
350    /// ```text
351    /// [  c  s ] [ a ] = [ r ]
352    ///
353    /// [ -s  c ] [ b ]   [ 0 ]
354    /// ```
355    ///
356    /// The variables a and b are overwritten by the routine.
357    #[doc(alias = "gsl_blas_srotg")]
358    pub fn srotg(a: &mut [f32], b: &mut [f32], c: &mut [f32], d: &mut [f32]) -> Result<(), Value> {
359        let ret = unsafe {
360            sys::gsl_blas_srotg(
361                a.as_mut_ptr(),
362                b.as_mut_ptr(),
363                c.as_mut_ptr(),
364                d.as_mut_ptr(),
365            )
366        };
367        result_handler!(ret, ())
368    }
369
370    /// This function computes a Givens rotation (c,s) which zeroes the vector (a,b),
371    ///
372    /// ```text
373    /// [  c  s ] [ a ] = [ r ]
374    ///
375    /// [ -s  c ] [ b ]   [ 0 ]
376    /// ```
377    ///
378    /// The variables a and b are overwritten by the routine.
379    #[doc(alias = "gsl_blas_drotg")]
380    pub fn drotg(a: &mut [f64], b: &mut [f64], c: &mut [f64], d: &mut [f64]) -> Result<(), Value> {
381        let ret = unsafe {
382            sys::gsl_blas_drotg(
383                a.as_mut_ptr(),
384                b.as_mut_ptr(),
385                c.as_mut_ptr(),
386                d.as_mut_ptr(),
387            )
388        };
389        result_handler!(ret, ())
390    }
391
392    /// This function applies a Givens rotation (x', y') = (c x + s y, -s x + c y) to the vectors x, y.
393    #[doc(alias = "gsl_blas_srot")]
394    pub fn srot(
395        a: &mut types::VectorF32,
396        b: &mut types::VectorF32,
397        c: f32,
398        d: f32,
399    ) -> Result<(), Value> {
400        let ret = unsafe { sys::gsl_blas_srot(a.unwrap_unique(), b.unwrap_unique(), c, d) };
401        result_handler!(ret, ())
402    }
403
404    /// This function applies a Givens rotation (x', y') = (c x + s y, -s x + c y) to the vectors x, y.
405    #[doc(alias = "gsl_blas_drot")]
406    pub fn drot(
407        a: &mut types::VectorF64,
408        b: &mut types::VectorF64,
409        c: f64,
410        d: f64,
411    ) -> Result<(), Value> {
412        let ret = unsafe { sys::gsl_blas_drot(a.unwrap_unique(), b.unwrap_unique(), c, d) };
413        result_handler!(ret, ())
414    }
415
416    /// This function computes a modified Givens transformation.
417    /// The modified Givens transformation is defined in the original Level-1 BLAS specification, given in the references.
418    #[doc(alias = "gsl_blas_srotmg")]
419    pub fn srotmg(
420        d1: &mut [f32],
421        d2: &mut [f32],
422        b1: &mut [f32],
423        b2: f32,
424        P: &mut [f32],
425    ) -> Result<(), Value> {
426        let ret = unsafe {
427            sys::gsl_blas_srotmg(
428                d1.as_mut_ptr(),
429                d2.as_mut_ptr(),
430                b1.as_mut_ptr(),
431                b2,
432                P.as_mut_ptr(),
433            )
434        };
435        result_handler!(ret, ())
436    }
437
438    /// This function computes a modified Givens transformation.
439    /// The modified Givens transformation is defined in the original Level-1 BLAS specification, given in the references.
440    #[doc(alias = "gsl_blas_drotmg")]
441    pub fn drotmg(
442        d1: &mut [f64],
443        d2: &mut [f64],
444        b1: &mut [f64],
445        b2: f64,
446        P: &mut [f64],
447    ) -> Result<(), Value> {
448        let ret = unsafe {
449            sys::gsl_blas_drotmg(
450                d1.as_mut_ptr(),
451                d2.as_mut_ptr(),
452                b1.as_mut_ptr(),
453                b2,
454                P.as_mut_ptr(),
455            )
456        };
457        result_handler!(ret, ())
458    }
459
460    /// This function applies a modified Givens transformation.
461    #[doc(alias = "gsl_blas_srotm")]
462    pub fn srotm(
463        x: &mut types::VectorF32,
464        y: &mut types::VectorF32,
465        P: &mut [f32],
466    ) -> Result<(), Value> {
467        let ret =
468            unsafe { sys::gsl_blas_srotm(x.unwrap_unique(), y.unwrap_unique(), P.as_mut_ptr()) };
469        result_handler!(ret, ())
470    }
471
472    /// This function applies a modified Givens transformation.
473    #[doc(alias = "gsl_blas_drotm")]
474    pub fn drotm(
475        x: &mut types::VectorF64,
476        y: &mut types::VectorF64,
477        P: &mut [f64],
478    ) -> Result<(), Value> {
479        let ret =
480            unsafe { sys::gsl_blas_drotm(x.unwrap_unique(), y.unwrap_unique(), P.as_mut_ptr()) };
481        result_handler!(ret, ())
482    }
483}
484
485pub mod level2 {
486    use crate::{enums, types, Value};
487    use ffi::FFI;
488
489    /// This function computes the matrix-vector product and sum y = \alpha op(A) x + \beta y, where op(A) = A, A^T, A^H for TransA = CblasNoTrans, CblasTrans, CblasConjTrans.
490    #[doc(alias = "gsl_blas_sgemv")]
491    pub fn sgemv(
492        transA: enums::CblasTranspose,
493        alpha: f32,
494        A: &types::MatrixF32,
495        x: &types::VectorF32,
496        beta: f32,
497        y: &mut types::VectorF32,
498    ) -> Result<(), Value> {
499        let ret = unsafe {
500            sys::gsl_blas_sgemv(
501                transA.into(),
502                alpha,
503                A.unwrap_shared(),
504                x.unwrap_shared(),
505                beta,
506                y.unwrap_unique(),
507            )
508        };
509        result_handler!(ret, ())
510    }
511
512    /// This function computes the matrix-vector product and sum y = \alpha op(A) x + \beta y, where op(A) = A, A^T, A^H for TransA = CblasNoTrans, CblasTrans, CblasConjTrans.
513    #[doc(alias = "gsl_blas_dgemv")]
514    pub fn dgemv(
515        transA: enums::CblasTranspose,
516        alpha: f64,
517        A: &types::MatrixF64,
518        x: &types::VectorF64,
519        beta: f64,
520        y: &mut types::VectorF64,
521    ) -> Result<(), Value> {
522        let ret = unsafe {
523            sys::gsl_blas_dgemv(
524                transA.into(),
525                alpha,
526                A.unwrap_shared(),
527                x.unwrap_shared(),
528                beta,
529                y.unwrap_unique(),
530            )
531        };
532        result_handler!(ret, ())
533    }
534
535    /// This function computes the matrix-vector product and sum y = \alpha op(A) x + \beta y, where op(A) = A, A^T, A^H for TransA = CblasNoTrans, CblasTrans, CblasConjTrans.
536    #[doc(alias = "gsl_blas_cgemv")]
537    pub fn cgemv(
538        transA: enums::CblasTranspose,
539        alpha: &types::ComplexF32,
540        A: &types::MatrixComplexF32,
541        x: &types::VectorComplexF32,
542        beta: &types::ComplexF32,
543        y: &mut types::VectorComplexF32,
544    ) -> Result<(), Value> {
545        let ret = unsafe {
546            sys::gsl_blas_cgemv(
547                transA.into(),
548                std::mem::transmute(*alpha),
549                A.unwrap_shared(),
550                x.unwrap_shared(),
551                std::mem::transmute(*beta),
552                y.unwrap_unique(),
553            )
554        };
555        result_handler!(ret, ())
556    }
557
558    /// This function computes the matrix-vector product and sum y = \alpha op(A) x + \beta y, where op(A) = A, A^T, A^H for TransA = CblasNoTrans, CblasTrans, CblasConjTrans.
559    #[doc(alias = "gsl_blas_zgemv")]
560    pub fn zgemv(
561        transA: enums::CblasTranspose,
562        alpha: &types::ComplexF64,
563        A: &types::MatrixComplexF64,
564        x: &types::VectorComplexF64,
565        beta: &types::ComplexF64,
566        y: &mut types::VectorComplexF64,
567    ) -> Result<(), Value> {
568        let ret = unsafe {
569            sys::gsl_blas_zgemv(
570                transA.into(),
571                std::mem::transmute(*alpha),
572                A.unwrap_shared(),
573                x.unwrap_shared(),
574                std::mem::transmute(*beta),
575                y.unwrap_unique(),
576            )
577        };
578        result_handler!(ret, ())
579    }
580
581    /// This function computes the matrix-vector product x = op(A) x for the triangular matrix A, where op(A) = A, A^T, A^H for TransA = CblasNoTrans, CblasTrans, CblasConjTrans.
582    /// When Uplo is CblasUpper then the upper triangle of A is used, and when Uplo is CblasLower then the lower triangle of A is used.
583    /// If Diag is CblasNonUnit then the diagonal of the matrix is used, but if Diag is CblasUnit then the diagonal elements of the matrix A are taken as unity and are not referenced.
584    #[doc(alias = "gsl_blas_strmv")]
585    pub fn strmv(
586        uplo: enums::CblasUplo,
587        transA: enums::CblasTranspose,
588        diag: enums::CblasDiag,
589        A: &types::MatrixF32,
590        x: &mut types::VectorF32,
591    ) -> Result<(), Value> {
592        let ret = unsafe {
593            sys::gsl_blas_strmv(
594                uplo.into(),
595                transA.into(),
596                diag.into(),
597                A.unwrap_shared(),
598                x.unwrap_unique(),
599            )
600        };
601        result_handler!(ret, ())
602    }
603
604    /// This function computes the matrix-vector product x = op(A) x for the triangular matrix A, where op(A) = A, A^T, A^H for TransA = CblasNoTrans, CblasTrans, CblasConjTrans.
605    /// When Uplo is CblasUpper then the upper triangle of A is used, and when Uplo is CblasLower then the lower triangle of A is used.
606    /// If Diag is CblasNonUnit then the diagonal of the matrix is used, but if Diag is CblasUnit then the diagonal elements of the matrix A are taken as unity and are not referenced.
607    #[doc(alias = "gsl_blas_dtrmv")]
608    pub fn dtrmv(
609        uplo: enums::CblasUplo,
610        transA: enums::CblasTranspose,
611        diag: enums::CblasDiag,
612        A: &types::MatrixF64,
613        x: &mut types::VectorF64,
614    ) -> Result<(), Value> {
615        let ret = unsafe {
616            sys::gsl_blas_dtrmv(
617                uplo.into(),
618                transA.into(),
619                diag.into(),
620                A.unwrap_shared(),
621                x.unwrap_unique(),
622            )
623        };
624        result_handler!(ret, ())
625    }
626
627    /// This function computes the matrix-vector product x = op(A) x for the triangular matrix A, where op(A) = A, A^T, A^H for TransA = CblasNoTrans, CblasTrans, CblasConjTrans.
628    /// When Uplo is CblasUpper then the upper triangle of A is used, and when Uplo is CblasLower then the lower triangle of A is used.
629    /// If Diag is CblasNonUnit then the diagonal of the matrix is used, but if Diag is CblasUnit then the diagonal elements of the matrix A are taken as unity and are not referenced.
630    #[doc(alias = "gsl_blas_ctrmv")]
631    pub fn ctrmv(
632        uplo: enums::CblasUplo,
633        transA: enums::CblasTranspose,
634        diag: enums::CblasDiag,
635        A: &types::MatrixComplexF32,
636        x: &mut types::VectorComplexF32,
637    ) -> Result<(), Value> {
638        let ret = unsafe {
639            sys::gsl_blas_ctrmv(
640                uplo.into(),
641                transA.into(),
642                diag.into(),
643                A.unwrap_shared(),
644                x.unwrap_unique(),
645            )
646        };
647        result_handler!(ret, ())
648    }
649
650    /// This function computes the matrix-vector product x = op(A) x for the triangular matrix A, where op(A) = A, A^T, A^H for TransA = CblasNoTrans, CblasTrans, CblasConjTrans.
651    /// When Uplo is CblasUpper then the upper triangle of A is used, and when Uplo is CblasLower then the lower triangle of A is used.
652    /// If Diag is CblasNonUnit then the diagonal of the matrix is used, but if Diag is CblasUnit then the diagonal elements of the matrix A are taken as unity and are not referenced.
653    #[doc(alias = "gsl_blas_ztrmv")]
654    pub fn ztrmv(
655        uplo: enums::CblasUplo,
656        transA: enums::CblasTranspose,
657        diag: enums::CblasDiag,
658        A: &types::MatrixComplexF64,
659        x: &mut types::VectorComplexF64,
660    ) -> Result<(), Value> {
661        let ret = unsafe {
662            sys::gsl_blas_ztrmv(
663                uplo.into(),
664                transA.into(),
665                diag.into(),
666                A.unwrap_shared(),
667                x.unwrap_unique(),
668            )
669        };
670        result_handler!(ret, ())
671    }
672
673    /// This function computes inv(op(A)) x for x, where op(A) = A, A^T, A^H for TransA = CblasNoTrans, CblasTrans, CblasConjTrans.
674    /// When Uplo is CblasUpper then the upper triangle of A is used, and when Uplo is CblasLower then the lower triangle of A is used.
675    /// If Diag is CblasNonUnit then the diagonal of the matrix is used, but if Diag is CblasUnit then the diagonal elements of the matrix A are taken as unity and are not referenced.
676    #[doc(alias = "gsl_blas_strsv")]
677    pub fn strsv(
678        uplo: enums::CblasUplo,
679        transA: enums::CblasTranspose,
680        diag: enums::CblasDiag,
681        A: &types::MatrixF32,
682        x: &mut types::VectorF32,
683    ) -> Result<(), Value> {
684        let ret = unsafe {
685            sys::gsl_blas_strsv(
686                uplo.into(),
687                transA.into(),
688                diag.into(),
689                A.unwrap_shared(),
690                x.unwrap_unique(),
691            )
692        };
693        result_handler!(ret, ())
694    }
695
696    /// This function computes inv(op(A)) x for x, where op(A) = A, A^T, A^H for TransA = CblasNoTrans, CblasTrans, CblasConjTrans.
697    /// When Uplo is CblasUpper then the upper triangle of A is used, and when Uplo is CblasLower then the lower triangle of A is used.
698    /// If Diag is CblasNonUnit then the diagonal of the matrix is used, but if Diag is CblasUnit then the diagonal elements of the matrix A are taken as unity and are not referenced.
699    #[doc(alias = "gsl_blas_dtrsv")]
700    pub fn dtrsv(
701        uplo: enums::CblasUplo,
702        transA: enums::CblasTranspose,
703        diag: enums::CblasDiag,
704        A: &types::MatrixF64,
705        x: &mut types::VectorF64,
706    ) -> Result<(), Value> {
707        let ret = unsafe {
708            sys::gsl_blas_dtrsv(
709                uplo.into(),
710                transA.into(),
711                diag.into(),
712                A.unwrap_shared(),
713                x.unwrap_unique(),
714            )
715        };
716        result_handler!(ret, ())
717    }
718
719    /// This function computes inv(op(A)) x for x, where op(A) = A, A^T, A^H for TransA = CblasNoTrans, CblasTrans, CblasConjTrans.
720    /// When Uplo is CblasUpper then the upper triangle of A is used, and when Uplo is CblasLower then the lower triangle of A is used.
721    /// If Diag is CblasNonUnit then the diagonal of the matrix is used, but if Diag is CblasUnit then the diagonal elements of the matrix A are taken as unity and are not referenced.
722    #[doc(alias = "gsl_blas_ctrsv")]
723    pub fn ctrsv(
724        uplo: enums::CblasUplo,
725        transA: enums::CblasTranspose,
726        diag: enums::CblasDiag,
727        A: &types::MatrixComplexF32,
728        x: &mut types::VectorComplexF32,
729    ) -> Result<(), Value> {
730        let ret = unsafe {
731            sys::gsl_blas_ctrsv(
732                uplo.into(),
733                transA.into(),
734                diag.into(),
735                A.unwrap_shared(),
736                x.unwrap_unique(),
737            )
738        };
739        result_handler!(ret, ())
740    }
741
742    /// This function computes inv(op(A)) x for x, where op(A) = A, A^T, A^H for TransA = CblasNoTrans, CblasTrans, CblasConjTrans.
743    /// When Uplo is CblasUpper then the upper triangle of A is used, and when Uplo is CblasLower then the lower triangle of A is used.
744    /// If Diag is CblasNonUnit then the diagonal of the matrix is used, but if Diag is CblasUnit then the diagonal elements of the matrix A are taken as unity and are not referenced.
745    #[doc(alias = "gsl_blas_ztrsv")]
746    pub fn ztrsv(
747        uplo: enums::CblasUplo,
748        transA: enums::CblasTranspose,
749        diag: enums::CblasDiag,
750        A: &types::MatrixComplexF64,
751        x: &mut types::VectorComplexF64,
752    ) -> Result<(), Value> {
753        let ret = unsafe {
754            sys::gsl_blas_ztrsv(
755                uplo.into(),
756                transA.into(),
757                diag.into(),
758                A.unwrap_shared(),
759                x.unwrap_unique(),
760            )
761        };
762        result_handler!(ret, ())
763    }
764
765    /// These functions compute the matrix-vector product and sum y = \alpha A x + \beta y for the symmetric matrix A.
766    /// Since the matrix A is symmetric only its upper half or lower half need to be stored.
767    /// When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used.
768    #[doc(alias = "gsl_blas_ssymv")]
769    pub fn ssymv(
770        uplo: enums::CblasUplo,
771        alpha: f32,
772        A: &types::MatrixF32,
773        x: &types::VectorF32,
774        beta: f32,
775        y: &mut types::VectorF32,
776    ) -> Result<(), Value> {
777        let ret = unsafe {
778            sys::gsl_blas_ssymv(
779                uplo.into(),
780                alpha,
781                A.unwrap_shared(),
782                x.unwrap_shared(),
783                beta,
784                y.unwrap_unique(),
785            )
786        };
787        result_handler!(ret, ())
788    }
789
790    /// These functions compute the matrix-vector product and sum y = \alpha A x + \beta y for the symmetric matrix A.
791    /// Since the matrix A is symmetric only its upper half or lower half need to be stored.
792    /// When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used.
793    #[doc(alias = "gsl_blas_dsymv")]
794    pub fn dsymv(
795        uplo: enums::CblasUplo,
796        alpha: f64,
797        A: &types::MatrixF64,
798        x: &types::VectorF64,
799        beta: f64,
800        y: &mut types::VectorF64,
801    ) -> Result<(), Value> {
802        let ret = unsafe {
803            sys::gsl_blas_dsymv(
804                uplo.into(),
805                alpha,
806                A.unwrap_shared(),
807                x.unwrap_shared(),
808                beta,
809                y.unwrap_unique(),
810            )
811        };
812        result_handler!(ret, ())
813    }
814
815    /// These functions compute the matrix-vector product and sum y = \alpha A x + \beta y for the hermitian matrix A.
816    /// Since the matrix A is hermitian only its upper half or lower half need to be stored. When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used.
817    /// The imaginary elements of the diagonal are automatically assumed to be zero and are not referenced.
818    #[doc(alias = "gsl_blas_chemv")]
819    pub fn chemv(
820        uplo: enums::CblasUplo,
821        alpha: &types::ComplexF32,
822        A: &types::MatrixComplexF32,
823        x: &types::VectorComplexF32,
824        beta: &types::ComplexF32,
825        y: &mut types::VectorComplexF32,
826    ) -> Result<(), Value> {
827        let ret = unsafe {
828            sys::gsl_blas_chemv(
829                uplo.into(),
830                std::mem::transmute(*alpha),
831                A.unwrap_shared(),
832                x.unwrap_shared(),
833                std::mem::transmute(*beta),
834                y.unwrap_unique(),
835            )
836        };
837        result_handler!(ret, ())
838    }
839
840    /// These functions compute the matrix-vector product and sum y = \alpha A x + \beta y for the hermitian matrix A.
841    /// Since the matrix A is hermitian only its upper half or lower half need to be stored. When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used.
842    /// The imaginary elements of the diagonal are automatically assumed to be zero and are not referenced.
843    #[doc(alias = "gsl_blas_zhemv")]
844    pub fn zhemv(
845        uplo: enums::CblasUplo,
846        alpha: &types::ComplexF64,
847        A: &types::MatrixComplexF64,
848        x: &types::VectorComplexF64,
849        beta: &types::ComplexF64,
850        y: &mut types::VectorComplexF64,
851    ) -> Result<(), Value> {
852        let ret = unsafe {
853            sys::gsl_blas_zhemv(
854                uplo.into(),
855                std::mem::transmute(*alpha),
856                A.unwrap_shared(),
857                x.unwrap_shared(),
858                std::mem::transmute(*beta),
859                y.unwrap_unique(),
860            )
861        };
862        result_handler!(ret, ())
863    }
864
865    /// This function computes the rank-1 update A = \alpha x y^T + A of the matrix A.
866    #[doc(alias = "gsl_blas_sger")]
867    pub fn sger(
868        alpha: f32,
869        x: &types::VectorF32,
870        y: &types::VectorF32,
871        A: &mut types::MatrixF32,
872    ) -> Result<(), Value> {
873        let ret = unsafe {
874            sys::gsl_blas_sger(
875                alpha,
876                x.unwrap_shared(),
877                y.unwrap_shared(),
878                A.unwrap_unique(),
879            )
880        };
881        result_handler!(ret, ())
882    }
883
884    /// This function computes the rank-1 update A = \alpha x y^T + A of the matrix A.
885    #[doc(alias = "gsl_blas_dger")]
886    pub fn dger(
887        alpha: f64,
888        x: &types::VectorF64,
889        y: &types::VectorF64,
890        A: &mut types::MatrixF64,
891    ) -> Result<(), Value> {
892        let ret = unsafe {
893            sys::gsl_blas_dger(
894                alpha,
895                x.unwrap_shared(),
896                y.unwrap_shared(),
897                A.unwrap_unique(),
898            )
899        };
900        result_handler!(ret, ())
901    }
902
903    /// This function computes the rank-1 update A = \alpha x y^T + A of the matrix A.
904    #[doc(alias = "gsl_blas_cgeru")]
905    pub fn cgeru(
906        alpha: &types::ComplexF32,
907        x: &types::VectorComplexF32,
908        y: &types::VectorComplexF32,
909        A: &mut types::MatrixComplexF32,
910    ) -> Result<(), Value> {
911        let ret = unsafe {
912            sys::gsl_blas_cgeru(
913                std::mem::transmute(*alpha),
914                x.unwrap_shared(),
915                y.unwrap_shared(),
916                A.unwrap_unique(),
917            )
918        };
919        result_handler!(ret, ())
920    }
921
922    /// This function computes the rank-1 update A = \alpha x y^T + A of the matrix A.
923    #[doc(alias = "gsl_blas_zgeru")]
924    pub fn zgeru(
925        alpha: &types::ComplexF64,
926        x: &types::VectorComplexF64,
927        y: &types::VectorComplexF64,
928        A: &mut types::MatrixComplexF64,
929    ) -> Result<(), Value> {
930        let ret = unsafe {
931            sys::gsl_blas_zgeru(
932                std::mem::transmute(*alpha),
933                x.unwrap_shared(),
934                y.unwrap_shared(),
935                A.unwrap_unique(),
936            )
937        };
938        result_handler!(ret, ())
939    }
940
941    /// This function computes the conjugate rank-1 update A = \alpha x y^H + A of the matrix A.
942    #[doc(alias = "gsl_blas_cgerc")]
943    pub fn cgerc(
944        alpha: &types::ComplexF32,
945        x: &types::VectorComplexF32,
946        y: &types::VectorComplexF32,
947        A: &mut types::MatrixComplexF32,
948    ) -> Result<(), Value> {
949        let ret = unsafe {
950            sys::gsl_blas_cgerc(
951                std::mem::transmute(*alpha),
952                x.unwrap_shared(),
953                y.unwrap_shared(),
954                A.unwrap_unique(),
955            )
956        };
957        result_handler!(ret, ())
958    }
959
960    /// This function computes the conjugate rank-1 update A = \alpha x y^H + A of the matrix A.
961    #[doc(alias = "gsl_blas_zgerc")]
962    pub fn zgerc(
963        alpha: &types::ComplexF64,
964        x: &types::VectorComplexF64,
965        y: &types::VectorComplexF64,
966        A: &mut types::MatrixComplexF64,
967    ) -> Result<(), Value> {
968        let ret = unsafe {
969            sys::gsl_blas_zgerc(
970                std::mem::transmute(*alpha),
971                x.unwrap_shared(),
972                y.unwrap_shared(),
973                A.unwrap_unique(),
974            )
975        };
976        result_handler!(ret, ())
977    }
978
979    /// This function computes the symmetric rank-1 update A = \alpha x x^T + A of the symmetric matrix A. Since the matrix A is symmetric only its upper half or lower half need to be stored.
980    /// When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used.
981    #[doc(alias = "gsl_blas_ssyr")]
982    pub fn ssyr(
983        uplo: enums::CblasUplo,
984        alpha: f32,
985        x: &types::VectorF32,
986        A: &mut types::MatrixF32,
987    ) -> Result<(), Value> {
988        let ret =
989            unsafe { sys::gsl_blas_ssyr(uplo.into(), alpha, x.unwrap_shared(), A.unwrap_unique()) };
990        result_handler!(ret, ())
991    }
992
993    /// This function computes the symmetric rank-1 update A = \alpha x x^T + A of the symmetric matrix A. Since the matrix A is symmetric only its upper half or lower half need to be stored.
994    /// When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used.
995    #[doc(alias = "gsl_blas_dsyr")]
996    pub fn dsyr(
997        uplo: enums::CblasUplo,
998        alpha: f64,
999        x: &types::VectorF64,
1000        A: &mut types::MatrixF64,
1001    ) -> Result<(), Value> {
1002        let ret =
1003            unsafe { sys::gsl_blas_dsyr(uplo.into(), alpha, x.unwrap_shared(), A.unwrap_unique()) };
1004        result_handler!(ret, ())
1005    }
1006
1007    /// These functions compute the hermitian rank-1 update A = \alpha x x^H + A of the hermitian matrix A.
1008    /// Since the matrix A is hermitian only its upper half or lower half need to be stored.
1009    /// When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used.
1010    /// The imaginary elements of the diagonal are automatically set to zero.
1011    #[doc(alias = "gsl_blas_cher")]
1012    pub fn cher(
1013        uplo: enums::CblasUplo,
1014        alpha: f32,
1015        x: &types::VectorComplexF32,
1016        A: &mut types::MatrixComplexF32,
1017    ) -> Result<(), Value> {
1018        let ret =
1019            unsafe { sys::gsl_blas_cher(uplo.into(), alpha, x.unwrap_shared(), A.unwrap_unique()) };
1020        result_handler!(ret, ())
1021    }
1022
1023    /// These functions compute the hermitian rank-1 update A = \alpha x x^H + A of the hermitian matrix A.
1024    /// Since the matrix A is hermitian only its upper half or lower half need to be stored.
1025    /// When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used.
1026    /// The imaginary elements of the diagonal are automatically set to zero.
1027    #[doc(alias = "gsl_blas_zher")]
1028    pub fn zher(
1029        uplo: enums::CblasUplo,
1030        alpha: f64,
1031        x: &types::VectorComplexF64,
1032        A: &mut types::MatrixComplexF64,
1033    ) -> Result<(), Value> {
1034        let ret =
1035            unsafe { sys::gsl_blas_zher(uplo.into(), alpha, x.unwrap_shared(), A.unwrap_unique()) };
1036        result_handler!(ret, ())
1037    }
1038
1039    /// These functions compute the symmetric rank-2 update A = \alpha x y^T + \alpha y x^T + A of the symmetric matrix A.
1040    /// Since the matrix A is symmetric only its upper half or lower half need to be stored.
1041    /// When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used.
1042    #[doc(alias = "gsl_blas_ssyr2")]
1043    pub fn ssyr2(
1044        uplo: enums::CblasUplo,
1045        alpha: f32,
1046        x: &types::VectorF32,
1047        y: &types::VectorF32,
1048        A: &mut types::MatrixF32,
1049    ) -> Result<(), Value> {
1050        let ret = unsafe {
1051            sys::gsl_blas_ssyr2(
1052                uplo.into(),
1053                alpha,
1054                x.unwrap_shared(),
1055                y.unwrap_shared(),
1056                A.unwrap_unique(),
1057            )
1058        };
1059        result_handler!(ret, ())
1060    }
1061
1062    /// These functions compute the symmetric rank-2 update A = \alpha x y^T + \alpha y x^T + A of the symmetric matrix A.
1063    /// Since the matrix A is symmetric only its upper half or lower half need to be stored.
1064    /// When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used.
1065    #[doc(alias = "gsl_blas_dsyr2")]
1066    pub fn dsyr2(
1067        uplo: enums::CblasUplo,
1068        alpha: f64,
1069        x: &types::VectorF64,
1070        y: &types::VectorF64,
1071        A: &mut types::MatrixF64,
1072    ) -> Result<(), Value> {
1073        let ret = unsafe {
1074            sys::gsl_blas_dsyr2(
1075                uplo.into(),
1076                alpha,
1077                x.unwrap_shared(),
1078                y.unwrap_shared(),
1079                A.unwrap_unique(),
1080            )
1081        };
1082        result_handler!(ret, ())
1083    }
1084
1085    /// These functions compute the hermitian rank-2 update A = \alpha x y^H + \alpha^* y x^H + A of the hermitian matrix A.
1086    /// Since the matrix A is hermitian only its upper half or lower half need to be stored.
1087    /// When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used.
1088    /// The imaginary elements of the diagonal are automatically set to zero.
1089    #[doc(alias = "gsl_blas_cher2")]
1090    pub fn cher2(
1091        uplo: enums::CblasUplo,
1092        alpha: &types::ComplexF32,
1093        x: &types::VectorComplexF32,
1094        y: &types::VectorComplexF32,
1095        A: &mut types::MatrixComplexF32,
1096    ) -> Result<(), Value> {
1097        let ret = unsafe {
1098            sys::gsl_blas_cher2(
1099                uplo.into(),
1100                std::mem::transmute(*alpha),
1101                x.unwrap_shared(),
1102                y.unwrap_shared(),
1103                A.unwrap_unique(),
1104            )
1105        };
1106        result_handler!(ret, ())
1107    }
1108
1109    /// These functions compute the hermitian rank-2 update A = \alpha x y^H + \alpha^* y x^H + A of the hermitian matrix A.
1110    /// Since the matrix A is hermitian only its upper half or lower half need to be stored.
1111    /// When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used.
1112    /// The imaginary elements of the diagonal are automatically set to zero.
1113    #[doc(alias = "gsl_blas_zher2")]
1114    pub fn zher2(
1115        uplo: enums::CblasUplo,
1116        alpha: &types::ComplexF64,
1117        x: &types::VectorComplexF64,
1118        y: &types::VectorComplexF64,
1119        A: &mut types::MatrixComplexF64,
1120    ) -> Result<(), Value> {
1121        let ret = unsafe {
1122            sys::gsl_blas_zher2(
1123                uplo.into(),
1124                std::mem::transmute(*alpha),
1125                x.unwrap_shared(),
1126                y.unwrap_shared(),
1127                A.unwrap_unique(),
1128            )
1129        };
1130        result_handler!(ret, ())
1131    }
1132}
1133
1134pub mod level3 {
1135    use crate::{enums, types, Value};
1136    use ffi::FFI;
1137
1138    /// This function computes the matrix-matrix product and sum C = \alpha op(A) op(B) + \beta C where op(A) = A, A^T, A^H for TransA = CblasNoTrans, CblasTrans, CblasConjTrans and similarly for the parameter TransB.
1139    #[doc(alias = "gsl_blas_sgemm")]
1140    pub fn sgemm(
1141        transA: enums::CblasTranspose,
1142        transB: enums::CblasTranspose,
1143        alpha: f32,
1144        A: &types::MatrixF32,
1145        B: &types::MatrixF32,
1146        beta: f32,
1147        C: &mut types::MatrixF32,
1148    ) -> Result<(), Value> {
1149        let ret = unsafe {
1150            sys::gsl_blas_sgemm(
1151                transA.into(),
1152                transB.into(),
1153                alpha,
1154                A.unwrap_shared(),
1155                B.unwrap_shared(),
1156                beta,
1157                C.unwrap_unique(),
1158            )
1159        };
1160        result_handler!(ret, ())
1161    }
1162
1163    /// This function computes the matrix-matrix product and sum C = \alpha op(A) op(B) + \beta C where op(A) = A, A^T, A^H for TransA = CblasNoTrans, CblasTrans, CblasConjTrans and similarly for the parameter TransB.
1164    #[doc(alias = "gsl_blas_dgemm")]
1165    pub fn dgemm(
1166        transA: enums::CblasTranspose,
1167        transB: enums::CblasTranspose,
1168        alpha: f64,
1169        A: &types::MatrixF64,
1170        B: &types::MatrixF64,
1171        beta: f64,
1172        C: &mut types::MatrixF64,
1173    ) -> Result<(), Value> {
1174        let ret = unsafe {
1175            sys::gsl_blas_dgemm(
1176                transA.into(),
1177                transB.into(),
1178                alpha,
1179                A.unwrap_shared(),
1180                B.unwrap_shared(),
1181                beta,
1182                C.unwrap_unique(),
1183            )
1184        };
1185        result_handler!(ret, ())
1186    }
1187
1188    /// This function computes the matrix-matrix product and sum C = \alpha op(A) op(B) + \beta C where op(A) = A, A^T, A^H for TransA = CblasNoTrans, CblasTrans, CblasConjTrans and similarly for the parameter TransB.
1189    #[doc(alias = "gsl_blas_cgemm")]
1190    pub fn cgemm(
1191        transA: enums::CblasTranspose,
1192        transB: enums::CblasTranspose,
1193        alpha: &types::ComplexF32,
1194        A: &types::MatrixComplexF32,
1195        B: &types::MatrixComplexF32,
1196        beta: &types::ComplexF32,
1197        C: &mut types::MatrixComplexF32,
1198    ) -> Result<(), Value> {
1199        let ret = unsafe {
1200            sys::gsl_blas_cgemm(
1201                transA.into(),
1202                transB.into(),
1203                std::mem::transmute(*alpha),
1204                A.unwrap_shared(),
1205                B.unwrap_shared(),
1206                std::mem::transmute(*beta),
1207                C.unwrap_unique(),
1208            )
1209        };
1210        result_handler!(ret, ())
1211    }
1212
1213    /// This function computes the matrix-matrix product and sum C = \alpha op(A) op(B) + \beta C where op(A) = A, A^T, A^H for TransA = CblasNoTrans, CblasTrans, CblasConjTrans and similarly for the parameter TransB.
1214    #[doc(alias = "gsl_blas_zgemm")]
1215    pub fn zgemm(
1216        transA: enums::CblasTranspose,
1217        transB: enums::CblasTranspose,
1218        alpha: &types::ComplexF64,
1219        A: &types::MatrixComplexF64,
1220        B: &types::MatrixComplexF64,
1221        beta: &types::ComplexF64,
1222        C: &mut types::MatrixComplexF64,
1223    ) -> Result<(), Value> {
1224        let ret = unsafe {
1225            sys::gsl_blas_zgemm(
1226                transA.into(),
1227                transB.into(),
1228                std::mem::transmute(*alpha),
1229                A.unwrap_shared(),
1230                B.unwrap_shared(),
1231                std::mem::transmute(*beta),
1232                C.unwrap_unique(),
1233            )
1234        };
1235        result_handler!(ret, ())
1236    }
1237
1238    /// This function computes the matrix-matrix product and sum C = \alpha A B + \beta C for Side is CblasLeft and C = \alpha B A + \beta C for Side is CblasRight, where the matrix A is symmetric.
1239    /// When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used.
1240    #[doc(alias = "gsl_blas_ssymm")]
1241    pub fn ssymm(
1242        side: enums::CblasSide,
1243        uplo: enums::CblasUplo,
1244        alpha: f32,
1245        A: &types::MatrixF32,
1246        B: &types::MatrixF32,
1247        beta: f32,
1248        C: &mut types::MatrixF32,
1249    ) -> Result<(), Value> {
1250        let ret = unsafe {
1251            sys::gsl_blas_ssymm(
1252                side.into(),
1253                uplo.into(),
1254                alpha,
1255                A.unwrap_shared(),
1256                B.unwrap_shared(),
1257                beta,
1258                C.unwrap_unique(),
1259            )
1260        };
1261        result_handler!(ret, ())
1262    }
1263
1264    /// This function computes the matrix-matrix product and sum C = \alpha A B + \beta C for Side is CblasLeft and C = \alpha B A + \beta C for Side is CblasRight, where the matrix A is symmetric.
1265    /// When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used.
1266    #[doc(alias = "gsl_blas_dsymm")]
1267    pub fn dsymm(
1268        side: enums::CblasSide,
1269        uplo: enums::CblasUplo,
1270        alpha: f64,
1271        A: &types::MatrixF64,
1272        B: &types::MatrixF64,
1273        beta: f64,
1274        C: &mut types::MatrixF64,
1275    ) -> Result<(), Value> {
1276        let ret = unsafe {
1277            sys::gsl_blas_dsymm(
1278                side.into(),
1279                uplo.into(),
1280                alpha,
1281                A.unwrap_shared(),
1282                B.unwrap_shared(),
1283                beta,
1284                C.unwrap_unique(),
1285            )
1286        };
1287        result_handler!(ret, ())
1288    }
1289
1290    /// This function computes the matrix-matrix product and sum C = \alpha A B + \beta C for Side is CblasLeft and C = \alpha B A + \beta C for Side is CblasRight, where the matrix A is symmetric.
1291    /// When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used.
1292    #[doc(alias = "gsl_blas_csymm")]
1293    pub fn csymm(
1294        side: enums::CblasSide,
1295        uplo: enums::CblasUplo,
1296        alpha: &types::ComplexF32,
1297        A: &types::MatrixComplexF32,
1298        B: &types::MatrixComplexF32,
1299        beta: &types::ComplexF32,
1300        C: &mut types::MatrixComplexF32,
1301    ) -> Result<(), Value> {
1302        let ret = unsafe {
1303            sys::gsl_blas_csymm(
1304                side.into(),
1305                uplo.into(),
1306                std::mem::transmute(*alpha),
1307                A.unwrap_shared(),
1308                B.unwrap_shared(),
1309                std::mem::transmute(*beta),
1310                C.unwrap_unique(),
1311            )
1312        };
1313        result_handler!(ret, ())
1314    }
1315
1316    /// This function computes the matrix-matrix product and sum C = \alpha A B + \beta C for Side is CblasLeft and C = \alpha B A + \beta C for Side is CblasRight, where the matrix A is symmetric.
1317    /// When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used.
1318    #[doc(alias = "gsl_blas_zsymm")]
1319    pub fn zsymm(
1320        side: enums::CblasSide,
1321        uplo: enums::CblasUplo,
1322        alpha: &types::ComplexF64,
1323        A: &types::MatrixComplexF64,
1324        B: &types::MatrixComplexF64,
1325        beta: &types::ComplexF64,
1326        C: &mut types::MatrixComplexF64,
1327    ) -> Result<(), Value> {
1328        let ret = unsafe {
1329            sys::gsl_blas_zsymm(
1330                side.into(),
1331                uplo.into(),
1332                std::mem::transmute(*alpha),
1333                A.unwrap_shared(),
1334                B.unwrap_shared(),
1335                std::mem::transmute(*beta),
1336                C.unwrap_unique(),
1337            )
1338        };
1339        result_handler!(ret, ())
1340    }
1341
1342    /// This function computes the matrix-matrix product and sum C = \alpha A B + \beta C for Side is Left and C = \alpha B A + \beta C for Side is Right, where the matrix A is hermitian.
1343    /// When Uplo is Upper then the upper triangle and diagonal of A are used, and when Uplo is Lower then the lower triangle and diagonal of A are used.
1344    /// The imaginary elements of the diagonal are automatically set to zero.
1345    #[doc(alias = "gsl_blas_chemm")]
1346    pub fn chemm(
1347        side: enums::CblasSide,
1348        uplo: enums::CblasUplo,
1349        alpha: &types::ComplexF32,
1350        A: &types::MatrixComplexF32,
1351        B: &types::MatrixComplexF32,
1352        beta: &types::ComplexF32,
1353        C: &mut types::MatrixComplexF32,
1354    ) -> Result<(), Value> {
1355        let ret = unsafe {
1356            sys::gsl_blas_chemm(
1357                side.into(),
1358                uplo.into(),
1359                std::mem::transmute(*alpha),
1360                A.unwrap_shared(),
1361                B.unwrap_shared(),
1362                std::mem::transmute(*beta),
1363                C.unwrap_unique(),
1364            )
1365        };
1366        result_handler!(ret, ())
1367    }
1368
1369    /// This function computes the matrix-matrix product and sum C = \alpha A B + \beta C for Side is CblasLeft and C = \alpha B A + \beta C for Side is CblasRight, where the matrix A is hermitian.
1370    /// When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used.
1371    /// The imaginary elements of the diagonal are automatically set to zero.
1372    #[doc(alias = "gsl_blas_zhemm")]
1373    pub fn zhemm(
1374        side: enums::CblasSide,
1375        uplo: enums::CblasUplo,
1376        alpha: &types::ComplexF64,
1377        A: &types::MatrixComplexF64,
1378        B: &types::MatrixComplexF64,
1379        beta: &types::ComplexF64,
1380        C: &mut types::MatrixComplexF64,
1381    ) -> Result<(), Value> {
1382        let ret = unsafe {
1383            sys::gsl_blas_zhemm(
1384                side.into(),
1385                uplo.into(),
1386                std::mem::transmute(*alpha),
1387                A.unwrap_shared(),
1388                B.unwrap_shared(),
1389                std::mem::transmute(*beta),
1390                C.unwrap_unique(),
1391            )
1392        };
1393        result_handler!(ret, ())
1394    }
1395
1396    /// This function computes the matrix-matrix product B = \alpha op(A) B for Side is Left and B = \alpha B op(A) for Side is CblasRight.
1397    /// The matrix A is triangular and op(A) = A, A^T, A^H for TransA = NoTrans, Trans, ConjTrans.
1398    /// When Uplo is Upper then the upper triangle of A is used, and when Uplo is Lower then the lower triangle of A is used.
1399    /// If Diag is NonUnit then the diagonal of A is used, but if Diag is Unit then the diagonal elements of the matrix A are taken as unity and are not referenced.
1400    #[doc(alias = "gsl_blas_strmm")]
1401    pub fn strmm(
1402        side: enums::CblasSide,
1403        uplo: enums::CblasUplo,
1404        transA: enums::CblasTranspose,
1405        diag: enums::CblasDiag,
1406        alpha: f32,
1407        A: &types::MatrixF32,
1408        B: &mut types::MatrixF32,
1409    ) -> Result<(), Value> {
1410        let ret = unsafe {
1411            sys::gsl_blas_strmm(
1412                side.into(),
1413                uplo.into(),
1414                transA.into(),
1415                diag.into(),
1416                alpha,
1417                A.unwrap_shared(),
1418                B.unwrap_unique(),
1419            )
1420        };
1421        result_handler!(ret, ())
1422    }
1423
1424    /// This function computes the matrix-matrix product B = \alpha op(A) B for Side is Left and B = \alpha B op(A) for Side is CblasRight.
1425    /// The matrix A is triangular and op(A) = A, A^T, A^H for TransA = NoTrans, Trans, ConjTrans.
1426    /// When Uplo is Upper then the upper triangle of A is used, and when Uplo is Lower then the lower triangle of A is used.
1427    /// If Diag is NonUnit then the diagonal of A is used, but if Diag is Unit then the diagonal elements of the matrix A are taken as unity and are not referenced.
1428    #[doc(alias = "gsl_blas_dtrmm")]
1429    pub fn dtrmm(
1430        side: enums::CblasSide,
1431        uplo: enums::CblasUplo,
1432        transA: enums::CblasTranspose,
1433        diag: enums::CblasDiag,
1434        alpha: f64,
1435        A: &types::MatrixF64,
1436        B: &mut types::MatrixF64,
1437    ) -> Result<(), Value> {
1438        let ret = unsafe {
1439            sys::gsl_blas_dtrmm(
1440                side.into(),
1441                uplo.into(),
1442                transA.into(),
1443                diag.into(),
1444                alpha,
1445                A.unwrap_shared(),
1446                B.unwrap_unique(),
1447            )
1448        };
1449        result_handler!(ret, ())
1450    }
1451
1452    /// This function computes the matrix-matrix product B = \alpha op(A) B for Side is Left and B = \alpha B op(A) for Side is CblasRight.
1453    /// The matrix A is triangular and op(A) = A, A^T, A^H for TransA = NoTrans, Trans, ConjTrans.
1454    /// When Uplo is Upper then the upper triangle of A is used, and when Uplo is Lower then the lower triangle of A is used.
1455    /// If Diag is NonUnit then the diagonal of A is used, but if Diag is Unit then the diagonal elements of the matrix A are taken as unity and are not referenced.
1456    #[doc(alias = "gsl_blas_ctrmm")]
1457    pub fn ctrmm(
1458        side: enums::CblasSide,
1459        uplo: enums::CblasUplo,
1460        transA: enums::CblasTranspose,
1461        diag: enums::CblasDiag,
1462        alpha: &types::ComplexF32,
1463        A: &types::MatrixComplexF32,
1464        B: &mut types::MatrixComplexF32,
1465    ) -> Result<(), Value> {
1466        let ret = unsafe {
1467            sys::gsl_blas_ctrmm(
1468                side.into(),
1469                uplo.into(),
1470                transA.into(),
1471                diag.into(),
1472                std::mem::transmute(*alpha),
1473                A.unwrap_shared(),
1474                B.unwrap_unique(),
1475            )
1476        };
1477        result_handler!(ret, ())
1478    }
1479
1480    /// This function computes the matrix-matrix product B = \alpha op(A) B for Side is Left and B = \alpha B op(A) for Side is CblasRight.
1481    /// The matrix A is triangular and op(A) = A, A^T, A^H for TransA = NoTrans, Trans, ConjTrans.
1482    /// When Uplo is Upper then the upper triangle of A is used, and when Uplo is Lower then the lower triangle of A is used.
1483    /// If Diag is NonUnit then the diagonal of A is used, but if Diag is Unit then the diagonal elements of the matrix A are taken as unity and are not referenced.
1484    #[doc(alias = "gsl_blas_ztrmm")]
1485    pub fn ztrmm(
1486        side: enums::CblasSide,
1487        uplo: enums::CblasUplo,
1488        transA: enums::CblasTranspose,
1489        diag: enums::CblasDiag,
1490        alpha: &types::ComplexF64,
1491        A: &types::MatrixComplexF64,
1492        B: &mut types::MatrixComplexF64,
1493    ) -> Result<(), Value> {
1494        let ret = unsafe {
1495            sys::gsl_blas_ztrmm(
1496                side.into(),
1497                uplo.into(),
1498                transA.into(),
1499                diag.into(),
1500                std::mem::transmute(*alpha),
1501                A.unwrap_shared(),
1502                B.unwrap_unique(),
1503            )
1504        };
1505        result_handler!(ret, ())
1506    }
1507
1508    /// This function computes the inverse-matrix matrix product B = \alpha op(inv(A))B for Side is Left and B = \alpha B op(inv(A)) for Side is Right.
1509    /// The matrix A is triangular and op(A) = A, A^T, A^H for TransA = NoTrans, Trans, ConjTrans.
1510    /// When Uplo is Upper then the upper triangle of A is used, and when Uplo is Lower then the lower triangle of A is used.
1511    /// If Diag is NonUnit then the diagonal of A is used, but if Diag is Unit then the diagonal elements of the matrix A are taken as unity and are not referenced.
1512    #[doc(alias = "gsl_blas_strsm")]
1513    pub fn strsm(
1514        side: enums::CblasSide,
1515        uplo: enums::CblasUplo,
1516        transA: enums::CblasTranspose,
1517        diag: enums::CblasDiag,
1518        alpha: f32,
1519        A: &types::MatrixF32,
1520        B: &mut types::MatrixF32,
1521    ) -> Result<(), Value> {
1522        let ret = unsafe {
1523            sys::gsl_blas_strsm(
1524                side.into(),
1525                uplo.into(),
1526                transA.into(),
1527                diag.into(),
1528                alpha,
1529                A.unwrap_shared(),
1530                B.unwrap_unique(),
1531            )
1532        };
1533        result_handler!(ret, ())
1534    }
1535
1536    /// This function computes the inverse-matrix matrix product B = \alpha op(inv(A))B for Side is Left and B = \alpha B op(inv(A)) for Side is Right.
1537    /// The matrix A is triangular and op(A) = A, A^T, A^H for TransA = NoTrans, Trans, ConjTrans.
1538    /// When Uplo is Upper then the upper triangle of A is used, and when Uplo is Lower then the lower triangle of A is used.
1539    /// If Diag is NonUnit then the diagonal of A is used, but if Diag is Unit then the diagonal elements of the matrix A are taken as unity and are not referenced.
1540    #[doc(alias = "gsl_blas_dtrsm")]
1541    pub fn dtrsm(
1542        side: enums::CblasSide,
1543        uplo: enums::CblasUplo,
1544        transA: enums::CblasTranspose,
1545        diag: enums::CblasDiag,
1546        alpha: f64,
1547        A: &types::MatrixF64,
1548        B: &mut types::MatrixF64,
1549    ) -> Result<(), Value> {
1550        let ret = unsafe {
1551            sys::gsl_blas_dtrsm(
1552                side.into(),
1553                uplo.into(),
1554                transA.into(),
1555                diag.into(),
1556                alpha,
1557                A.unwrap_shared(),
1558                B.unwrap_unique(),
1559            )
1560        };
1561        result_handler!(ret, ())
1562    }
1563
1564    /// This function computes the inverse-matrix matrix product B = \alpha op(inv(A))B for Side is Left and B = \alpha B op(inv(A)) for Side is Right.
1565    /// The matrix A is triangular and op(A) = A, A^T, A^H for TransA = NoTrans, Trans, ConjTrans.
1566    /// When Uplo is Upper then the upper triangle of A is used, and when Uplo is Lower then the lower triangle of A is used.
1567    /// If Diag is NonUnit then the diagonal of A is used, but if Diag is Unit then the diagonal elements of the matrix A are taken as unity and are not referenced.
1568    #[doc(alias = "gsl_blas_ctrsm")]
1569    pub fn ctrsm(
1570        side: enums::CblasSide,
1571        uplo: enums::CblasUplo,
1572        transA: enums::CblasTranspose,
1573        diag: enums::CblasDiag,
1574        alpha: &types::ComplexF32,
1575        A: &types::MatrixComplexF32,
1576        B: &mut types::MatrixComplexF32,
1577    ) -> Result<(), Value> {
1578        let ret = unsafe {
1579            sys::gsl_blas_ctrsm(
1580                side.into(),
1581                uplo.into(),
1582                transA.into(),
1583                diag.into(),
1584                std::mem::transmute(*alpha),
1585                A.unwrap_shared(),
1586                B.unwrap_unique(),
1587            )
1588        };
1589        result_handler!(ret, ())
1590    }
1591
1592    /// This function computes the inverse-matrix matrix product B = \alpha op(inv(A))B for Side is Left and B = \alpha B op(inv(A)) for Side is Right.
1593    /// The matrix A is triangular and op(A) = A, A^T, A^H for TransA = NoTrans, Trans, ConjTrans.
1594    /// When Uplo is Upper then the upper triangle of A is used, and when Uplo is Lower then the lower triangle of A is used.
1595    /// If Diag is NonUnit then the diagonal of A is used, but if Diag is Unit then the diagonal elements of the matrix A are taken as unity and are not referenced.
1596    #[doc(alias = "gsl_blas_ztrsm")]
1597    pub fn ztrsm(
1598        side: enums::CblasSide,
1599        uplo: enums::CblasUplo,
1600        transA: enums::CblasTranspose,
1601        diag: enums::CblasDiag,
1602        alpha: &types::ComplexF64,
1603        A: &types::MatrixComplexF64,
1604        B: &mut types::MatrixComplexF64,
1605    ) -> Result<(), Value> {
1606        let ret = unsafe {
1607            sys::gsl_blas_ztrsm(
1608                side.into(),
1609                uplo.into(),
1610                transA.into(),
1611                diag.into(),
1612                std::mem::transmute(*alpha),
1613                A.unwrap_shared(),
1614                B.unwrap_unique(),
1615            )
1616        };
1617        result_handler!(ret, ())
1618    }
1619
1620    /// This function computes a rank-k update of the symmetric matrix C, C = \alpha A A^T + \beta C when Trans is NoTrans and C = \alpha A^T A + \beta C when Trans is Trans.
1621    /// Since the matrix C is symmetric only its upper half or lower half need to be stored.
1622    /// When Uplo is Upper then the upper triangle and diagonal of C are used, and when Uplo is Lower then the lower triangle and diagonal of C are used.
1623    #[doc(alias = "gsl_blas_ssyrk")]
1624    pub fn ssyrk(
1625        uplo: enums::CblasUplo,
1626        trans: enums::CblasTranspose,
1627        alpha: f32,
1628        A: &types::MatrixF32,
1629        beta: f32,
1630        C: &mut types::MatrixF32,
1631    ) -> Result<(), Value> {
1632        let ret = unsafe {
1633            sys::gsl_blas_ssyrk(
1634                uplo.into(),
1635                trans.into(),
1636                alpha,
1637                A.unwrap_shared(),
1638                beta,
1639                C.unwrap_unique(),
1640            )
1641        };
1642        result_handler!(ret, ())
1643    }
1644
1645    /// This function computes a rank-k update of the symmetric matrix C, C = \alpha A A^T + \beta C when Trans is NoTrans and C = \alpha A^T A + \beta C when Trans is Trans.
1646    /// Since the matrix C is symmetric only its upper half or lower half need to be stored.
1647    /// When Uplo is Upper then the upper triangle and diagonal of C are used, and when Uplo is Lower then the lower triangle and diagonal of C are used.
1648    #[doc(alias = "gsl_blas_dsyrk")]
1649    pub fn dsyrk(
1650        uplo: enums::CblasUplo,
1651        trans: enums::CblasTranspose,
1652        alpha: f64,
1653        A: &types::MatrixF64,
1654        beta: f64,
1655        C: &mut types::MatrixF64,
1656    ) -> Result<(), Value> {
1657        let ret = unsafe {
1658            sys::gsl_blas_dsyrk(
1659                uplo.into(),
1660                trans.into(),
1661                alpha,
1662                A.unwrap_shared(),
1663                beta,
1664                C.unwrap_unique(),
1665            )
1666        };
1667        result_handler!(ret, ())
1668    }
1669
1670    /// This function computes a rank-k update of the symmetric matrix C, C = \alpha A A^T + \beta C when Trans is NoTrans and C = \alpha A^T A + \beta C when Trans is Trans.
1671    /// Since the matrix C is symmetric only its upper half or lower half need to be stored.
1672    /// When Uplo is Upper then the upper triangle and diagonal of C are used, and when Uplo is Lower then the lower triangle and diagonal of C are used.
1673    #[doc(alias = "gsl_blas_csyrk")]
1674    pub fn csyrk(
1675        uplo: enums::CblasUplo,
1676        trans: enums::CblasTranspose,
1677        alpha: &types::ComplexF32,
1678        A: &types::MatrixComplexF32,
1679        beta: &types::ComplexF32,
1680        C: &mut types::MatrixComplexF32,
1681    ) -> Result<(), Value> {
1682        let ret = unsafe {
1683            sys::gsl_blas_csyrk(
1684                uplo.into(),
1685                trans.into(),
1686                std::mem::transmute(*alpha),
1687                A.unwrap_shared(),
1688                std::mem::transmute(*beta),
1689                C.unwrap_unique(),
1690            )
1691        };
1692        result_handler!(ret, ())
1693    }
1694
1695    /// This function computes a rank-k update of the symmetric matrix C, C = \alpha A A^T + \beta C when Trans is NoTrans and C = \alpha A^T A + \beta C when Trans is Trans.
1696    /// Since the matrix C is symmetric only its upper half or lower half need to be stored.
1697    /// When Uplo is Upper then the upper triangle and diagonal of C are used, and when Uplo is Lower then the lower triangle and diagonal of C are used.
1698    #[doc(alias = "gsl_blas_zsyrk")]
1699    pub fn zsyrk(
1700        uplo: enums::CblasUplo,
1701        trans: enums::CblasTranspose,
1702        alpha: &types::ComplexF64,
1703        A: &types::MatrixComplexF64,
1704        beta: &types::ComplexF64,
1705        C: &mut types::MatrixComplexF64,
1706    ) -> Result<(), Value> {
1707        let ret = unsafe {
1708            sys::gsl_blas_zsyrk(
1709                uplo.into(),
1710                trans.into(),
1711                std::mem::transmute(*alpha),
1712                A.unwrap_shared(),
1713                std::mem::transmute(*beta),
1714                C.unwrap_unique(),
1715            )
1716        };
1717        result_handler!(ret, ())
1718    }
1719
1720    /// These functions compute a rank-k update of the hermitian matrix C, C = \alpha A A^H + \beta C when Trans is NoTrans and C = \alpha A^H A + \beta C when Trans is ConjTrans.
1721    /// Since the matrix C is hermitian only its upper half or lower half need to be stored.
1722    /// When Uplo is Upper then the upper triangle and diagonal of C are used, and when Uplo is Lower then the lower triangle and diagonal of C are used.
1723    /// The imaginary elements of the diagonal are automatically set to zero.
1724    #[doc(alias = "gsl_blas_cherk")]
1725    pub fn cherk(
1726        uplo: enums::CblasUplo,
1727        trans: enums::CblasTranspose,
1728        alpha: f32,
1729        A: &types::MatrixComplexF32,
1730        beta: f32,
1731        C: &mut types::MatrixComplexF32,
1732    ) -> Result<(), Value> {
1733        let ret = unsafe {
1734            sys::gsl_blas_cherk(
1735                uplo.into(),
1736                trans.into(),
1737                alpha,
1738                A.unwrap_shared(),
1739                beta,
1740                C.unwrap_unique(),
1741            )
1742        };
1743        result_handler!(ret, ())
1744    }
1745
1746    /// These functions compute a rank-k update of the hermitian matrix C, C = \alpha A A^H + \beta C when Trans is NoTrans and C = \alpha A^H A + \beta C when Trans is ConjTrans.
1747    /// Since the matrix C is hermitian only its upper half or lower half need to be stored.
1748    /// When Uplo is Upper then the upper triangle and diagonal of C are used, and when Uplo is Lower then the lower triangle and diagonal of C are used.
1749    /// The imaginary elements of the diagonal are automatically set to zero.
1750    #[doc(alias = "gsl_blas_zherk")]
1751    pub fn zherk(
1752        uplo: enums::CblasUplo,
1753        trans: enums::CblasTranspose,
1754        alpha: f64,
1755        A: &types::MatrixComplexF64,
1756        beta: f64,
1757        C: &mut types::MatrixComplexF64,
1758    ) -> Result<(), Value> {
1759        let ret = unsafe {
1760            sys::gsl_blas_zherk(
1761                uplo.into(),
1762                trans.into(),
1763                alpha,
1764                A.unwrap_shared(),
1765                beta,
1766                C.unwrap_unique(),
1767            )
1768        };
1769        result_handler!(ret, ())
1770    }
1771
1772    /// This function computes a rank-2k update of the symmetric matrix C, C = \alpha A B^T + \alpha B A^T + \beta C when Trans is NoTrans and C = \alpha A^T B + \alpha B^T A + \beta C when Trans is Trans.
1773    /// Since the matrix C is symmetric only its upper half or lower half need to be stored.
1774    /// When Uplo is Upper then the upper triangle and diagonal of C are used, and when Uplo is Lower then the lower triangle and diagonal of C are used.
1775    #[doc(alias = "gsl_blas_ssyr2k")]
1776    pub fn ssyr2k(
1777        uplo: enums::CblasUplo,
1778        trans: enums::CblasTranspose,
1779        alpha: f32,
1780        A: &types::MatrixF32,
1781        B: &types::MatrixF32,
1782        beta: f32,
1783        C: &mut types::MatrixF32,
1784    ) -> Result<(), Value> {
1785        let ret = unsafe {
1786            sys::gsl_blas_ssyr2k(
1787                uplo.into(),
1788                trans.into(),
1789                alpha,
1790                A.unwrap_shared(),
1791                B.unwrap_shared(),
1792                beta,
1793                C.unwrap_unique(),
1794            )
1795        };
1796        result_handler!(ret, ())
1797    }
1798
1799    /// This function computes a rank-2k update of the symmetric matrix C, C = \alpha A B^T + \alpha B A^T + \beta C when Trans is NoTrans and C = \alpha A^T B + \alpha B^T A + \beta C when Trans is Trans.
1800    /// Since the matrix C is symmetric only its upper half or lower half need to be stored.
1801    /// When Uplo is Upper then the upper triangle and diagonal of C are used, and when Uplo is Lower then the lower triangle and diagonal of C are used.
1802    #[doc(alias = "gsl_blas_dsyr2k")]
1803    pub fn dsyr2k(
1804        uplo: enums::CblasUplo,
1805        trans: enums::CblasTranspose,
1806        alpha: f64,
1807        A: &types::MatrixF64,
1808        B: &types::MatrixF64,
1809        beta: f64,
1810        C: &mut types::MatrixF64,
1811    ) -> Result<(), Value> {
1812        let ret = unsafe {
1813            sys::gsl_blas_dsyr2k(
1814                uplo.into(),
1815                trans.into(),
1816                alpha,
1817                A.unwrap_shared(),
1818                B.unwrap_shared(),
1819                beta,
1820                C.unwrap_unique(),
1821            )
1822        };
1823        result_handler!(ret, ())
1824    }
1825
1826    /// This function computes a rank-2k update of the symmetric matrix C, C = \alpha A B^T + \alpha B A^T + \beta C when Trans is NoTrans and C = \alpha A^T B + \alpha B^T A + \beta C when Trans is Trans.
1827    /// Since the matrix C is symmetric only its upper half or lower half need to be stored.
1828    /// When Uplo is Upper then the upper triangle and diagonal of C are used, and when Uplo is Lower then the lower triangle and diagonal of C are used.
1829    #[doc(alias = "gsl_blas_csyr2k")]
1830    pub fn csyr2k(
1831        uplo: enums::CblasUplo,
1832        trans: enums::CblasTranspose,
1833        alpha: &types::ComplexF32,
1834        A: &types::MatrixComplexF32,
1835        B: &types::MatrixComplexF32,
1836        beta: &types::ComplexF32,
1837        C: &mut types::MatrixComplexF32,
1838    ) -> Result<(), Value> {
1839        let ret = unsafe {
1840            sys::gsl_blas_csyr2k(
1841                uplo.into(),
1842                trans.into(),
1843                std::mem::transmute(*alpha),
1844                A.unwrap_shared(),
1845                B.unwrap_shared(),
1846                std::mem::transmute(*beta),
1847                C.unwrap_unique(),
1848            )
1849        };
1850        result_handler!(ret, ())
1851    }
1852
1853    /// This function computes a rank-2k update of the symmetric matrix C, C = \alpha A B^T + \alpha B A^T + \beta C when Trans is NoTrans and C = \alpha A^T B + \alpha B^T A + \beta C when Trans is Trans.
1854    /// Since the matrix C is symmetric only its upper half or lower half need to be stored.
1855    /// When Uplo is Upper then the upper triangle and diagonal of C are used, and when Uplo is Lower then the lower triangle and diagonal of C are used.
1856    #[doc(alias = "gsl_blas_zsyr2k")]
1857    pub fn zsyr2k(
1858        uplo: enums::CblasUplo,
1859        trans: enums::CblasTranspose,
1860        alpha: &types::ComplexF64,
1861        A: &types::MatrixComplexF64,
1862        B: &types::MatrixComplexF64,
1863        beta: &types::ComplexF64,
1864        C: &mut types::MatrixComplexF64,
1865    ) -> Result<(), Value> {
1866        let ret = unsafe {
1867            sys::gsl_blas_zsyr2k(
1868                uplo.into(),
1869                trans.into(),
1870                std::mem::transmute(*alpha),
1871                A.unwrap_shared(),
1872                B.unwrap_shared(),
1873                std::mem::transmute(*beta),
1874                C.unwrap_unique(),
1875            )
1876        };
1877        result_handler!(ret, ())
1878    }
1879
1880    /// This function computes a rank-2k update of the hermitian matrix C, C = \alpha A B^H + \alpha^* B A^H + \beta C when Trans is NoTrans and C = \alpha A^H B + \alpha^* B^H A + \beta C when Trans is ConjTrans.
1881    /// Since the matrix C is hermitian only its upper half or lower half need to be stored.
1882    /// When Uplo is Upper then the upper triangle and diagonal of C are used, and when Uplo is Lower then the lower triangle and diagonal of C are used.
1883    /// The imaginary elements of the diagonal are automatically set to zero.
1884    #[doc(alias = "gsl_blas_cher2k")]
1885    pub fn cher2k(
1886        uplo: enums::CblasUplo,
1887        trans: enums::CblasTranspose,
1888        alpha: &types::ComplexF32,
1889        A: &types::MatrixComplexF32,
1890        B: &types::MatrixComplexF32,
1891        beta: f32,
1892        C: &mut types::MatrixComplexF32,
1893    ) -> Result<(), Value> {
1894        let ret = unsafe {
1895            sys::gsl_blas_cher2k(
1896                uplo.into(),
1897                trans.into(),
1898                std::mem::transmute(*alpha),
1899                A.unwrap_shared(),
1900                B.unwrap_shared(),
1901                beta,
1902                C.unwrap_unique(),
1903            )
1904        };
1905        result_handler!(ret, ())
1906    }
1907
1908    /// This function computes a rank-2k update of the hermitian matrix C, C = \alpha A B^H + \alpha^* B A^H + \beta C when Trans is NoTrans and C = \alpha A^H B + \alpha^* B^H A + \beta C when Trans is ConjTrans.
1909    /// Since the matrix C is hermitian only its upper half or lower half need to be stored.
1910    /// When Uplo is Upper then the upper triangle and diagonal of C are used, and when Uplo is Lower then the lower triangle and diagonal of C are used.
1911    /// The imaginary elements of the diagonal are automatically set to zero.
1912    #[doc(alias = "gsl_blas_zher2k")]
1913    pub fn zher2k(
1914        uplo: enums::CblasUplo,
1915        trans: enums::CblasTranspose,
1916        alpha: &types::ComplexF64,
1917        A: &types::MatrixComplexF64,
1918        B: &types::MatrixComplexF64,
1919        beta: f64,
1920        C: &mut types::MatrixComplexF64,
1921    ) -> Result<(), Value> {
1922        let ret = unsafe {
1923            sys::gsl_blas_zher2k(
1924                uplo.into(),
1925                trans.into(),
1926                std::mem::transmute(*alpha),
1927                A.unwrap_shared(),
1928                B.unwrap_shared(),
1929                beta,
1930                C.unwrap_unique(),
1931            )
1932        };
1933        result_handler!(ret, ())
1934    }
1935}