Hilbert Matrix | C # program for Hilbert Matrix ; Function that generates a Hilbert matrix ; using the formula to generate hilbert matrix ; Driver code
using System ; class GFG { static void printMatrix ( int n ) { float [ , ] H = new float [ n , n ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { H [ i , j ] = ( float ) 1.0 / ( ( i + 1 ) + ( j + 1 ) - ( float ) 1.0 ) ; } } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) Console . Write ( H [ i , j ] + " ▁ " ) ; Console . WriteLine ( " " ) ; } } public static void Main ( ) { int n = 3 ; printMatrix ( n ) ; } }