.NET Matrix Library
Norm Method
See Also  Example Send Feedback



type
A NormType enumeration value that specifies the type of norm to be returned.
Returns the matrix norm.

Syntax

Visual Basic (Declaration) 
Public Function Norm( _
   ByVal type As NormType _
) As Double
Visual Basic (Usage)Copy Code
Dim instance As Matrix
Dim type As NormType
Dim value As Double
 
value = instance.Norm(type)
C# 
public double Norm( 
   NormType type
)
C++/CLI 
public:
double Norm( 
   NormType type
) 

Parameters

type
A NormType enumeration value that specifies the type of norm to be returned.

Return Value

A double value representing the specified norm.

Example

The following example calculates and prints the four different types norms of a matrix using the Norm method.
Visual BasicCopy Code
Imports System
Imports Bluebit.MatrixLibrary

Class Test

    Public Shared Sub Main()

        Dim A As Matrix
        'Declaring a random 4x3 Matrix
        A = New Matrix(4, 3)
        A.FillRandom()
        Console.WriteLine(A)

        Console.WriteLine(String.Format("Frobenius Norm = {0,6:F3}", A.Norm(NormType.FrobeniusNorm)))
        Console.WriteLine(String.Format("Infinity Norm  = {0,6:F3}", A.Norm(NormType.InfinityNorm)))
        Console.WriteLine(String.Format("One Norm       = {0,6:F3}", A.Norm(NormType.OneNorm)))
        Console.WriteLine(String.Format("Max Abs Value  = {0,6:F3}", A.Norm(NormType.MaxAbsValue)))

        Console.Read()
    End Sub

End Class
C#Copy Code
using System;
using Bluebit.MatrixLibrary;

class Test
{
    static void Main(string[] args)
    {
        Matrix A;
        //Declaring a random 4x3 Matrix
        A = new Matrix(4, 3);
        A.FillRandom();
        Console.WriteLine(A);

        Console.WriteLine(String.Format("Frobenius Norm = {0,6:F3}", A.Norm(NormType.FrobeniusNorm)));
        Console.WriteLine(String.Format("Infinity Norm  = {0,6:F3}", A.Norm(NormType.InfinityNorm)));
        Console.WriteLine(String.Format("One Norm       = {0,6:F3}", A.Norm(NormType.OneNorm)));
        Console.WriteLine(String.Format("Max Abs Value  = {0,6:F3}", A.Norm(NormType.MaxAbsValue)));

        Console.Read();
    }
}
C++Copy Code
#include "stdafx.h"

using namespace System;
using namespace Bluebit::MatrixLibrary;

int main(array<System::String ^> ^args) 
{
    Matrix^ A;
    //Declaring a random 4x3 Matrix
    A = gcnew Matrix(4, 3);
    A->FillRandom();
    Console::WriteLine(A);

    Console::WriteLine(String::Format("Frobenius Norm = {0,6:F3}", A->Norm(NormType::FrobeniusNorm) ));
	Console::WriteLine(String::Format("Infinity Norm  = {0,6:F3}", A->Norm(NormType::InfinityNorm) ));
	Console::WriteLine(String::Format("One Norm       = {0,6:F3}", A->Norm(NormType::OneNorm) ));
	Console::WriteLine(String::Format("Max Abs Value  = {0,6:F3}", A->Norm(NormType::MaxAbsValue) ));
    
    Console::Read();
    
	return 0;
}

Remarks

The following table lists all possible values for the type parameter and the types of norm that can be calculated.

Member Description
FrobeniusNorm Frobenius norm of the matrix (square root of sum of squares).
InfinityNorm Infinity norm of the matrix (maximum row sum).
OneNorm 1-norm of the matrix (maximum column sum).
MaxAbsValue The element of largest absolute value of the matrix.

Requirements

Target Platforms: Windows 2000, Windows XP, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7

See Also

.NET Matrix Library