You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

lapacke_zbbcsd_work.c 4.4 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*****************************************************************************
  2. Copyright (c) 2014, Intel Corp.
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are met:
  6. * Redistributions of source code must retain the above copyright notice,
  7. this list of conditions and the following disclaimer.
  8. * Redistributions in binary form must reproduce the above copyright
  9. notice, this list of conditions and the following disclaimer in the
  10. documentation and/or other materials provided with the distribution.
  11. * Neither the name of Intel Corporation nor the names of its contributors
  12. may be used to endorse or promote products derived from this software
  13. without specific prior written permission.
  14. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  15. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  16. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  17. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  18. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  19. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  20. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  21. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  22. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  23. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  24. THE POSSIBILITY OF SUCH DAMAGE.
  25. *****************************************************************************
  26. * Contents: Native middle-level C interface to LAPACK function zbbcsd
  27. * Author: Intel Corporation
  28. * Generated June 2017
  29. *****************************************************************************/
  30. #include "lapacke_utils.h"
  31. lapack_int LAPACKE_zbbcsd_work( int matrix_layout, char jobu1, char jobu2,
  32. char jobv1t, char jobv2t, char trans,
  33. lapack_int m, lapack_int p, lapack_int q,
  34. double* theta, double* phi,
  35. lapack_complex_double* u1, lapack_int ldu1,
  36. lapack_complex_double* u2, lapack_int ldu2,
  37. lapack_complex_double* v1t, lapack_int ldv1t,
  38. lapack_complex_double* v2t, lapack_int ldv2t,
  39. double* b11d, double* b11e, double* b12d,
  40. double* b12e, double* b21d, double* b21e,
  41. double* b22d, double* b22e, double* rwork,
  42. lapack_int lrwork )
  43. {
  44. lapack_int info = 0;
  45. /* LAPACK function works with matrices in both layouts. It is supported
  46. * through TRANS parameter. So all conversion between layouts can be
  47. * completed in LAPACK function. See the table below which describes how
  48. * every LAPACKE call is forwarded to corresponding LAPACK call.
  49. *
  50. * matrix_layout | trans_LAPACKE | -> trans_LAPACK
  51. * | (trans) | (ltrans)
  52. * -----------------+---------------+----------------
  53. * LAPACK_COL_MAJOR | 'N' | -> 'N'
  54. * LAPACK_COL_MAJOR | 'T' | -> 'T'
  55. * LAPACK_ROW_MAJOR | 'N' | -> 'T'
  56. * LAPACK_ROW_MAJOR | 'T' | -> 'T'
  57. * (note that for row major layout trans parameter is ignored)
  58. */
  59. if( matrix_layout == LAPACK_COL_MAJOR ||
  60. matrix_layout == LAPACK_ROW_MAJOR ) {
  61. char ltrans;
  62. if( !LAPACKE_lsame( trans, 't' ) && matrix_layout == LAPACK_COL_MAJOR ) {
  63. ltrans = 'n';
  64. } else {
  65. ltrans = 't';
  66. }
  67. /* Call LAPACK function and adjust info */
  68. LAPACK_zbbcsd( &jobu1, &jobu2, &jobv1t, &jobv2t, &ltrans, &m, &p, &q,
  69. theta, phi, u1, &ldu1, u2, &ldu2, v1t, &ldv1t, v2t,
  70. &ldv2t, b11d, b11e, b12d, b12e, b21d, b21e, b22d, b22e,
  71. rwork, &lrwork, &info );
  72. if( info < 0 ) {
  73. info = info - 1;
  74. }
  75. } else {
  76. info = -1;
  77. LAPACKE_xerbla( "LAPACKE_zbbcsd_work", info );
  78. }
  79. return info;
  80. }