/// <summary> /// Converts from <see cref="DoubleMatrixRow"/> to <see cref="DoubleMatrix"/>. /// </summary> /// <param name="value">The object to convert.</param> /// <returns>The converted object.</returns> public static DoubleMatrix ToDoubleMatrix(DoubleMatrixRow value) { if (value is null) { return(null); } return(value.collection.matrix[value.rowIndex, ":"]); }
/// <summary> /// Compares the current object with another object of the same type. /// </summary> /// <param name="other">An object to compare with this object.</param> /// <remarks> /// <inheritdoc cref="DoubleMatrixRow" /// path="para[@id='quasi.lexicographic.order']"/> /// <inheritdoc cref="DoubleMatrixRow" /// path="para[@id='quasi.lexicographic.equality']"/> /// </remarks> /// <returns>A value that indicates the relative order of the objects /// being compared. The return value has the following meanings: /// <list type="table"> /// <listheader> /// <term>Value</term> /// <term>Meaning</term> /// </listheader> /// <item> /// <term>Less than zero</term> /// <term>This object is less than the <paramref name="other" /> parameter.</term> /// </item> /// <item> /// <term>Zero</term> /// <term>This object is equal to <paramref name="other" />.</term> /// </item> /// <item> /// <term>Greater than zero</term> /// <term>This object is greater than <paramref name="other" />.</term> /// </item> /// </list> /// </returns> /// <seealso href="https://en.wikipedia.org/wiki/Lexicographical_order"/> public int CompareTo(DoubleMatrixRow other) { if (other is null) { return(1); } // A value that indicates the relative order of the objects being compared. // The return value has the following meanings: // // Value Meaning // // Less than zero This object is less than the other parameter. // Zero This object is equal to other. // Greater than zero This object is greater than other. // Quasi-lexicographic order // Order by length first int thisLength = this.Length; int lengthDifference = other.Length - thisLength; if (lengthDifference > 0) { return(-1); } if (lengthDifference < 0) { return(1); } // Here if and only if lengthDifference == 0 int result = 0; double thisValue, otherValue; for (int j = 0; j < thisLength; j++) { thisValue = this[j]; otherValue = other[j]; if (thisValue < otherValue) { result = -1; break; } else if (thisValue > otherValue) { result = 1; break; } } return(result); }
/// <summary> /// Indicates whether the current object is equal to another object of the same type. /// </summary> /// <param name="other">An object to compare with this object.</param> /// <returns><c>true</c> if the current object is equal to the <paramref name="other" /> /// parameter; otherwise, <c>false</c>.</returns> /// <remarks> /// <inheritdoc cref="DoubleMatrixRow" /// path="para[@id='quasi.lexicographic.order']"/> /// <inheritdoc cref="DoubleMatrixRow" /// path="para[@id='quasi.lexicographic.equality']"/> /// </remarks> /// <seealso href="https://en.wikipedia.org/wiki/Lexicographical_order"/> public bool Equals(DoubleMatrixRow other) { return(0 == this.CompareTo(other)); }
public DoubleMatrixRowEnumerator(DoubleMatrixRow matrixRow) { this.matrixRow = matrixRow; }