comparison liboctave/MatrixType.cc @ 6460:fa6312d93730

[project @ 2007-03-26 21:23:00 by dbateman]
author dbateman
date Mon, 26 Mar 2007 21:23:00 +0000
parents 7e90124eddba
children 93c65f2a5668
comparison
equal deleted inserted replaced
6459:5dc550e1f419 6460:fa6312d93730
34 #include "oct-spparms.h" 34 #include "oct-spparms.h"
35 35
36 // FIXME There is a large code duplication here 36 // FIXME There is a large code duplication here
37 37
38 MatrixType::MatrixType (void) 38 MatrixType::MatrixType (void)
39 : typ (MatrixType::Unknown), sp_bandden (0), bandden (0), upper_band (0), 39 : typ (MatrixType::Unknown),
40 sp_bandden (octave_sparse_params::get_bandden()),
41 bandden (0), upper_band (0),
40 lower_band (0), dense (false), full (false), nperm (0), perm (0) { } 42 lower_band (0), dense (false), full (false), nperm (0), perm (0) { }
41 43
42 MatrixType::MatrixType (const MatrixType &a) 44 MatrixType::MatrixType (const MatrixType &a)
43 : typ (a.typ), sp_bandden (a.sp_bandden), bandden (a.bandden), 45 : typ (a.typ), sp_bandden (a.sp_bandden), bandden (a.bandden),
44 upper_band (a.upper_band), lower_band (a.lower_band), 46 upper_band (a.upper_band), lower_band (a.lower_band),
184 186
185 if (octave_sparse_params::get_key ("spumoni") != 0.) 187 if (octave_sparse_params::get_key ("spumoni") != 0.)
186 (*current_liboctave_warning_handler) 188 (*current_liboctave_warning_handler)
187 ("Calculating Sparse Matrix Type"); 189 ("Calculating Sparse Matrix Type");
188 190
189 sp_bandden = octave_sparse_params::get_key ("bandden"); 191 sp_bandden = octave_sparse_params::get_bandden();
190 bool maybe_hermitian = false; 192 bool maybe_hermitian = false;
191 typ = MatrixType::Full; 193 typ = MatrixType::Full;
192 194
193 if (nnz == nm) 195 if (nnz == nm)
194 { 196 {
510 512
511 if (octave_sparse_params::get_key ("spumoni") != 0.) 513 if (octave_sparse_params::get_key ("spumoni") != 0.)
512 (*current_liboctave_warning_handler) 514 (*current_liboctave_warning_handler)
513 ("Calculating Sparse Matrix Type"); 515 ("Calculating Sparse Matrix Type");
514 516
515 sp_bandden = octave_sparse_params::get_key ("bandden"); 517 sp_bandden = octave_sparse_params::get_bandden();
516 bool maybe_hermitian = false; 518 bool maybe_hermitian = false;
517 typ = MatrixType::Full; 519 typ = MatrixType::Full;
518 520
519 if (nnz == nm) 521 if (nnz == nm)
520 { 522 {
823 } 825 }
824 } 826 }
825 } 827 }
826 MatrixType::MatrixType (const matrix_type t, bool _full) 828 MatrixType::MatrixType (const matrix_type t, bool _full)
827 : typ (MatrixType::Unknown), 829 : typ (MatrixType::Unknown),
828 sp_bandden (octave_sparse_params::get_key ("bandden")), 830 sp_bandden (octave_sparse_params::get_bandden()),
829 bandden (0), upper_band (0), lower_band (0), 831 bandden (0), upper_band (0), lower_band (0),
830 dense (false), full (_full), nperm (0), perm (0) 832 dense (false), full (_full), nperm (0), perm (0)
831 { 833 {
832 if (t == MatrixType::Full || t == MatrixType::Diagonal || 834 if (t == MatrixType::Full || t == MatrixType::Diagonal ||
833 t == MatrixType::Permuted_Diagonal || t == MatrixType::Upper || 835 t == MatrixType::Permuted_Diagonal || t == MatrixType::Upper ||
839 } 841 }
840 842
841 MatrixType::MatrixType (const matrix_type t, const octave_idx_type np, 843 MatrixType::MatrixType (const matrix_type t, const octave_idx_type np,
842 const octave_idx_type *p, bool _full) 844 const octave_idx_type *p, bool _full)
843 : typ (MatrixType::Unknown), 845 : typ (MatrixType::Unknown),
844 sp_bandden (octave_sparse_params::get_key ("bandden")), 846 sp_bandden (octave_sparse_params::get_bandden()),
845 bandden (0), upper_band (0), lower_band (0), 847 bandden (0), upper_band (0), lower_band (0),
846 dense (false), full (_full), nperm (0), perm (0) 848 dense (false), full (_full), nperm (0), perm (0)
847 { 849 {
848 if ((t == MatrixType::Permuted_Upper || t == MatrixType::Permuted_Lower) && 850 if ((t == MatrixType::Permuted_Upper || t == MatrixType::Permuted_Lower) &&
849 np > 0 && p != 0) 851 np > 0 && p != 0)
859 } 861 }
860 862
861 MatrixType::MatrixType (const matrix_type t, const octave_idx_type ku, 863 MatrixType::MatrixType (const matrix_type t, const octave_idx_type ku,
862 const octave_idx_type kl, bool _full) 864 const octave_idx_type kl, bool _full)
863 : typ (MatrixType::Unknown), 865 : typ (MatrixType::Unknown),
864 sp_bandden (octave_sparse_params::get_key ("bandden")), 866 sp_bandden (octave_sparse_params::get_bandden()),
865 bandden (0), upper_band (0), lower_band (0), 867 bandden (0), upper_band (0), lower_band (0),
866 dense (false), full (_full), nperm (0), perm (0) 868 dense (false), full (_full), nperm (0), perm (0)
867 { 869 {
868 if (t == MatrixType::Banded || t == MatrixType::Banded_Hermitian) 870 if (t == MatrixType::Banded || t == MatrixType::Banded_Hermitian)
869 { 871 {
910 912
911 int 913 int
912 MatrixType::type (bool quiet) 914 MatrixType::type (bool quiet)
913 { 915 {
914 if (typ != MatrixType::Unknown && (full || 916 if (typ != MatrixType::Unknown && (full ||
915 sp_bandden == octave_sparse_params::get_key ("bandden"))) 917 sp_bandden == octave_sparse_params::get_bandden()))
916 { 918 {
917 if (!quiet && 919 if (!quiet &&
918 octave_sparse_params::get_key ("spumoni") != 0.) 920 octave_sparse_params::get_key ("spumoni") != 0.)
919 (*current_liboctave_warning_handler) 921 (*current_liboctave_warning_handler)
920 ("Using Cached Matrix Type"); 922 ("Using Cached Matrix Type");
934 936
935 int 937 int
936 MatrixType::type (const SparseMatrix &a) 938 MatrixType::type (const SparseMatrix &a)
937 { 939 {
938 if (typ != MatrixType::Unknown && (full || 940 if (typ != MatrixType::Unknown && (full ||
939 sp_bandden == octave_sparse_params::get_key ("bandden"))) 941 sp_bandden == octave_sparse_params::get_bandden()))
940 { 942 {
941 if (octave_sparse_params::get_key ("spumoni") != 0.) 943 if (octave_sparse_params::get_key ("spumoni") != 0.)
942 (*current_liboctave_warning_handler) 944 (*current_liboctave_warning_handler)
943 ("Using Cached Matrix Type"); 945 ("Using Cached Matrix Type");
944 946
967 969
968 int 970 int
969 MatrixType::type (const SparseComplexMatrix &a) 971 MatrixType::type (const SparseComplexMatrix &a)
970 { 972 {
971 if (typ != MatrixType::Unknown && (full || 973 if (typ != MatrixType::Unknown && (full ||
972 sp_bandden == octave_sparse_params::get_key ("bandden"))) 974 sp_bandden == octave_sparse_params::get_bandden()))
973 { 975 {
974 if (octave_sparse_params::get_key ("spumoni") != 0.) 976 if (octave_sparse_params::get_key ("spumoni") != 0.)
975 (*current_liboctave_warning_handler) 977 (*current_liboctave_warning_handler)
976 ("Using Cached Matrix Type"); 978 ("Using Cached Matrix Type");
977 979