Skip to content

Commit cd6b4ba

Browse files
committed
Merge remote-tracking branch 'origin/develop' into develop
2 parents 2a4cf82 + 6a1b0a7 commit cd6b4ba

File tree

3 files changed

+33
-17
lines changed

3 files changed

+33
-17
lines changed

src/utils/optimizeCallback.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import { typeOf as _typeOf } from './is.js'
88
* @param {Function} callback The original callback function to simplify.
99
* @param {Array|Matrix} array The array that will be used with the callback function.
1010
* @param {string} name The name of the function that is using the callback.
11-
* @param {boolean} [isUnary=false] If true, the callback function is unary and will be optimized as such.
11+
* @param {boolean} isUnary If true, the callback function is unary and will be optimized as such.
1212
* @returns {Function} Returns a simplified version of the callback function.
1313
*/
14-
export function optimizeCallback (callback, array, name, isUnary = false) {
14+
export function optimizeCallback (callback, array, name, isUnary) {
1515
if (typed.isTypedFunction(callback)) {
1616
let numberOfArguments
1717
if (isUnary) {

test/unit-tests/function/matrix/ctranspose.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('ctranspose', function () {
1818
assert.deepStrictEqual(ctranspose(math.matrix([1, 2, 3]).toArray()), [1, 2, 3])
1919
})
2020

21-
it('should conjgate a complex vector', function () {
21+
it('should conjugate a complex vector', function () {
2222
const a = math.complex(1, 2)
2323
const b = math.complex(3, 4)
2424
const c = math.complex(5, 6)

types/index.d.ts

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ export interface MathJsInstance extends MathJsFactory {
10931093
* decomposition.
10941094
* @param order The Symbolic Ordering and Analysis order: 0 - Natural
10951095
* ordering, no permutation vector q is returned 1 - Matrix must be
1096-
* square, symbolic ordering and analisis is performed on M = A + A' 2 -
1096+
* square, symbolic ordering and analysis is performed on M = A + A' 2 -
10971097
* Symbolic ordering and analysis is performed on M = A' * A. Dense
10981098
* columns from A' are dropped, A recreated from A'. This is appropriate
10991099
* for LU factorization of non-symmetric matrices. 3 - Symbolic ordering
@@ -1329,7 +1329,7 @@ export interface MathJsInstance extends MathJsFactory {
13291329
* @param args A list with numeric values or an Array or Matrix. Matrix
13301330
* and Array input is flattened and returns a single number for the
13311331
* whole matrix.
1332-
* @returns Returns the hypothenuse of the input values.
1332+
* @returns Returns the hypotenuse of the input values.
13331333
*/
13341334
hypot<T extends number | BigNumber>(...args: T[]): T
13351335
hypot<T extends number | BigNumber>(args: T[]): T
@@ -1547,7 +1547,7 @@ export interface MathJsInstance extends MathJsFactory {
15471547
* strings will be converted to a number. For complex numbers, both real
15481548
* and complex value are inverted.
15491549
* @param x Number to be inverted
1550-
* @returns Retursn the value with inverted sign
1550+
* @returns Returns the value with inverted sign
15511551
*/
15521552
unaryMinus<T extends MathType>(x: T): T
15531553

@@ -1758,7 +1758,7 @@ export interface MathJsInstance extends MathJsFactory {
17581758
************************************************************************/
17591759

17601760
/**
1761-
* Calculates: The eucledian distance between two points in 2 and 3
1761+
* Calculates: The Euclidean distance between two points in 2 and 3
17621762
* dimensional spaces. Distance between point and a line in 2 and 3
17631763
* dimensional spaces. Pairwise distance between a set of 2D or 3D
17641764
* points NOTE: When substituting coefficients of a line(a, b and c),
@@ -1898,6 +1898,14 @@ export interface MathJsInstance extends MathJsFactory {
18981898
*/
18991899
cross(x: MathCollection, y: MathCollection): MathCollection
19001900

1901+
/**
1902+
* Transpose and complex conjugate a matrix. All values of the matrix are
1903+
* reflected over its main diagonal and then the complex conjugate is taken.
1904+
* This is equivalent to complex conjugation for scalars and vectors.
1905+
* @param x Matrix to be ctransposed
1906+
*/
1907+
ctranspose(x: MathCollection): MathCollection
1908+
19011909
/**
19021910
* Calculate the determinant of a matrix.
19031911
* @param x A Matrix
@@ -2082,7 +2090,7 @@ export interface MathJsInstance extends MathJsFactory {
20822090

20832091
/**
20842092
* Calculate the inverse of a square matrix.
2085-
* @param x Matrix to be inversed
2093+
* @param x Matrix to be inverted
20862094
* @returns The inverse of x
20872095
*/
20882096
inv<T extends number | Complex | MathCollection>(x: T): NoLiteralType<T>
@@ -2191,7 +2199,7 @@ export interface MathJsInstance extends MathJsFactory {
21912199

21922200
/**
21932201
* Calculate the Moore–Penrose inverse of a matrix.
2194-
* @param x Matrix to be inversed
2202+
* @param x Matrix to be inverted
21952203
* @return The inverse of `x`.
21962204
*/
21972205
pinv<T extends MathType>(x: T): T
@@ -2458,7 +2466,7 @@ export interface MathJsInstance extends MathJsFactory {
24582466
* distributions
24592467
* @param q First vector
24602468
* @param p Second vector
2461-
* @returns Returns disance between q and p
2469+
* @returns Returns distance between q and p
24622470
*/
24632471
kldivergence(q: MathCollection, p: MathCollection): number
24642472

@@ -2475,7 +2483,7 @@ export interface MathJsInstance extends MathJsFactory {
24752483
* takes one array of integers as an argument. The following condition
24762484
* must be enforced: every ai <= 0
24772485
* @param a Integer number of objects in the subset
2478-
* @returns multinomial coefficent
2486+
* @returns multinomial coefficient
24792487
*/
24802488
multinomial<T extends number | BigNumber>(a: T[]): NoLiteralType<T>
24812489

@@ -2580,7 +2588,7 @@ export interface MathJsInstance extends MathJsFactory {
25802588
* Test element wise whether two matrices are equal. The function
25812589
* accepts both matrices and scalar values.
25822590
* @param x First matrix to compare
2583-
* @param y Second amtrix to compare
2591+
* @param y Second matrix to compare
25842592
* @returns Returns true when the input matrices have the same size and
25852593
* each of their elements is equal.
25862594
*/
@@ -2622,7 +2630,7 @@ export interface MathJsInstance extends MathJsFactory {
26222630
* compare values smaller than approximately 2.22e-16. For matrices, the
26232631
* function is evaluated element wise.
26242632
* @param x First value to compare
2625-
* @param y Second value to vcompare
2633+
* @param y Second value to compare
26262634
* @returns Returns true when x is larger than y, else returns false
26272635
*/
26282636
larger(x: MathType | string, y: MathType | string): boolean | MathCollection
@@ -2634,7 +2642,7 @@ export interface MathJsInstance extends MathJsFactory {
26342642
* to compare values smaller than approximately 2.22e-16. For matrices,
26352643
* the function is evaluated element wise.
26362644
* @param x First value to compare
2637-
* @param y Second value to vcompare
2645+
* @param y Second value to compare
26382646
* @returns Returns true when x is larger than or equal to y, else
26392647
* returns false
26402648
*/
@@ -2647,7 +2655,7 @@ export interface MathJsInstance extends MathJsFactory {
26472655
* to compare values smaller than approximately 2.22e-16. For matrices,
26482656
* the function is evaluated element wise.
26492657
* @param x First value to compare
2650-
* @param y Second value to vcompare
2658+
* @param y Second value to compare
26512659
* @returns Returns true when x is smaller than y, else returns false
26522660
*/
26532661
smaller(x: MathType | string, y: MathType | string): boolean | MathCollection
@@ -2659,7 +2667,7 @@ export interface MathJsInstance extends MathJsFactory {
26592667
* used to compare values smaller than approximately 2.22e-16. For
26602668
* matrices, the function is evaluated element wise.
26612669
* @param x First value to compare
2662-
* @param y Second value to vcompare
2670+
* @param y Second value to compare
26632671
* @returns Returns true when x is smaller than or equal to y, else
26642672
* returns false
26652673
*/
@@ -2693,7 +2701,7 @@ export interface MathJsInstance extends MathJsFactory {
26932701
* strictly, thus null is unequal with everything except null, and
26942702
* undefined is unequal with everything except undefined.
26952703
* @param x First value to compare
2696-
* @param y Second value to vcompare
2704+
* @param y Second value to compare
26972705
* @returns Returns true when the compared values are unequal, else
26982706
* returns false
26992707
*/
@@ -5816,6 +5824,13 @@ export interface MathJsChain<TValue> {
58165824
y: MathCollection
58175825
): MathJsChain<MathCollection>
58185826

5827+
/**
5828+
* Transpose and complex conjugate a matrix. All values of the matrix are
5829+
* reflected over its main diagonal and then the complex conjugate is taken.
5830+
* This is equivalent to complex conjugation for scalars and vectors.
5831+
*/
5832+
ctranspose(this: MathJsChain<MathCollection>): MathJsChain<MathCollection>
5833+
58195834
/**
58205835
* Calculate the difference between adjacent elements of the chained matrix or array.
58215836
* @param dim The dimension to apply the difference on.
@@ -7302,6 +7317,7 @@ export const {
73027317
apply, // @deprecated prior name of mapSlices
73037318
concat,
73047319
cross,
7320+
ctranspose,
73057321
det,
73067322
diag,
73077323
dot,

0 commit comments

Comments
 (0)