Skip to content

Commit dc43e62

Browse files
authored
Expose nuclear norm order in linalg API (#411)
1 parent 058eda6 commit dc43e62

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

Source/MLX/Linalg.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ public enum MLXLinalg {
1313
public enum NormKind: String, Sendable {
1414
/// Frobenius norm
1515
case fro
16+
17+
/// Nuclear norm, the sum of singular values
18+
case nuc
1619
}
1720

1821
/// Matrix or vector norm.
@@ -36,7 +39,7 @@ public enum MLXLinalg {
3639
/// -2 | smallest singular value | as below
3740
/// other | -- | sum(abs(x)**ord)**(1./ord)
3841
///
39-
/// > Nuclear norm and norms based on singular values are not yet implemented.
42+
/// Nuclear norm and norms based on singular values are implemented by the linalg backend.
4043
///
4144
/// The Frobenius norm is given by G. H. Golub and C. F. Van Loan, *Matrix Computations*,
4245
/// Baltimore, MD, Johns Hopkins University Press, 1985, pg. 15
@@ -91,7 +94,7 @@ public enum MLXLinalg {
9194
/// -2 | smallest singular value | as below
9295
/// other | -- | sum(abs(x)**ord)**(1./ord)
9396
///
94-
/// > Nuclear norm and norms based on singular values are not yet implemented.
97+
/// Nuclear norm and norms based on singular values are implemented by the linalg backend.
9598
///
9699
/// The Frobenius norm is given by G. H. Golub and C. F. Van Loan, *Matrix Computations*,
97100
/// Baltimore, MD, Johns Hopkins University Press, 1985, pg. 15
@@ -548,7 +551,7 @@ public enum MLXLinalg {
548551
/// -2 | smallest singular value | as below
549552
/// other | -- | sum(abs(x)**ord)**(1./ord)
550553
///
551-
/// > Nuclear norm and norms based on singular values are not yet implemented.
554+
/// Nuclear norm and norms based on singular values are implemented by the linalg backend.
552555
///
553556
/// The Frobenius norm is given by G. H. Golub and C. F. Van Loan, *Matrix Computations*,
554557
/// Baltimore, MD, Johns Hopkins University Press, 1985, pg. 15
@@ -597,7 +600,7 @@ public func norm(
597600
/// -2 | smallest singular value | as below
598601
/// other | -- | sum(abs(x)**ord)**(1./ord)
599602
///
600-
/// > Nuclear norm and norms based on singular values are not yet implemented.
603+
/// Nuclear norm and norms based on singular values are implemented by the linalg backend.
601604
///
602605
/// The Frobenius norm is given by G. H. Golub and C. F. Van Loan, *Matrix Computations*,
603606
/// Baltimore, MD, Johns Hopkins University Press, 1985, pg. 15

Source/MLXLinalg/Linalg.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public let deprecationWarning: Void = ()
3131
/// -2 | smallest singular value | as below
3232
/// other | -- | sum(abs(x)**ord)**(1./ord)
3333
///
34-
/// > Nuclear norm and norms based on singular values are not yet implemented.
34+
/// Nuclear norm and norms based on singular values are implemented by the linalg backend.
3535
///
3636
/// The Frobenius norm is given by G. H. Golub and C. F. Van Loan, *Matrix Computations*,
3737
/// Baltimore, MD, Johns Hopkins University Press, 1985, pg. 15
@@ -81,7 +81,7 @@ public func norm(
8181
/// -2 | smallest singular value | as below
8282
/// other | -- | sum(abs(x)**ord)**(1./ord)
8383
///
84-
/// > Nuclear norm and norms based on singular values are not yet implemented.
84+
/// Nuclear norm and norms based on singular values are implemented by the linalg backend.
8585
///
8686
/// The Frobenius norm is given by G. H. Golub and C. F. Van Loan, *Matrix Computations*,
8787
/// Baltimore, MD, Johns Hopkins University Press, 1985, pg. 15

0 commit comments

Comments
 (0)