@@ -720,7 +720,41 @@ public static MatrixF zscoreRowsInplace(MatrixF A, MomentsF moments) {
720
720
}
721
721
722
722
/**
723
- * Rescales all elements in the matrix {@code A} into the range
723
+ * Rescales all elements in a copy of the matrix {@code A} into the range
724
+ * {@code [lowerBound, upperBound]}. Matrix {@code A} doesn't get mutated.
725
+ *
726
+ * @param A
727
+ * the matrix to rescale
728
+ * @param lowerBound
729
+ * the minimum value of an element after rescaling
730
+ * @param upperBound
731
+ * the maximum value of an element after rescaling
732
+ * @return a copy of matrix {@code A} with all elements rescaled
733
+ * @since 1.4.6
734
+ */
735
+ public static MatrixD rescale (MatrixD A , double lowerBound , double upperBound ) {
736
+ return rescaleInplace (A .copy (), lowerBound , upperBound );
737
+ }
738
+
739
+ /**
740
+ * Rescales all elements in a copy of the matrix {@code A} into the range
741
+ * {@code [lowerBound, upperBound]}. Matrix {@code A} doesn't get mutated.
742
+ *
743
+ * @param A
744
+ * the matrix to rescale
745
+ * @param lowerBound
746
+ * the minimum value of an element after rescaling
747
+ * @param upperBound
748
+ * the maximum value of an element after rescaling
749
+ * @return a copy of matrix {@code A} with all elements rescaled
750
+ * @since 1.4.6
751
+ */
752
+ public static MatrixF rescale (MatrixF A , float lowerBound , float upperBound ) {
753
+ return rescaleInplace (A .copy (), lowerBound , upperBound );
754
+ }
755
+
756
+ /**
757
+ * Rescales all elements in the matrix {@code A} in-place into the range
724
758
* {@code [lowerBound, upperBound]}.
725
759
*
726
760
* @param A
@@ -754,7 +788,7 @@ public static MatrixD rescaleInplace(MatrixD A, double lowerBound, double upperB
754
788
}
755
789
756
790
/**
757
- * Rescales all elements in the matrix {@code A} into the range
791
+ * Rescales all elements in the matrix {@code A} in-place into the range
758
792
* {@code [lowerBound, upperBound]}.
759
793
*
760
794
* @param A
@@ -939,6 +973,34 @@ public static ComplexMatrixF zscoreColumnsInplace(ComplexMatrixF A) {
939
973
return A ;
940
974
}
941
975
976
+ /**
977
+ * Randomly permutes the columns in a copy of matrix {@code A} using a
978
+ * default source of randomness. All permutations occur with approximately
979
+ * equal probability. Matrix {@code A} doesn't get mutated.
980
+ *
981
+ * @param A
982
+ * the matrix whose columns will be permuted at random
983
+ * @return a copy of matrix {@code A} with columns randomly permuted
984
+ * @since 1.4.6
985
+ */
986
+ public static MatrixD shuffleColumns (MatrixD A ) {
987
+ return shuffleColumnsInplace (A .copy (), null );
988
+ }
989
+
990
+ /**
991
+ * Randomly permutes the columns in a copy of matrix {@code A} using a
992
+ * default source of randomness. All permutations occur with approximately
993
+ * equal probability. Matrix {@code A} doesn't get mutated.
994
+ *
995
+ * @param A
996
+ * the matrix whose columns will be permuted at random
997
+ * @return a copy of matrix {@code A} with columns randomly permuted
998
+ * @since 1.4.6
999
+ */
1000
+ public static MatrixF shuffleColumns (MatrixF A ) {
1001
+ return shuffleColumnsInplace (A .copy (), null );
1002
+ }
1003
+
942
1004
/**
943
1005
* Randomly permutes the columns in matrix {@code A} in place using a
944
1006
* default source of randomness. All permutations occur with approximately
@@ -1031,6 +1093,34 @@ private static void swap(int aoff1, Object a, Object tmp, int len, int aoff2) {
1031
1093
}
1032
1094
}
1033
1095
1096
+ /**
1097
+ * Randomly permutes the rows in a copy of matrix {@code A} using a default
1098
+ * source of randomness. All permutations occur with approximately equal
1099
+ * probability. Matrix {@code A} doesn't get mutated.
1100
+ *
1101
+ * @param A
1102
+ * the matrix whose rows will be permuted at random
1103
+ * @return a copy of matrix {@code A} with rows randomly permuted
1104
+ * @since 1.4.6
1105
+ */
1106
+ public static MatrixD shuffleRows (MatrixD A ) {
1107
+ return shuffleRowsInplace (A .copy (), null );
1108
+ }
1109
+
1110
+ /**
1111
+ * Randomly permutes the rows in a copy of matrix {@code A} using a default
1112
+ * source of randomness. All permutations occur with approximately equal
1113
+ * probability. Matrix {@code A} doesn't get mutated.
1114
+ *
1115
+ * @param A
1116
+ * the matrix whose rows will be permuted at random
1117
+ * @return a copy of matrix {@code A} with rows randomly permuted
1118
+ * @since 1.4.6
1119
+ */
1120
+ public static MatrixF shuffleRows (MatrixF A ) {
1121
+ return shuffleRowsInplace (A .copy (), null );
1122
+ }
1123
+
1034
1124
/**
1035
1125
* Randomly permutes the rows in matrix {@code A} in place using a
1036
1126
* default source of randomness. All permutations occur with approximately
0 commit comments