Browse Source

LinearAlgebra: Complex primitives DataContract to support ephemeral serialization

netstandard
Christoph Ruegg 11 years ago
parent
commit
3b3346e130
  1. 15
      src/Numerics/Complex32.cs
  2. 16
      src/Numerics/Complex64.cs

15
src/Numerics/Complex32.cs

@ -28,17 +28,17 @@
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// </copyright> // </copyright>
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace MathNet.Numerics namespace MathNet.Numerics
{ {
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.InteropServices;
#if !PORTABLE #if !PORTABLE
using System.Runtime; using System.Runtime;
#endif #endif
#if !NOSYSNUMERICS #if !NOSYSNUMERICS
using Complex = System.Numerics.Complex; using Complex = System.Numerics.Complex;
using BigInteger = System.Numerics.BigInteger; using BigInteger = System.Numerics.BigInteger;
@ -72,16 +72,19 @@ namespace MathNet.Numerics
/// </remarks> /// </remarks>
[Serializable] [Serializable]
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
[DataContract(Namespace = "urn:MathNet/Numerics")]
public struct Complex32 : IFormattable, IEquatable<Complex32> public struct Complex32 : IFormattable, IEquatable<Complex32>
{ {
/// <summary> /// <summary>
/// The real component of the complex number. /// The real component of the complex number.
/// </summary> /// </summary>
[DataMember(Order = 1)]
private readonly float _real; private readonly float _real;
/// <summary> /// <summary>
/// The imaginary component of the complex number. /// The imaginary component of the complex number.
/// </summary> /// </summary>
[DataMember(Order = 2)]
private readonly float _imag; private readonly float _imag;
/// <summary> /// <summary>

16
src/Numerics/Complex64.cs

@ -29,14 +29,15 @@
// </copyright> // </copyright>
#if NOSYSNUMERICS #if NOSYSNUMERICS
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Text;
namespace MathNet.Numerics namespace MathNet.Numerics
{ {
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using Properties;
/// <summary> /// <summary>
/// 64-bit double precision complex numbers class. /// 64-bit double precision complex numbers class.
/// </summary> /// </summary>
@ -64,17 +65,20 @@ namespace MathNet.Numerics
/// </para> /// </para>
/// </remarks> /// </remarks>
[Serializable] [Serializable]
[DataContract(Namespace = "urn:MathNet/Numerics")]
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct Complex : IFormattable, IEquatable<Complex>, IPrecisionSupport<Complex> public struct Complex : IFormattable, IEquatable<Complex>, IPrecisionSupport<Complex>
{ {
/// <summary> /// <summary>
/// The real component of the complex number. /// The real component of the complex number.
/// </summary> /// </summary>
[DataMember(Order = 1)]
private readonly double _real; private readonly double _real;
/// <summary> /// <summary>
/// The imaginary component of the complex number. /// The imaginary component of the complex number.
/// </summary> /// </summary>
[DataMember(Order = 2)]
private readonly double _imag; private readonly double _imag;
/// <summary> /// <summary>

Loading…
Cancel
Save