matpi

package module
v0.0.0-...-19a498c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2019 License: MIT Imports: 8 Imported by: 0

README

Coverage Status Go Report Card GoDoc GitHub license

matpi

Convert matrix from gonum.mat.Matrix to PNG picture. Non-zero matrix element is black.

Example:

	m := mat.NewDense(100, 80, nil)
	for i := 0; i < 80; i++ {
		m.Set(i, i, 1.0)
	}

	err := matpi.Convert(m, "result.png", matpi.NewConfig())
	if err != nil {
		return
	}

Diagonal

Symmetrical LU matrix

Mass Matrix

Matrix for modal calculation

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(m mat.Matrix, filename string, config *Config) error

Convert matrix 'gonum.mat.Matrix' to PNG picture file with filename. Color of picture pixel in according to `config`.

Example
package main

import (
	"github.com/Konstantin8105/matpi"
	"gonum.org/v1/gonum/mat"
)

func main() {
	m := mat.NewDense(100, 80, nil)
	for i := 0; i < 80; i++ {
		m.Set(i, i, 1.0)
		m.Set(i, 79-i, -1.0)
	}

	err := matpi.Convert(m, "result.png", matpi.NewConfig())
	if err != nil {
		panic(err)
	}
}
Output:

Types

type Config

type Config struct {
	// color of positive value
	PositiveColor color.RGBA

	// color of negative value
	NegativeColor color.RGBA

	// color of zero value
	ZeroColor color.RGBA

	// scale of picture
	Scale int
}

Config is configuration of matrix picture

func NewConfig

func NewConfig() *Config

NewConfig is default configuration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL