Mercurial > octave
comparison liboctave/array/dMatrix.cc @ 29931:7faff48840eb
prefer data over fortran_vec for read-only access to data
See also the discussion here: https://octave.discourse.group/t/rename-uses-of-fortran-vec-to-data-for-clarity/1439
* Array.h (const T * Array<T>::fortran_vec (void) const): Deprecate.
Change all uses to call data instead.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 30 Jul 2021 11:46:05 -0400 |
parents | 3cb8519fed0f |
children | 1e277c6b6626 |
comparison
equal
deleted
inserted
replaced
29930:aa98b5fdfbbb | 29931:7faff48840eb |
---|---|
731 { | 731 { |
732 npts = nr; | 732 npts = nr; |
733 nsamples = nc; | 733 nsamples = nc; |
734 } | 734 } |
735 | 735 |
736 const double *in (fortran_vec ()); | 736 const double *in (data ()); |
737 Complex *out (retval.fortran_vec ()); | 737 Complex *out (retval.fortran_vec ()); |
738 | 738 |
739 octave::fftw::fft (in, out, npts, nsamples); | 739 octave::fftw::fft (in, out, npts, nsamples); |
740 | 740 |
741 return retval; | 741 return retval; |
761 npts = nr; | 761 npts = nr; |
762 nsamples = nc; | 762 nsamples = nc; |
763 } | 763 } |
764 | 764 |
765 ComplexMatrix tmp (*this); | 765 ComplexMatrix tmp (*this); |
766 Complex *in (tmp.fortran_vec ()); | 766 const Complex *in (tmp.data ()); |
767 Complex *out (retval.fortran_vec ()); | 767 Complex *out (retval.fortran_vec ()); |
768 | 768 |
769 octave::fftw::ifft (in, out, npts, nsamples); | 769 octave::fftw::ifft (in, out, npts, nsamples); |
770 | 770 |
771 return retval; | 771 return retval; |
774 ComplexMatrix | 774 ComplexMatrix |
775 Matrix::fourier2d (void) const | 775 Matrix::fourier2d (void) const |
776 { | 776 { |
777 dim_vector dv (rows (), cols ()); | 777 dim_vector dv (rows (), cols ()); |
778 | 778 |
779 const double *in = fortran_vec (); | 779 const double *in = data (); |
780 ComplexMatrix retval (rows (), cols ()); | 780 ComplexMatrix retval (rows (), cols ()); |
781 octave::fftw::fftNd (in, retval.fortran_vec (), 2, dv); | 781 octave::fftw::fftNd (in, retval.fortran_vec (), 2, dv); |
782 | 782 |
783 return retval; | 783 return retval; |
784 } | 784 } |
1034 typ = mattype.type (*this); | 1034 typ = mattype.type (*this); |
1035 | 1035 |
1036 // Only calculate the condition number for LU/Cholesky | 1036 // Only calculate the condition number for LU/Cholesky |
1037 if (typ == MatrixType::Upper) | 1037 if (typ == MatrixType::Upper) |
1038 { | 1038 { |
1039 const double *tmp_data = fortran_vec (); | 1039 const double *tmp_data = data (); |
1040 F77_INT info = 0; | 1040 F77_INT info = 0; |
1041 char norm = '1'; | 1041 char norm = '1'; |
1042 char uplo = 'U'; | 1042 char uplo = 'U'; |
1043 char dia = 'N'; | 1043 char dia = 'N'; |
1044 | 1044 |
1062 else if (typ == MatrixType::Permuted_Upper) | 1062 else if (typ == MatrixType::Permuted_Upper) |
1063 (*current_liboctave_error_handler) | 1063 (*current_liboctave_error_handler) |
1064 ("permuted triangular matrix not implemented"); | 1064 ("permuted triangular matrix not implemented"); |
1065 else if (typ == MatrixType::Lower) | 1065 else if (typ == MatrixType::Lower) |
1066 { | 1066 { |
1067 const double *tmp_data = fortran_vec (); | 1067 const double *tmp_data = data (); |
1068 F77_INT info = 0; | 1068 F77_INT info = 0; |
1069 char norm = '1'; | 1069 char norm = '1'; |
1070 char uplo = 'L'; | 1070 char uplo = 'L'; |
1071 char dia = 'N'; | 1071 char dia = 'N'; |
1072 | 1072 |
1207 | 1207 |
1208 if (typ == MatrixType::Permuted_Upper) | 1208 if (typ == MatrixType::Permuted_Upper) |
1209 (*current_liboctave_error_handler) | 1209 (*current_liboctave_error_handler) |
1210 ("permuted triangular matrix not implemented"); | 1210 ("permuted triangular matrix not implemented"); |
1211 | 1211 |
1212 const double *tmp_data = fortran_vec (); | 1212 const double *tmp_data = data (); |
1213 | 1213 |
1214 retval = b; | 1214 retval = b; |
1215 double *result = retval.fortran_vec (); | 1215 double *result = retval.fortran_vec (); |
1216 | 1216 |
1217 char uplo = 'U'; | 1217 char uplo = 'U'; |
1305 | 1305 |
1306 if (typ == MatrixType::Permuted_Lower) | 1306 if (typ == MatrixType::Permuted_Lower) |
1307 (*current_liboctave_error_handler) | 1307 (*current_liboctave_error_handler) |
1308 ("permuted triangular matrix not implemented"); | 1308 ("permuted triangular matrix not implemented"); |
1309 | 1309 |
1310 const double *tmp_data = fortran_vec (); | 1310 const double *tmp_data = data (); |
1311 | 1311 |
1312 retval = b; | 1312 retval = b; |
1313 double *result = retval.fortran_vec (); | 1313 double *result = retval.fortran_vec (); |
1314 | 1314 |
1315 char uplo = 'L'; | 1315 char uplo = 'L'; |