Returns the matrix norm.
Syntax
| Visual Basic (Usage) | Copy Code |
|---|
Dim instance As Matrix
Dim type As NormType
Dim value As Double
value = instance.Norm(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 Basic | Copy 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
Requirements
Target Platforms: Windows 2000, Windows XP, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7
See Also