github.com/gonum/matrix@v0.0.0-20181209220409-c518dec07be9/cmat128/doc.go (about)

     1  // Generated by running
     2  //  go generate github.com/gonum/matrix
     3  // DO NOT EDIT.
     4  
     5  // Copyright ©2015 The gonum Authors. All rights reserved.
     6  // Use of this source code is governed by a BSD-style
     7  // license that can be found in the LICENSE file.
     8  
     9  // This repository is no longer maintained.
    10  // Development has moved to https://github.com/gonum/gonum.
    11  //
    12  // Package cmat128 provides implementations of complex128 matrix structures and
    13  // linear algebra operations on them.
    14  //
    15  // Overview
    16  //
    17  // This section provides a quick overview of the cmat128 package. The following
    18  // sections provide more in depth commentary.
    19  //
    20  // cmat128 provides:
    21  //  - Interfaces for a complex Matrix
    22  //
    23  // BLAS and LAPACK
    24  //
    25  // BLAS and LAPACK are the standard APIs for linear algebra routines. Many
    26  // operations in cmat128 are implemented using calls to the wrapper functions
    27  // in gonum/blas/cblas128 and gonum/lapack/clapack128. By default, cblas128 and
    28  // clapack128 call the native Go implementations of the routines. Alternatively,
    29  // it is possible to use C-based implementations of the APIs through the respective
    30  // cgo packages and "Use" functions. The Go implementation of LAPACK makes calls
    31  // through cblas128, so if a cgo BLAS implementation is registered, the clapack128
    32  // calls will be partially executed in Go and partially executed in C.
    33  //
    34  // Type Switching
    35  //
    36  // The Matrix abstraction enables efficiency as well as interoperability. Go's
    37  // type reflection capabilities are used to choose the most efficient routine
    38  // given the specific concrete types. For example, in
    39  //  c.Mul(a, b)
    40  // if a and b both implement RawMatrixer, that is, they can be represented as a
    41  // cblas128.General, cblas128.Gemm (general matrix multiplication) is called, while
    42  // instead if b is a RawSymmetricer cblas128.Symm is used (general-symmetric
    43  // multiplication), and if b is a *Vector cblas128.Gemv is used.
    44  //
    45  // There are many possible type combinations and special cases. No specific guarantees
    46  // are made about the performance of any method, and in particular, note that an
    47  // abstract matrix type may be copied into a concrete type of the corresponding
    48  // value. If there are specific special cases that are needed, please submit a
    49  // pull-request or file an issue.
    50  //
    51  // Invariants
    52  //
    53  // Matrix input arguments to functions are never directly modified. If an operation
    54  // changes Matrix data, the mutated matrix will be the receiver of a function.
    55  //
    56  // For convenience, a matrix may be used as both a receiver and as an input, e.g.
    57  //  a.Pow(a, 6)
    58  //  v.SolveVec(a.T(), v)
    59  // though in many cases this will cause an allocation (see Element Aliasing).
    60  // An exception to this rule is Copy, which does not allow a.Copy(a.T()).
    61  //
    62  // Element Aliasing
    63  //
    64  // Most methods in cmat128 modify receiver data. It is forbidden for the modified
    65  // data region of the receiver to overlap the used data area of the input
    66  // arguments. The exception to this rule is when the method receiver is equal to one
    67  // of the input arguments, as in the a.Pow(a, 6) call above, or its implicit transpose.
    68  //
    69  // This prohibition is to help avoid subtle mistakes when the method needs to read
    70  // from and write to the same data region. There are ways to make mistakes using the
    71  // cmat128 API, and cmat128 functions will detect and complain about those.
    72  // There are many ways to make mistakes by excursion from the cmat128 API via
    73  // interaction with raw matrix values.
    74  //
    75  // If you need to read the rest of this section to understand the behavior of
    76  // your program, you are being clever. Don't be clever. If you must be clever,
    77  // cblas128 and clapack128 may be used to call the behavior directly.
    78  //
    79  // cmat128 will use the following rules to detect overlap between the receiver and one
    80  // of the inputs:
    81  //  - the input implements one of the Raw methods, and
    82  //  - the Raw type matches that of the receiver or
    83  //    one is a RawMatrixer and the other is a RawVectorer, and
    84  //  - the address ranges of the backing data slices overlap, and
    85  //  - the strides differ or there is an overlap in the used data elements.
    86  // If such an overlap is detected, the method will panic.
    87  //
    88  // The following cases will not panic:
    89  //  - the data slices do not overlap,
    90  //  - there is pointer identity between the receiver and input values after
    91  //    the value has been untransposed if necessary.
    92  //
    93  // cmat128 will not attempt to detect element overlap if the input does not implement a
    94  // Raw method, or if the Raw method differs from that of the receiver except when a
    95  // conversion has occurred through a cmat128 API function. Method behavior is undefined
    96  // if there is undetected overlap.
    97  //
    98  package cmat128